diff options
author | dbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-10-07 17:30:51 +0000 |
---|---|---|
committer | dbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-10-07 17:30:51 +0000 |
commit | 7035b37e71c8c8805a2148c7c454537b903b0d51 (patch) | |
tree | 378327e448e461e2f76759c96190de17d85cc714 | |
parent | 4c450b5c6b7612576eb091f47a794e6477f471b8 (diff) | |
download | openocd+libswd-7035b37e71c8c8805a2148c7c454537b903b0d51.tar.gz openocd+libswd-7035b37e71c8c8805a2148c7c454537b903b0d51.tar.bz2 openocd+libswd-7035b37e71c8c8805a2148c7c454537b903b0d51.tar.xz openocd+libswd-7035b37e71c8c8805a2148c7c454537b903b0d51.zip |
Remove much #ifdeffery around _DEBUG_JTAG_IO_ usage.
Have DEBUG_JTAG_IO() always trigger necessary warnings.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2822 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r-- | src/jtag/commands.c | 38 | ||||
-rw-r--r-- | src/jtag/ft2232.c | 45 | ||||
-rw-r--r-- | src/jtag/jtag.h | 6 |
3 files changed, 47 insertions, 42 deletions
diff --git a/src/jtag/commands.c b/src/jtag/commands.c index 0cee02af..70e30ab5 100644 --- a/src/jtag/commands.c +++ b/src/jtag/commands.c @@ -184,36 +184,37 @@ int jtag_build_buffer(const scan_command_t *cmd, uint8_t **buffer) bit_count = 0; -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("%s num_fields: %i", cmd->ir_scan ? "IRSCAN" : "DRSCAN", cmd->num_fields); -#endif + DEBUG_JTAG_IO("%s num_fields: %i", + cmd->ir_scan ? "IRSCAN" : "DRSCAN", + cmd->num_fields); for (i = 0; i < cmd->num_fields; i++) { if (cmd->fields[i].out_value) { #ifdef _DEBUG_JTAG_IO_ - char* char_buf = buf_to_str(cmd->fields[i].out_value, (cmd->fields[i].num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : cmd->fields[i].num_bits, 16); -#endif - buf_set_buf(cmd->fields[i].out_value, 0, *buffer, bit_count, cmd->fields[i].num_bits); -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("fields[%i].out_value[%i]: 0x%s", i, cmd->fields[i].num_bits, char_buf); + char *char_buf = buf_to_str(cmd->fields[i].out_value, + (cmd->fields[i].num_bits > DEBUG_JTAG_IOZ) + ? DEBUG_JTAG_IOZ + : cmd->fields[i].num_bits, 16); + + LOG_DEBUG("fields[%i].out_value[%i]: 0x%s", i, + cmd->fields[i].num_bits, char_buf); free(char_buf); #endif + buf_set_buf(cmd->fields[i].out_value, 0, *buffer, + bit_count, cmd->fields[i].num_bits); } else { -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("fields[%i].out_value[%i]: NULL", i, cmd->fields[i].num_bits); -#endif + DEBUG_JTAG_IO("fields[%i].out_value[%i]: NULL", + i, cmd->fields[i].num_bits); } bit_count += cmd->fields[i].num_bits; } -#ifdef _DEBUG_JTAG_IO_ - //LOG_DEBUG("bit_count totalling: %i", bit_count); -#endif + //DEBUG_JTAG_IO("bit_count totalling: %i", bit_count); return bit_count; } @@ -238,8 +239,13 @@ int jtag_read_buffer(uint8_t *buffer, const scan_command_t *cmd) uint8_t *captured = buf_set_buf(buffer, bit_count, malloc(CEIL(num_bits, 8)), 0, num_bits); #ifdef _DEBUG_JTAG_IO_ - char *char_buf = buf_to_str(captured, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16); - LOG_DEBUG("fields[%i].in_value[%i]: 0x%s", i, num_bits, char_buf); + char *char_buf = buf_to_str(captured, + (num_bits > DEBUG_JTAG_IOZ) + ? DEBUG_JTAG_IOZ + : num_bits, 16); + + LOG_DEBUG("fields[%i].in_value[%i]: 0x%s", + i, num_bits, char_buf); free(char_buf); #endif diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index 87f02d60..839976fa 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -263,9 +263,8 @@ static void clock_tms(uint8_t mpsse_cmd, int tms_bits, int tms_count, bool tdi_b assert(tms_count > 0); -#if 0 - LOG_DEBUG("mpsse cmd=%02x, tms_bits = 0x%08x, bit_count=%d", mpsse_cmd, tms_bits, tms_count); -#endif + DEBUG_JTAG_IO("mpsse cmd=%02x, tms_bits = 0x%08x, bit_count=%d", + mpsse_cmd, tms_bits, tms_count); for (tms_byte = tms_ndx = i = 0; i < tms_count; ++i, tms_bits>>=1) { @@ -773,6 +772,8 @@ static void ft2232_add_pathmove(tap_state_t* path, int num_states) assert((unsigned) num_states <= 32u); /* tms_bits only holds 32 bits */ + DEBUG_JTAG_IO("-"); + /* this loop verifies that the path is legal and logs each state in the path */ while (num_states) { @@ -952,7 +953,6 @@ static void ft2232_add_scan(bool ir_scan, enum scan_type type, uint8_t* buffer, tms_count = 2; /* Clock Data to TMS/CS Pin with Read */ mpsse_cmd = 0x6b; - /* LOG_DEBUG("added TMS scan (read)"); */ } else { @@ -960,9 +960,9 @@ static void ft2232_add_scan(bool ir_scan, enum scan_type type, uint8_t* buffer, tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); /* Clock Data to TMS/CS Pin (no Read) */ mpsse_cmd = 0x4b; - /* LOG_DEBUG("added TMS scan (no read)"); */ } + DEBUG_JTAG_IO("finish %s", (type == SCAN_OUT) ? "without read" : "via PAUSE"); clock_tms(mpsse_cmd, tms_bits, tms_count, last_bit); } @@ -1154,6 +1154,7 @@ static int ft2232_large_scan(scan_command_t* cmd, enum scan_type type, uint8_t* /* LOG_DEBUG("added TMS scan (no read)"); */ } + DEBUG_JTAG_IO("finish, %s", (type == SCAN_OUT) ? "no read" : "read"); clock_tms(mpsse_cmd, tms_bits, tms_count, last_bit); } @@ -1565,10 +1566,9 @@ static int ft2232_execute_runtest(jtag_command_t *cmd) } require_send = 1; -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("runtest: %i, end in %s", cmd->cmd.runtest->num_cycles, tap_state_name(tap_get_end_state())); -#endif - + DEBUG_JTAG_IO("runtest: %i, end in %s", + cmd->cmd.runtest->num_cycles, + tap_state_name(tap_get_end_state())); return retval; } @@ -1577,7 +1577,8 @@ static int ft2232_execute_statemove(jtag_command_t *cmd) int predicted_size = 0; int retval = ERROR_OK; - DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state); + DEBUG_JTAG_IO("statemove end in %s", + tap_state_name(cmd->cmd.statemove->end_state)); /* only send the maximum buffer size that FT2232C can handle */ predicted_size = 3; @@ -1685,10 +1686,9 @@ static int ft2232_execute_scan(jtag_command_t *cmd) require_send = 1; if (buffer) free(buffer); -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("%s scan, %i bits, end in %s", (cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size, + DEBUG_JTAG_IO("%s scan, %i bits, end in %s", + (cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size, tap_state_name(tap_get_end_state())); -#endif return retval; } @@ -1720,9 +1720,8 @@ static int ft2232_execute_reset(jtag_command_t *cmd) layout->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); require_send = 1; -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("trst: %i, srst: %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst); -#endif + DEBUG_JTAG_IO("trst: %i, srst: %i", + cmd->cmd.reset->trst, cmd->cmd.reset->srst); return retval; } @@ -1737,10 +1736,9 @@ static int ft2232_execute_sleep(jtag_command_t *cmd) retval = ERROR_JTAG_QUEUE_FAILED; first_unsent = cmd->next; jtag_sleep(cmd->cmd.sleep->us); -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("sleep %i usec while in %s", cmd->cmd.sleep->us, tap_state_name(tap_get_state())); -#endif - + DEBUG_JTAG_IO("sleep %i usec while in %s", + cmd->cmd.sleep->us, + tap_state_name(tap_get_state())); return retval; } @@ -1754,10 +1752,9 @@ static int ft2232_execute_stableclocks(jtag_command_t *cmd) */ if (ft2232_stableclocks(cmd->cmd.stableclocks->num_cycles, cmd) != ERROR_OK) retval = ERROR_JTAG_QUEUE_FAILED; -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("clocks %i while in %s", cmd->cmd.stableclocks->num_cycles, tap_state_name(tap_get_state())); -#endif - + DEBUG_JTAG_IO("clocks %i while in %s", + cmd->cmd.stableclocks->num_cycles, + tap_state_name(tap_get_state())); return retval; } diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index 60774589..35635cd8 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -28,9 +28,11 @@ #ifdef _DEBUG_JTAG_IO_ -#define DEBUG_JTAG_IO(expr ...) LOG_DEBUG(expr) +#define DEBUG_JTAG_IO(expr ...) \ + do { if (1) LOG_DEBUG(expr); } while (0) #else -#define DEBUG_JTAG_IO(expr ...) +#define DEBUG_JTAG_IO(expr ...) \ + do { if (0) LOG_DEBUG(expr); } while (0) #endif #ifndef DEBUG_JTAG_IOZ |