diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/flash/lpc2000.c | 3 | ||||
-rw-r--r-- | src/jtag/gw16012.c | 53 | ||||
-rw-r--r-- | src/jtag/jtag.c | 32 | ||||
-rw-r--r-- | src/jtag/jtag.h | 4 | ||||
-rw-r--r-- | src/jtag/parport.c | 2 | ||||
-rw-r--r-- | src/openocd.c | 2 |
6 files changed, 88 insertions, 8 deletions
diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index 16e20e2a..f35c0ba0 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -47,6 +47,8 @@ * - 213x * - 214x * - 2101|2|3 + * - 2364|6|8 + * - 2378 */ int lpc2000_register_commands(struct command_context_s *cmd_ctx); @@ -171,6 +173,7 @@ int lpc2000_build_sector_list(struct flash_bank_s *bank) case 256 * 1024: num_sectors = 15; break; + case 512 * 1024: case 500 * 1024: num_sectors = 27; break; diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c index 6210a52c..218ac4c6 100644 --- a/src/jtag/gw16012.c +++ b/src/jtag/gw16012.c @@ -25,6 +25,10 @@ #include "jtag.h" +#if 1 +#define _DEBUG_GW16012_IO_ +#endif + /* system includes */ /* system includes */ @@ -123,6 +127,10 @@ void gw16012_data(u8 value) { value = (value & 0x7f) | gw16012_msb; gw16012_msb ^= 0x80; /* toggle MSB */ + +#ifdef _DEBUG_GW16012_IO_ + DEBUG("%2.2x", value); +#endif #if PARPORT_USE_PPDEV == 1 ioctl(device_handle, PPWDATA, &value); @@ -141,6 +149,10 @@ void gw16012_control(u8 value) { gw16012_control_value = value; +#ifdef _DEBUG_GW16012_IO_ + DEBUG("%2.2x", gw16012_control_value); +#endif + #if PARPORT_USE_PPDEV == 1 ioctl(device_handle, PPWCONTROL, &gw16012_control_value); #else @@ -160,6 +172,10 @@ void gw16012_input(u8 *value) #else *value = inb(gw16012_port + 1); #endif + +#ifdef _DEBUG_GW16012_IO_ + DEBUG("%2.2x", *value); +#endif } /* (1) assert or (0) deassert reset lines */ @@ -211,6 +227,37 @@ void gw16012_state_move(void) cur_state = end_state; } +void gw16012_path_move(pathmove_command_t *cmd) +{ + int num_states = cmd->num_states; + int state_count; + + state_count = 0; + while (num_states) + { + gw16012_control(0x0); /* single-bit mode */ + if (tap_transitions[cur_state].low == cmd->path[state_count]) + { + gw16012_data(0x0); /* TCK cycle with TMS low */ + } + else if (tap_transitions[cur_state].high == cmd->path[state_count]) + { + gw16012_data(0x2); /* TCK cycle with TMS high */ + } + else + { + ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]); + exit(-1); + } + + cur_state = cmd->path[state_count]; + state_count++; + num_states--; + } + + end_state = cur_state; +} + void gw16012_runtest(int num_cycles) { enum tap_state saved_end_state = end_state; @@ -343,6 +390,12 @@ int gw16012_execute_queue(void) gw16012_end_state(cmd->cmd.statemove->end_state); gw16012_state_move(); break; + case JTAG_PATHMOVE: +#ifdef _DEBUG_JTAG_IO_ + DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]); +#endif + gw16012_path_move(cmd->cmd.pathmove); + break; case JTAG_SCAN: if (cmd->cmd.scan->end_state != -1) gw16012_end_state(cmd->cmd.scan->end_state); diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index cc9f8dc4..a3e8cff8 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -95,6 +95,14 @@ tap_transition_t tap_transitions[16] = {TAP_SDS, TAP_RTI} /* UI */ }; +char* jtag_event_strings[] = +{ + "SRST asserted", + "TRST asserted", + "SRST released", + "TRST released" +}; + enum tap_state end_state = TAP_TLR; enum tap_state cur_state = TAP_TLR; int jtag_trst = 0; @@ -184,6 +192,18 @@ char* jtag_interface = NULL; int jtag_speed = -1; /* forward declarations */ +int jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate); +int jtag_add_dr_scan(int num_fields, scan_field_t *fields, enum tap_state endstate); +int jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate); +int jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, enum tap_state endstate); +int jtag_add_statemove(enum tap_state endstate); +int jtag_add_pathmove(int num_states, enum tap_state *path); +int jtag_add_runtest(int num_cycles, enum tap_state endstate); +int jtag_add_reset(int trst, int srst); +int jtag_add_end_state(enum tap_state endstate); +int jtag_add_sleep(u32 us); +int jtag_execute_queue(void); +int jtag_cancel_queue(void); /* jtag commands */ int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); @@ -255,7 +275,7 @@ int jtag_call_event_callbacks(enum jtag_event event) { jtag_event_callback_t *callback = jtag_event_callbacks; - DEBUG("jtag event: %i", event); + DEBUG("jtag event: %s", jtag_event_strings[event]); while (callback) { @@ -1128,7 +1148,8 @@ int jtag_examine_chain() int i; int bit_count; int device_count = 0; - u8 valid = 0x0; + u8 zero_check = 0x0; + u8 one_check = 0xff; field.device = 0; field.num_bits = sizeof(idcode_buffer) * 8; @@ -1150,11 +1171,12 @@ int jtag_examine_chain() for (i = 0; i < JTAG_MAX_CHAIN_SIZE * 4; i++) { - valid |= idcode_buffer[i]; + zero_check |= idcode_buffer[i]; + one_check &= idcode_buffer[i]; } - /* if there wasn't a single non-zero bit, the scan isn't valid */ - if (!valid) + /* if there wasn't a single non-zero bit or if all bits were one, the scan isn't valid */ + if ((zero_check == 0x00) || (one_check == 0xff)) { ERROR("JTAG communication failure, check connection, JTAG interface, target power etc."); exit(-1); diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index 7ad38278..ad038ae5 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -25,7 +25,7 @@ #include "command.h" -#if 0 +#if 1 #define _DEBUG_JTAG_IO_ #endif @@ -199,6 +199,8 @@ enum jtag_event JTAG_TRST_RELEASED, }; +extern char* jtag_event_strings[]; + extern int jtag_trst; extern int jtag_srst; diff --git a/src/jtag/parport.c b/src/jtag/parport.c index 9485f7d9..83006d86 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -99,7 +99,7 @@ cable_t cables[] = { "dlc5", 0x10, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x10 }, { "triton", 0x80, 0x08, 0x04, 0x01, 0x02, 0x00, 0x00, 0x80, 0x00 }, { "lattice", 0x40, 0x10, 0x04, 0x02, 0x01, 0x08, 0x00, 0x00, 0x18 }, - { "flashlink", 0x20, 0x10, 0x02, 0x01, 0x04, 0x20,0x30, 0x20, 0x00 }, + { "flashlink", 0x20, 0x10, 0x02, 0x01, 0x04, 0x20, 0x30, 0x20, 0x00 }, { NULL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; diff --git a/src/openocd.c b/src/openocd.c index 502e9740..f10c1a98 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -18,7 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#define OPENOCD_VERSION "Open On-Chip Debugger (2006-01-26 13:30 CET)" +#define OPENOCD_VERSION "Open On-Chip Debugger (2007-01-31 12:00 CET)" #ifdef HAVE_CONFIG_H #include "config.h" |