Skip to content

Commit 0a17510

Browse files
authored
Merge pull request #562 from LeeLeahy2/vct-debug-cmd-issue
VCT: Add DEBUG_CMD_ISSUE to display issued commands
2 parents 7b6e4b1 + 24b9571 commit 0a17510

File tree

1 file changed

+44
-17
lines changed

1 file changed

+44
-17
lines changed

Firmware/Tools/VcServerTest.c

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#define SET_PROGRAM_COMPLETE "ati12"
3131
#define START_3_WAY_HANDSHAKE "atc"
3232

33+
#define DEBUG_CMD_ISSUE 0
3334
#define DEBUG_LOCAL_COMMANDS 0
3435
#define DEBUG_PC_CMD_ISSUE 0
3536
#define DEBUG_PC_TO_RADIO 0
@@ -64,28 +65,54 @@
6465
{ \
6566
if (COMMAND_PENDING(queue, active)) \
6667
{ \
68+
if (DEBUG_CMD_ISSUE) \
69+
{ \
70+
if (queue == pcCommandQueue) \
71+
printf("PC %s done\n", commandName[active]); \
72+
else \
73+
{ \
74+
int vc = (&queue[0] - &virtualCircuitList[0].commandQueue[0]) \
75+
* sizeof(QUEUE_T) / sizeof(virtualCircuitList[0]); \
76+
printf("VC %d %s done\n", vc, commandName[active]); \
77+
} \
78+
} \
6779
queue[active / QUEUE_T_BITS] &= ~(1 << (active & QUEUE_T_MASK)); \
6880
active = CMD_LIST_SIZE; \
6981
} \
7082
}
7183

72-
#define COMMAND_ISSUE(queue, pollCount, cmd) \
73-
{ \
74-
/* Place the command in the queue */ \
75-
queue[cmd / QUEUE_T_BITS] |= 1 << (cmd & QUEUE_T_MASK); \
76-
\
77-
/* Timeout the command processor */ \
78-
if (!commandProcessorRunning) \
79-
commandProcessorRunning = STALL_CHECK_COUNT; \
80-
\
81-
/* Remember when this command was issued */ \
82-
if (!pollCount) \
83-
{ \
84-
if (timeoutCount) \
85-
pollCount = timeoutCount; \
86-
else \
87-
pollCount = 1; \
88-
} \
84+
#define COMMAND_ISSUE(queue, pollCount, cmd) \
85+
{ \
86+
if (DEBUG_CMD_ISSUE) \
87+
{ \
88+
if (!COMMAND_PENDING(queue, cmd)) \
89+
{ \
90+
if (queue == pcCommandQueue) \
91+
printf("PC %s issued\n", commandName[cmd]); \
92+
else \
93+
{ \
94+
int vc = (&queue[0] - &virtualCircuitList[0].commandQueue[0]) \
95+
* sizeof(QUEUE_T) / sizeof(virtualCircuitList[0]); \
96+
printf("VC %d %s issued\n", vc, commandName[cmd]); \
97+
} \
98+
} \
99+
} \
100+
\
101+
/* Place the command in the queue */ \
102+
queue[cmd / QUEUE_T_BITS] |= 1 << (cmd & QUEUE_T_MASK); \
103+
\
104+
/* Timeout the command processor */ \
105+
if (!commandProcessorRunning) \
106+
commandProcessorRunning = STALL_CHECK_COUNT; \
107+
\
108+
/* Remember when this command was issued */ \
109+
if (!pollCount) \
110+
{ \
111+
if (timeoutCount) \
112+
pollCount = timeoutCount; \
113+
else \
114+
pollCount = 1; \
115+
} \
89116
}
90117

91118
#define COMMAND_PENDING(queue,cmd) ((queue[cmd / QUEUE_T_BITS] >> (cmd & QUEUE_T_MASK)) & 1)

0 commit comments

Comments
 (0)