You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(16) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <zw...@ma...> - 2009-06-05 02:04:28
|
Author: zwelch Date: 2009-06-05 02:04:12 +0200 (Fri, 05 Jun 2009) New Revision: 2059 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Add accessors for reset delays; use them in jim command handlers. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-05 00:02:00 UTC (rev 2058) +++ trunk/src/jtag/jtag.c 2009-06-05 00:04:12 UTC (rev 2059) @@ -2085,7 +2085,7 @@ } else { - jtag_nsrst_delay = strtoul(args[0], NULL, 0); + jtag_set_nsrst_delay(strtoul(args[0], NULL, 0)); } return ERROR_OK; @@ -2100,12 +2100,13 @@ } else { - jtag_ntrst_delay = strtoul(args[0], NULL, 0); + jtag_set_ntrst_delay(strtoul(args[0], NULL, 0)); } return ERROR_OK; } + static int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { int retval=ERROR_OK; @@ -2699,3 +2700,13 @@ return retval; } +void jtag_set_nsrst_delay(unsigned delay) +{ + jtag_nsrst_delay = delay; +} +void jtag_set_ntrst_delay(unsigned delay) +{ + jtag_ntrst_delay = delay; +} + + Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-05 00:02:00 UTC (rev 2058) +++ trunk/src/jtag/jtag.h 2009-06-05 00:04:12 UTC (rev 2059) @@ -642,6 +642,8 @@ /// @returns the number of times the scan queue has been flushed int jtag_get_flush_queue_count(void); +void jtag_set_nsrst_delay(unsigned delay); +void jtag_set_ntrst_delay(unsigned delay); void jtag_set_speed_khz(unsigned speed); unsigned jtag_get_speed_khz(void); |
From: <zw...@ma...> - 2009-06-05 02:02:05
|
Author: zwelch Date: 2009-06-05 02:02:00 +0200 (Fri, 05 Jun 2009) New Revision: 2058 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Add accessors for speed_khz; use them in jim command handler. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 23:52:58 UTC (rev 2057) +++ trunk/src/jtag/jtag.c 2009-06-05 00:02:00 UTC (rev 2058) @@ -1659,7 +1659,7 @@ } if(hasKHz) { - jtag_interface->khz(speed_khz, &jtag_speed); + jtag_interface->khz(jtag_get_speed_khz(), &jtag_speed); hasKHz = false; } @@ -1772,6 +1772,15 @@ return jtag_init_reset(cmd_ctx); } +void jtag_set_speed_khz(unsigned khz) +{ + speed_khz = khz; +} +unsigned jtag_get_speed_khz(void) +{ + return speed_khz; +} + static int default_khz(int khz, int *jtag_speed) { LOG_ERROR("Translation from khz to jtag_speed not implemented"); @@ -2130,17 +2139,17 @@ int retval=ERROR_OK; LOG_DEBUG("handle jtag khz"); + int cur_speed = 0; if(argc == 1) { - speed_khz = strtoul(args[0], NULL, 0); + jtag_set_speed_khz(strtoul(args[0], NULL, 0)); if (jtag != NULL) { - int cur_speed = 0; LOG_DEBUG("have interface set up"); int speed_div1; - if ((retval=jtag->khz(speed_khz, &speed_div1))!=ERROR_OK) + if ((retval=jtag->khz(jtag_get_speed_khz(), &speed_div1))!=ERROR_OK) { - speed_khz = 0; + jtag_set_speed_khz(0); return retval; } @@ -2157,20 +2166,18 @@ { return ERROR_COMMAND_SYNTAX_ERROR; } + cur_speed = jtag_get_speed_khz(); if (jtag!=NULL) { - if ((retval=jtag->speed_div(jtag_speed, &speed_khz))!=ERROR_OK) + if ((retval=jtag->speed_div(jtag_speed, &cur_speed))!=ERROR_OK) return retval; } - if (speed_khz==0) - { + if (cur_speed) + command_print(cmd_ctx, "%d kHz", cur_speed); + else command_print(cmd_ctx, "RCLK - adaptive"); - } else - { - command_print(cmd_ctx, "%d kHz", speed_khz); - } return retval; } Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-04 23:52:58 UTC (rev 2057) +++ trunk/src/jtag/jtag.h 2009-06-05 00:02:00 UTC (rev 2058) @@ -642,5 +642,7 @@ /// @returns the number of times the scan queue has been flushed int jtag_get_flush_queue_count(void); +void jtag_set_speed_khz(unsigned speed); +unsigned jtag_get_speed_khz(void); #endif /* JTAG_H */ |
From: <zw...@ma...> - 2009-06-05 01:53:04
|
Author: zwelch Date: 2009-06-05 01:52:58 +0200 (Fri, 05 Jun 2009) New Revision: 2057 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Add jtag_get_flush_queue_count accessor to help future factoring. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 23:49:52 UTC (rev 2056) +++ trunk/src/jtag/jtag.c 2009-06-04 23:52:58 UTC (rev 2057) @@ -909,6 +909,11 @@ } } +int jtag_get_flush_queue_count(void) +{ + return jtag_flush_queue_count; +} + int jtag_execute_queue(void) { int retval; @@ -2480,7 +2485,7 @@ static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args) { - Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_flush_queue_count)); + Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_get_flush_queue_count())); return JIM_OK; } Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-04 23:49:52 UTC (rev 2056) +++ trunk/src/jtag/jtag.h 2009-06-04 23:52:58 UTC (rev 2057) @@ -640,4 +640,7 @@ */ extern int jtag_add_statemove(tap_state_t goal_state); +/// @returns the number of times the scan queue has been flushed +int jtag_get_flush_queue_count(void); + #endif /* JTAG_H */ |
From: <zw...@ma...> - 2009-06-05 01:49:56
|
Author: zwelch Date: 2009-06-05 01:49:52 +0200 (Fri, 05 Jun 2009) New Revision: 2056 Modified: trunk/src/jtag/jtag.c Log: Clean up the JTAG TAP creation handler: - Factor jtag_tap_init() helper out of the end of jim_newtap_cmd. - Factor jtag_tap_free() helper out of the error case in jim_newtap_cmd. - Invert test to improve indentation at the end of jim_newtap_cmd. - Improve whitespace in the newly factored functions. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 23:26:58 UTC (rev 2055) +++ trunk/src/jtag/jtag.c 2009-06-04 23:49:52 UTC (rev 2056) @@ -1270,6 +1270,41 @@ return JIM_OK; } + +static void jtag_tap_init(jtag_tap_t *tap) +{ + assert(0 != tap->ir_length); + + tap->expected = malloc(tap->ir_length); + tap->expected_mask = malloc(tap->ir_length); + tap->cur_instr = malloc(tap->ir_length); + + buf_set_u32(tap->expected, 0, tap->ir_length, tap->ir_capture_value); + buf_set_u32(tap->expected_mask, 0, tap->ir_length, tap->ir_capture_mask); + buf_set_ones(tap->cur_instr, tap->ir_length); + + // place TAP in bypass mode + tap->bypass = 1; + // register the reset callback for the TAP + jtag_register_event_callback(&jtag_reset_callback, tap); + + LOG_DEBUG("Created Tap: %s @ abs position %d, " + "irlen %d, capture: 0x%x mask: 0x%x", tap->dotted_name, + tap->abs_chain_position, tap->ir_length, + tap->ir_capture_value, tap->ir_capture_mask); + jtag_tap_add(tap); +} + +static void jtag_tap_free(jtag_tap_t *tap) +{ + /// @todo is anything missing? no memory leaks please + free((void *)tap->expected_ids); + free((void *)tap->chip); + free((void *)tap->tapname); + free((void *)tap->dotted_name); + free(tap); +} + static int jim_newtap_cmd( Jim_GetOptInfo *goi ) { jtag_tap_t *pTap; @@ -1404,49 +1439,18 @@ } /* switch(n->value) */ } /* while( goi->argc ) */ - /* Did we get all the options? */ - if( reqbits ){ - // no - Jim_SetResult_sprintf( goi->interp, - "newtap: %s missing required parameters", - pTap->dotted_name); - /* TODO: Tell user what is missing :-( */ - /* no memory leaks pelase */ - free(((void *)(pTap->expected_ids))); - free(((void *)(pTap->chip))); - free(((void *)(pTap->tapname))); - free(((void *)(pTap->dotted_name))); - free(((void *)(pTap))); - return JIM_ERR; + /* Did all the required option bits get cleared? */ + if (0 == reqbits) + { + jtag_tap_init(pTap); + return ERROR_OK; } - pTap->expected = malloc( pTap->ir_length ); - pTap->expected_mask = malloc( pTap->ir_length ); - pTap->cur_instr = malloc( pTap->ir_length ); - - buf_set_u32( pTap->expected, - 0, - pTap->ir_length, - pTap->ir_capture_value ); - buf_set_u32( pTap->expected_mask, - 0, - pTap->ir_length, - pTap->ir_capture_mask ); - buf_set_ones( pTap->cur_instr, - pTap->ir_length ); - - pTap->bypass = 1; - - jtag_register_event_callback(jtag_reset_callback, pTap ); - - jtag_tap_add(pTap); - - LOG_DEBUG("Created Tap: %s @ abs position %d, " - "irlen %d, capture: 0x%x mask: 0x%x", pTap->dotted_name, - pTap->abs_chain_position, pTap->ir_length, - pTap->ir_capture_value, pTap->ir_capture_mask); - - return ERROR_OK; + Jim_SetResult_sprintf(goi->interp, + "newtap: %s missing required parameters", + pTap->dotted_name); + jtag_tap_free(pTap); + return JIM_ERR; } static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) |
From: <zw...@ma...> - 2009-06-05 01:27:13
|
Author: zwelch Date: 2009-06-05 01:26:58 +0200 (Fri, 05 Jun 2009) New Revision: 2055 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Clean up the core JTAG TAP APIs: - Move jtag_tap_name to same location as other TAP functions; export it. - Factor new jtag_tap_add() from jim_newtap_cmd(); appends TAP to global list. - Move static chain position counter to global; use in jtag_NumTotalTaps(). - Use jtag_AllTaps for reading tap list, instead of accessing global directly. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 22:43:34 UTC (rev 2054) +++ trunk/src/jtag/jtag.c 2009-06-04 23:26:58 UTC (rev 2055) @@ -63,7 +63,15 @@ int jtag_trst = 0; int jtag_srst = 0; +/** + * List all TAPs that have been created. + */ static jtag_tap_t *jtag_all_taps = NULL; +/** + * The number of TAPs in the jtag_all_taps list, used to track the + * assigned chain position to new TAPs + */ +static int jtag_num_taps = 0; enum reset_types jtag_reset_config = RESET_NONE; tap_state_t cmd_queue_end_state = TAP_RESET; @@ -235,16 +243,7 @@ int jtag_NumTotalTaps(void) { - jtag_tap_t *t; - int n; - - n = 0; - t = jtag_AllTaps(); - while(t){ - n++; - t = t->next_tap; - } - return n; + return jtag_num_taps; } int jtag_NumEnabledTaps(void) @@ -263,6 +262,17 @@ return n; } +/// Append a new TAP to the chain of all taps. +static void jtag_tap_add(struct jtag_tap_s *t) +{ + t->abs_chain_position = jtag_num_taps++; + + jtag_tap_t **tap = &jtag_all_taps; + while(*tap != NULL) + tap = &(*tap)->next_tap; + *tap = t; +} + jtag_tap_t *jtag_TapByString( const char *s ) { jtag_tap_t *t; @@ -324,6 +334,12 @@ return t; } +const char *jtag_tap_name(const jtag_tap_t *tap) +{ + return (tap == NULL) ? "(unknown)" : tap->dotted_name; +} + + int jtag_register_event_callback(int (*callback)(enum jtag_event event, void *priv), void *priv) { jtag_event_callback_t **callbacks_p = &jtag_event_callbacks; @@ -798,11 +814,6 @@ return; } -static const char *jtag_tap_name(const jtag_tap_t *tap) -{ - return (tap == NULL) ? "(unknown)" : tap->dotted_name; -} - int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, int num_bits) { int retval = ERROR_OK; @@ -1262,7 +1273,6 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi ) { jtag_tap_t *pTap; - jtag_tap_t **ppTap; jim_wide w; int x; int e; @@ -1429,22 +1439,13 @@ jtag_register_event_callback(jtag_reset_callback, pTap ); - ppTap = &(jtag_all_taps); - while( (*ppTap) != NULL ){ - ppTap = &((*ppTap)->next_tap); - } - *ppTap = pTap; - { - static int n_taps = 0; - pTap->abs_chain_position = n_taps++; - } - LOG_DEBUG( "Created Tap: %s @ abs position %d, irlen %d, capture: 0x%x mask: 0x%x", - (*ppTap)->dotted_name, - (*ppTap)->abs_chain_position, - (*ppTap)->ir_length, - (*ppTap)->ir_capture_value, - (*ppTap)->ir_capture_mask ); + jtag_tap_add(pTap); + LOG_DEBUG("Created Tap: %s @ abs position %d, " + "irlen %d, capture: 0x%x mask: 0x%x", pTap->dotted_name, + pTap->abs_chain_position, pTap->ir_length, + pTap->ir_capture_value, pTap->ir_capture_mask); + return ERROR_OK; } @@ -1914,7 +1915,7 @@ { jtag_tap_t *tap; - tap = jtag_all_taps; + tap = jtag_AllTaps(); command_print(cmd_ctx, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr "); command_print(cmd_ctx, "---|--------------------|---------|------------|------------|------|------|------|---------"); Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-04 22:43:34 UTC (rev 2054) +++ trunk/src/jtag/jtag.h 2009-06-04 23:26:58 UTC (rev 2055) @@ -176,6 +176,7 @@ jtag_tap_t* next_tap; }; extern jtag_tap_t* jtag_AllTaps(void); +extern const char *jtag_tap_name(const jtag_tap_t *tap); extern jtag_tap_t* jtag_TapByPosition(int n); extern jtag_tap_t* jtag_TapByString(const char* dotted_name); extern jtag_tap_t* jtag_TapByJimObj(Jim_Interp* interp, Jim_Obj* obj); |
From: <zw...@ma...> - 2009-06-05 00:43:39
|
Author: zwelch Date: 2009-06-05 00:43:34 +0200 (Fri, 05 Jun 2009) New Revision: 2054 Modified: trunk/src/jtag/jtag.c Log: Change hasKHz to use bool type. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 22:41:21 UTC (rev 2053) +++ trunk/src/jtag/jtag.c 2009-06-04 22:43:34 UTC (rev 2054) @@ -86,7 +86,7 @@ /* speed in kHz*/ static int speed_khz = 0; /* flag if the kHz speed was defined */ -static int hasKHz = 0; +static bool hasKHz = false; /* jtag interfaces (parport, FTDI-USB, TI-USB, ...) */ @@ -1650,7 +1650,7 @@ if(hasKHz) { jtag_interface->khz(speed_khz, &jtag_speed); - hasKHz = 0; + hasKHz = false; } if (jtag_interface->init() != ERROR_OK) @@ -2139,7 +2139,7 @@ retval=jtag->speed(cur_speed); } else { - hasKHz = 1; + hasKHz = true; } } else if (argc==0) { |
From: <zw...@ma...> - 2009-06-05 00:41:25
|
Author: zwelch Date: 2009-06-05 00:41:21 +0200 (Fri, 05 Jun 2009) New Revision: 2053 Modified: trunk/src/jtag/jtag.c Log: Add missing static keywords in JTAG source file. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 20:05:32 UTC (rev 2052) +++ trunk/src/jtag/jtag.c 2009-06-04 22:41:21 UTC (rev 2053) @@ -37,7 +37,8 @@ #endif -int jtag_flush_queue_count; /* count # of flushes for profiling / debugging purposes */ +/// The number of JTAG queue flushes (for profiling and debugging purposes). +static int jtag_flush_queue_count; static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state), int in_num_fields, scan_field_t *in_fields, tap_state_t state); @@ -906,7 +907,7 @@ return retval; } -int jtag_reset_callback(enum jtag_event event, void *priv) +static int jtag_reset_callback(enum jtag_event event, void *priv) { jtag_tap_t *tap = priv; @@ -928,7 +929,7 @@ /* Try to examine chain layout according to IEEE 1149.1 §12 */ -int jtag_examine_chain(void) +static int jtag_examine_chain(void) { jtag_tap_t *tap; scan_field_t field; @@ -1094,7 +1095,7 @@ return ERROR_OK; } -int jtag_validate_chain(void) +static int jtag_validate_chain(void) { jtag_tap_t *tap; int total_ir_length = 0; |
From: <oh...@ma...> - 2009-06-04 22:05:34
|
Author: oharboe Date: 2009-06-04 22:05:32 +0200 (Thu, 04 Jun 2009) New Revision: 2052 Modified: trunk/src/target/arm11.h Log: unbreak arm11. TAP_INVALID is used to communicate inband that a special state should be used to lower level fn's in ARM11 code. Modified: trunk/src/target/arm11.h =================================================================== --- trunk/src/target/arm11.h 2009-06-04 13:45:50 UTC (rev 2051) +++ trunk/src/target/arm11.h 2009-06-04 20:05:32 UTC (rev 2052) @@ -47,7 +47,7 @@ 23 * ARM11_REGCACHE_MODEREGS + \ 9 * ARM11_REGCACHE_FREGS) -#define ARM11_TAP_DEFAULT jtag_get_end_state() +#define ARM11_TAP_DEFAULT TAP_INVALID #define CHECK_RETVAL(action) \ |
From: ntfreak at B. <nt...@ma...> - 2009-06-04 15:45:51
|
Author: ntfreak Date: 2009-06-04 15:45:50 +0200 (Thu, 04 Jun 2009) New Revision: 2051 Modified: trunk/src/target/arm_adi_v5.c trunk/src/target/arm_adi_v5.h trunk/src/target/cortex_m3.c Log: - add support for different TAR autotincrement sizes as per ARM ADI spec. - set TAR size to 12 bits for Cortex-M3. - Original patch submitted by Magnus Lundin [lu...@ml...]. Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-04 13:18:07 UTC (rev 2050) +++ trunk/src/target/arm_adi_v5.c 2009-06-04 13:45:50 UTC (rev 2051) @@ -52,6 +52,18 @@ * are immediatley available. */ + +/* ARM ADI Specification requires at least 10 bits used for TAR autoincrement */ + +/* + u32 tar_block_size(u32 address) + Return the largest block starting at address that does not cross a tar block size alignment boundary +*/ +static u32 max_tar_block_size(u32 tar_autoincr_block, u32 address) +{ + return (tar_autoincr_block - ((tar_autoincr_block - 1) & address)) >> 2; +} + /*************************************************************************** * * * DPACC and APACC scanchain access through JTAG-DP * @@ -467,8 +479,8 @@ while (wcount > 0) { - /* Adjust to write blocks within 4K aligned boundaries */ - blocksize = (0x1000 - (0xFFF & address)) >> 2; + /* Adjust to write blocks within boundaries aligned to the TAR autoincremnent size*/ + blocksize = max_tar_block_size(swjdp->tar_autoincr_block, address); if (wcount < blocksize) blocksize = wcount; @@ -517,8 +529,8 @@ { int nbytes; - /* Adjust to read within 4K block boundaries */ - blocksize = (0x1000 - (0xFFF & address)) >> 1; + /* Adjust to write blocks within boundaries aligned to the TAR autoincremnent size*/ + blocksize = max_tar_block_size(swjdp->tar_autoincr_block, address); if (wcount < blocksize) blocksize = wcount; @@ -613,8 +625,8 @@ { int nbytes; - /* Adjust to read within 4K block boundaries */ - blocksize = (0x1000 - (0xFFF & address)); + /* Adjust to write blocks within boundaries aligned to the TAR autoincremnent size*/ + blocksize = max_tar_block_size(swjdp->tar_autoincr_block, address); if (wcount < blocksize) blocksize = wcount; @@ -710,8 +722,8 @@ while (wcount > 0) { - /* Adjust to read within 4K block boundaries */ - blocksize = (0x1000 - (0xFFF & address)) >> 2; + /* Adjust to read blocks within boundaries aligned to the TAR autoincremnent size*/ + blocksize = max_tar_block_size(swjdp->tar_autoincr_block, address); if (wcount < blocksize) blocksize = wcount; @@ -784,8 +796,8 @@ { int nbytes; - /* Adjust to read within 4K block boundaries */ - blocksize = (0x1000 - (0xFFF & address)) >> 1; + /* Adjust to read blocks within boundaries aligned to the TAR autoincremnent size*/ + blocksize = max_tar_block_size(swjdp->tar_autoincr_block, address); if (wcount < blocksize) blocksize = wcount; @@ -879,8 +891,8 @@ { int nbytes; - /* Adjust to read within 4K block boundaries */ - blocksize = (0x1000 - (0xFFF & address)); + /* Adjust to read blocks within boundaries aligned to the TAR autoincremnent size*/ + blocksize = max_tar_block_size(swjdp->tar_autoincr_block, address); if (wcount < blocksize) blocksize = wcount; Modified: trunk/src/target/arm_adi_v5.h =================================================================== --- trunk/src/target/arm_adi_v5.h 2009-06-04 13:18:07 UTC (rev 2050) +++ trunk/src/target/arm_adi_v5.h 2009-06-04 13:45:50 UTC (rev 2051) @@ -99,8 +99,17 @@ u8 ack; /* extra tck clocks for memory bus access */ u32 memaccess_tck; + /* Size of TAR autoincrement block, ARM ADI Specification requires at least 10 bits */ + u32 tar_autoincr_block; + } swjdp_common_t; +/* Accessor function for currently selected DAP-AP number */ +static inline u8 dap_ap_get_select(swjdp_common_t *swjdp) +{ + return (u8)( swjdp ->apsel >> 24); +} + /* Internal functions used in the module, partial transactions, use with caution */ extern int dap_dp_write_reg(swjdp_common_t *swjdp, u32 value, u8 reg_addr); /* extern int swjdp_write_apacc(swjdp_common_t *swjdp, u32 value, u8 reg_addr); */ Modified: trunk/src/target/cortex_m3.c =================================================================== --- trunk/src/target/cortex_m3.c 2009-06-04 13:18:07 UTC (rev 2050) +++ trunk/src/target/cortex_m3.c 2009-06-04 13:45:50 UTC (rev 2051) @@ -1579,6 +1579,7 @@ armv7m->swjdp_info.ap_tar_value = -1; armv7m->swjdp_info.jtag_info = &cortex_m3->jtag_info; armv7m->swjdp_info.memaccess_tck = 8; + armv7m->swjdp_info.tar_autoincr_block = (1<<12); /* Cortex-M3 has 4096 bytes autoincrement range */ /* initialize arch-specific breakpoint handling */ |
From: oharboe at B. <oh...@ma...> - 2009-06-04 15:18:08
|
Author: oharboe Date: 2009-06-04 15:18:07 +0200 (Thu, 04 Jun 2009) New Revision: 2050 Modified: trunk/src/flash/str9xpec.c trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h trunk/src/jtag/minidriver.h trunk/src/jtag/zy1000.c trunk/src/pld/virtex2.c trunk/src/target/arm11_dbgtap.c trunk/src/target/arm720t.c trunk/src/target/arm7_9_common.c trunk/src/target/arm7tdmi.c trunk/src/target/arm920t.c trunk/src/target/arm926ejs.c trunk/src/target/arm966e.c trunk/src/target/arm9tdmi.c trunk/src/target/arm_adi_v5.c trunk/src/target/avrt.c trunk/src/target/embeddedice.c trunk/src/target/etb.c trunk/src/target/etm.c trunk/src/target/feroceon.c trunk/src/target/mips_ejtag.c trunk/src/target/mips_m4k.c trunk/src/target/xscale.c trunk/src/xsvf/xsvf.c Log: Rename jtag_add_end_state to jtag_set_end_state since "add" implies that this fn has something to do with the queue, which it does not as such. Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/flash/str9xpec.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -137,7 +137,7 @@ field.in_value = &status; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE)); jtag_execute_queue(); LOG_DEBUG("status: 0x%2.2x", status); @@ -225,7 +225,7 @@ field.in_value = str9xpec_info->options; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE)); jtag_execute_queue(); status = str9xpec_isc_status(tap); @@ -372,7 +372,7 @@ field.out_value = buffer; field.in_value = NULL; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE)); jtag_add_sleep(40000); /* read blank check result */ @@ -478,7 +478,7 @@ field.out_value = buffer; field.in_value = NULL; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE)); jtag_execute_queue(); jtag_add_sleep(10); @@ -704,7 +704,7 @@ field.out_value = (buffer + bytes_written); field.in_value = NULL; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE)); /* small delay before polling */ jtag_add_sleep(50); @@ -754,7 +754,7 @@ field.out_value = last_dword; field.in_value = NULL; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE)); /* small delay before polling */ jtag_add_sleep(50); @@ -826,7 +826,7 @@ field.out_value = NULL; field.in_value = buffer; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE)); jtag_execute_queue(); idcode = buf_get_u32(buffer, 0, 32); @@ -946,7 +946,7 @@ field.out_value = str9xpec_info->options; field.in_value = NULL; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE)); /* small delay before polling */ jtag_add_sleep(50); Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/jtag/jtag.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -750,7 +750,7 @@ if (trst_with_tlr) { LOG_DEBUG("JTAG reset with RESET instead of TRST"); - jtag_add_end_state(TAP_RESET); + jtag_set_end_state(TAP_RESET); jtag_add_tlr(); return; } @@ -771,7 +771,7 @@ } } -tap_state_t jtag_add_end_state(tap_state_t state) +tap_state_t jtag_set_end_state(tap_state_t state) { if ((state == TAP_DRSHIFT)||(state == TAP_IRSHIFT)) { @@ -2179,7 +2179,7 @@ command_print( cmd_ctx, "Invalid state name: %s\n", args[0] ); return ERROR_COMMAND_SYNTAX_ERROR; } - jtag_add_end_state(state); + jtag_set_end_state(state); jtag_execute_queue(); } command_print(cmd_ctx, "current endstate: %s", tap_state_name(cmd_queue_end_state)); Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/jtag/jtag.h 2009-06-04 13:18:07 UTC (rev 2050) @@ -488,14 +488,14 @@ /** - * Function jtag_add_end_state + * Function jtag_set_end_state * * Set a global variable to \a state if \a state != TAP_INVALID. * * Return the value of the global variable. * **/ -extern tap_state_t jtag_add_end_state(tap_state_t state); +extern tap_state_t jtag_set_end_state(tap_state_t state); /** * Function jtag_get_end_state * Modified: trunk/src/jtag/minidriver.h =================================================================== --- trunk/src/jtag/minidriver.h 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/jtag/minidriver.h 2009-06-04 13:18:07 UTC (rev 2050) @@ -120,7 +120,7 @@ * approperiate */ extern int interface_jtag_add_reset(int trst, int srst); -extern int interface_jtag_add_end_state(tap_state_t endstate); +extern int interface_jtag_set_end_state(tap_state_t endstate); extern int interface_jtag_add_sleep(u32 us); extern int interface_jtag_add_clocks(int num_cycles); extern int interface_jtag_execute_queue(void); Modified: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/jtag/zy1000.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -499,7 +499,7 @@ } } -int interface_jtag_add_end_state(tap_state_t state) +int interface_jtag_set_end_state(tap_state_t state) { return ERROR_OK; } Modified: trunk/src/pld/virtex2.c =================================================================== --- trunk/src/pld/virtex2.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/pld/virtex2.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -58,7 +58,7 @@ - jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_IDLE)); + jtag_add_ir_scan(1, &field, jtag_set_end_state(TAP_IDLE)); free(field.out_value); } @@ -85,7 +85,7 @@ virtex2_set_instr(virtex2_info->tap, 0x5); /* CFG_IN */ - jtag_add_dr_scan(1, &scan_field, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(1, &scan_field, jtag_set_end_state(TAP_DRPAUSE)); free(values); @@ -113,7 +113,7 @@ { scan_field.in_value = (u8 *)words; - jtag_add_dr_scan(1, &scan_field, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(1, &scan_field, jtag_set_end_state(TAP_DRPAUSE)); jtag_add_callback(virtexflip32, (u8 *)words); @@ -165,7 +165,7 @@ if ((retval = xilinx_read_bit_file(&bit_file, filename)) != ERROR_OK) return retval; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); virtex2_set_instr(virtex2_info->tap, 0xb); /* JPROG_B */ jtag_execute_queue(); jtag_add_sleep(1000); @@ -179,18 +179,18 @@ field.num_bits = bit_file.length * 8; field.out_value = bit_file.data; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_DRPAUSE)); jtag_execute_queue(); jtag_add_tlr(); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); virtex2_set_instr(virtex2_info->tap, 0xc); /* JSTART */ - jtag_add_runtest(13, jtag_add_end_state(TAP_IDLE)); + jtag_add_runtest(13, jtag_set_end_state(TAP_IDLE)); virtex2_set_instr(virtex2_info->tap, 0x3f); /* BYPASS */ virtex2_set_instr(virtex2_info->tap, 0x3f); /* BYPASS */ virtex2_set_instr(virtex2_info->tap, 0xc); /* JSTART */ - jtag_add_runtest(13, jtag_add_end_state(TAP_IDLE)); + jtag_add_runtest(13, jtag_set_end_state(TAP_IDLE)); virtex2_set_instr(virtex2_info->tap, 0x3f); /* BYPASS */ jtag_execute_queue(); Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/arm11_dbgtap.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -439,7 +439,7 @@ { Data = *data; - arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, jtag_add_end_state(TAP_IDLE)); + arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, jtag_set_end_state(TAP_IDLE)); CHECK_RETVAL(jtag_execute_queue()); @@ -526,13 +526,13 @@ if (count) { - jtag_add_dr_scan(asizeof(chain5_fields), chain5_fields, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(asizeof(chain5_fields), chain5_fields, jtag_set_end_state(TAP_DRPAUSE)); jtag_add_pathmove(asizeof(arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay), arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay); } else { - jtag_add_dr_scan(asizeof(chain5_fields), chain5_fields, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(asizeof(chain5_fields), chain5_fields, jtag_set_end_state(TAP_IDLE)); } } Modified: trunk/src/target/arm720t.c =================================================================== --- trunk/src/target/arm720t.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/arm720t.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -96,7 +96,7 @@ buf_set_u32(out_buf, 0, 32, flip_u32(out, 32)); - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); if((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK) { return retval; Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/arm7_9_common.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -693,7 +693,7 @@ reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT]; /* set RESTART instruction */ - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); if (arm7_9->need_bypass_before_restart) { arm7_9->need_bypass_before_restart = 0; arm_jtag_set_instr(jtag_info, 0xf, NULL); @@ -747,7 +747,7 @@ reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT]; /* set RESTART instruction */ - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); if (arm7_9->need_bypass_before_restart) { arm7_9->need_bypass_before_restart = 0; arm_jtag_set_instr(jtag_info, 0xf, NULL); @@ -1724,14 +1724,14 @@ arm_jtag_t *jtag_info = &arm7_9->jtag_info; /* set RESTART instruction */ - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); if (arm7_9->need_bypass_before_restart) { arm7_9->need_bypass_before_restart = 0; arm_jtag_set_instr(jtag_info, 0xf, NULL); } arm_jtag_set_instr(jtag_info, 0x4, NULL); - jtag_add_runtest(1, jtag_add_end_state(TAP_IDLE)); + jtag_add_runtest(1, jtag_set_end_state(TAP_IDLE)); return jtag_execute_queue(); } Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/arm7tdmi.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -98,7 +98,7 @@ u8 databus[4]; u8 breakpoint; - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); fields[0].tap = arm7_9->jtag_info.tap; fields[0].num_bits = 1; @@ -116,7 +116,7 @@ } arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL); - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(2, fields, jtag_set_end_state(TAP_DRPAUSE)); if((retval = jtag_execute_queue()) != ERROR_OK) { return retval; @@ -127,7 +127,7 @@ fields[1].in_value = NULL; fields[1].out_value = databus; - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(2, fields, jtag_set_end_state(TAP_DRPAUSE)); if (breakpoint & 1) target->debug_reason = DBG_REASON_WATCHPOINT; @@ -157,7 +157,7 @@ /* put an instruction in the ARM7TDMI pipeline or write the data bus, and optionally read data */ static __inline int arm7tdmi_clock_out(arm_jtag_t *jtag_info, u32 out, u32 *deprecated, int breakpoint) { - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); arm_jtag_scann(jtag_info, 0x1); arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); @@ -170,7 +170,7 @@ int retval = ERROR_OK; scan_field_t fields[2]; - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); if((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK) { return retval; @@ -260,7 +260,7 @@ int retval = ERROR_OK; scan_field_t fields[2]; - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); if((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK) { return retval; Modified: trunk/src/target/arm920t.c =================================================================== --- trunk/src/target/arm920t.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/arm920t.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -103,7 +103,7 @@ u8 reg_addr_buf = reg_addr & 0x3f; u8 nr_w_buf = 0; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(jtag_info, 0xf); arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); @@ -156,7 +156,7 @@ buf_set_u32(value_buf, 0, 32, value); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(jtag_info, 0xf); arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); @@ -201,7 +201,7 @@ u8 nr_w_buf = 0; u8 cp15_opcode_buf[4]; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(jtag_info, 0xf); arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); Modified: trunk/src/target/arm926ejs.c =================================================================== --- trunk/src/target/arm926ejs.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/arm926ejs.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -129,7 +129,7 @@ buf_set_u32(address_buf, 0, 14, address); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK) { return retval; @@ -200,7 +200,7 @@ buf_set_u32(address_buf, 0, 14, address); buf_set_u32(value_buf, 0, 32, value); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK) { return retval; Modified: trunk/src/target/arm966e.c =================================================================== --- trunk/src/target/arm966e.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/arm966e.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -167,7 +167,7 @@ u8 reg_addr_buf = reg_addr & 0x3f; u8 nr_w_buf = 0; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK) { return retval; @@ -222,7 +222,7 @@ buf_set_u32(value_buf, 0, 32, value); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK) { return retval; Modified: trunk/src/target/arm9tdmi.c =================================================================== --- trunk/src/target/arm9tdmi.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/arm9tdmi.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -111,7 +111,7 @@ u8 instructionbus[4]; u8 debug_reason; - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); fields[0].tap = arm7_9->jtag_info.tap; fields[0].num_bits = 32; @@ -134,7 +134,7 @@ } arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL); - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(3, fields, jtag_set_end_state(TAP_DRPAUSE)); if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; @@ -147,7 +147,7 @@ fields[2].in_value = NULL; fields[2].out_value = instructionbus; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(3, fields, jtag_set_end_state(TAP_DRPAUSE)); if (debug_reason & 0x4) if (debug_reason & 0x2) @@ -178,7 +178,7 @@ if (sysspeed) buf_set_u32(&sysspeed_buf, 2, 1, 1); - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK) { return retval; @@ -240,7 +240,7 @@ int retval = ERROR_OK;; scan_field_t fields[3]; - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK) { return retval; @@ -307,7 +307,7 @@ int retval = ERROR_OK; scan_field_t fields[3]; - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK) { return retval; Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/arm_adi_v5.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -65,12 +65,12 @@ scan_field_t fields[2]; u8 out_addr_buf; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_set_instr(jtag_info, instr, NULL); /* Add specified number of tck clocks before accessing memory bus */ if ((instr == DAP_IR_APACC) && ((reg_addr == AP_REG_DRW)||((reg_addr&0xF0) == AP_REG_BD0) )&& (swjdp->memaccess_tck != 0)) - jtag_add_runtest(swjdp->memaccess_tck, jtag_add_end_state(TAP_IDLE)); + jtag_add_runtest(swjdp->memaccess_tck, jtag_set_end_state(TAP_IDLE)); fields[0].tap = jtag_info->tap; fields[0].num_bits = 3; @@ -96,12 +96,12 @@ u8 out_value_buf[4]; u8 out_addr_buf; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_set_instr(jtag_info, instr, NULL); /* Add specified number of tck clocks before accessing memory bus */ if ((instr == DAP_IR_APACC) && ((reg_addr == AP_REG_DRW)||((reg_addr&0xF0) == AP_REG_BD0) )&& (swjdp->memaccess_tck != 0)) - jtag_add_runtest(swjdp->memaccess_tck, jtag_add_end_state(TAP_IDLE)); + jtag_add_runtest(swjdp->memaccess_tck, jtag_set_end_state(TAP_IDLE)); fields[0].tap = jtag_info->tap; fields[0].num_bits = 3; Modified: trunk/src/target/avrt.c =================================================================== --- trunk/src/target/avrt.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/avrt.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -218,7 +218,7 @@ field[0].num_bits = tap->ir_length; field[0].out_value = ir_out; field[0].in_value = ir_in; - jtag_add_plain_ir_scan(sizeof(field) / sizeof(field[0]), field, jtag_add_end_state(TAP_IDLE)); + jtag_add_plain_ir_scan(sizeof(field) / sizeof(field[0]), field, jtag_set_end_state(TAP_IDLE)); } return ERROR_OK; @@ -239,7 +239,7 @@ field[0].num_bits = dr_len; field[0].out_value = dr_out; field[0].in_value = dr_in; - jtag_add_plain_dr_scan(sizeof(field) / sizeof(field[0]), field, jtag_add_end_state(TAP_IDLE)); + jtag_add_plain_dr_scan(sizeof(field) / sizeof(field[0]), field, jtag_set_end_state(TAP_IDLE)); } return ERROR_OK; Modified: trunk/src/target/embeddedice.c =================================================================== --- trunk/src/target/embeddedice.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/embeddedice.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -238,7 +238,7 @@ u8 field1_out[1]; u8 field2_out[1]; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(ice_reg->jtag_info, 0x2); arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL); @@ -293,7 +293,7 @@ u8 field1_out[1]; u8 field2_out[1]; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(jtag_info, 0x2); arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); @@ -369,7 +369,7 @@ LOG_DEBUG("%i: 0x%8.8x", ice_reg->addr, value); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(ice_reg->jtag_info, 0x2); arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL); @@ -395,7 +395,7 @@ u8 field1_out[1]; u8 field2_out[1]; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(jtag_info, 0x2); arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); @@ -450,7 +450,7 @@ else return ERROR_INVALID_ARGUMENTS; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(jtag_info, 0x2); arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); Modified: trunk/src/target/etb.c =================================================================== --- trunk/src/target/etb.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/etb.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -169,7 +169,7 @@ scan_field_t fields[3]; int i; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); etb_scann(etb, 0x0); etb_set_instr(etb, 0xc); @@ -225,7 +225,7 @@ LOG_DEBUG("%i", etb_reg->addr); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); etb_scann(etb_reg->etb, 0x0); etb_set_instr(etb_reg->etb, 0xc); @@ -314,7 +314,7 @@ LOG_DEBUG("%i: 0x%8.8x", etb_reg->addr, value); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); etb_scann(etb_reg->etb, 0x0); etb_set_instr(etb_reg->etb, 0xc); Modified: trunk/src/target/etm.c =================================================================== --- trunk/src/target/etm.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/etm.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -320,7 +320,7 @@ LOG_DEBUG("%i", etm_reg->addr); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(etm_reg->jtag_info, 0x6); arm_jtag_set_instr(etm_reg->jtag_info, etm_reg->jtag_info->intest_instr, NULL); @@ -405,7 +405,7 @@ LOG_DEBUG("%i: 0x%8.8x", etm_reg->addr, value); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); arm_jtag_scann(etm_reg->jtag_info, 0x6); arm_jtag_set_instr(etm_reg->jtag_info, etm_reg->jtag_info->intest_instr, NULL); Modified: trunk/src/target/feroceon.c =================================================================== --- trunk/src/target/feroceon.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/feroceon.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -124,7 +124,7 @@ buf_set_u32(instr_buf, 0, 32, flip_u32(instr, 32)); - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); arm_jtag_scann(jtag_info, 0x1); arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); Modified: trunk/src/target/mips_ejtag.c =================================================================== --- trunk/src/target/mips_ejtag.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/mips_ejtag.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -60,7 +60,7 @@ { scan_field_t field; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); mips_ejtag_set_instr(ejtag_info, EJTAG_INST_IDCODE, NULL); @@ -87,7 +87,7 @@ { scan_field_t field; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); mips_ejtag_set_instr(ejtag_info, EJTAG_INST_IMPCODE, NULL); @@ -199,7 +199,7 @@ int mips_ejtag_enter_debug(mips_ejtag_t *ejtag_info) { u32 ejtag_ctrl; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL, NULL); /* set debug break bit */ Modified: trunk/src/target/mips_m4k.c =================================================================== --- trunk/src/target/mips_m4k.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/mips_m4k.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -161,7 +161,7 @@ u32 ejtag_ctrl = ejtag_info->ejtag_ctrl; /* read ejtag control reg */ - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL, NULL); mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl); @@ -171,7 +171,7 @@ { /* we have detected a reset, clear flag * otherwise ejtag will not work */ - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); ejtag_ctrl = ejtag_info->ejtag_ctrl & ~EJTAG_CTRL_ROCC; mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL, NULL); @@ -184,7 +184,7 @@ { if ((target->state == TARGET_RUNNING) || (target->state == TARGET_RESET)) { - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); mips_ejtag_set_instr(ejtag_info, EJTAG_INST_NORMALBOOT, NULL); target->state = TARGET_HALTED; @@ -276,12 +276,12 @@ if (target->reset_halt) { /* use hardware to catch reset */ - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); mips_ejtag_set_instr(ejtag_info, EJTAG_INST_EJTAGBOOT, NULL); } else { - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); mips_ejtag_set_instr(ejtag_info, EJTAG_INST_NORMALBOOT, NULL); } Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/target/xscale.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -238,7 +238,7 @@ u8 field2_check_value = 0x0; u8 field2_check_mask = 0x1; - jtag_add_end_state(TAP_DRPAUSE); + jtag_set_end_state(TAP_DRPAUSE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dcsr); buf_set_u32(&field0, 1, 1, xscale->hold_rst); @@ -283,7 +283,7 @@ fields[1].out_value = xscale->reg_cache->reg_list[XSCALE_DCSR].value; fields[1].in_value = NULL; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); jtag_add_dr_scan(3, fields, jtag_get_end_state()); @@ -345,7 +345,7 @@ fields[2].check_value = &field2_check_value; fields[2].check_mask = &field2_check_mask; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dbgtx); jtag_add_runtest(1, jtag_get_end_state()); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */ @@ -363,7 +363,7 @@ fields[1].in_value = (u8 *)(field1+i); - jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan_check(3, fields, jtag_set_end_state(TAP_IDLE)); jtag_add_callback(xscale_getbuf, (u8 *)(field1+i)); @@ -429,7 +429,7 @@ u8 field2_check_value = 0x0; u8 field2_check_mask = 0x1; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dbgtx); @@ -477,7 +477,7 @@ jtag_add_pathmove(sizeof(noconsume_path)/sizeof(*noconsume_path), noconsume_path); } - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(3, fields, jtag_set_end_state(TAP_IDLE)); jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask); jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask); @@ -532,7 +532,7 @@ u8 field2_check_value = 0x0; u8 field2_check_mask = 0x1; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dbgrx); @@ -560,7 +560,7 @@ LOG_DEBUG("polling RX"); for (;;) { - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(3, fields, jtag_set_end_state(TAP_IDLE)); jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask); jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask); @@ -592,7 +592,7 @@ /* set rx_valid */ field2 = 0x1; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_IDLE)); + jtag_add_dr_scan(3, fields, jtag_set_end_state(TAP_IDLE)); if ((retval = jtag_execute_queue()) != ERROR_OK) { @@ -615,7 +615,7 @@ int done_count = 0; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dbgrx); @@ -658,7 +658,7 @@ 3, bits, t, - jtag_add_end_state(TAP_IDLE)); + jtag_set_end_state(TAP_IDLE)); buffer += size; } @@ -701,7 +701,7 @@ if (ext_dbg_brk != -1) xscale->external_debug_break = ext_dbg_brk; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dcsr); buf_set_u32(&field0, 1, 1, xscale->hold_rst); @@ -766,7 +766,7 @@ LOG_DEBUG("loading miniIC at 0x%8.8x", va); - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.ldic); /* LDIC */ /* CMD is b010 for Main IC and b011 for Mini IC */ @@ -833,7 +833,7 @@ scan_field_t fields[2]; - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.ldic); /* LDIC */ /* CMD for invalidate IC line b000, bits [6:4] b000 */ @@ -1572,7 +1572,7 @@ /* select DCSR instruction (set endstate to R-T-I to ensure we don't * end up in T-L-R, which would reset JTAG */ - jtag_add_end_state(TAP_IDLE); + jtag_set_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dcsr); /* set Hold reset, Halt mode and Trap Reset */ @@ -1646,7 +1646,7 @@ /* wait 300ms; 150 and 100ms were not enough */ jtag_add_sleep(300*1000); - jtag_add_runtest(2030, jtag_add_end_state(TAP_IDLE)); + jtag_add_runtest(2030, jtag_set_end_state(TAP_IDLE)); jtag_execute_queue(); /* set Hold reset, Halt mode and Trap Reset */ @@ -1709,7 +1709,7 @@ xscale_load_ic(target, 1, 0x0, xscale->low_vectors); xscale_load_ic(target, 1, 0xffff0000, xscale->high_vectors); - jtag_add_runtest(30, jtag_add_end_state(TAP_IDLE)); + jtag_add_runtest(30, jtag_set_end_state(TAP_IDLE)); jtag_add_sleep(100000); Modified: trunk/src/xsvf/xsvf.c =================================================================== --- trunk/src/xsvf/xsvf.c 2009-06-04 13:14:07 UTC (rev 2049) +++ trunk/src/xsvf/xsvf.c 2009-06-04 13:18:07 UTC (rev 2050) @@ -405,9 +405,9 @@ field.in_value = calloc(CEIL(field.num_bits, 8), 1); if (tap == NULL) - jtag_add_plain_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_plain_dr_scan(1, &field, jtag_set_end_state(TAP_DRPAUSE)); else - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_DRPAUSE)); jtag_check_value_mask(&field, dr_in_buf, dr_in_mask); @@ -853,9 +853,9 @@ LOG_USER("LSDR retry %d", attempt); if (tap == NULL) - jtag_add_plain_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_plain_dr_scan(1, &field, jtag_set_end_state(TAP_DRPAUSE)); else - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); + jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_DRPAUSE)); jtag_check_value_mask(&field, dr_in_buf, dr_in_mask); |
From: oharboe at B. <oh...@ma...> - 2009-06-04 15:14:10
|
Author: oharboe Date: 2009-06-04 15:14:07 +0200 (Thu, 04 Jun 2009) New Revision: 2049 Modified: trunk/src/flash/str9xpec.c trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h trunk/src/jtag/zy1000.c trunk/src/target/arm11.h trunk/src/target/arm720t.c trunk/src/target/arm7tdmi.c trunk/src/target/arm920t.c trunk/src/target/arm926ejs.c trunk/src/target/arm966e.c trunk/src/target/arm9tdmi.c trunk/src/target/arm_adi_v5.c trunk/src/target/arm_jtag.c trunk/src/target/embeddedice.c trunk/src/target/embeddedice.h trunk/src/target/etb.c trunk/src/target/etm.c trunk/src/target/feroceon.c trunk/src/target/mips_ejtag.c trunk/src/target/xscale.c Log: Introduce jtag_get_end_state() fn to clarify code a bit. Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/flash/str9xpec.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -539,7 +539,7 @@ field.out_value = NULL; field.in_value = &status; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(1, &field, jtag_get_end_state()); jtag_execute_queue(); } while(!(status & ISC_STATUS_BUSY)); @@ -620,7 +620,7 @@ field.out_value = §or; field.in_value = NULL; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(1, &field, jtag_get_end_state()); return ERROR_OK; } @@ -717,7 +717,7 @@ field.out_value = NULL; field.in_value = scanbuf; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(1, &field, jtag_get_end_state()); jtag_execute_queue(); status = buf_get_u32(scanbuf, 0, 8); @@ -767,7 +767,7 @@ field.out_value = NULL; field.in_value = scanbuf; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(1, &field, jtag_get_end_state()); jtag_execute_queue(); status = buf_get_u32(scanbuf, 0, 8); @@ -959,7 +959,7 @@ field.out_value = NULL; field.in_value = &status; - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(1, &field, jtag_get_end_state()); jtag_execute_queue(); } while(!(status & ISC_STATUS_BUSY)); Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/jtag/jtag.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -783,6 +783,11 @@ return cmd_queue_end_state; } +tap_state_t jtag_get_end_state(void) +{ + return cmd_queue_end_state; +} + void jtag_add_sleep(u32 us) { keep_alive(); /* we might be running on a very slow JTAG clk */ @@ -2226,7 +2231,7 @@ return ERROR_COMMAND_SYNTAX_ERROR; } - jtag_add_runtest(strtol(args[0], NULL, 0), jtag_add_end_state(TAP_INVALID)); + jtag_add_runtest(strtol(args[0], NULL, 0), jtag_get_end_state()); jtag_execute_queue(); return ERROR_OK; Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/jtag/jtag.h 2009-06-04 13:14:07 UTC (rev 2049) @@ -488,7 +488,7 @@ /** - * Function jtag_add_stable_clocks + * Function jtag_add_end_state * * Set a global variable to \a state if \a state != TAP_INVALID. * @@ -496,6 +496,13 @@ * **/ extern tap_state_t jtag_add_end_state(tap_state_t state); +/** + * Function jtag_get_end_state + * + * Return the value of the global variable for end state + * + **/ +extern tap_state_t jtag_get_end_state(void); extern void jtag_add_sleep(u32 us); Modified: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/jtag/zy1000.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -748,7 +748,7 @@ void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count) { // static int const reg_addr=0x5; - tap_state_t end_state=jtag_add_end_state(TAP_INVALID); + tap_state_t end_state=jtag_get_end_state(); if (jtag_NextEnabledTap(jtag_NextEnabledTap(NULL))==NULL) { /* better performance via code duplication */ Modified: trunk/src/target/arm11.h =================================================================== --- trunk/src/target/arm11.h 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/arm11.h 2009-06-04 13:14:07 UTC (rev 2049) @@ -47,7 +47,7 @@ 23 * ARM11_REGCACHE_MODEREGS + \ 9 * ARM11_REGCACHE_FREGS) -#define ARM11_TAP_DEFAULT jtag_add_end_state(TAP_INVALID) +#define ARM11_TAP_DEFAULT jtag_get_end_state() #define CHECK_RETVAL(action) \ Modified: trunk/src/target/arm720t.c =================================================================== --- trunk/src/target/arm720t.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/arm720t.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -119,15 +119,15 @@ if (in) { fields[1].in_value = (u8 *)in; - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); jtag_add_callback(arm7flip32, (u8 *)in); } else { - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); } if (clock) - jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); + jtag_add_runtest(0, jtag_get_end_state()); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ if((retval = jtag_execute_queue()) != ERROR_OK) Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/arm7tdmi.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -147,9 +147,9 @@ 2, arm7tdmi_num_bits, values, - jtag_add_end_state(TAP_INVALID)); + jtag_get_end_state()); - jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); + jtag_add_runtest(0, jtag_get_end_state()); return ERROR_OK; } @@ -187,11 +187,11 @@ fields[1].out_value = NULL; fields[1].in_value = (u8 *)in; - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); jtag_add_callback(arm7flip32, (u8 *)in); - jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); + jtag_add_runtest(0, jtag_get_end_state()); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { @@ -277,11 +277,11 @@ fields[1].out_value = NULL; jtag_alloc_in_value32(&fields[1]); - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); jtag_add_callback4(arm7endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[1].in_value); - jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); + jtag_add_runtest(0, jtag_get_end_state()); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { Modified: trunk/src/target/arm920t.c =================================================================== --- trunk/src/target/arm920t.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/arm920t.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -127,11 +127,11 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(4, fields, jtag_get_end_state()); fields[1].in_value = (u8 *)value; - jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(4, fields, jtag_get_end_state()); jtag_add_callback(arm_le_to_h_u32, (u8 *)value); @@ -180,7 +180,7 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(4, fields, jtag_get_end_state()); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, value); @@ -227,7 +227,7 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(4, fields, jtag_get_end_state()); arm9tdmi_clock_out(jtag_info, arm_opcode, 0, NULL, 0); arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 1); Modified: trunk/src/target/arm926ejs.c =================================================================== --- trunk/src/target/arm926ejs.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/arm926ejs.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -157,7 +157,7 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(4, fields, jtag_get_end_state()); /*TODO: add timeout*/ do @@ -165,7 +165,7 @@ /* rescan with NOP, to wait for the access to complete */ access = 0; nr_w_buf = 0; - jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(4, fields, jtag_get_end_state()); jtag_add_callback(arm_le_to_h_u32, (u8 *)value); @@ -227,14 +227,14 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(4, fields, jtag_get_end_state()); /*TODO: add timeout*/ do { /* rescan with NOP, to wait for the access to complete */ access = 0; nr_w_buf = 0; - jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(4, fields, jtag_get_end_state()); if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; Modified: trunk/src/target/arm966e.c =================================================================== --- trunk/src/target/arm966e.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/arm966e.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -189,11 +189,11 @@ fields[2].out_value = &nr_w_buf; fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); fields[1].in_value = (u8 *)value; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); jtag_add_callback(arm_le_to_h_u32, (u8 *)value); @@ -244,7 +244,7 @@ fields[2].out_value = &nr_w_buf; fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, value); Modified: trunk/src/target/arm9tdmi.c =================================================================== --- trunk/src/target/arm9tdmi.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/arm9tdmi.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -204,16 +204,16 @@ if (in) { fields[0].in_value=(u8 *)in; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); jtag_add_callback(arm_le_to_h_u32, (u8 *)in); } else { - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); } - jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); + jtag_add_runtest(0, jtag_get_end_state()); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { @@ -263,11 +263,11 @@ fields[2].out_value = NULL; fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); jtag_add_callback(arm_le_to_h_u32, (u8 *)in); - jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); + jtag_add_runtest(0, jtag_get_end_state()); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { @@ -330,11 +330,11 @@ fields[2].out_value = NULL; fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); jtag_add_callback4(arm9endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[0].in_value); - jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); + jtag_add_runtest(0, jtag_get_end_state()); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/arm_adi_v5.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -83,7 +83,7 @@ fields[1].out_value = outvalue; fields[1].in_value = invalue; - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); return ERROR_OK; } @@ -118,13 +118,13 @@ if (invalue) { fields[1].in_value = (u8 *)invalue; - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); jtag_add_callback(arm_le_to_h_u32, (u8 *)invalue); } else { - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); } return ERROR_OK; Modified: trunk/src/target/arm_jtag.c =================================================================== --- trunk/src/target/arm_jtag.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/arm_jtag.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -53,13 +53,13 @@ if (no_verify_capture==NULL) { - jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_ir_scan(1, &field, jtag_get_end_state()); } else { /* FIX!!!! this is a kludge!!! arm926ejs.c should reimplement this arm_jtag_set_instr to * have special verification code. */ - jtag_add_ir_scan_noverify(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_ir_scan_noverify(1, &field, jtag_get_end_state()); } } @@ -86,7 +86,7 @@ 1, num_bits, values, - jtag_add_end_state(TAP_INVALID)); + jtag_get_end_state()); jtag_info->cur_scan_chain = new_scan_chain; } Modified: trunk/src/target/embeddedice.c =================================================================== --- trunk/src/target/embeddedice.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/embeddedice.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -266,7 +266,7 @@ fields[2].check_value = NULL; fields[2].check_mask = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); fields[0].in_value = reg->value; fields[0].check_value = check_value; @@ -278,7 +278,7 @@ */ buf_set_u32(fields[1].out_value, 0, 5, embeddedice_reg_arch_info[EICE_COMMS_CTRL]); - jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan_check(3, fields, jtag_get_end_state()); return ERROR_OK; } @@ -314,7 +314,7 @@ buf_set_u32(fields[2].out_value, 0, 1, 0); fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); while (size > 0) { @@ -325,7 +325,7 @@ buf_set_u32(fields[1].out_value, 0, 5, embeddedice_reg_arch_info[EICE_COMMS_CTRL]); fields[0].in_value = (u8 *)data; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); jtag_add_callback(arm_le_to_h_u32, (u8 *)data); data++; @@ -420,7 +420,7 @@ while (size > 0) { buf_set_u32(fields[0].out_value, 0, 32, *data); - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); data++; size--; @@ -471,11 +471,11 @@ buf_set_u32(fields[2].out_value, 0, 1, 0); fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); gettimeofday(&lap, NULL); do { - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); if ((retval = jtag_execute_queue()) != ERROR_OK) return retval; Modified: trunk/src/target/embeddedice.h =================================================================== --- trunk/src/target/embeddedice.h 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/embeddedice.h 2009-06-04 13:14:07 UTC (rev 2049) @@ -121,7 +121,7 @@ 3, embeddedice_num_bits, values, - jtag_add_end_state(TAP_INVALID)); + jtag_get_end_state()); } void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count); Modified: trunk/src/target/etb.c =================================================================== --- trunk/src/target/etb.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/etb.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -63,7 +63,7 @@ field.in_value = NULL; - jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_ir_scan(1, &field, jtag_get_end_state()); free(field.out_value); } @@ -86,7 +86,7 @@ /* select INTEST instruction */ etb_set_instr(etb, 0x2); - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(1, &field, jtag_get_end_state()); etb->cur_scan_chain = new_scan_chain; @@ -190,7 +190,7 @@ buf_set_u32(fields[2].out_value, 0, 1, 0); fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); for (i = 0; i < num_frames; i++) { @@ -204,7 +204,7 @@ buf_set_u32(fields[1].out_value, 0, 7, 0); fields[0].in_value = (u8 *)(data+i); - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); jtag_add_callback(etb_getbuf, (u8 *)(data+i)); } @@ -252,7 +252,7 @@ fields[2].check_value = NULL; fields[2].check_mask = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); /* read the identification register in the second run, to make sure we * don't read the ETB data register twice, skipping every second entry @@ -262,7 +262,7 @@ fields[0].check_value = check_value; fields[0].check_mask = check_mask; - jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan_check(3, fields, jtag_get_end_state()); free(fields[1].out_value); free(fields[2].out_value); Modified: trunk/src/target/etm.c =================================================================== --- trunk/src/target/etm.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/etm.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -347,13 +347,13 @@ fields[2].check_value = NULL; fields[2].check_mask = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); fields[0].in_value = reg->value; fields[0].check_value = check_value; fields[0].check_mask = check_mask; - jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan_check(3, fields, jtag_get_end_state()); free(fields[1].out_value); free(fields[2].out_value); @@ -430,7 +430,7 @@ buf_set_u32(fields[2].out_value, 0, 1, 1); fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); return ERROR_OK; } Modified: trunk/src/target/feroceon.c =================================================================== --- trunk/src/target/feroceon.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/feroceon.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -159,9 +159,9 @@ - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); - /* no jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)) here */ + /* no jtag_add_runtest(0, jtag_get_end_state()) here */ return ERROR_OK; } Modified: trunk/src/target/mips_ejtag.c =================================================================== --- trunk/src/target/mips_ejtag.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/mips_ejtag.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -50,7 +50,7 @@ - jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_ir_scan(1, &field, jtag_get_end_state()); } return ERROR_OK; @@ -73,7 +73,7 @@ - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(1, &field, jtag_get_end_state()); if (jtag_execute_queue() != ERROR_OK) { @@ -100,7 +100,7 @@ - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(1, &field, jtag_get_end_state()); if (jtag_execute_queue() != ERROR_OK) { @@ -131,7 +131,7 @@ - jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(1, &field, jtag_get_end_state()); if ((retval = jtag_execute_queue()) != ERROR_OK) { Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-06-04 13:05:57 UTC (rev 2048) +++ trunk/src/target/xscale.c 2009-06-04 13:14:07 UTC (rev 2049) @@ -212,7 +212,7 @@ u8 tmp[4]; field.in_value = tmp; - jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID)); + jtag_add_ir_scan(1, &field, jtag_get_end_state()); /* FIX!!!! isn't this check superfluous? verify_ircapture handles this? */ jtag_check_value_mask(&field, tap->expected, tap->expected_mask); @@ -262,7 +262,7 @@ u8 tmp2; fields[2].in_value = &tmp2; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask); jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask); @@ -285,7 +285,7 @@ jtag_add_end_state(TAP_IDLE); - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); /* DANGER!!! this must be here. It will make sure that the arguments * to jtag_set_check_value() does not go out of scope! */ @@ -347,7 +347,7 @@ jtag_add_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dbgtx); - jtag_add_runtest(1, jtag_add_end_state(TAP_INVALID)); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */ + jtag_add_runtest(1, jtag_get_end_state()); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */ /* repeat until all words have been collected */ int attempts=0; @@ -725,7 +725,7 @@ u8 tmp2; fields[2].in_value = &tmp2; - jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(3, fields, jtag_get_end_state()); jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask); jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask); @@ -800,7 +800,7 @@ - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); fields[0].num_bits = 32; fields[0].out_value = packet; @@ -816,7 +816,7 @@ memcpy(&value, packet, sizeof(u32)); cmd = parity(value); - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); } jtag_execute_queue(); @@ -862,7 +862,7 @@ - jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); + jtag_add_dr_scan(2, fields, jtag_get_end_state()); return ERROR_OK; } |
From: oharboe at B. <oh...@ma...> - 2009-06-04 15:05:57
|
Author: oharboe Date: 2009-06-04 15:05:57 +0200 (Thu, 04 Jun 2009) New Revision: 2048 Modified: trunk/src/jtag/jtag.h trunk/src/jtag/zy1000.c Log: tiny bit of encapsulation of global end state. No longer expose it as a global variable. Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-04 12:52:54 UTC (rev 2047) +++ trunk/src/jtag/jtag.h 2009-06-04 13:05:57 UTC (rev 2048) @@ -104,8 +104,6 @@ /// The current TAP state of the pending JTAG command queue. extern tap_state_t cmd_queue_cur_state; -/// The TAP state in which DR scans should end. -extern tap_state_t cmd_queue_end_state; /** * This structure defines a single scan field in the scan. It provides Modified: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2009-06-04 12:52:54 UTC (rev 2047) +++ trunk/src/jtag/zy1000.c 2009-06-04 13:05:57 UTC (rev 2048) @@ -748,7 +748,7 @@ void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count) { // static int const reg_addr=0x5; - tap_state_t end_state=cmd_queue_end_state; + tap_state_t end_state=jtag_add_end_state(TAP_INVALID); if (jtag_NextEnabledTap(jtag_NextEnabledTap(NULL))==NULL) { /* better performance via code duplication */ |
From: oharboe at B. <oh...@ma...> - 2009-06-04 14:52:54
|
Author: oharboe Date: 2009-06-04 14:52:54 +0200 (Thu, 04 Jun 2009) New Revision: 2047 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/zy1000.c Log: do not modify global end state from jtag_add_xxx() Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 12:42:21 UTC (rev 2046) +++ trunk/src/jtag/jtag.c 2009-06-04 12:52:54 UTC (rev 2047) @@ -396,9 +396,7 @@ assert(state!=TAP_INVALID); - jtag_add_end_state(state); - - cmd_queue_cur_state = cmd_queue_end_state; + cmd_queue_cur_state = state; } void jtag_alloc_in_value32(scan_field_t *field) @@ -411,7 +409,7 @@ int retval; jtag_prelude(state); - retval=interface_jtag_add_ir_scan(in_num_fields, in_fields, cmd_queue_end_state); + retval=interface_jtag_add_ir_scan(in_num_fields, in_fields, state); if (retval!=ERROR_OK) jtag_error=retval; @@ -460,7 +458,7 @@ jtag_prelude(state); - retval=interface_jtag_add_plain_ir_scan(in_num_fields, in_fields, cmd_queue_end_state); + retval=interface_jtag_add_plain_ir_scan(in_num_fields, in_fields, state); if (retval!=ERROR_OK) jtag_error=retval; } @@ -548,7 +546,7 @@ jtag_prelude(state); - retval=interface_jtag_add_dr_scan(in_num_fields, in_fields, cmd_queue_end_state); + retval=interface_jtag_add_dr_scan(in_num_fields, in_fields, state); if (retval!=ERROR_OK) jtag_error=retval; } @@ -567,7 +565,7 @@ jtag_prelude(state); - retval=interface_jtag_add_plain_dr_scan(in_num_fields, in_fields, cmd_queue_end_state); + retval=interface_jtag_add_plain_dr_scan(in_num_fields, in_fields, state); if (retval!=ERROR_OK) jtag_error=retval; } @@ -578,13 +576,11 @@ { assert(end_state != TAP_INVALID); - cmd_queue_end_state = end_state; + cmd_queue_cur_state = end_state; - cmd_queue_cur_state = cmd_queue_end_state; - interface_jtag_add_dr_out(tap, num_fields, num_bits, value, - cmd_queue_end_state); + end_state); } void jtag_add_tlr(void) @@ -644,7 +640,7 @@ jtag_prelude(state); /* executed by sw or hw fifo */ - retval=interface_jtag_add_runtest(num_cycles, cmd_queue_end_state); + retval=interface_jtag_add_runtest(num_cycles, state); if (retval!=ERROR_OK) jtag_error=retval; } Modified: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2009-06-04 12:42:21 UTC (rev 2046) +++ trunk/src/jtag/zy1000.c 2009-06-04 12:52:54 UTC (rev 2047) @@ -517,7 +517,7 @@ tap_state_t end_state; if (nextTap==NULL) { - end_state = cmd_queue_end_state; + end_state = state; } else { end_state = TAP_IRSHIFT; @@ -568,7 +568,7 @@ int interface_jtag_add_plain_ir_scan(int num_fields, const scan_field_t *fields, tap_state_t state) { - scanFields(num_fields, fields, TAP_IRSHIFT, cmd_queue_end_state); + scanFields(num_fields, fields, TAP_IRSHIFT, state); return ERROR_OK; } @@ -587,7 +587,7 @@ tap_state_t end_state; if (nextTap==NULL) { - end_state = cmd_queue_end_state; + end_state = state; } else { end_state = TAP_DRSHIFT; @@ -621,7 +621,7 @@ int interface_jtag_add_plain_dr_scan(int num_fields, const scan_field_t *fields, tap_state_t state) { - scanFields(num_fields, fields, TAP_DRSHIFT, cmd_queue_end_state); + scanFields(num_fields, fields, TAP_DRSHIFT, state); return ERROR_OK; } @@ -693,7 +693,7 @@ int interface_jtag_add_clocks(int num_cycles) { - return zy1000_jtag_add_clocks(num_cycles, cmd_queue_cur_state, cmd_queue_end_state); + return zy1000_jtag_add_clocks(num_cycles, cmd_queue_cur_state, cmd_queue_cur_state); } int interface_jtag_add_sleep(u32 us) |
From: oharboe at B. <oh...@ma...> - 2009-06-04 14:42:21
|
Author: oharboe Date: 2009-06-04 14:42:21 +0200 (Thu, 04 Jun 2009) New Revision: 2046 Modified: trunk/src/jtag/zy1000.c Log: remove unused code. Modified: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2009-06-04 12:12:38 UTC (rev 2045) +++ trunk/src/jtag/zy1000.c 2009-06-04 12:42:21 UTC (rev 2046) @@ -427,11 +427,6 @@ extern int jtag_check_value(u8 *captured, void *priv); -static void gotoEndState(void) -{ - setCurrentState(cmd_queue_end_state); -} - static __inline void scanFields(int num_fields, scan_field_t *fields, tap_state_t shiftState, tap_state_t end_state) { int i; |
From: oharboe at B. <oh...@ma...> - 2009-06-04 14:12:39
|
Author: oharboe Date: 2009-06-04 14:12:38 +0200 (Thu, 04 Jun 2009) New Revision: 2045 Modified: trunk/src/pld/virtex2.c trunk/src/target/arm11_dbgtap.c trunk/src/target/arm7tdmi.c trunk/src/target/arm9tdmi.c trunk/src/xsvf/xsvf.c Log: no longer use jtag_add_xxx() to set end state to TAP_DRPAUSE Modified: trunk/src/pld/virtex2.c =================================================================== --- trunk/src/pld/virtex2.c 2009-06-04 12:06:31 UTC (rev 2044) +++ trunk/src/pld/virtex2.c 2009-06-04 12:12:38 UTC (rev 2045) @@ -85,7 +85,7 @@ virtex2_set_instr(virtex2_info->tap, 0x5); /* CFG_IN */ - jtag_add_dr_scan(1, &scan_field, TAP_DRPAUSE); + jtag_add_dr_scan(1, &scan_field, jtag_add_end_state(TAP_DRPAUSE)); free(values); @@ -113,7 +113,7 @@ { scan_field.in_value = (u8 *)words; - jtag_add_dr_scan(1, &scan_field, TAP_DRPAUSE); + jtag_add_dr_scan(1, &scan_field, jtag_add_end_state(TAP_DRPAUSE)); jtag_add_callback(virtexflip32, (u8 *)words); @@ -179,7 +179,7 @@ field.num_bits = bit_file.length * 8; field.out_value = bit_file.data; - jtag_add_dr_scan(1, &field, TAP_DRPAUSE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); jtag_execute_queue(); jtag_add_tlr(); Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2009-06-04 12:06:31 UTC (rev 2044) +++ trunk/src/target/arm11_dbgtap.c 2009-06-04 12:12:38 UTC (rev 2045) @@ -526,7 +526,7 @@ if (count) { - jtag_add_dr_scan(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE); + jtag_add_dr_scan(asizeof(chain5_fields), chain5_fields, jtag_add_end_state(TAP_DRPAUSE)); jtag_add_pathmove(asizeof(arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay), arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay); } Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-06-04 12:06:31 UTC (rev 2044) +++ trunk/src/target/arm7tdmi.c 2009-06-04 12:12:38 UTC (rev 2045) @@ -116,7 +116,7 @@ } arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL); - jtag_add_dr_scan(2, fields, TAP_DRPAUSE); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_DRPAUSE)); if((retval = jtag_execute_queue()) != ERROR_OK) { return retval; @@ -127,7 +127,7 @@ fields[1].in_value = NULL; fields[1].out_value = databus; - jtag_add_dr_scan(2, fields, TAP_DRPAUSE); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_DRPAUSE)); if (breakpoint & 1) target->debug_reason = DBG_REASON_WATCHPOINT; Modified: trunk/src/target/arm9tdmi.c =================================================================== --- trunk/src/target/arm9tdmi.c 2009-06-04 12:06:31 UTC (rev 2044) +++ trunk/src/target/arm9tdmi.c 2009-06-04 12:12:38 UTC (rev 2045) @@ -134,7 +134,7 @@ } arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL); - jtag_add_dr_scan(3, fields, TAP_DRPAUSE); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_DRPAUSE)); if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; @@ -147,7 +147,7 @@ fields[2].in_value = NULL; fields[2].out_value = instructionbus; - jtag_add_dr_scan(3, fields, TAP_DRPAUSE); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_DRPAUSE)); if (debug_reason & 0x4) if (debug_reason & 0x2) Modified: trunk/src/xsvf/xsvf.c =================================================================== --- trunk/src/xsvf/xsvf.c 2009-06-04 12:06:31 UTC (rev 2044) +++ trunk/src/xsvf/xsvf.c 2009-06-04 12:12:38 UTC (rev 2045) @@ -405,9 +405,9 @@ field.in_value = calloc(CEIL(field.num_bits, 8), 1); if (tap == NULL) - jtag_add_plain_dr_scan(1, &field, TAP_DRPAUSE); + jtag_add_plain_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); else - jtag_add_dr_scan(1, &field, TAP_DRPAUSE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); jtag_check_value_mask(&field, dr_in_buf, dr_in_mask); @@ -853,9 +853,9 @@ LOG_USER("LSDR retry %d", attempt); if (tap == NULL) - jtag_add_plain_dr_scan(1, &field, TAP_DRPAUSE); + jtag_add_plain_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); else - jtag_add_dr_scan(1, &field, TAP_DRPAUSE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_DRPAUSE)); jtag_check_value_mask(&field, dr_in_buf, dr_in_mask); |
From: oharboe at B. <oh...@ma...> - 2009-06-04 14:06:35
|
Author: oharboe Date: 2009-06-04 14:06:31 +0200 (Thu, 04 Jun 2009) New Revision: 2044 Modified: trunk/src/flash/str9xpec.c trunk/src/pld/virtex2.c trunk/src/target/arm11_dbgtap.c trunk/src/target/arm7_9_common.c trunk/src/target/arm_adi_v5.c trunk/src/target/avrt.c trunk/src/target/xscale.c Log: no longer use jtag_add_xxx() to set end state to TAP_IDLE. Same must be done for TAP_DRPAUSE Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2009-06-04 11:42:34 UTC (rev 2043) +++ trunk/src/flash/str9xpec.c 2009-06-04 12:06:31 UTC (rev 2044) @@ -137,7 +137,7 @@ field.in_value = &status; - jtag_add_dr_scan(1, &field, TAP_IDLE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); jtag_execute_queue(); LOG_DEBUG("status: 0x%2.2x", status); @@ -225,7 +225,7 @@ field.in_value = str9xpec_info->options; - jtag_add_dr_scan(1, &field, TAP_IDLE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); jtag_execute_queue(); status = str9xpec_isc_status(tap); @@ -372,7 +372,7 @@ field.out_value = buffer; field.in_value = NULL; - jtag_add_dr_scan(1, &field, TAP_IDLE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); jtag_add_sleep(40000); /* read blank check result */ @@ -478,7 +478,7 @@ field.out_value = buffer; field.in_value = NULL; - jtag_add_dr_scan(1, &field, TAP_IDLE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); jtag_execute_queue(); jtag_add_sleep(10); @@ -704,7 +704,7 @@ field.out_value = (buffer + bytes_written); field.in_value = NULL; - jtag_add_dr_scan(1, &field, TAP_IDLE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); /* small delay before polling */ jtag_add_sleep(50); @@ -754,7 +754,7 @@ field.out_value = last_dword; field.in_value = NULL; - jtag_add_dr_scan(1, &field, TAP_IDLE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); /* small delay before polling */ jtag_add_sleep(50); @@ -826,7 +826,7 @@ field.out_value = NULL; field.in_value = buffer; - jtag_add_dr_scan(1, &field, TAP_IDLE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); jtag_execute_queue(); idcode = buf_get_u32(buffer, 0, 32); @@ -946,7 +946,7 @@ field.out_value = str9xpec_info->options; field.in_value = NULL; - jtag_add_dr_scan(1, &field, TAP_IDLE); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_IDLE)); /* small delay before polling */ jtag_add_sleep(50); Modified: trunk/src/pld/virtex2.c =================================================================== --- trunk/src/pld/virtex2.c 2009-06-04 11:42:34 UTC (rev 2043) +++ trunk/src/pld/virtex2.c 2009-06-04 12:06:31 UTC (rev 2044) @@ -58,7 +58,7 @@ - jtag_add_ir_scan(1, &field, TAP_IDLE); + jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_IDLE)); free(field.out_value); } @@ -186,11 +186,11 @@ jtag_add_end_state(TAP_IDLE); virtex2_set_instr(virtex2_info->tap, 0xc); /* JSTART */ - jtag_add_runtest(13, TAP_IDLE); + jtag_add_runtest(13, jtag_add_end_state(TAP_IDLE)); virtex2_set_instr(virtex2_info->tap, 0x3f); /* BYPASS */ virtex2_set_instr(virtex2_info->tap, 0x3f); /* BYPASS */ virtex2_set_instr(virtex2_info->tap, 0xc); /* JSTART */ - jtag_add_runtest(13, TAP_IDLE); + jtag_add_runtest(13, jtag_add_end_state(TAP_IDLE)); virtex2_set_instr(virtex2_info->tap, 0x3f); /* BYPASS */ jtag_execute_queue(); Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2009-06-04 11:42:34 UTC (rev 2043) +++ trunk/src/target/arm11_dbgtap.c 2009-06-04 12:06:31 UTC (rev 2044) @@ -439,7 +439,7 @@ { Data = *data; - arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_IDLE); + arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, jtag_add_end_state(TAP_IDLE)); CHECK_RETVAL(jtag_execute_queue()); @@ -532,7 +532,7 @@ } else { - jtag_add_dr_scan(asizeof(chain5_fields), chain5_fields, TAP_IDLE); + jtag_add_dr_scan(asizeof(chain5_fields), chain5_fields, jtag_add_end_state(TAP_IDLE)); } } Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-04 11:42:34 UTC (rev 2043) +++ trunk/src/target/arm7_9_common.c 2009-06-04 12:06:31 UTC (rev 2044) @@ -1731,7 +1731,7 @@ } arm_jtag_set_instr(jtag_info, 0x4, NULL); - jtag_add_runtest(1, TAP_IDLE); + jtag_add_runtest(1, jtag_add_end_state(TAP_IDLE)); return jtag_execute_queue(); } Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-04 11:42:34 UTC (rev 2043) +++ trunk/src/target/arm_adi_v5.c 2009-06-04 12:06:31 UTC (rev 2044) @@ -70,7 +70,7 @@ /* Add specified number of tck clocks before accessing memory bus */ if ((instr == DAP_IR_APACC) && ((reg_addr == AP_REG_DRW)||((reg_addr&0xF0) == AP_REG_BD0) )&& (swjdp->memaccess_tck != 0)) - jtag_add_runtest(swjdp->memaccess_tck, TAP_IDLE); + jtag_add_runtest(swjdp->memaccess_tck, jtag_add_end_state(TAP_IDLE)); fields[0].tap = jtag_info->tap; fields[0].num_bits = 3; @@ -101,7 +101,7 @@ /* Add specified number of tck clocks before accessing memory bus */ if ((instr == DAP_IR_APACC) && ((reg_addr == AP_REG_DRW)||((reg_addr&0xF0) == AP_REG_BD0) )&& (swjdp->memaccess_tck != 0)) - jtag_add_runtest(swjdp->memaccess_tck, TAP_IDLE); + jtag_add_runtest(swjdp->memaccess_tck, jtag_add_end_state(TAP_IDLE)); fields[0].tap = jtag_info->tap; fields[0].num_bits = 3; Modified: trunk/src/target/avrt.c =================================================================== --- trunk/src/target/avrt.c 2009-06-04 11:42:34 UTC (rev 2043) +++ trunk/src/target/avrt.c 2009-06-04 12:06:31 UTC (rev 2044) @@ -218,7 +218,7 @@ field[0].num_bits = tap->ir_length; field[0].out_value = ir_out; field[0].in_value = ir_in; - jtag_add_plain_ir_scan(sizeof(field) / sizeof(field[0]), field, TAP_IDLE); + jtag_add_plain_ir_scan(sizeof(field) / sizeof(field[0]), field, jtag_add_end_state(TAP_IDLE)); } return ERROR_OK; @@ -239,7 +239,7 @@ field[0].num_bits = dr_len; field[0].out_value = dr_out; field[0].in_value = dr_in; - jtag_add_plain_dr_scan(sizeof(field) / sizeof(field[0]), field, TAP_IDLE); + jtag_add_plain_dr_scan(sizeof(field) / sizeof(field[0]), field, jtag_add_end_state(TAP_IDLE)); } return ERROR_OK; Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-06-04 11:42:34 UTC (rev 2043) +++ trunk/src/target/xscale.c 2009-06-04 12:06:31 UTC (rev 2044) @@ -363,7 +363,7 @@ fields[1].in_value = (u8 *)(field1+i); - jtag_add_dr_scan_check(3, fields, TAP_IDLE); + jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_IDLE)); jtag_add_callback(xscale_getbuf, (u8 *)(field1+i)); @@ -477,7 +477,7 @@ jtag_add_pathmove(sizeof(noconsume_path)/sizeof(*noconsume_path), noconsume_path); } - jtag_add_dr_scan(3, fields, TAP_IDLE); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_IDLE)); jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask); jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask); @@ -560,7 +560,7 @@ LOG_DEBUG("polling RX"); for (;;) { - jtag_add_dr_scan(3, fields, TAP_IDLE); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_IDLE)); jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask); jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask); @@ -592,7 +592,7 @@ /* set rx_valid */ field2 = 0x1; - jtag_add_dr_scan(3, fields, TAP_IDLE); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_IDLE)); if ((retval = jtag_execute_queue()) != ERROR_OK) { @@ -658,7 +658,7 @@ 3, bits, t, - TAP_IDLE); + jtag_add_end_state(TAP_IDLE)); buffer += size; } @@ -1646,7 +1646,7 @@ /* wait 300ms; 150 and 100ms were not enough */ jtag_add_sleep(300*1000); - jtag_add_runtest(2030, TAP_IDLE); + jtag_add_runtest(2030, jtag_add_end_state(TAP_IDLE)); jtag_execute_queue(); /* set Hold reset, Halt mode and Trap Reset */ @@ -1709,7 +1709,7 @@ xscale_load_ic(target, 1, 0x0, xscale->low_vectors); xscale_load_ic(target, 1, 0xffff0000, xscale->high_vectors); - jtag_add_runtest(30, TAP_IDLE); + jtag_add_runtest(30, jtag_add_end_state(TAP_IDLE)); jtag_add_sleep(100000); |
From: oharboe at B. <oh...@ma...> - 2009-06-04 13:42:37
|
Author: oharboe Date: 2009-06-04 13:42:34 +0200 (Thu, 04 Jun 2009) New Revision: 2043 Modified: trunk/src/jtag/jtag.c Log: use assert() to catch TAP_INVALID passed to jtag_add_xxx() fn's. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 11:33:36 UTC (rev 2042) +++ trunk/src/jtag/jtag.c 2009-06-04 11:42:34 UTC (rev 2043) @@ -394,9 +394,10 @@ { jtag_checks(); - if (state != TAP_INVALID) - jtag_add_end_state(state); + assert(state!=TAP_INVALID); + jtag_add_end_state(state); + cmd_queue_cur_state = cmd_queue_end_state; } @@ -575,9 +576,10 @@ int num_fields, const int* num_bits, const u32* value, tap_state_t end_state) { - if (end_state != TAP_INVALID) - cmd_queue_end_state = end_state; + assert(end_state != TAP_INVALID); + cmd_queue_end_state = end_state; + cmd_queue_cur_state = cmd_queue_end_state; interface_jtag_add_dr_out(tap, |
From: oharboe at B. <oh...@ma...> - 2009-06-04 13:33:38
|
Author: oharboe Date: 2009-06-04 13:33:36 +0200 (Thu, 04 Jun 2009) New Revision: 2042 Modified: trunk/src/flash/str9xpec.c trunk/src/jtag/jtag.c trunk/src/target/arm11.h trunk/src/target/arm720t.c trunk/src/target/arm7tdmi.c trunk/src/target/arm920t.c trunk/src/target/arm926ejs.c trunk/src/target/arm966e.c trunk/src/target/arm9tdmi.c trunk/src/target/arm_adi_v5.c trunk/src/target/arm_jtag.c trunk/src/target/embeddedice.c trunk/src/target/embeddedice.h trunk/src/target/etb.c trunk/src/target/etm.c trunk/src/target/feroceon.c trunk/src/target/mips_ejtag.c trunk/src/target/xscale.c Log: remove TAP_INVALID as argument to jtag_add_xxx() fn's Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/flash/str9xpec.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -539,7 +539,7 @@ field.out_value = NULL; field.in_value = &status; - jtag_add_dr_scan(1, &field, TAP_INVALID); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); jtag_execute_queue(); } while(!(status & ISC_STATUS_BUSY)); @@ -620,7 +620,7 @@ field.out_value = §or; field.in_value = NULL; - jtag_add_dr_scan(1, &field, TAP_INVALID); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); return ERROR_OK; } @@ -717,7 +717,7 @@ field.out_value = NULL; field.in_value = scanbuf; - jtag_add_dr_scan(1, &field, TAP_INVALID); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); jtag_execute_queue(); status = buf_get_u32(scanbuf, 0, 8); @@ -767,7 +767,7 @@ field.out_value = NULL; field.in_value = scanbuf; - jtag_add_dr_scan(1, &field, TAP_INVALID); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); jtag_execute_queue(); status = buf_get_u32(scanbuf, 0, 8); @@ -959,7 +959,7 @@ field.out_value = NULL; field.in_value = &status; - jtag_add_dr_scan(1, &field, TAP_INVALID); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); jtag_execute_queue(); } while(!(status & ISC_STATUS_BUSY)); Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/jtag/jtag.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -2228,7 +2228,7 @@ return ERROR_COMMAND_SYNTAX_ERROR; } - jtag_add_runtest(strtol(args[0], NULL, 0), TAP_INVALID); + jtag_add_runtest(strtol(args[0], NULL, 0), jtag_add_end_state(TAP_INVALID)); jtag_execute_queue(); return ERROR_OK; Modified: trunk/src/target/arm11.h =================================================================== --- trunk/src/target/arm11.h 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/arm11.h 2009-06-04 11:33:36 UTC (rev 2042) @@ -47,7 +47,7 @@ 23 * ARM11_REGCACHE_MODEREGS + \ 9 * ARM11_REGCACHE_FREGS) -#define ARM11_TAP_DEFAULT TAP_INVALID +#define ARM11_TAP_DEFAULT jtag_add_end_state(TAP_INVALID) #define CHECK_RETVAL(action) \ Modified: trunk/src/target/arm720t.c =================================================================== --- trunk/src/target/arm720t.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/arm720t.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -119,15 +119,15 @@ if (in) { fields[1].in_value = (u8 *)in; - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(arm7flip32, (u8 *)in); } else { - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); } if (clock) - jtag_add_runtest(0, TAP_INVALID); + jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ if((retval = jtag_execute_queue()) != ERROR_OK) Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/arm7tdmi.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -147,9 +147,9 @@ 2, arm7tdmi_num_bits, values, - TAP_INVALID); + jtag_add_end_state(TAP_INVALID)); - jtag_add_runtest(0, TAP_INVALID); + jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); return ERROR_OK; } @@ -187,11 +187,11 @@ fields[1].out_value = NULL; fields[1].in_value = (u8 *)in; - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(arm7flip32, (u8 *)in); - jtag_add_runtest(0, TAP_INVALID); + jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { @@ -277,11 +277,11 @@ fields[1].out_value = NULL; jtag_alloc_in_value32(&fields[1]); - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback4(arm7endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[1].in_value); - jtag_add_runtest(0, TAP_INVALID); + jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { Modified: trunk/src/target/arm920t.c =================================================================== --- trunk/src/target/arm920t.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/arm920t.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -127,11 +127,11 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, TAP_INVALID); + jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); fields[1].in_value = (u8 *)value; - jtag_add_dr_scan(4, fields, TAP_INVALID); + jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(arm_le_to_h_u32, (u8 *)value); @@ -180,7 +180,7 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, TAP_INVALID); + jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, value); @@ -227,7 +227,7 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, TAP_INVALID); + jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); arm9tdmi_clock_out(jtag_info, arm_opcode, 0, NULL, 0); arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 1); Modified: trunk/src/target/arm926ejs.c =================================================================== --- trunk/src/target/arm926ejs.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/arm926ejs.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -157,7 +157,7 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, TAP_INVALID); + jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); /*TODO: add timeout*/ do @@ -165,7 +165,7 @@ /* rescan with NOP, to wait for the access to complete */ access = 0; nr_w_buf = 0; - jtag_add_dr_scan(4, fields, TAP_INVALID); + jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(arm_le_to_h_u32, (u8 *)value); @@ -227,14 +227,14 @@ fields[3].out_value = &nr_w_buf; fields[3].in_value = NULL; - jtag_add_dr_scan(4, fields, TAP_INVALID); + jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); /*TODO: add timeout*/ do { /* rescan with NOP, to wait for the access to complete */ access = 0; nr_w_buf = 0; - jtag_add_dr_scan(4, fields, TAP_INVALID); + jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID)); if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; Modified: trunk/src/target/arm966e.c =================================================================== --- trunk/src/target/arm966e.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/arm966e.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -189,11 +189,11 @@ fields[2].out_value = &nr_w_buf; fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); fields[1].in_value = (u8 *)value; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(arm_le_to_h_u32, (u8 *)value); @@ -244,7 +244,7 @@ fields[2].out_value = &nr_w_buf; fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, value); Modified: trunk/src/target/arm9tdmi.c =================================================================== --- trunk/src/target/arm9tdmi.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/arm9tdmi.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -204,16 +204,16 @@ if (in) { fields[0].in_value=(u8 *)in; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(arm_le_to_h_u32, (u8 *)in); } else { - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); } - jtag_add_runtest(0, TAP_INVALID); + jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { @@ -263,11 +263,11 @@ fields[2].out_value = NULL; fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(arm_le_to_h_u32, (u8 *)in); - jtag_add_runtest(0, TAP_INVALID); + jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { @@ -330,11 +330,11 @@ fields[2].out_value = NULL; fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback4(arm9endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[0].in_value); - jtag_add_runtest(0, TAP_INVALID); + jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/arm_adi_v5.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -83,7 +83,7 @@ fields[1].out_value = outvalue; fields[1].in_value = invalue; - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); return ERROR_OK; } @@ -118,13 +118,13 @@ if (invalue) { fields[1].in_value = (u8 *)invalue; - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(arm_le_to_h_u32, (u8 *)invalue); } else { - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); } return ERROR_OK; Modified: trunk/src/target/arm_jtag.c =================================================================== --- trunk/src/target/arm_jtag.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/arm_jtag.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -53,13 +53,13 @@ if (no_verify_capture==NULL) { - jtag_add_ir_scan(1, &field, TAP_INVALID); + jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID)); } else { /* FIX!!!! this is a kludge!!! arm926ejs.c should reimplement this arm_jtag_set_instr to * have special verification code. */ - jtag_add_ir_scan_noverify(1, &field, TAP_INVALID); + jtag_add_ir_scan_noverify(1, &field, jtag_add_end_state(TAP_INVALID)); } } @@ -86,7 +86,7 @@ 1, num_bits, values, - TAP_INVALID); + jtag_add_end_state(TAP_INVALID)); jtag_info->cur_scan_chain = new_scan_chain; } Modified: trunk/src/target/embeddedice.c =================================================================== --- trunk/src/target/embeddedice.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/embeddedice.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -266,7 +266,7 @@ fields[2].check_value = NULL; fields[2].check_mask = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); fields[0].in_value = reg->value; fields[0].check_value = check_value; @@ -278,7 +278,7 @@ */ buf_set_u32(fields[1].out_value, 0, 5, embeddedice_reg_arch_info[EICE_COMMS_CTRL]); - jtag_add_dr_scan_check(3, fields, TAP_INVALID); + jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_INVALID)); return ERROR_OK; } @@ -314,7 +314,7 @@ buf_set_u32(fields[2].out_value, 0, 1, 0); fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); while (size > 0) { @@ -325,7 +325,7 @@ buf_set_u32(fields[1].out_value, 0, 5, embeddedice_reg_arch_info[EICE_COMMS_CTRL]); fields[0].in_value = (u8 *)data; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(arm_le_to_h_u32, (u8 *)data); data++; @@ -420,7 +420,7 @@ while (size > 0) { buf_set_u32(fields[0].out_value, 0, 32, *data); - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); data++; size--; @@ -471,11 +471,11 @@ buf_set_u32(fields[2].out_value, 0, 1, 0); fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); gettimeofday(&lap, NULL); do { - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); if ((retval = jtag_execute_queue()) != ERROR_OK) return retval; Modified: trunk/src/target/embeddedice.h =================================================================== --- trunk/src/target/embeddedice.h 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/embeddedice.h 2009-06-04 11:33:36 UTC (rev 2042) @@ -121,7 +121,7 @@ 3, embeddedice_num_bits, values, - TAP_INVALID); + jtag_add_end_state(TAP_INVALID)); } void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count); Modified: trunk/src/target/etb.c =================================================================== --- trunk/src/target/etb.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/etb.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -63,7 +63,7 @@ field.in_value = NULL; - jtag_add_ir_scan(1, &field, TAP_INVALID); + jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID)); free(field.out_value); } @@ -86,7 +86,7 @@ /* select INTEST instruction */ etb_set_instr(etb, 0x2); - jtag_add_dr_scan(1, &field, TAP_INVALID); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); etb->cur_scan_chain = new_scan_chain; @@ -190,7 +190,7 @@ buf_set_u32(fields[2].out_value, 0, 1, 0); fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); for (i = 0; i < num_frames; i++) { @@ -204,7 +204,7 @@ buf_set_u32(fields[1].out_value, 0, 7, 0); fields[0].in_value = (u8 *)(data+i); - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); jtag_add_callback(etb_getbuf, (u8 *)(data+i)); } @@ -252,7 +252,7 @@ fields[2].check_value = NULL; fields[2].check_mask = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); /* read the identification register in the second run, to make sure we * don't read the ETB data register twice, skipping every second entry @@ -262,7 +262,7 @@ fields[0].check_value = check_value; fields[0].check_mask = check_mask; - jtag_add_dr_scan_check(3, fields, TAP_INVALID); + jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_INVALID)); free(fields[1].out_value); free(fields[2].out_value); Modified: trunk/src/target/etm.c =================================================================== --- trunk/src/target/etm.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/etm.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -347,13 +347,13 @@ fields[2].check_value = NULL; fields[2].check_mask = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); fields[0].in_value = reg->value; fields[0].check_value = check_value; fields[0].check_mask = check_mask; - jtag_add_dr_scan_check(3, fields, TAP_INVALID); + jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_INVALID)); free(fields[1].out_value); free(fields[2].out_value); @@ -430,7 +430,7 @@ buf_set_u32(fields[2].out_value, 0, 1, 1); fields[2].in_value = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); return ERROR_OK; } Modified: trunk/src/target/feroceon.c =================================================================== --- trunk/src/target/feroceon.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/feroceon.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -159,9 +159,9 @@ - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); - /* no jtag_add_runtest(0, TAP_INVALID) here */ + /* no jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)) here */ return ERROR_OK; } Modified: trunk/src/target/mips_ejtag.c =================================================================== --- trunk/src/target/mips_ejtag.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/mips_ejtag.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -50,7 +50,7 @@ - jtag_add_ir_scan(1, &field, TAP_INVALID); + jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID)); } return ERROR_OK; @@ -73,7 +73,7 @@ - jtag_add_dr_scan(1, &field, TAP_INVALID); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); if (jtag_execute_queue() != ERROR_OK) { @@ -100,7 +100,7 @@ - jtag_add_dr_scan(1, &field, TAP_INVALID); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); if (jtag_execute_queue() != ERROR_OK) { @@ -131,7 +131,7 @@ - jtag_add_dr_scan(1, &field, TAP_INVALID); + jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID)); if ((retval = jtag_execute_queue()) != ERROR_OK) { Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-06-04 07:05:22 UTC (rev 2041) +++ trunk/src/target/xscale.c 2009-06-04 11:33:36 UTC (rev 2042) @@ -212,7 +212,7 @@ u8 tmp[4]; field.in_value = tmp; - jtag_add_ir_scan(1, &field, TAP_INVALID); + jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID)); /* FIX!!!! isn't this check superfluous? verify_ircapture handles this? */ jtag_check_value_mask(&field, tap->expected, tap->expected_mask); @@ -262,7 +262,7 @@ u8 tmp2; fields[2].in_value = &tmp2; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask); jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask); @@ -285,7 +285,7 @@ jtag_add_end_state(TAP_IDLE); - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); /* DANGER!!! this must be here. It will make sure that the arguments * to jtag_set_check_value() does not go out of scope! */ @@ -347,7 +347,7 @@ jtag_add_end_state(TAP_IDLE); xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dbgtx); - jtag_add_runtest(1, TAP_INVALID); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */ + jtag_add_runtest(1, jtag_add_end_state(TAP_INVALID)); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */ /* repeat until all words have been collected */ int attempts=0; @@ -725,7 +725,7 @@ u8 tmp2; fields[2].in_value = &tmp2; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID)); jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask); jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask); @@ -800,7 +800,7 @@ - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); fields[0].num_bits = 32; fields[0].out_value = packet; @@ -816,7 +816,7 @@ memcpy(&value, packet, sizeof(u32)); cmd = parity(value); - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); } jtag_execute_queue(); @@ -862,7 +862,7 @@ - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID)); return ERROR_OK; } |
From: oharboe at B. <oh...@ma...> - 2009-06-04 09:05:28
|
Author: oharboe Date: 2009-06-04 09:05:22 +0200 (Thu, 04 Jun 2009) New Revision: 2041 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: jtag_add_end_state() now returns the value of the global variable and does not modify the global variable if passed TAP_INVALID. This patch has no effect on the current code and is just to prepare upcoming patches. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 06:56:22 UTC (rev 2040) +++ trunk/src/jtag/jtag.c 2009-06-04 07:05:22 UTC (rev 2041) @@ -773,13 +773,16 @@ } } -void jtag_add_end_state(tap_state_t state) +tap_state_t jtag_add_end_state(tap_state_t state) { - cmd_queue_end_state = state; - if ((cmd_queue_end_state == TAP_DRSHIFT)||(cmd_queue_end_state == TAP_IRSHIFT)) + if ((state == TAP_DRSHIFT)||(state == TAP_IRSHIFT)) { LOG_ERROR("BUG: TAP_DRSHIFT/IRSHIFT can't be end state. Calling code should use a larger scan field"); } + + if (state!=TAP_INVALID) + cmd_queue_end_state = state; + return cmd_queue_end_state; } void jtag_add_sleep(u32 us) Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-04 06:56:22 UTC (rev 2040) +++ trunk/src/jtag/jtag.h 2009-06-04 07:05:22 UTC (rev 2041) @@ -488,7 +488,16 @@ */ extern void jtag_add_reset(int req_tlr_or_trst, int srst); -extern void jtag_add_end_state(tap_state_t endstate); + +/** + * Function jtag_add_stable_clocks + * + * Set a global variable to \a state if \a state != TAP_INVALID. + * + * Return the value of the global variable. + * + **/ +extern tap_state_t jtag_add_end_state(tap_state_t state); extern void jtag_add_sleep(u32 us); |
From: oharboe at B. <oh...@ma...> - 2009-06-04 08:56:25
|
Author: oharboe Date: 2009-06-04 08:56:22 +0200 (Thu, 04 Jun 2009) New Revision: 2040 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: JTAG_TRST_ASSERTED event cleanup. More clear where and when it is invoked and some duplicate(harmless) invocations avoided. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 01:22:23 UTC (rev 2039) +++ trunk/src/jtag/jtag.c 2009-06-04 06:56:22 UTC (rev 2040) @@ -385,17 +385,14 @@ return ERROR_OK; } -static void jtag_prelude1(void) +static void jtag_checks(void) { assert(jtag_trst == 0); - - if (cmd_queue_end_state == TAP_RESET) - jtag_call_event_callbacks(JTAG_TRST_ASSERTED); } static void jtag_prelude(tap_state_t state) { - jtag_prelude1(); + jtag_checks(); if (state != TAP_INVALID) jtag_add_end_state(state); @@ -596,6 +593,8 @@ retval=interface_jtag_add_tlr(); if (retval!=ERROR_OK) jtag_error=retval; + + jtag_call_event_callbacks(JTAG_TRST_ASSERTED); } void jtag_add_pathmove(int num_states, const tap_state_t *path) @@ -628,7 +627,7 @@ cur_state = path[i]; } - jtag_prelude1(); + jtag_checks(); retval = interface_jtag_add_pathmove(num_states, path); cmd_queue_cur_state = path[num_states - 1]; @@ -663,7 +662,7 @@ if( num_cycles > 0 ) { - jtag_prelude1(); + jtag_checks(); retval = interface_jtag_add_clocks(num_cycles); if (retval != ERROR_OK) @@ -755,7 +754,6 @@ LOG_DEBUG("JTAG reset with RESET instead of TRST"); jtag_add_end_state(TAP_RESET); jtag_add_tlr(); - jtag_call_event_callbacks(JTAG_TRST_ASSERTED); return; } Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-04 01:22:23 UTC (rev 2039) +++ trunk/src/jtag/jtag.h 2009-06-04 06:56:22 UTC (rev 2040) @@ -218,6 +218,17 @@ LINE_PUSH_PULL = 0x1, }; +/* + * There are three cases when JTAG_TRST_ASSERTED callback is invoked. The + * event is invoked *after* TRST is asserted(or queued rather). It is illegal + * to communicate with the JTAG interface during the callback(as there is + * currently a queue being built). + * + * - TMS reset + * - SRST pulls TRST + * - TRST asserted + * + **/ enum jtag_event { JTAG_TRST_ASSERTED }; |
From: <zw...@ma...> - 2009-06-04 03:22:26
|
Author: zwelch Date: 2009-06-04 03:22:23 +0200 (Thu, 04 Jun 2009) New Revision: 2039 Modified: trunk/doc/openocd.texi Log: David Brownell <da...@pa...>: Update the "General Commands" (a.k.a. "random stuff") chapter, and associated chunks of other text: - Switch to @deffn and review everything that's documented - Improve descriptions of reset events, with reference to the setup.tcl code which issues them. - Move one zy1000-specific command to that driver's doc. - There is no "script" command; remove its doc. NOTE: Some things missing from this bit of work are: 1- Reviewing the code to catch various *missing* functions, mostly from "target.c" 2- Alphabetizing and organizing. This chapter is a real grab-bag with no evident focus or structural principle. 3- Hole-filling and bugfixing with respect to messaging/logging. Example, what principle could possibly justify the tcl command output going into the server output/log instead of just the telnet session? 4- Not just for this chapter ... but there should be a section with descriptions of all the supported image file formats, so every image command can just reference that section. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-04 01:17:27 UTC (rev 2038) +++ trunk/doc/openocd.texi 2009-06-04 01:22:23 UTC (rev 2039) @@ -1565,8 +1565,14 @@ This defines some driver-specific commands, which are not currently documented here. @end quotation + +@deffn Command power [@option{on}|@option{off}] +Turn power switch to target on/off. +No arguments: print status. @end deffn +@end deffn + @anchor{JTAG Speed} @section JTAG Speed JTAG clock setup is part of system setup. @@ -2308,26 +2314,33 @@ @item @b{old-pre_resume} @* DO NOT USE THIS: Used internally @item @b{reset-assert-pre} -@* Before reset is asserted on the tap. +@* Issued as part of @command{reset} processing +after SRST and/or TRST were activated and deactivated, +but before reset is asserted on the tap. @item @b{reset-assert-post} -@* Reset is now asserted on the tap. +@* Issued as part of @command{reset} processing +when reset is asserted on the tap. @item @b{reset-deassert-pre} -@* Reset is about to be released on the tap +@* Issued as part of @command{reset} processing +when reset is about to be released on the tap. @item @b{reset-deassert-post} -@* Reset has been released on the tap +@* Issued as part of @command{reset} processing +when reset has been released on the tap. @item @b{reset-end} -@* Currently not used. +@* Issued as the final step in @command{reset} processing. @item @b{reset-halt-post} @* Currently not usd @item @b{reset-halt-pre} @* Currently not used @item @b{reset-init} @* Used by @b{reset init} command for board-specific initialization. +This event fires after @emph{reset-deassert-post}. This is where you would configure PLLs and clocking, set up DRAM so you can download programs that don't fit in on-chip SRAM, set up pin multiplexing, and so on. @item @b{reset-start} -@* Currently not used +@* Issued as part of @command{reset} processing +before either SRST or TRST are activated. @item @b{reset-wait-pos} @* Currently not used @item @b{reset-wait-pre} @@ -3472,28 +3485,38 @@ @section Daemon Commands -@subsection sleep [@var{msec}] -@cindex sleep -@*Wait for n milliseconds before resuming. Useful in connection with script files -(@var{script} command and @var{target_script} configuration). +@deffn Command sleep msec [@option{busy}] +Wait for at least @var{msec} milliseconds before resuming. +If @option{busy} is passed, busy-wait instead of sleeping. +(This option is strongly discouraged.) +Useful in connection with script files +(@command{script} command and @command{target_name} configuration). +@end deffn -@subsection shutdown -@cindex shutdown -@*Close the OpenOCD daemon, disconnecting all clients (GDB, telnet, other). +@deffn Command shutdown +Close the OpenOCD daemon, disconnecting all clients (GDB, telnet, other). +@end deffn @anchor{debug_level} -@subsection debug_level [@var{n}] -@cindex debug_level -@*Display or adjust debug level to n<0-3> +@deffn Command debug_level [n] +@cindex message level +Display debug level. +If @var{n} (from 0..3) is provided, then set it to that level. +This affects the kind of messages sent to the server log. +Level 0 is error messages only; +level 1 adds warnings; +level 2 (the default) adds informational messages; +and level 3 adds debugging messages. +@end deffn -@subsection fast [@var{enable|disable}] -@cindex fast -@*Default disabled. Set default behaviour of OpenOCD to be "fast and dangerous". For instance ARM7/9 DCC memory -downloads and fast memory access will work if the JTAG interface isn't too fast and -the core doesn't run at a too low frequency. Note that this option only changes the default -and that the indvidual options, like DCC memory downloads, can be enabled and disabled -individually. +@deffn Command fast [enable|disable] +Default disabled. +Set default behaviour of OpenOCD to be "fast and dangerous". +At this writing, this only affects the defaults for two ARM7/ARM9 parameters: +fast memory access, and DCC downloads. Those parameters may still be +individually overridden. + The target specific "dangerous" optimisation tweaking options may come and go as more robust and user friendly ways are found to ensure maximum throughput and robustness with a minimum of configuration. @@ -3503,192 +3526,265 @@ @example openocd -c "fast enable" -c "interface dummy" -f target/str710.cfg @end example +@end deffn -@subsection echo <@var{message}> -@cindex echo -@*Output message to stdio. e.g. echo "Programming - please wait" +@deffn Command echo message +Logs a message at "user" priority. +Output @var{message} to stdout. +@example +echo "Downloading kernel -- please wait" +@end example +@end deffn -@subsection log_output <@var{file}> -@cindex log_output -@*Redirect logging to <file> (default: stderr) +@deffn Command log_output [filename] +Redirect logging to @var{filename}; +the initial log output channel is stderr. +@end deffn -@subsection script <@var{file}> -@cindex script -@*Execute commands from <file> -See also: ``source [find FILENAME]'' +@section Target State handling +@cindex reset +@cindex halt +@cindex target initialization -@section Target state handling -@subsection power <@var{on}|@var{off}> -@cindex reg -@*Turn power switch to target on/off. -No arguments: print status. -Not all interfaces support this. +In this section ``target'' refers to a CPU configured as +shown earlier (@pxref{CPU Configuration}). +These commands, like many, implicitly refer to +a @dfn{current target} which is used to perform the +various operations. The current target may be changed +by using @command{targets} command with the name of the +target which should become current. -@subsection reg [@option{#}|@option{name}] [value] -@cindex reg -@*Access a single register by its number[@option{#}] or by its [@option{name}]. -No arguments: list all available registers for the current target. -Number or name argument: display a register. -Number or name and value arguments: set register value. +@deffn Command reg [(number|name) [value]] +Access a single register by @var{number} or by its @var{name}. -@subsection poll [@option{on}|@option{off}] -@cindex poll -@*Poll the target for its current state. If the target is in debug mode, architecture +@emph{With no arguments}: +list all available registers for the current target, +showing number, name, size, value, and cache status. + +@emph{With number/name}: display that register's value. + +@emph{With both number/name and value}: set register's value. + +Cores may have surprisingly many registers in their +Debug and trace infrastructure: + +@example +> reg +(0) r0 (/32): 0x0000D3C2 (dirty: 1, valid: 1) +(1) r1 (/32): 0xFD61F31C (dirty: 0, valid: 1) +(2) r2 (/32): 0x00022551 (dirty: 0, valid: 1) +... +(164) ETM_CONTEXTID_COMPARATOR_MASK (/32): \ + 0x00000000 (dirty: 0, valid: 0) +> +@end example +@end deffn + +@deffn Command poll [@option{on}|@option{off}] +Poll the current target for its current state. +If that target is in debug mode, architecture specific information about the current state is printed. An optional parameter allows continuous polling to be enabled and disabled. -@subsection halt [@option{ms}] -@cindex halt -@*Send a halt request to the target and wait for it to halt for up to [@option{ms}] milliseconds. -Default [@option{ms}] is 5 seconds if no arg given. -Optional arg @option{ms} is a timeout in milliseconds. Using 0 as the [@option{ms}] -will stop OpenOCD from waiting. +@example +> poll +target state: halted +target halted in ARM state due to debug-request, \ + current mode: Supervisor +cpsr: 0x800000d3 pc: 0x11081bfc +MMU: disabled, D-Cache: disabled, I-Cache: enabled +> +@end example +@end deffn -@subsection wait_halt [@option{ms}] -@cindex wait_halt -@*Wait for the target to enter debug mode. Optional [@option{ms}] is -a timeout in milliseconds. Default [@option{ms}] is 5 seconds if no -arg is given. +@deffn Command halt [ms] +@deffnx Command wait_halt [ms] +The @command{halt} command first sends a halt request to the target, +which @command{wait_halt} doesn't. +Otherwise these behave the same: wait up to @var{ms} milliseconds, +or 5 seconds if there is no parameter, for the target to halt +(and enter debug mode). +Using 0 as the @var{ms} parameter prevents OpenOCD from waiting. +@end deffn -@subsection resume [@var{address}] -@cindex resume -@*Resume the target at its current code position, or at an optional address. +@deffn Command resume [address] +Resume the target at its current code position, +or the optional @var{address} if it is provided. OpenOCD will wait 5 seconds for the target to resume. +@end deffn -@subsection step [@var{address}] -@cindex step -@*Single-step the target at its current code position, or at an optional address. +@deffn Command step [address] +Single-step the target at its current code position, +or the optional @var{address} if it is provided. +@end deffn @anchor{Reset Command} -@subsection reset [@option{run}|@option{halt}|@option{init}] -@cindex reset -@*Perform a hard-reset. The optional parameter specifies what should +@deffn Command reset +@deffnx Command {reset run} +@deffnx Command {reset halt} +@deffnx Command {reset init} +Perform as hard a reset as possible, using SRST if possible. +@emph{All defined targets will be reset, and target +events will fire during the reset sequence.} + +The optional parameter specifies what should happen after the reset. If there is no parameter, a @command{reset run} is executed. The other options will not work on all systems. @xref{Reset Configuration}. + @itemize @minus -@item @b{run} -@cindex reset run -@*Let the target run. -@item @b{halt} -@cindex reset halt -@*Immediately halt the target (works only with certain configurations). -@item @b{init} -@cindex reset init -@*Immediately halt the target, and execute the reset script (works only with certain -configurations) +@item @b{run} Let the target run +@item @b{halt} Immediately halt the target +@item @b{init} Immediately halt the target, and execute the reset-init script @end itemize +@end deffn -@subsection soft_reset_halt -@cindex reset -@*Requesting target halt and executing a soft reset. This is often used +@deffn Command soft_reset_halt +Requesting target halt and executing a soft reset. This is often used when a target cannot be reset and halted. The target, after reset is released begins to execute code. OpenOCD attempts to stop the CPU and then sets the program counter back to the reset vector. Unfortunately the code that was executed may have left the hardware in an unknown state. +@end deffn +@section I/O Utilities +These commands are available when +OpenOCD is built with @option{--enable-ioutil}. +They are mainly useful on embedded targets; +PC type hosts have complimentary tools. + +@emph{Note:} there are several more such commands. + +@deffn Command meminfo +Display available RAM memory on OpenOCD host. +Used in OpenOCD regression testing scripts. +@end deffn + @anchor{Memory access} @section Memory access commands -@subsection meminfo -display available RAM memory on OpenOCD host. Used in OpenOCD regression testing scripts. Mainly -useful on embedded targets, PC type hosts have complimentary tools like Valgrind to address -resource tracking problems. -@subsection Memory peek/poke type commands +@cindex memory access + These commands allow accesses of a specific size to the memory system. Often these are used to configure the current target in some -special way. For example - one may need to write certian values to the +special way. For example - one may need to write certain values to the SDRAM controller to enable SDRAM. @enumerate -@item To change the current target see the ``targets'' (plural) command -@item In system level scripts these commands are deprecated, please use the TARGET object versions. +@item Use the @command{targets} (plural) command +to change the current target. +@item In system level scripts these commands are deprecated. +Please use their TARGET object siblings to avoid making assumptions +about what TAP is the current target, or about MMU configuration. @end enumerate -@itemize @bullet -@item @b{mdw} <@var{addr}> [@var{count}] -@cindex mdw -@*display memory words (32bit) -@item @b{mdh} <@var{addr}> [@var{count}] -@cindex mdh -@*display memory half-words (16bit) -@item @b{mdb} <@var{addr}> [@var{count}] -@cindex mdb -@*display memory bytes (8bit) -@item @b{mww} <@var{addr}> <@var{value}> -@cindex mww -@*write memory word (32bit) -@item @b{mwh} <@var{addr}> <@var{value}> -@cindex mwh -@*write memory half-word (16bit) -@item @b{mwb} <@var{addr}> <@var{value}> -@cindex mwb -@*write memory byte (8bit) -@end itemize +@deffn Command mdw addr [count] +@deffnx Command mdh addr [count] +@deffnx Command mdb addr [count] +Display contents of address @var{addr}, as +32-bit words (@command{mdw}), 16-bit halfwords (@command{mdh}), +or 8-bit bytes (@command{mdb}). +If @var{count} is specified, displays that many units. +@end deffn +@deffn Command mww addr word +@deffnx Command mwh addr halfword +@deffnx Command mwb addr byte +Writes the specified @var{word} (32 bits), +@var{halfword} (16 bits), or @var{byte} (8-bit) pattern, +at the specified address @var{addr}. +@end deffn + + @anchor{Image access} @section Image loading commands -@anchor{load_image} -@subsection load_image -@b{load_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}] -@cindex load_image -@*Load image <@var{file}> to target memory at <@var{address}> -@subsection fast_load_image -@b{fast_load_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}] -@cindex fast_load_image -@*Normally you should be using @b{load_image} or GDB load. However, for +@cindex image loading +@cindex image dumping + +@anchor{dump_image} +@deffn Command {dump_image} filename address size +Dump @var{size} bytes of target memory starting at @var{address} to the +binary file named @var{filename}. +@end deffn + +@deffn Command {fast_load} +Loads an image stored in memory by @command{fast_load_image} to the +current target. Must be preceeded by fast_load_image. +@end deffn + +@deffn Command {fast_load_image} filename address [@option{bin}|@option{ihex}|@option{elf}] +Normally you should be using @command{load_image} or GDB load. However, for testing purposes or when I/O overhead is significant(OpenOCD running on an embedded host), storing the image in memory and uploading the image to the target can be a way to upload e.g. multiple debug sessions when the binary does not change. -Arguments are the same as @b{load_image}, but the image is stored in OpenOCD host +Arguments are the same as @command{load_image}, but the image is stored in OpenOCD host memory, i.e. does not affect target. This approach is also useful when profiling target programming performance as I/O and target programming can easily be profiled separately. -@subsection fast_load -@b{fast_load} -@cindex fast_image -@*Loads an image stored in memory by @b{fast_load_image} to the current target. Must be preceeded by fast_load_image. -@anchor{dump_image} -@subsection dump_image -@b{dump_image} <@var{file}> <@var{address}> <@var{size}> -@cindex dump_image -@*Dump <@var{size}> bytes of target memory starting at <@var{address}> to a -(binary) <@var{file}>. -@subsection verify_image -@b{verify_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}] -@cindex verify_image -@*Verify <@var{file}> against target memory starting at <@var{address}>. +@end deffn + +@anchor{load_image} +@deffn Command {load_image} filename address [@option{bin}|@option{ihex}|@option{elf}] +Load image from file @var{filename} to target memory at @var{address}. +The file format may optionally be specified +(@option{bin}, @option{ihex}, or @option{elf}) +@end deffn + +@deffn Command {verify_image} filename address [@option{bin}|@option{ihex}|@option{elf}] +Verify @var{filename} against target memory starting at @var{address}. +The file format may optionally be specified +(@option{bin}, @option{ihex}, or @option{elf}) This will first attempt a comparison using a CRC checksum, if this fails it will try a binary compare. +@end deffn -@section Breakpoint commands -@cindex Breakpoint commands -@itemize @bullet -@item @b{bp} <@var{addr}> <@var{len}> [@var{hw}] -@cindex bp -@*set breakpoint <address> <length> [hw] -@item @b{rbp} <@var{addr}> -@cindex rbp -@*remove breakpoint <adress> -@item @b{wp} <@var{addr}> <@var{len}> <@var{r}|@var{w}|@var{a}> [@var{value}] [@var{mask}] -@cindex wp -@*set watchpoint <address> <length> <r/w/a> [value] [mask] -@item @b{rwp} <@var{addr}> -@cindex rwp -@*remove watchpoint <adress> -@end itemize +@section Breakpoint and Watchpoint commands +@cindex breakpoint +@cindex watchpoint +CPUs often make debug modules accessible through JTAG, with +hardware support for a handful of code breakpoints and data +watchpoints. +In addition, CPUs almost always support software breakpoints. + +@deffn Command {bp} [address len [@option{hw}]] +With no parameters, lists all active breakpoints. +Else sets a breakpoint on code execution starting +at @var{address} for @var{length} bytes. +This is a software breakpoint, unless @option{hw} is specified +in which case it will be a hardware breakpoint. +@end deffn + +@deffn Command {rbp} address +Remove the breakpoint at @var{address}. +@end deffn + +@deffn Command {rwp} address +Remove data watchpoint on @var{address} +@end deffn + +@deffn Command {wp} [address len [(@option{r}|@option{w}|@option{a}) [value [mask]]] +With no parameters, lists all active watchpoints. +Else sets a data watchpoint on data from @var{address} for @var{length} bytes. +The watch point is an "access" watchpoint unless +the @option{r} or @option{w} parameter is provided, +defining it as respectively a read or write watchpoint. +If a @var{value} is provided, that value is used when determining if +the watchpoint should trigger. The value may be first be masked +using @var{mask} to mark ``don't care'' fields. +@end deffn + @section Misc Commands -@cindex Other Target Commands -@itemize -@item @b{profile} <@var{seconds}> <@var{gmon.out}> +@cindex profiling -Profiling samples the CPU's program counter as quickly as possible, which is useful for non-intrusive stochastic profiling. +@deffn Command {profile} seconds filename +Profiling samples the CPU's program counter as quickly as possible, +which is useful for non-intrusive stochastic profiling. +Saves up to 10000 sampines in @file{filename} using ``gmon.out'' format. +@end deffn -@end itemize - @node Architecture and Core Commands @chapter Architecture and Core Commands @cindex Architecture Specific Commands |
From: <zw...@ma...> - 2009-06-04 03:17:30
|
Author: zwelch Date: 2009-06-04 03:17:27 +0200 (Thu, 04 Jun 2009) New Revision: 2038 Modified: trunk/src/jtag/ft2232.c Log: David Brownell <da...@pa...>: Remove pernicious whitespace from ft2232 driver; as usual, end-of-line noise, but here also much line-internal stuff. Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-06-04 01:16:43 UTC (rev 2037) +++ trunk/src/jtag/ft2232.c 2009-06-04 01:17:27 UTC (rev 2038) @@ -52,7 +52,7 @@ #if (BUILD_FT2232_FTD2XX==1 && BUILD_FT2232_LIBFTDI==1) #error "BUILD_FT2232_FTD2XX && BUILD_FT2232_LIBFTDI are mutually exclusive" -#elif(BUILD_FT2232_FTD2XX!=1 && BUILD_FT2232_LIBFTDI!=1) +#elif (BUILD_FT2232_FTD2XX!=1 && BUILD_FT2232_LIBFTDI!=1) #error "BUILD_FT2232_FTD2XX || BUILD_FT2232_LIBFTDI must be chosen" #endif @@ -101,8 +101,8 @@ static char* ft2232_device_desc = NULL; static char* ft2232_serial = NULL; static char* ft2232_layout = NULL; -static u8 ft2232_latency = 2; -static unsigned ft2232_max_tck = 6000; +static u8 ft2232_latency = 2; +static unsigned ft2232_max_tck = 6000; #define MAX_USB_IDS 8 @@ -119,17 +119,17 @@ } ft2232_layout_t; /* init procedures for supported layouts */ -static int usbjtag_init(void); -static int jtagkey_init(void); -static int olimex_jtag_init(void); -static int flyswatter_init(void); -static int turtle_init(void); -static int comstick_init(void); -static int stm32stick_init(void); -static int axm0432_jtag_init(void); -static int sheevaplug_init(void); -static int icebear_jtag_init(void); -static int cortino_jtag_init(void); +static int usbjtag_init(void); +static int jtagkey_init(void); +static int olimex_jtag_init(void); +static int flyswatter_init(void); +static int turtle_init(void); +static int comstick_init(void); +static int stm32stick_init(void); +static int axm0432_jtag_init(void); +static int sheevaplug_init(void); +static int icebear_jtag_init(void); +static int cortino_jtag_init(void); /* reset procedures for supported layouts */ static void usbjtag_reset(int trst, int srst); @@ -177,8 +177,8 @@ static u8 high_direction = 0x0; #if BUILD_FT2232_FTD2XX == 1 -static FT_HANDLE ftdih = NULL; -static FT_DEVICE ftdi_device = 0; +static FT_HANDLE ftdih = NULL; +static FT_DEVICE ftdi_device = 0; #elif BUILD_FT2232_LIBFTDI == 1 static struct ftdi_context ftdic; #endif @@ -213,10 +213,10 @@ * writes a byte into the byte buffer, "ft2232_buffer", which must be sent later. * @param val is the byte to send. */ -static inline void buffer_write( u8 val ) +static inline void buffer_write(u8 val) { - assert( ft2232_buffer ); - assert( (unsigned) ft2232_buffer_size < (unsigned) FT2232_BUFFER_SIZE ); + assert(ft2232_buffer); + assert((unsigned) ft2232_buffer_size < (unsigned) FT2232_BUFFER_SIZE); ft2232_buffer[ft2232_buffer_size++] = val; } @@ -226,8 +226,8 @@ */ static inline u8 buffer_read(void) { - assert( ft2232_buffer ); - assert( ft2232_read_pointer < ft2232_buffer_size ); + assert(ft2232_buffer); + assert(ft2232_read_pointer < ft2232_buffer_size); return ft2232_buffer[ft2232_read_pointer++]; } @@ -238,51 +238,51 @@ * Rigorous state transition logging is done here via tap_set_state(). * * @param mpsse_cmd One of the MPSSE TMS oriented commands such as - * 0x4b or 0x6b. See the MPSSE spec referenced above for their - * functionality. The MPSSE command "Clock Data to TMS/CS Pin (no Read)" - * is often used for this, 0x4b. + * 0x4b or 0x6b. See the MPSSE spec referenced above for their + * functionality. The MPSSE command "Clock Data to TMS/CS Pin (no Read)" + * is often used for this, 0x4b. * * @param tms_bits Holds the sequence of bits to send. * @param tms_count Tells how many bits in the sequence. * @param tdi_bit A single bit to pass on to TDI before the first TCK - * cycle and held static for the duration of TMS clocking. + * cycle and held static for the duration of TMS clocking. * * See the MPSSE spec referenced above. */ -static void clock_tms( u8 mpsse_cmd, int tms_bits, int tms_count, bool tdi_bit ) +static void clock_tms(u8 mpsse_cmd, int tms_bits, int tms_count, bool tdi_bit) { u8 tms_byte; int i; int tms_ndx; /* bit index into tms_byte */ - assert( tms_count > 0 ); + assert(tms_count > 0); -// LOG_DEBUG("mpsse cmd=%02x, tms_bits=0x%08x, bit_count=%d", mpsse_cmd, tms_bits, tms_count ); +// LOG_DEBUG("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) { bool bit = tms_bits & 1; - if(bit) + if (bit) tms_byte |= (1<<tms_ndx); /* always do state transitions in public view */ - tap_set_state( tap_state_transition(tap_get_state(), bit) ); + tap_set_state(tap_state_transition(tap_get_state(), bit)); - /* we wrote a bit to tms_byte just above, increment bit index. if bit was zero + /* we wrote a bit to tms_byte just above, increment bit index. if bit was zero also increment. */ ++tms_ndx; - if( tms_ndx==7 || i==tms_count-1 ) + if (tms_ndx==7 || i==tms_count-1) { - buffer_write( mpsse_cmd ); - buffer_write( tms_ndx - 1 ); + buffer_write(mpsse_cmd); + buffer_write(tms_ndx - 1); - /* Bit 7 of the byte is passed on to TDI/DO before the first TCK/SK of + /* Bit 7 of the byte is passed on to TDI/DO before the first TCK/SK of TMS/CS and is held static for the duration of TMS/CS clocking. */ - buffer_write( tms_byte | (tdi_bit << 7) ); + buffer_write(tms_byte | (tdi_bit << 7)); } } } @@ -293,7 +293,7 @@ * returns what clock_tms() will consume if called with * same \a bit_count. */ -static inline int get_tms_buffer_requirements( int bit_count ) +static inline int get_tms_buffer_requirements(int bit_count) { return ((bit_count + 6)/7) * 3; } @@ -307,11 +307,11 @@ * * @param goal_state is the destination state for the move. */ -static void move_to_state( tap_state_t goal_state ) +static void move_to_state(tap_state_t goal_state) { - tap_state_t start_state = tap_get_state(); + tap_state_t start_state = tap_get_state(); - /* goal_state is 1/2 of a tuple/pair of states which allow convenient + /* goal_state is 1/2 of a tuple/pair of states which allow convenient lookup of the required TMS pattern to move to this state from the start state. */ @@ -320,30 +320,30 @@ int tms_bits = tap_get_tms_path(start_state, goal_state); int tms_count = tap_get_tms_path_len(start_state, goal_state); - DEBUG_JTAG_IO( "start=%s goal=%s", tap_state_name(start_state), tap_state_name(goal_state) ); + DEBUG_JTAG_IO("start=%s goal=%s", tap_state_name(start_state), tap_state_name(goal_state)); - clock_tms( 0x4b, tms_bits, tms_count, 0 ); + clock_tms(0x4b, tms_bits, tms_count, 0); } jtag_interface_t ft2232_interface = { - .name = "ft2232", - .execute_queue = ft2232_execute_queue, - .speed = ft2232_speed, - .speed_div = ft2232_speed_div, - .khz = ft2232_khz, - .register_commands = ft2232_register_commands, - .init = ft2232_init, - .quit = ft2232_quit, + .name = "ft2232", + .execute_queue = ft2232_execute_queue, + .speed = ft2232_speed, + .speed_div = ft2232_speed_div, + .khz = ft2232_khz, + .register_commands = ft2232_register_commands, + .init = ft2232_init, + .quit = ft2232_quit, }; static int ft2232_write(u8* buf, int size, u32* bytes_written) { #if BUILD_FT2232_FTD2XX == 1 FT_STATUS status; - DWORD dw_bytes_written; - if ( ( status = FT_Write(ftdih, buf, size, &dw_bytes_written) ) != FT_OK ) + DWORD dw_bytes_written; + if ((status = FT_Write(ftdih, buf, size, &dw_bytes_written)) != FT_OK) { *bytes_written = dw_bytes_written; LOG_ERROR("FT_Write returned: %lu", status); @@ -356,10 +356,10 @@ } #elif BUILD_FT2232_LIBFTDI == 1 int retval; - if ( ( retval = ftdi_write_data(&ftdic, buf, size) ) < 0 ) + if ((retval = ftdi_write_data(&ftdic, buf, size)) < 0) { *bytes_written = 0; - LOG_ERROR( "ftdi_write_data: %s", ftdi_get_error_string(&ftdic) ); + LOG_ERROR("ftdi_write_data: %s", ftdi_get_error_string(&ftdic)); return ERROR_JTAG_DEVICE_ERROR; } else @@ -379,10 +379,10 @@ int timeout = 5; *bytes_read = 0; - while ( (*bytes_read < size) && timeout-- ) + while ((*bytes_read < size) && timeout--) { - if ( ( status = FT_Read(ftdih, buf + *bytes_read, size - - *bytes_read, &dw_bytes_read) ) != FT_OK ) + if ((status = FT_Read(ftdih, buf + *bytes_read, size - + *bytes_read, &dw_bytes_read)) != FT_OK) { *bytes_read = 0; LOG_ERROR("FT_Read returned: %lu", status); @@ -396,12 +396,12 @@ int timeout = 100; *bytes_read = 0; - while ( (*bytes_read < size) && timeout-- ) + while ((*bytes_read < size) && timeout--) { - if ( ( retval = ftdi_read_data(&ftdic, buf + *bytes_read, size - *bytes_read) ) < 0 ) + if ((retval = ftdi_read_data(&ftdic, buf + *bytes_read, size - *bytes_read)) < 0) { *bytes_read = 0; - LOG_ERROR( "ftdi_read_data: %s", ftdi_get_error_string(&ftdic) ); + LOG_ERROR("ftdi_read_data: %s", ftdi_get_error_string(&ftdic)); return ERROR_JTAG_DEVICE_ERROR; } *bytes_read += retval; @@ -467,12 +467,12 @@ ft2232_adaptive_clocking(speed); - buf[0] = 0x86; /* command "set divisor" */ + buf[0] = 0x86; /* command "set divisor" */ buf[1] = speed & 0xff; /* valueL (0=6MHz, 1=3MHz, 2=2.0MHz, ...*/ buf[2] = (speed >> 8) & 0xff; /* valueH */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( retval = ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((retval = ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't set FT2232 TCK speed"); return retval; @@ -583,13 +583,13 @@ buffer[cur_byte] = 0x0; - /* There is one more partial byte left from the clock data in/out instructions */ + /* There is one more partial byte left from the clock data in/out instructions */ if (bits_left > 1) { buffer[cur_byte] = buffer_read() >> 1; } /* This shift depends on the length of the clock data to tms instruction, insterted at end of the scan, now fixed to a two step transition in ft2232_add_scan */ - buffer[cur_byte] = ( buffer[cur_byte] | ( ( (buffer_read()) << 1 ) & 0x80 )) >> (8 - bits_left); + buffer[cur_byte] = (buffer[cur_byte] | (((buffer_read()) << 1) & 0x80)) >> (8 - bits_left); } @@ -638,7 +638,7 @@ gettimeofday(&start, NULL); #endif - if ( ( retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written) ) != ERROR_OK ) + if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) { LOG_ERROR("couldn't write MPSSE commands to FT2232"); return retval; @@ -657,7 +657,7 @@ gettimeofday(&inter2, NULL); #endif - if ( ( retval = ft2232_read(ft2232_buffer, ft2232_expect_read, &bytes_read) ) != ERROR_OK ) + if ((retval = ft2232_read(ft2232_buffer, ft2232_expect_read, &bytes_read)) != ERROR_OK) { LOG_ERROR("couldn't read from FT2232"); return retval; @@ -742,34 +742,34 @@ * ending with the last state at path[num_states-1] * @param num_states is the count of state steps to move through */ -static void ft2232_add_pathmove( tap_state_t* path, int num_states ) +static void ft2232_add_pathmove(tap_state_t* path, int num_states) { int tms_bits = 0; int state_ndx; tap_state_t walker = tap_get_state(); - assert( (unsigned) num_states <= 32u ); /* tms_bits only holds 32 bits */ + assert((unsigned) num_states <= 32u); /* tms_bits only holds 32 bits */ /* this loop verifies that the path is legal and logs each state in the path */ - for( state_ndx = 0; state_ndx < num_states; ++state_ndx ) + for (state_ndx = 0; state_ndx < num_states; ++state_ndx) { tap_state_t desired_next_state = path[state_ndx]; - if (tap_state_transition(walker, false) == desired_next_state ) + if (tap_state_transition(walker, false) == desired_next_state) ; /* bit within tms_bits at index state_ndx is already zero */ - else if (tap_state_transition(walker, true) == desired_next_state ) + else if (tap_state_transition(walker, true) == desired_next_state) tms_bits |= (1<<state_ndx); else { - LOG_ERROR( "BUG: %s -> %s isn't a valid TAP transition", - tap_state_name(walker), tap_state_name(desired_next_state) ); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", + tap_state_name(walker), tap_state_name(desired_next_state)); exit(-1); } walker = desired_next_state; } - clock_tms( 0x4b, tms_bits, num_states, 0 ); + clock_tms(0x4b, tms_bits, num_states, 0); tap_set_end_state(tap_get_state()); } @@ -782,18 +782,18 @@ int cur_byte = 0; int last_bit; - if ( !ir_scan ) + if (!ir_scan) { if (tap_get_state() != TAP_DRSHIFT) { - move_to_state( TAP_DRSHIFT ); + move_to_state(TAP_DRSHIFT); } } else { if (tap_get_state() != TAP_IRSHIFT) { - move_to_state( TAP_IRSHIFT ); + move_to_state(TAP_IRSHIFT); } } @@ -804,34 +804,34 @@ if (type == SCAN_IO) { /* Clock Data Bytes In and Out LSB First */ - buffer_write( 0x39 ); + buffer_write(0x39); /* LOG_DEBUG("added TDI bytes (io %i)", num_bytes); */ } else if (type == SCAN_OUT) { /* Clock Data Bytes Out on -ve Clock Edge LSB First (no Read) */ - buffer_write( 0x19 ); + buffer_write(0x19); /* LOG_DEBUG("added TDI bytes (o)"); */ } else if (type == SCAN_IN) { /* Clock Data Bytes In on +ve Clock Edge LSB First (no Write) */ - buffer_write( 0x28 ); + buffer_write(0x28); /* LOG_DEBUG("added TDI bytes (i %i)", num_bytes); */ } thisrun_bytes = (num_bytes > 65537) ? 65536 : (num_bytes - 1); num_bytes -= thisrun_bytes; - buffer_write( (u8) (thisrun_bytes - 1) ); - buffer_write( (u8) ((thisrun_bytes - 1) >> 8) ); + buffer_write((u8) (thisrun_bytes - 1)); + buffer_write((u8) ((thisrun_bytes - 1) >> 8)); if (type != SCAN_IN) { /* add complete bytes */ while (thisrun_bytes-- > 0) { - buffer_write( buffer[cur_byte++] ); + buffer_write(buffer[cur_byte++]); bits_left -= 8; } } @@ -843,7 +843,7 @@ /* the most signifcant bit is scanned during TAP movement */ if (type != SCAN_IN) - last_bit = ( buffer[cur_byte] >> (bits_left - 1) ) & 0x1; + last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1; else last_bit = 0; @@ -853,50 +853,50 @@ if (type == SCAN_IO) { /* Clock Data Bits In and Out LSB First */ - buffer_write( 0x3b ); + buffer_write(0x3b); /* LOG_DEBUG("added TDI bits (io) %i", bits_left - 1); */ } else if (type == SCAN_OUT) { /* Clock Data Bits Out on -ve Clock Edge LSB First (no Read) */ - buffer_write( 0x1b ); + buffer_write(0x1b); /* LOG_DEBUG("added TDI bits (o)"); */ } else if (type == SCAN_IN) { /* Clock Data Bits In on +ve Clock Edge LSB First (no Write) */ - buffer_write( 0x2a ); + buffer_write(0x2a); /* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */ } - buffer_write( bits_left - 2 ); + buffer_write(bits_left - 2); if (type != SCAN_IN) - buffer_write( buffer[cur_byte] ); + buffer_write(buffer[cur_byte]); } - if ( ( ir_scan && (tap_get_end_state() == TAP_IRSHIFT) ) - || ( !ir_scan && (tap_get_end_state() == TAP_DRSHIFT) ) ) + if (( ir_scan && (tap_get_end_state() == TAP_IRSHIFT)) + || (!ir_scan && (tap_get_end_state() == TAP_DRSHIFT))) { if (type == SCAN_IO) { /* Clock Data Bits In and Out LSB First */ - buffer_write( 0x3b ); + buffer_write(0x3b); /* LOG_DEBUG("added TDI bits (io) %i", bits_left - 1); */ } else if (type == SCAN_OUT) { /* Clock Data Bits Out on -ve Clock Edge LSB First (no Read) */ - buffer_write( 0x1b ); + buffer_write(0x1b); /* LOG_DEBUG("added TDI bits (o)"); */ } else if (type == SCAN_IN) { /* Clock Data Bits In on +ve Clock Edge LSB First (no Write) */ - buffer_write( 0x2a ); + buffer_write(0x2a); /* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */ } - buffer_write( 0x0 ); - buffer_write( last_bit ); + buffer_write(0x0); + buffer_write(last_bit); } else { @@ -917,19 +917,19 @@ } else { - tms_bits = tap_get_tms_path( tap_get_state(), tap_get_end_state() ); - tms_count = tap_get_tms_path_len( tap_get_state(), tap_get_end_state() ); + tms_bits = tap_get_tms_path(tap_get_state(), tap_get_end_state()); + 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)"); */ } - clock_tms( mpsse_cmd, tms_bits, tms_count, last_bit ); + clock_tms(mpsse_cmd, tms_bits, tms_count, last_bit); } - + if (tap_get_state() != tap_get_end_state()) { - move_to_state( tap_get_end_state() ); + move_to_state(tap_get_end_state()); } } @@ -940,7 +940,7 @@ int bits_left = scan_size; int cur_byte = 0; int last_bit; - u8* receive_buffer = malloc( CEIL(scan_size, 8) ); + u8* receive_buffer = malloc(CEIL(scan_size, 8)); u8* receive_pointer = receive_buffer; u32 bytes_written; u32 bytes_read; @@ -955,10 +955,10 @@ if (tap_get_state() != TAP_DRSHIFT) { - move_to_state( TAP_DRSHIFT ); + move_to_state(TAP_DRSHIFT); } - if ( ( retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written) ) != ERROR_OK ) + if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) { LOG_ERROR("couldn't write MPSSE commands to FT2232"); exit(-1); @@ -974,34 +974,34 @@ if (type == SCAN_IO) { /* Clock Data Bytes In and Out LSB First */ - buffer_write( 0x39 ); + buffer_write(0x39); /* LOG_DEBUG("added TDI bytes (io %i)", num_bytes); */ } else if (type == SCAN_OUT) { /* Clock Data Bytes Out on -ve Clock Edge LSB First (no Read) */ - buffer_write( 0x19 ); + buffer_write(0x19); /* LOG_DEBUG("added TDI bytes (o)"); */ } else if (type == SCAN_IN) { /* Clock Data Bytes In on +ve Clock Edge LSB First (no Write) */ - buffer_write( 0x28 ); + buffer_write(0x28); /* LOG_DEBUG("added TDI bytes (i %i)", num_bytes); */ } thisrun_bytes = (num_bytes > 65537) ? 65536 : (num_bytes - 1); thisrun_read = thisrun_bytes; num_bytes -= thisrun_bytes; - buffer_write( (u8) (thisrun_bytes - 1) ); - buffer_write( (u8) ( (thisrun_bytes - 1) >> 8 )); + buffer_write((u8) (thisrun_bytes - 1)); + buffer_write((u8) ((thisrun_bytes - 1) >> 8)); if (type != SCAN_IN) { /* add complete bytes */ while (thisrun_bytes-- > 0) { - buffer_write( buffer[cur_byte] ); + buffer_write(buffer[cur_byte]); cur_byte++; bits_left -= 8; } @@ -1011,7 +1011,7 @@ bits_left -= 8 * (thisrun_bytes); } - if ( ( retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written) ) != ERROR_OK ) + if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) { LOG_ERROR("couldn't write MPSSE commands to FT2232"); exit(-1); @@ -1021,7 +1021,7 @@ if (type != SCAN_OUT) { - if ( ( retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read) ) != ERROR_OK ) + if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK) { LOG_ERROR("couldn't read from FT2232"); exit(-1); @@ -1035,7 +1035,7 @@ /* the most signifcant bit is scanned during TAP movement */ if (type != SCAN_IN) - last_bit = ( buffer[cur_byte] >> (bits_left - 1) ) & 0x1; + last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1; else last_bit = 0; @@ -1045,24 +1045,24 @@ if (type == SCAN_IO) { /* Clock Data Bits In and Out LSB First */ - buffer_write( 0x3b ); + buffer_write(0x3b); /* LOG_DEBUG("added TDI bits (io) %i", bits_left - 1); */ } else if (type == SCAN_OUT) { /* Clock Data Bits Out on -ve Clock Edge LSB First (no Read) */ - buffer_write( 0x1b ); + buffer_write(0x1b); /* LOG_DEBUG("added TDI bits (o)"); */ } else if (type == SCAN_IN) { /* Clock Data Bits In on +ve Clock Edge LSB First (no Write) */ - buffer_write( 0x2a ); + buffer_write(0x2a); /* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */ } - buffer_write( bits_left - 2 ); + buffer_write(bits_left - 2); if (type != SCAN_IN) - buffer_write( buffer[cur_byte] ); + buffer_write(buffer[cur_byte]); if (type != SCAN_OUT) thisrun_read += 2; @@ -1073,28 +1073,28 @@ if (type == SCAN_IO) { /* Clock Data Bits In and Out LSB First */ - buffer_write( 0x3b ); + buffer_write(0x3b); /* LOG_DEBUG("added TDI bits (io) %i", bits_left - 1); */ } else if (type == SCAN_OUT) { /* Clock Data Bits Out on -ve Clock Edge LSB First (no Read) */ - buffer_write( 0x1b ); + buffer_write(0x1b); /* LOG_DEBUG("added TDI bits (o)"); */ } else if (type == SCAN_IN) { /* Clock Data Bits In on +ve Clock Edge LSB First (no Write) */ - buffer_write( 0x2a ); + buffer_write(0x2a); /* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */ } - buffer_write( 0x0 ); - buffer_write( last_bit ); + buffer_write(0x0); + buffer_write(last_bit); } else { - int tms_bits = tap_get_tms_path( tap_get_state(), tap_get_end_state() ); - int tms_count = tap_get_tms_path_len( tap_get_state(), tap_get_end_state() ); + int tms_bits = tap_get_tms_path(tap_get_state(), tap_get_end_state()); + int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); u8 mpsse_cmd; /* move from Shift-IR/DR to end state */ @@ -1111,13 +1111,13 @@ /* LOG_DEBUG("added TMS scan (no read)"); */ } - clock_tms( mpsse_cmd, tms_bits, tms_count, last_bit ); + clock_tms(mpsse_cmd, tms_bits, tms_count, last_bit); } if (type != SCAN_OUT) thisrun_read += 1; - if ( ( retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written) ) != ERROR_OK ) + if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) { LOG_ERROR("couldn't write MPSSE commands to FT2232"); exit(-1); @@ -1127,7 +1127,7 @@ if (type != SCAN_OUT) { - if ( ( retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read) ) != ERROR_OK ) + if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK) { LOG_ERROR("couldn't read from FT2232"); exit(-1); @@ -1146,7 +1146,7 @@ int num_bytes = (scan_size - 1) / 8; if (tap_get_state() != TAP_DRSHIFT) - predicted_size += get_tms_buffer_requirements( tap_get_tms_path_len( tap_get_state(), TAP_DRSHIFT) ); + predicted_size += get_tms_buffer_requirements(tap_get_tms_path_len(tap_get_state(), TAP_DRSHIFT)); if (type == SCAN_IN) /* only from device to host */ { @@ -1154,7 +1154,7 @@ predicted_size += CEIL(num_bytes, 65536) * 3; /* remaining bits - 1 (up to 7) */ - predicted_size += ( (scan_size - 1) % 8 ) ? 2 : 0; + predicted_size += ((scan_size - 1) % 8) ? 2 : 0; } else /* host to device, or bidirectional */ { @@ -1162,7 +1162,7 @@ predicted_size += num_bytes + CEIL(num_bytes, 65536) * 3; /* remaining bits -1 (up to 7) */ - predicted_size += ( (scan_size - 1) % 8 ) ? 3 : 0; + predicted_size += ((scan_size - 1) % 8) ? 3 : 0; } return predicted_size; @@ -1179,7 +1179,7 @@ predicted_size += (CEIL(scan_size, 8) > 1) ? (CEIL(scan_size, 8) - 1) : 0; /* remaining bits - 1 */ - predicted_size += ( (scan_size - 1) % 8 ) ? 1 : 0; + predicted_size += ((scan_size - 1) % 8) ? 1 : 0; /* last bit (from TMS scan) */ predicted_size += 1; @@ -1224,9 +1224,9 @@ } /* command "set data bits low byte" */ - buffer_write( 0x80 ); - buffer_write( low_output ); - buffer_write( low_direction ); + buffer_write(0x80); + buffer_write(low_output); + buffer_write(low_direction); } @@ -1263,9 +1263,9 @@ } /* command "set data bits high byte" */ - buffer_write( 0x82 ); - buffer_write( high_output ); - buffer_write( high_direction ); + buffer_write(0x82); + buffer_write(high_output); + buffer_write(high_direction); LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } @@ -1298,9 +1298,9 @@ } /* command "set data bits high byte" */ - buffer_write( 0x82 ); - buffer_write( high_output ); - buffer_write( high_direction ); + buffer_write(0x82); + buffer_write(high_output); + buffer_write(high_direction); LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } @@ -1328,9 +1328,9 @@ } /* command "set data bits low byte" */ - buffer_write( 0x82 ); - buffer_write( high_output ); - buffer_write( high_direction ); + buffer_write(0x82); + buffer_write(high_output); + buffer_write(high_direction); LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } @@ -1357,9 +1357,9 @@ } /* command "set data bits low byte" */ - buffer_write( 0x80 ); - buffer_write( low_output ); - buffer_write( low_direction ); + buffer_write(0x80); + buffer_write(low_output); + buffer_write(low_direction); LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", trst, srst, low_output, low_direction); } @@ -1378,9 +1378,9 @@ } /* command "set data bits low byte" */ - buffer_write( 0x80 ); - buffer_write( low_output ); - buffer_write( low_direction ); + buffer_write(0x80); + buffer_write(low_output); + buffer_write(low_direction); LOG_DEBUG("srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", srst, low_output, low_direction); } @@ -1406,9 +1406,9 @@ } /* command "set data bits high byte" */ - buffer_write( 0x82 ); - buffer_write( high_output ); - buffer_write( high_direction ); + buffer_write(0x82); + buffer_write(high_output); + buffer_write(high_direction); LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } @@ -1435,14 +1435,14 @@ } /* command "set data bits low byte" */ - buffer_write( 0x80 ); - buffer_write( low_output ); - buffer_write( low_direction ); + buffer_write(0x80); + buffer_write(low_output); + buffer_write(low_direction); /* command "set data bits high byte" */ - buffer_write( 0x82 ); - buffer_write( high_output ); - buffer_write( high_direction ); + buffer_write(0x82); + buffer_write(high_output); + buffer_write(high_direction); LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } @@ -1462,9 +1462,9 @@ high_output |= nSRSTnOE; /* command "set data bits high byte" */ - buffer_write( 0x82 ); - buffer_write( high_output ); - buffer_write( high_direction ); + buffer_write(0x82); + buffer_write(high_output); + buffer_write(high_direction); LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } @@ -1484,9 +1484,9 @@ if (tap_get_state() != TAP_IDLE) predicted_size += 3; predicted_size += 3 * CEIL(cmd->cmd.runtest->num_cycles, 7); - if ( cmd->cmd.runtest->end_state != TAP_IDLE) + if (cmd->cmd.runtest->end_state != TAP_IDLE) predicted_size += 3; - if ( tap_get_end_state() != TAP_IDLE) + if (tap_get_end_state() != TAP_IDLE) predicted_size += 3; if (ft2232_buffer_size + predicted_size + 1 > FT2232_BUFFER_SIZE) { @@ -1497,7 +1497,7 @@ } if (tap_get_state() != TAP_IDLE) { - move_to_state( TAP_IDLE ); + move_to_state(TAP_IDLE); require_send = 1; } i = cmd->cmd.runtest->num_cycles; @@ -1506,13 +1506,13 @@ /* there are no state transitions in this code, so omit state tracking */ /* command "Clock Data to TMS/CS Pin (no Read)" */ - buffer_write( 0x4b ); + buffer_write(0x4b); /* scan 7 bits */ - buffer_write( (i > 7) ? 6 : (i - 1) ); + buffer_write((i > 7) ? 6 : (i - 1)); /* TMS data bits */ - buffer_write( 0x0 ); + buffer_write(0x0); tap_set_state(TAP_IDLE); i -= (i > 7) ? 7 : i; @@ -1521,14 +1521,14 @@ ft2232_end_state(cmd->cmd.runtest->end_state); - if ( tap_get_state() != tap_get_end_state() ) + if (tap_get_state() != tap_get_end_state()) { - move_to_state( tap_get_end_state() ); + move_to_state(tap_get_end_state()); } 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() ) ); + LOG_DEBUG("runtest: %i, end in %s", cmd->cmd.runtest->num_cycles, tap_state_name(tap_get_end_state())); #endif return retval; @@ -1537,8 +1537,8 @@ static int ft2232_execute_statemove(jtag_command_t *cmd) { - int predicted_size = 0; - int retval = ERROR_OK; + int predicted_size = 0; + int retval = ERROR_OK; DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state); @@ -1554,9 +1554,9 @@ ft2232_end_state(cmd->cmd.statemove->end_state); /* move to end state */ - if ( tap_get_state() != tap_get_end_state() ) + if (tap_get_state() != tap_get_end_state()) { - move_to_state( tap_get_end_state() ); + move_to_state(tap_get_end_state()); require_send = 1; } @@ -1565,15 +1565,15 @@ static int ft2232_execute_pathmove(jtag_command_t *cmd) { - int predicted_size = 0; + int predicted_size = 0; int retval = ERROR_OK; tap_state_t* path = cmd->cmd.pathmove->path; int num_states = cmd->cmd.pathmove->num_states; DEBUG_JTAG_IO("pathmove: %i states, current: %s end: %s", num_states, - tap_state_name( tap_get_state() ), - tap_state_name( path[num_states-1] ) + tap_state_name(tap_get_state()), + tap_state_name(path[num_states-1]) ); /* only send the maximum buffer size that FT2232C can handle */ @@ -1587,7 +1587,7 @@ first_unsent = cmd; } - ft2232_add_pathmove( path, num_states ); + ft2232_add_pathmove(path, num_states); require_send = 1; return retval; @@ -1603,12 +1603,12 @@ enum scan_type type = jtag_scan_type(cmd->cmd.scan); - DEBUG_JTAG_IO( "%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN", type ); + DEBUG_JTAG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN", type); scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer); predicted_size = ft2232_predict_scan_out(scan_size, type); - if ( (predicted_size + 1) > FT2232_BUFFER_SIZE ) + if ((predicted_size + 1) > FT2232_BUFFER_SIZE) { LOG_DEBUG("oversized ft2232 scan (predicted_size > FT2232_BUFFER_SIZE)"); /* unsent commands before this */ @@ -1643,8 +1643,8 @@ 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, - tap_state_name( tap_get_end_state() ) ); + LOG_DEBUG("%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; @@ -1690,7 +1690,7 @@ 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() ) ); + LOG_DEBUG("sleep %i usec while in %s", cmd->cmd.sleep->us, tap_state_name(tap_get_state())); #endif return retval; @@ -1707,7 +1707,7 @@ 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() ) ); + LOG_DEBUG("clocks %i while in %s", cmd->cmd.stableclocks->num_cycles, tap_state_name(tap_get_state())); #endif return retval; @@ -1720,13 +1720,13 @@ switch (cmd->type) { - case JTAG_RESET: retval = ft2232_execute_reset(cmd); break; - case JTAG_RUNTEST: retval = ft2232_execute_runtest(cmd); break; - case JTAG_STATEMOVE: retval = ft2232_execute_statemove(cmd); break; - case JTAG_PATHMOVE: retval = ft2232_execute_pathmove(cmd); break; - case JTAG_SCAN: retval = ft2232_execute_scan(cmd); break; - case JTAG_SLEEP: retval = ft2232_execute_sleep(cmd); break; - case JTAG_STABLECLOCKS: retval = ft2232_execute_stableclocks(cmd); break; + case JTAG_RESET: retval = ft2232_execute_reset(cmd); break; + case JTAG_RUNTEST: retval = ft2232_execute_runtest(cmd); break; + case JTAG_STATEMOVE: retval = ft2232_execute_statemove(cmd); break; + case JTAG_PATHMOVE: retval = ft2232_execute_pathmove(cmd); break; + case JTAG_SCAN: retval = ft2232_execute_scan(cmd); break; + case JTAG_SLEEP: retval = ft2232_execute_sleep(cmd); break; + case JTAG_STABLECLOCKS: retval = ft2232_execute_stableclocks(cmd); break; default: LOG_ERROR("BUG: unknown JTAG command type encountered"); exit(-1); @@ -1779,19 +1779,19 @@ #if BUILD_FT2232_FTD2XX == 1 static int ft2232_init_ftd2xx(u16 vid, u16 pid, int more, int* try_more) { - FT_STATUS status; + FT_STATUS status; DWORD deviceID; char SerialNumber[16]; - char Description[64]; - DWORD openex_flags = 0; - char* openex_string = NULL; - u8 latency_timer; + char Description[64]; + DWORD openex_flags = 0; + char* openex_string = NULL; + u8 latency_timer; LOG_DEBUG("'ft2232' interface using FTD2XX with '%s' layout (%4.4x:%4.4x)", ft2232_layout, vid, pid); #if IS_WIN32 == 0 /* Add non-standard Vid/Pid to the linux driver */ - if ( ( status = FT_SetVIDPID(vid, pid) ) != FT_OK ) + if ((status = FT_SetVIDPID(vid, pid)) != FT_OK) { LOG_WARNING("couldn't add %4.4x:%4.4x", vid, pid); } @@ -1822,27 +1822,27 @@ } status = FT_OpenEx(openex_string, openex_flags, &ftdih); - if( status != FT_OK ){ + if (status != FT_OK) { // under Win32, the FTD2XX driver appends an "A" to the end // of the description, if we tried by the desc, then // try by the alternate "A" description. - if( openex_string == ft2232_device_desc ){ + if (openex_string == ft2232_device_desc) { // Try the alternate method. openex_string = ft2232_device_desc_A; status = FT_OpenEx(openex_string, openex_flags, &ftdih); - if( status == FT_OK ){ + if (status == FT_OK) { // yea, the "alternate" method worked! } else { // drat, give the user a meaningfull message. // telling the use we tried *BOTH* methods. LOG_WARNING("Unable to open FTDI Device tried: '%s' and '%s'\n", ft2232_device_desc, - ft2232_device_desc_A ); + ft2232_device_desc_A); } } } - if ( status != FT_OK ) + if (status != FT_OK) { DWORD num_devices; @@ -1856,7 +1856,7 @@ status = FT_ListDevices(&num_devices, NULL, FT_LIST_NUMBER_ONLY); if (status == FT_OK) { - char** desc_array = malloc( sizeof(char*) * (num_devices + 1) ); + char** desc_array = malloc(sizeof(char*) * (num_devices + 1)); u32 i; for (i = 0; i < num_devices; i++) @@ -1885,13 +1885,13 @@ return ERROR_JTAG_INIT_FAILED; } - if ( ( status = FT_SetLatencyTimer(ftdih, ft2232_latency) ) != FT_OK ) + if ((status = FT_SetLatencyTimer(ftdih, ft2232_latency)) != FT_OK) { LOG_ERROR("unable to set latency timer: %lu", status); return ERROR_JTAG_INIT_FAILED; } - if ( ( status = FT_GetLatencyTimer(ftdih, &latency_timer) ) != FT_OK ) + if ((status = FT_GetLatencyTimer(ftdih, &latency_timer)) != FT_OK) { LOG_ERROR("unable to get latency timer: %lu", status); return ERROR_JTAG_INIT_FAILED; @@ -1901,19 +1901,19 @@ LOG_DEBUG("current latency timer: %i", latency_timer); } - if ( ( status = FT_SetTimeouts(ftdih, 5000, 5000) ) != FT_OK ) + if ((status = FT_SetTimeouts(ftdih, 5000, 5000)) != FT_OK) { LOG_ERROR("unable to set timeouts: %lu", status); return ERROR_JTAG_INIT_FAILED; } - if ( ( status = FT_SetBitMode(ftdih, 0x0b, 2) ) != FT_OK ) + if ((status = FT_SetBitMode(ftdih, 0x0b, 2)) != FT_OK) { LOG_ERROR("unable to enable bit i/o mode: %lu", status); return ERROR_JTAG_INIT_FAILED; } - if ( ( status = FT_GetDeviceInfo(ftdih, &ftdi_device, &deviceID, SerialNumber, Description, NULL) ) != FT_OK ) + if ((status = FT_GetDeviceInfo(ftdih, &ftdi_device, &deviceID, SerialNumber, Description, NULL)) != FT_OK) { LOG_ERROR("unable to get FT_GetDeviceInfo: %lu", status); return ERROR_JTAG_INIT_FAILED; @@ -1942,7 +1942,7 @@ { FT_STATUS status; - if ( ( status = FT_Purge(ftdih, FT_PURGE_RX | FT_PURGE_TX) ) != FT_OK ) + if ((status = FT_Purge(ftdih, FT_PURGE_RX | FT_PURGE_TX)) != FT_OK) { LOG_ERROR("error purging ftd2xx device: %lu", status); return ERROR_JTAG_INIT_FAILED; @@ -2036,15 +2036,15 @@ int i; if (tap_get_tms_path_len(TAP_IRPAUSE,TAP_IRPAUSE)==7) - { + { LOG_DEBUG("ft2232 interface using 7 step jtag state transitions"); } else { LOG_DEBUG("ft2232 interface using shortest path jtag state transitions"); - + } - if ( (ft2232_layout == NULL) || (ft2232_layout[0] == 0) ) + if ((ft2232_layout == NULL) || (ft2232_layout[0] == 0)) { ft2232_layout = "usbjtag"; LOG_WARNING("No ft2232 layout specified, using default 'usbjtag'"); @@ -2102,7 +2102,7 @@ ft2232_speed(jtag_speed); buf[0] = 0x85; /* Disconnect TDI/DO to TDO/DI for Loopback */ - if ( ( ( retval = ft2232_write(buf, 1, &bytes_written) ) != ERROR_OK ) || (bytes_written != 1) ) + if (((retval = ft2232_write(buf, 1, &bytes_written)) != ERROR_OK) || (bytes_written != 1)) { LOG_ERROR("couldn't write to FT2232 to disable loopback"); return ERROR_JTAG_INIT_FAILED; @@ -2183,7 +2183,7 @@ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'USBJTAG' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2207,7 +2207,7 @@ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2253,7 +2253,7 @@ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'Dicarlo' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2277,7 +2277,7 @@ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2290,8 +2290,8 @@ nSRST = 0x02; nSRSTnOE = 0x08; } - else if ( (strcmp(layout->name, "jtagkey_prototype_v1") == 0) - || (strcmp(layout->name, "oocdlink") == 0) ) + else if ((strcmp(layout->name, "jtagkey_prototype_v1") == 0) + || (strcmp(layout->name, "oocdlink") == 0)) { nTRST = 0x02; nTRSTnOE = 0x1; @@ -2335,7 +2335,7 @@ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2359,7 +2359,7 @@ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'Olimex' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2426,7 +2426,7 @@ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE[12]=out, n[ST]srst=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2449,7 +2449,7 @@ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2473,7 +2473,7 @@ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2490,7 +2490,7 @@ buf[2] = high_direction; LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2514,7 +2514,7 @@ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'comstick' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2534,7 +2534,7 @@ buf[2] = high_direction; LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'comstick' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2558,7 +2558,7 @@ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2578,7 +2578,7 @@ buf[2] = high_direction; LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2639,7 +2639,7 @@ return ERROR_OK; } -static int cortino_jtag_init(void) +static int cortino_jtag_init(void) { u8 buf[3]; u32 bytes_written; @@ -2653,7 +2653,7 @@ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'cortino' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2673,7 +2673,7 @@ buf[2] = high_direction; LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout"); return ERROR_JTAG_INIT_FAILED; @@ -2698,9 +2698,9 @@ high_output |= 0x08; } - buffer_write( 0x82 ); - buffer_write( high_output ); - buffer_write( high_direction ); + buffer_write(0x82); + buffer_write(high_output); + buffer_write(high_direction); } @@ -2711,9 +2711,9 @@ */ high_output ^= 0x0c; - buffer_write( 0x82 ); - buffer_write( high_output ); - buffer_write( high_direction ); + buffer_write(0x82); + buffer_write(high_output); + buffer_write(high_direction); } @@ -2731,9 +2731,9 @@ high_output = 0x08; } - buffer_write( 0x82 ); - buffer_write( high_output ); - buffer_write( high_direction ); + buffer_write(0x82); + buffer_write(high_output); + buffer_write(high_direction); } @@ -2763,23 +2763,23 @@ if (argc == 1) { ft2232_device_desc = strdup(args[0]); - cp = strchr( ft2232_device_desc, 0 ); + cp = strchr(ft2232_device_desc, 0); // under Win32, the FTD2XX driver appends an "A" to the end // of the description, this examines the given desc // and creates the 'missing' _A or non_A variable. - if( (cp[-1] == 'A') && (cp[-2]==' ') ){ + if ((cp[-1] == 'A') && (cp[-2]==' ')) { // it was, so make this the "A" version. ft2232_device_desc_A = ft2232_device_desc; // and *CREATE* the non-A version. - strcpy( buf, ft2232_device_desc ); - cp = strchr( buf, 0 ); + strcpy(buf, ft2232_device_desc); + cp = strchr(buf, 0); cp[-2] = 0; - ft2232_device_desc = strdup( buf ); + ft2232_device_desc = strdup(buf); } else { // <space>A not defined // so create it - sprintf( buf, "%s A", ft2232_device_desc ); - ft2232_device_desc_A = strdup( buf ); + sprintf(buf, "%s A", ft2232_device_desc); + ft2232_device_desc_A = strdup(buf); } } else @@ -2828,7 +2828,7 @@ "(maximum is %d pairs)", MAX_USB_IDS); argc = MAX_USB_IDS * 2; } - if ( argc < 2 || (argc & 1) ) + if (argc < 2 || (argc & 1)) { LOG_WARNING("incomplete ft2232_vid_pid configuration directive"); if (argc < 2) @@ -2892,13 +2892,13 @@ /* there are no state transitions in this code, so omit state tracking */ /* command "Clock Data to TMS/CS Pin (no Read)" */ - buffer_write( 0x4b ); + buffer_write(0x4b); /* scan 7 bit */ - buffer_write( bitcount_per_command - 1 ); + buffer_write(bitcount_per_command - 1); /* TMS data bits are either all zeros or ones to stay in the current stable state */ - buffer_write( tms ); + buffer_write(tms); require_send = 1; @@ -2911,7 +2911,7 @@ /* --------------------------------------------------------------------- * Support for IceBear JTAG adapter from Section5: - * http://section5.ch/icebear + * http://section5.ch/icebear * * Author: Sten, de...@sa... */ @@ -2961,7 +2961,7 @@ buf[2] = low_direction; LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) { + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'IceBear' layout (low)"); return ERROR_JTAG_INIT_FAILED; } @@ -2976,7 +2976,7 @@ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) { + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { LOG_ERROR("couldn't initialize FT2232 with 'IceBear' layout (high)"); return ERROR_JTAG_INIT_FAILED; } @@ -3005,9 +3005,9 @@ } /* command "set data bits low byte" */ - buffer_write( 0x80 ); - buffer_write( low_output ); - buffer_write( low_direction ); + buffer_write(0x80); + buffer_write(low_output); + buffer_write(low_direction); LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", trst, srst, low_output, low_direction); } |
From: <zw...@ma...> - 2009-06-04 03:16:47
|
Author: zwelch Date: 2009-06-04 03:16:43 +0200 (Thu, 04 Jun 2009) New Revision: 2037 Modified: trunk/src/jtag/ft2232.c Log: David Brownell <da...@pa...>: Minor cleanup of FT2232: - make Olimex glue warn about Olimex issues instead of JTAGkey issues; - make some data static+const; - don't export some internal symbols. Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-06-04 00:56:41 UTC (rev 2036) +++ trunk/src/jtag/ft2232.c 2009-06-04 01:16:43 UTC (rev 2037) @@ -148,7 +148,7 @@ static void flyswatter_jtag_blink(void); static void turtle_jtag_blink(void); -ft2232_layout_t ft2232_layouts[] = +static const ft2232_layout_t ft2232_layouts[] = { { "usbjtag", usbjtag_init, usbjtag_reset, NULL }, { "jtagkey", jtagkey_init, jtagkey_reset, NULL }, @@ -170,7 +170,7 @@ static u8 nTRST, nTRSTnOE, nSRST, nSRSTnOE; -static ft2232_layout_t* layout; +static const ft2232_layout_t *layout; static u8 low_output = 0x0; static u8 low_direction = 0x0; static u8 high_output = 0x0; @@ -558,7 +558,7 @@ } -void ft2232_end_state(tap_state_t state) +static void ft2232_end_state(tap_state_t state) { if (tap_is_state_stable(state)) tap_set_end_state(state); @@ -775,7 +775,7 @@ } -void ft2232_add_scan(bool ir_scan, enum scan_type type, u8* buffer, int scan_size) +static void ft2232_add_scan(bool ir_scan, enum scan_type type, u8* buffer, int scan_size) { int num_bytes = (scan_size + 7) / 8; int bits_left = scan_size; @@ -2032,7 +2032,7 @@ u8 buf[1]; int retval; u32 bytes_written; - ft2232_layout_t* cur_layout = ft2232_layouts; + const ft2232_layout_t* cur_layout = ft2232_layouts; int i; if (tap_get_tms_path_len(TAP_IRPAUSE,TAP_IRPAUSE)==7) @@ -2361,7 +2361,7 @@ if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'Olimex' layout"); return ERROR_JTAG_INIT_FAILED; } @@ -2402,9 +2402,9 @@ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) + if ((ft2232_write(buf, 3, &bytes_written) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'Olimex' layout"); return ERROR_JTAG_INIT_FAILED; } |
From: <zw...@ma...> - 2009-06-04 02:56:50
|
Author: zwelch Date: 2009-06-04 02:56:41 +0200 (Thu, 04 Jun 2009) New Revision: 2036 Modified: trunk/src/jtag/arm-jtag-ew.c trunk/src/jtag/bitbang.c trunk/src/jtag/ep93xx.c trunk/src/jtag/jlink.c trunk/src/jtag/jtag.c trunk/src/jtag/parport.c trunk/src/jtag/presto.c trunk/src/jtag/vsllink.c Log: David Brownell <da...@pa...>: Remove pernicious whitespace from src/jtag/*c files; mostly the end-of-line flavor for now, although there's more. Modified: trunk/src/jtag/arm-jtag-ew.c =================================================================== --- trunk/src/jtag/arm-jtag-ew.c 2009-06-04 00:54:25 UTC (rev 2035) +++ trunk/src/jtag/arm-jtag-ew.c 2009-06-04 00:56:41 UTC (rev 2036) @@ -1,4 +1,4 @@ -// vim:ts=4 sw=4: +// vim:ts=4 sw=4: /*************************************************************************** * Copyright (C) 2009 by Dimitar Dimitrov <di...@gm...> * @@ -222,14 +222,14 @@ usb_out_buffer[0] = CMD_GET_TCK_FREQUENCY; result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4); speed_real = (int)buf_get_u32(usb_in_buffer,0,32); - if(result < 0) + if(result < 0) { LOG_ERROR("ARM-JTAG-EW getting speed failed (%d)", result); return ERROR_JTAG_DEVICE_ERROR; - } + } else { - LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed, speed_real); + LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed, speed_real); } return ERROR_OK; @@ -334,7 +334,7 @@ for (i = 0; i < num_states; i++) { /* - * TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode. + * TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode. * Either handle that here, or update the documentation with examples * how to fix that in the configuration files. */ @@ -504,7 +504,7 @@ usb_out_buffer[0] = CMD_GET_VERSION; result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4+15+256); - if (result != 0) + if (result != 0) { LOG_ERROR("ARM-JTAG-EW command CMD_GET_VERSION failed (%d)\n", result); return ERROR_JTAG_DEVICE_ERROR; @@ -791,7 +791,7 @@ if (result == out_length) { result = armjtagew_usb_read(armjtagew_jtag, in_length); - if (result != in_length) + if (result != in_length) { LOG_ERROR("usb_bulk_read failed (requested=%d, result=%d)", in_length, result); return -1; Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2009-06-04 00:54:25 UTC (rev 2035) +++ trunk/src/jtag/bitbang.c 2009-06-04 00:56:41 UTC (rev 2036) @@ -79,7 +79,7 @@ int i=0, tms=0; u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); - + for (i = skip; i < tms_count; i++) { tms = (tms_scan >> i) & 1; Modified: trunk/src/jtag/ep93xx.c =================================================================== --- trunk/src/jtag/ep93xx.c 2009-06-04 00:54:25 UTC (rev 2035) +++ trunk/src/jtag/ep93xx.c 2009-06-04 00:56:41 UTC (rev 2036) @@ -53,13 +53,13 @@ struct timespec ep93xx_zzzz; -jtag_interface_t ep93xx_interface = +jtag_interface_t ep93xx_interface = { .name = "ep93xx", .execute_queue = bitbang_execute_queue, - .speed = ep93xx_speed, + .speed = ep93xx_speed, .register_commands = ep93xx_register_commands, .init = ep93xx_init, .quit = ep93xx_quit, @@ -84,12 +84,12 @@ output_value |= TCK_BIT; else output_value &= ~TCK_BIT; - + if (tms) output_value |= TMS_BIT; else output_value &= ~TMS_BIT; - + if (tdi) output_value |= TDI_BIT; else @@ -111,7 +111,7 @@ output_value |= SRST_BIT; else if (srst == 1) output_value &= ~SRST_BIT; - + *gpio_data_register = output_value; nanosleep(&ep93xx_zzzz, NULL); } @@ -153,7 +153,7 @@ { int ret; - bitbang_interface = &ep93xx_bitbang; + bitbang_interface = &ep93xx_bitbang; ep93xx_zzzz.tv_sec = 0; ep93xx_zzzz.tv_nsec = 10000000; @@ -203,7 +203,7 @@ gpio_data_direction_register = gpio_controller + 0x18; LOG_INFO("gpio_data_register = %p\n", gpio_data_register); - LOG_INFO("gpio_data_direction_reg = %p\n", gpio_data_direction_register); + LOG_INFO("gpio_data_direction_reg = %p\n", gpio_data_direction_register); /* * Configure bit 0 (TDO) as an input, and bits 1-5 (TDI, TCK * TMS, TRST, SRST) as outputs. Drive TDI and TCK low, and Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-06-04 00:54:25 UTC (rev 2035) +++ trunk/src/jtag/jlink.c 2009-06-04 00:56:41 UTC (rev 2036) @@ -59,24 +59,24 @@ static u8 usb_emu_result_buffer[JLINK_EMU_RESULT_BUFFER_SIZE]; /* Constants for JLink command */ -#define EMU_CMD_VERSION 0x01 -#define EMU_CMD_SET_SPEED 0x05 -#define EMU_CMD_GET_STATE 0x07 +#define EMU_CMD_VERSION 0x01 +#define EMU_CMD_SET_SPEED 0x05 +#define EMU_CMD_GET_STATE 0x07 #define EMU_CMD_HW_CLOCK 0xc8 -#define EMU_CMD_HW_TMS0 0xc9 -#define EMU_CMD_HW_TMS1 0xca -#define EMU_CMD_HW_JTAG2 0xce -#define EMU_CMD_HW_JTAG3 0xcf +#define EMU_CMD_HW_TMS0 0xc9 +#define EMU_CMD_HW_TMS1 0xca +#define EMU_CMD_HW_JTAG2 0xce +#define EMU_CMD_HW_JTAG3 0xcf #define EMU_CMD_GET_MAX_MEM_BLOCK 0xd4 -#define EMU_CMD_HW_RESET0 0xdc -#define EMU_CMD_HW_RESET1 0xdd -#define EMU_CMD_HW_TRST0 0xde -#define EMU_CMD_HW_TRST1 0xdf -#define EMU_CMD_GET_CAPS 0xe8 -#define EMU_CMD_GET_HW_VERSION 0xf0 +#define EMU_CMD_HW_RESET0 0xdc +#define EMU_CMD_HW_RESET1 0xdd +#define EMU_CMD_HW_TRST0 0xde +#define EMU_CMD_HW_TRST1 0xdf +#define EMU_CMD_GET_CAPS 0xe8 +#define EMU_CMD_GET_HW_VERSION 0xf0 /* bits return from EMU_CMD_GET_CAPS */ -#define EMU_CAP_GET_HW_VERSION 1 +#define EMU_CAP_GET_HW_VERSION 1 #define EMU_CAP_GET_MAX_BLOCK_SIZE 11 /* max speed 12MHz v5.0 jlink */ @@ -294,7 +294,7 @@ static int jlink_register_commands(struct command_context_s *cmd_ctx) { - register_command(cmd_ctx, NULL, "jlink_info", + register_command(cmd_ctx, NULL, "jlink_info", &jlink_handle_jlink_info_command, COMMAND_EXEC, "query jlink info"); register_command(cmd_ctx, NULL, "jlink_hw_jtag", @@ -307,7 +307,7 @@ { int check_cnt; int i; - + jlink_jtag_handle = jlink_usb_open(); if (jlink_jtag_handle == 0) @@ -343,12 +343,12 @@ jlink_speed(jtag_speed); /* v5/6 jlink seems to have an issue if the first tap move - * is not divisible by 8, so we send a TLR on first power up */ + * is not divisible by 8, so we send a TLR on first power up */ for (i = 0; i < 8; i++) { jlink_tap_append_step(1, 0); } jlink_tap_execute(); - + return ERROR_OK; } @@ -567,7 +567,7 @@ LOG_ERROR("J-Link command EMU_CMD_VERSION impossible return length 0x%0x", len); len = JLINK_IN_BUFFER_SIZE; } - + result = jlink_usb_read(jlink_jtag_handle, len); if (result != len) { Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-04 00:54:25 UTC (rev 2035) +++ trunk/src/jtag/jtag.c 2009-06-04 00:56:41 UTC (rev 2036) @@ -2658,7 +2658,7 @@ jtag_add_pathmove(tms_count, moves); } - /* else state must be immediately reachable in one clock cycle, and does not + /* else state must be immediately reachable in one clock cycle, and does not need to be a stable state. */ else if( tap_state_transition(cur_state, true) == goal_state Modified: trunk/src/jtag/parport.c =================================================================== --- trunk/src/jtag/parport.c 2009-06-04 00:54:25 UTC (rev 2035) +++ trunk/src/jtag/parport.c 2009-06-04 00:56:41 UTC (rev 2036) @@ -75,8 +75,8 @@ u8 LED_MASK; /* data port bit for LED */ } cable_t; -static cable_t cables[] = -{ +static cable_t cables[] = +{ /* name tdo trst tms tck tdi srst o_inv i_inv init exit led */ { "wiggler", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x80, 0x00 }, { "wiggler2", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x00, 0x20 }, @@ -135,13 +135,13 @@ static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -jtag_interface_t parport_interface = +jtag_interface_t parport_interface = { .name = "parport", - + .execute_queue = bitbang_execute_queue, - .speed = parport_speed, + .speed = parport_speed, .register_commands = parport_register_commands, .init = parport_init, .quit = parport_quit, @@ -158,7 +158,7 @@ static int parport_read(void) { int data = 0; - + #if PARPORT_USE_PPDEV == 1 ioctl(device_handle, PPRSTATUS, & data); #else @@ -190,22 +190,22 @@ static void parport_write(int tck, int tms, int tdi) { int i = jtag_speed + 1; - + if (tck) dataport_value |= cable->TCK_MASK; else dataport_value &= ~cable->TCK_MASK; - + if (tms) dataport_value |= cable->TMS_MASK; else dataport_value &= ~cable->TMS_MASK; - + if (tdi) dataport_value |= cable->TDI_MASK; else dataport_value &= ~cable->TDI_MASK; - + while (i-- > 0) parport_write_data(); } @@ -224,10 +224,10 @@ dataport_value |= cable->SRST_MASK; else if (srst == 1) dataport_value &= ~cable->SRST_MASK; - + parport_write_data(); } - + /* turn LED on parport adapter on (1) or off (0) */ static void parport_led(int on) { @@ -261,7 +261,7 @@ { HANDLE h; OSVERSIONINFO version; - + version.dwOSVersionInfoSize = sizeof version; if (!GetVersionEx( &version )) { errno = EINVAL; @@ -269,15 +269,15 @@ } if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) return 0; - + h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if (h == INVALID_HANDLE_VALUE) { errno = ENODEV; return -1; } - + CloseHandle( h ); - + return 0; } #endif @@ -289,15 +289,15 @@ char buffer[256]; int i = 0; #endif - + cur_cable = cables; - + if ((parport_cable == NULL) || (parport_cable[0] == 0)) { parport_cable = "wiggler"; LOG_WARNING("No parport cable specified, using default 'wiggler'"); } - + while (cur_cable->name) { if (strcmp(cur_cable->name, parport_cable) == 0) @@ -313,9 +313,9 @@ LOG_ERROR("No matching cable found for %s", parport_cable); return ERROR_JTAG_INIT_FAILED; } - + dataport_value = cable->PORT_INIT; - + #if PARPORT_USE_PPDEV == 1 if (device_handle > 0) { @@ -374,10 +374,10 @@ parport_port = 0x378; LOG_WARNING("No parport port specified, using default '0x378' (LPT1)"); } - + dataport = parport_port; statusport = parport_port + 1; - + LOG_DEBUG("requesting privileges for parallel port 0x%lx...", dataport); #if PARPORT_USE_GIVEIO == 1 if (parport_get_giveio_access() != 0) @@ -389,21 +389,21 @@ return ERROR_JTAG_INIT_FAILED; } LOG_DEBUG("...privileges granted"); - + /* make sure parallel port is in right mode (clear tristate and interrupt */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) outb(parport_port + 2, 0x0); #else outb(0x0, parport_port + 2); #endif - + #endif /* PARPORT_USE_PPDEV */ - + parport_reset(0, 0); parport_write(0, 0, 0); parport_led(1); - bitbang_interface = &parport_bitbang; + bitbang_interface = &parport_bitbang; return ERROR_OK; } @@ -417,13 +417,13 @@ dataport_value = cable->PORT_EXIT; parport_write_data(); } - + if (parport_cable) { free(parport_cable); parport_cable = NULL; } - + return ERROR_OK; } @@ -461,11 +461,11 @@ command_print(cmd_ctx, "usage: parport_write_on_exit <on|off>"); return ERROR_OK; } - + if (strcmp(args[0], "on") == 0) parport_exit = 1; else if (strcmp(args[0], "off") == 0) parport_exit = 0; - + return ERROR_OK; } Modified: trunk/src/jtag/presto.c =================================================================== --- trunk/src/jtag/presto.c 2009-06-04 00:54:25 UTC (rev 2035) +++ trunk/src/jtag/presto.c 2009-06-04 00:56:41 UTC (rev 2036) @@ -117,7 +117,7 @@ int jtag_tdi_count; int jtag_speed; - + } presto_t; static presto_t presto_state; @@ -420,7 +420,7 @@ presto->jtag_tdi_count=0; presto->jtag_speed=0; - + #if BUILD_PRESTO_FTD2XX == 1 return presto_open_ftd2xx(req_serial); #elif BUILD_PRESTO_LIBFTDI == 1 @@ -575,7 +575,7 @@ presto_sendbyte(presto->jtag_tdi_data); presto->jtag_tdi_count = 0; presto->jtag_tdi_data = 0; - + return 0; } @@ -586,7 +586,7 @@ presto_sendbyte(0xCA); presto->jtag_tck = 0; } - + return 0; } @@ -711,7 +711,7 @@ if (khz >= 3000) *jtag_speed = 0; else *jtag_speed = (1000+khz-1)/khz; - + return 0; } @@ -725,26 +725,26 @@ if (speed == 0) *khz = 3000; else *khz = 1000/speed; - + return 0; } static int presto_jtag_speed(int speed) { int khz; - + if (presto_jtag_speed_div(speed, &khz)) { return ERROR_INVALID_ARGUMENTS; } presto->jtag_speed = speed; - + if (khz%1000 == 0) LOG_INFO("setting speed to %d, max. TCK freq. is %d MHz", speed, khz/1000); else LOG_INFO("setting speed to %d, max. TCK freq. is %d kHz", speed, khz); - + return 0; } Modified: trunk/src/jtag/vsllink.c =================================================================== --- trunk/src/jtag/vsllink.c 2009-06-04 00:54:25 UTC (rev 2035) +++ trunk/src/jtag/vsllink.c 2009-06-04 00:56:41 UTC (rev 2036) @@ -91,7 +91,7 @@ * 3: Pause-DR * 4: Shift-IR * 5: Pause-IR - * + * * SD->SD and SI->SI have to be caught in interface specific code */ static u8 VSLLINK_tap_move[6][6] = @@ -300,29 +300,29 @@ case JTAG_RUNTEST: DEBUG_JTAG_IO( "runtest %i cycles, end in %s", cmd->cmd.runtest->num_cycles, \ tap_state_name(cmd->cmd.runtest->end_state)); - + vsllink_end_state(cmd->cmd.runtest->end_state); vsllink_runtest(cmd->cmd.runtest->num_cycles); break; - + case JTAG_STATEMOVE: DEBUG_JTAG_IO("statemove end in %s", tap_state_name(cmd->cmd.statemove->end_state)); - + vsllink_end_state(cmd->cmd.statemove->end_state); vsllink_state_move(); break; - + case JTAG_PATHMOVE: DEBUG_JTAG_IO("pathmove: %i states, end in %s", \ cmd->cmd.pathmove->num_states, \ tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1])); - + vsllink_path_move(cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path); break; - + case JTAG_SCAN: vsllink_end_state(cmd->cmd.scan->end_state); - + scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer); if (cmd->cmd.scan->ir_scan) { @@ -332,34 +332,34 @@ { DEBUG_JTAG_IO("JTAG Scan write DR(%d bits), end in %s:", scan_size, tap_state_name(cmd->cmd.scan->end_state)); } - + #ifdef _DEBUG_JTAG_IO_ vsllink_debug_buffer(buffer, (scan_size + 7) >> 3); #endif - + type = jtag_scan_type(cmd->cmd.scan); - + vsllink_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size, cmd->cmd.scan); break; - + case JTAG_RESET: DEBUG_JTAG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst); - + vsllink_tap_execute(); - + if (cmd->cmd.reset->trst == 1) { tap_set_state(TAP_RESET); } vsllink_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); break; - + case JTAG_SLEEP: DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us); vsllink_tap_execute(); jtag_sleep(cmd->cmd.sleep->us); break; - + case JTAG_STABLECLOCKS: DEBUG_JTAG_IO("add %d clocks", cmd->cmd.stableclocks->num_cycles); switch(tap_get_state()) @@ -383,27 +383,27 @@ } vsllink_stableclocks(cmd->cmd.stableclocks->num_cycles, scan_size); break; - + default: LOG_ERROR("BUG: unknown JTAG command type encountered: %d", cmd->type); exit(-1); } cmd = cmd->next; } - + return vsllink_tap_execute(); } static int vsllink_speed(int speed) { int result; - + vsllink_usb_out_buffer[0] = VSLLINK_CMD_SET_SPEED; vsllink_usb_out_buffer[1] = (speed >> 0) & 0xff; vsllink_usb_out_buffer[2] = (speed >> 8) & 0xFF; - + result = vsllink_usb_write(vsllink_jtag_handle, 3); - + if (result == 3) { return ERROR_OK; @@ -413,21 +413,21 @@ LOG_ERROR("VSLLink setting speed failed (%d)", result); return ERROR_JTAG_DEVICE_ERROR; } - + return ERROR_OK; } static int vsllink_khz(int khz, int *jtag_speed) { *jtag_speed = khz; - + return ERROR_OK; } static int vsllink_speed_div(int jtag_speed, int *khz) { *khz = jtag_speed; - + return ERROR_OK; } @@ -436,7 +436,7 @@ int check_cnt, to_tmp; int result; char version_str[100]; - + vsllink_usb_in_buffer = malloc(VSLLINK_BufferSize); vsllink_usb_out_buffer = malloc(VSLLINK_BufferSize); if ((vsllink_usb_in_buffer == NULL) || (vsllink_usb_out_buffer == NULL)) @@ -444,16 +444,16 @@ LOG_ERROR("Not enough memory"); exit(-1); } - + vsllink_jtag_handle = vsllink_usb_open(); - + if (vsllink_jtag_handle == 0) { LOG_ERROR("Can't find USB JTAG Interface! Please check connection and permissions."); return ERROR_JTAG_INIT_FAILED; } LOG_DEBUG("vsllink found on %04X:%04X", vsllink_usb_vid, vsllink_usb_pid); - + to_tmp = VSLLINK_USB_TIMEOUT; VSLLINK_USB_TIMEOUT = 100; check_cnt = 0; @@ -461,20 +461,20 @@ { vsllink_simple_command(0x00); result = vsllink_usb_read(vsllink_jtag_handle); - + if (result > 2) { vsllink_usb_in_buffer[result] = 0; VSLLINK_BufferSize = vsllink_usb_in_buffer[0] + (vsllink_usb_in_buffer[1] << 8); strncpy(version_str, (char *)vsllink_usb_in_buffer + 2, sizeof(version_str)); LOG_INFO("%s", version_str); - + // free the pre-alloc memroy free(vsllink_usb_in_buffer); free(vsllink_usb_out_buffer); vsllink_usb_in_buffer = NULL; vsllink_usb_out_buffer = NULL; - + // alloc new memory vsllink_usb_in_buffer = malloc(VSLLINK_BufferSize); vsllink_usb_out_buffer = malloc(VSLLINK_BufferSize); @@ -512,7 +512,7 @@ exit(-1); } VSLLINK_USB_TIMEOUT = to_tmp; - + // connect to vsllink vsllink_connect(); // initialize function pointers @@ -523,11 +523,11 @@ vsllink_path_move = vsllink_path_move_normal; vsllink_stableclocks = vsllink_stableclocks_normal; vsllink_scan = vsllink_scan_normal; - + vsllink_tap_init = vsllink_tap_init_normal; vsllink_tap_execute = vsllink_tap_execute_normal; vsllink_tap_ensure_space = vsllink_tap_ensure_space_normal; - + LOG_INFO("vsllink run in NORMAL mode"); } else @@ -537,14 +537,14 @@ vsllink_path_move = vsllink_path_move_dma; vsllink_stableclocks = vsllink_stableclocks_dma; vsllink_scan = vsllink_scan_dma; - + vsllink_tap_init = vsllink_tap_init_dma; vsllink_tap_execute = vsllink_tap_execute_dma; vsllink_tap_ensure_space = vsllink_tap_ensure_space_dma; - + LOG_INFO("vsllink run in DMA mode"); } - + // Set SRST and TRST to output, Set USR1 and USR2 to input vsllink_usb_out_buffer[0] = VSLLINK_CMD_SET_PORTDIR; vsllink_usb_out_buffer[1] = JTAG_PINMSK_SRST | JTAG_PINMSK_TRST | JTAG_PINMSK_USR1 | JTAG_PINMSK_USR2; @@ -554,13 +554,13 @@ LOG_ERROR("VSLLink USB send data error"); exit(-1); } - + vsllink_reset(0, 0); - + LOG_INFO("VSLLink JTAG Interface ready"); - + vsllink_tap_init(); - + return ERROR_OK; } @@ -577,13 +577,13 @@ LOG_ERROR("VSLLink USB send data error"); exit(-1); } - + // disconnect vsllink_disconnect(); vsllink_usb_close(vsllink_jtag_handle); vsllink_jtag_handle = NULL; } - + if (vsllink_usb_in_buffer != NULL) { free(vsllink_usb_in_buffer); @@ -594,7 +594,7 @@ free(vsllink_usb_out_buffer); vsllink_usb_out_buffer = NULL; } - + return ERROR_OK; } @@ -609,7 +609,7 @@ static int vsllink_connect(void) { char vsllink_str[100]; - + vsllink_usb_out_buffer[0] = VSLLINK_CMD_CONN; vsllink_usb_out_buffer[1] = vsllink_mode; vsllink_usb_message(vsllink_jtag_handle, 2, 0); @@ -618,7 +618,7 @@ strncpy(vsllink_str, (char *)vsllink_usb_in_buffer + 2, sizeof(vsllink_str)); LOG_INFO("%s", vsllink_str); } - + return ERROR_OK; } @@ -630,7 +630,7 @@ u16 tms2; insert_insignificant_operation_t *insert = \ &VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())]; - + if (((tap_get_state() != TAP_RESET) && (tap_get_state() != TAP_IDLE) && (tap_get_state() != TAP_DRPAUSE) && (tap_get_state() != TAP_IRPAUSE)) || \ (vsllink_tms_data_len <= 0) || (vsllink_tms_data_len >= 8) || \ (vsllink_tms_cmd_pos == NULL)) @@ -638,7 +638,7 @@ LOG_ERROR("There MUST be some bugs in the driver"); exit(-1); } - + tms2 = (tms_scan & VSLLINK_BIT_MSK[insert->insert_position]) << \ vsllink_tms_data_len; if (insert->insert_value == 1) @@ -648,10 +648,10 @@ } tms2 |= (tms_scan >> insert->insert_position) << \ (8 + insert->insert_position); - + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (tms2 >> 0) & 0xff; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms2 >> 8) & 0xff; - + vsllink_tms_data_len = 0; vsllink_tms_cmd_pos = NULL; } @@ -679,11 +679,11 @@ else { vsllink_tap_ensure_space(0, 2); - + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_TMSBYTE; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state()); } - + tap_set_state(tap_get_end_state()); } static void vsllink_state_move_dma(void) @@ -692,21 +692,21 @@ insert_insignificant_operation_t *insert = \ &VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())]; u8 tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state()); - + if (tap_get_state() == TAP_RESET) { vsllink_tap_ensure_space(0, 8); - + for (i = 0; i < 8; i++) { vsllink_tap_append_step(1, 0); } } - + if (insert_length > 0) { vsllink_tap_ensure_space(0, 16); - + for (i = 0; i < insert->insert_position; i++) { vsllink_tap_append_step((tms_scan >> i) & 1, 0); @@ -723,13 +723,13 @@ else { vsllink_tap_ensure_space(0, 8); - + for (i = 0; i < 8; i++) { vsllink_tap_append_step((tms_scan >> i) & 1, 0); } } - + tap_set_state(tap_get_end_state()); } @@ -737,7 +737,7 @@ static void vsllink_add_path(int start, int num, tap_state_t *path) { int i; - + for (i = start; i < (start + num); i++) { if ((i & 7) == 0) @@ -748,7 +748,7 @@ } vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = 0; } - + if (path[i - start] == tap_state_transition(tap_get_state(), true)) { vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] |= 1 << (i & 7); @@ -769,14 +769,14 @@ vsllink_usb_out_buffer_idx++; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = 0; } - + tap_set_end_state(tap_get_state()); } static void vsllink_path_move_normal(int num_states, tap_state_t *path) { int i, tms_len, tms_cmd_pos, path_idx = 0; - + if (vsllink_tms_data_len > 0) { // there are vsllink_tms_data_len more tms bits to be shifted @@ -827,7 +827,7 @@ // end last tms shift command vsllink_add_path(vsllink_tms_data_len, num_states, path); } - + vsllink_tms_data_len = (vsllink_tms_data_len + num_states) & 7; if (vsllink_tms_data_len == 0) { @@ -838,19 +838,19 @@ else { vsllink_add_path(vsllink_tms_data_len, 16 - vsllink_tms_data_len, path); - + path += 16 - vsllink_tms_data_len; num_states -= 16 - vsllink_tms_data_len; vsllink_tms_data_len = 0; vsllink_tms_cmd_pos = NULL; } } - + if (num_states > 0) { // Normal operation, don't need to append tms data vsllink_tms_data_len = num_states & 7; - + while (num_states > 0) { if (num_states > ((VSLLINK_CMDJTAGSEQ_LENMSK + 1) * 8)) @@ -865,13 +865,13 @@ vsllink_tap_ensure_space(0, tms_len + 2); tms_cmd_pos = vsllink_usb_out_buffer_idx; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_TMSBYTE | (tms_len - 1); - + vsllink_add_path(0, i, path + path_idx); - + path_idx += i; num_states -= i; } - + if (vsllink_tms_data_len > 0) { if (tms_len < (VSLLINK_CMDJTAGSEQ_LENMSK + 1)) @@ -882,7 +882,7 @@ else { vsllink_usb_out_buffer[tms_cmd_pos]--; - + tms_len = vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx]; vsllink_tap_ensure_space(0, 3); vsllink_tms_cmd_pos = &vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx]; @@ -895,7 +895,7 @@ static void vsllink_path_move_dma(int num_states, tap_state_t *path) { int i, j = 0; - + if (tap_length & 7) { if ((8 - (tap_length & 7)) < num_states) @@ -925,11 +925,11 @@ } num_states -= j; } - + if (num_states > 0) { vsllink_tap_ensure_space(0, num_states); - + for (i = 0; i < num_states; i++) { if (path[j + i] == tap_state_transition(tap_get_state(), false)) @@ -948,7 +948,7 @@ tap_set_state(path[j + i]); } } - + tap_set_end_state(tap_get_state()); } @@ -956,7 +956,7 @@ { int tms_len; u16 tms_append_byte; - + if (vsllink_tms_data_len > 0) { // there are vsllink_tms_data_len more tms bits to be shifted @@ -1022,7 +1022,7 @@ vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF); vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (u8)(tms_append_byte >> 8); } - + vsllink_tms_data_len = tms_len & 7; if (vsllink_tms_data_len == 0) { @@ -1035,14 +1035,14 @@ // more shifts will be needed vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF); vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (u8)(tms_append_byte >> 8); - + num_cycles -= 16 - vsllink_tms_data_len; vsllink_tms_data_len = 0; vsllink_tms_cmd_pos = NULL; } } // from here vsllink_tms_data_len == 0 or num_cycles == 0 - + if (vsllink_tms_data_len > 0) { // num_cycles == 0 @@ -1075,17 +1075,17 @@ vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms_len >> 8) & 0xff; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms_len >> 16) & 0xff; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms_len >> 24) & 0xff; - + vsllink_usb_in_want_length += 1; pending_scan_results_buffer[pending_scan_results_length].buffer = NULL; pending_scan_results_length++; - + if (tms_len > 0xFFFF) { vsllink_tap_execute(); } } - + // post-process vsllink_tms_data_len = num_cycles & 7; if (vsllink_tms_data_len > 0) @@ -1109,7 +1109,7 @@ static void vsllink_stableclocks_dma(int num_cycles, int tms) { int i, cur_cycles; - + if (tap_length & 7) { if ((8 - (tap_length & 7)) < num_cycles) @@ -1126,7 +1126,7 @@ } num_cycles -= cur_cycles; } - + while (num_cycles > 0) { if (num_cycles > 8 * tap_buffer_size) @@ -1137,14 +1137,14 @@ { cur_cycles = num_cycles; } - + vsllink_tap_ensure_space(0, cur_cycles); - + for (i = 0; i < cur_cycles; i++) { vsllink_tap_append_step(tms, 0); } - + num_cycles -= cur_cycles; } } @@ -1152,16 +1152,16 @@ static void vsllink_runtest(int num_cycles) { tap_state_t saved_end_state = tap_get_end_state(); - + if (tap_get_state() != TAP_IDLE) { // enter into IDLE state vsllink_end_state(TAP_IDLE); vsllink_state_move(); } - + vsllink_stableclocks(num_cycles, 0); - + // post-process // set end_state vsllink_end_state(saved_end_state); @@ -1177,24 +1177,24 @@ tap_state_t saved_end_state; u8 bits_left, tms_tmp, tdi_len; int i; - + if (0 == scan_size ) { return; } - + tdi_len = ((scan_size + 7) >> 3); if ((tdi_len + 7) > VSLLINK_BufferSize) { LOG_ERROR("Your implementation of VSLLink has not enough buffer"); exit(-1); } - + saved_end_state = tap_get_end_state(); - + /* Move to appropriate scan state */ vsllink_end_state(ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT); - + if (vsllink_tms_data_len > 0) { if (tap_get_state() == tap_get_end_state()) @@ -1216,16 +1216,16 @@ tms_tmp = vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx]; *vsllink_tms_cmd_pos -= 2; } - + vsllink_tap_ensure_space(1, tdi_len + 7); - // VSLLINK_CMDJTAGSEQ_SCAN ored by 1 means that tms_before is valid + // VSLLINK_CMDJTAGSEQ_SCAN ored by 1 means that tms_before is valid // which is merged from the last tms shift command vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN | 1; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 0) & 0xff; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 8) & 0xff; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = tms_tmp; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = buffer[0] << (8 - vsllink_tms_data_len); - + for (i = 0; i < tdi_len; i++) { buffer[i] >>= 8 - vsllink_tms_data_len; @@ -1234,7 +1234,7 @@ buffer[i] += buffer[i + 1] << vsllink_tms_data_len; } } - + vsllink_tap_append_scan_normal(scan_size - vsllink_tms_data_len, buffer, command, vsllink_tms_data_len); scan_size -= 8 - vsllink_tms_data_len; vsllink_tms_data_len = 0; @@ -1243,31 +1243,31 @@ { vsllink_state_move(); vsllink_tap_ensure_space(1, tdi_len + 5); - + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tdi_len >> 0) & 0xff; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tdi_len >> 8) & 0xff; - + vsllink_tap_append_scan_normal(scan_size, buffer, command, 0); } } else { vsllink_tap_ensure_space(1, tdi_len + 7); - + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN | 1; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 0) & 0xff; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1)>> 8) & 0xff; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state()); vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 0; - + vsllink_tap_append_scan_normal(scan_size, buffer, command, 8); } vsllink_end_state(saved_end_state); - + bits_left = scan_size & 0x07; tap_set_state(ir_scan ? TAP_IRPAUSE : TAP_DRPAUSE); - + if (bits_left > 0) { vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 1 << (bits_left - 1); @@ -1276,7 +1276,7 @@ { vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 1 << 7; } - + if (tap_get_state() != tap_get_end_state()) { vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state()); @@ -1285,31 +1285,31 @@ { vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 0; } - + tap_set_state(tap_get_end_state()); } static void vsllink_scan_dma(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command) { tap_state_t saved_end_state; - + saved_end_state = tap_get_end_state(); - + /* Move to appropriate scan state */ vsllink_end_state(ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT); - + vsllink_state_move(); vsllink_end_state(saved_end_state); - + /* Scan */ vsllink_tap_append_scan_dma(scan_size, buffer, command); - + tap_set_state(ir_scan ? TAP_IRPAUSE : TAP_DRPAUSE); while (tap_length % 8 != 0) { // more 0s in Pause vsllink_tap_append_step(0, 0); } - + if (tap_get_state() != tap_get_end_state()) { vsllink_state_move(); @@ -1319,9 +1319,9 @@ static void vsllink_reset(int trst, int srst) { int result; - + LOG_DEBUG("trst: %i, srst: %i", trst, srst); - + /* Signals are active low */ vsllink_usb_out_buffer[0] = VSLLINK_CMD_SET_PORT; vsllink_usb_out_buffer[1] = JTAG_PINMSK_SRST | JTAG_PINMSK_TRST; @@ -1334,7 +1334,7 @@ { vsllink_usb_out_buffer[2] |= JTAG_PINMSK_TRST; } - + result = vsllink_usb_write(vsllink_jtag_handle, 3); if (result != 3) { @@ -1345,12 +1345,12 @@ static void vsllink_simple_command(u8 command) { int result; - + DEBUG_JTAG_IO("0x%02x", command); - + vsllink_usb_out_buffer[0] = command; result = vsllink_usb_write(vsllink_jtag_handle, 1); - + if (result != 1) { LOG_ERROR("VSLLink command 0x%02x failed (%d)", command, result); @@ -1359,19 +1359,19 @@ static int vsllink_register_commands(struct command_context_s *cmd_ctx) { - register_command(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command, + register_command(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_pid", vsllink_handle_usb_pid_command, + register_command(cmd_ctx, NULL, "vsllink_usb_pid", vsllink_handle_usb_pid_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", vsllink_handle_usb_bulkin_command, + register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", vsllink_handle_usb_bulkin_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", vsllink_handle_usb_bulkout_command, + register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", vsllink_handle_usb_bulkout_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_interface", vsllink_handle_usb_interface_command, + register_command(cmd_ctx, NULL, "vsllink_usb_interface", vsllink_handle_usb_interface_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_mode", vsllink_handle_mode_command, + register_command(cmd_ctx, NULL, "vsllink_mode", vsllink_handle_mode_command, COMMAND_CONFIG, NULL); - + return ERROR_OK; } @@ -1381,7 +1381,7 @@ LOG_ERROR("parameter error, should be one parameter for VID"); return ERROR_FAIL; } - + if (!strcmp(args[0], "normal")) { vsllink_mode = VSLLINK_MODE_NORMAL; @@ -1395,7 +1395,7 @@ LOG_ERROR("invalid vsllink_mode: %s", args[0]); return ERROR_FAIL; } - + return ERROR_OK; } @@ -1406,9 +1406,9 @@ LOG_ERROR("parameter error, should be one parameter for VID"); return ERROR_OK; } - + vsllink_usb_vid = strtol(args[0], NULL, 0); - + return ERROR_OK; } @@ -1419,9 +1419,9 @@ LOG_ERROR("parameter error, should be one parameter for PID"); return ERROR_OK; } - + vsllink_usb_pid = strtol(args[0], NULL, 0); - + return ERROR_OK; } @@ -1432,9 +1432,9 @@ LOG_ERROR("parameter error, should be one parameter for BULKIN endpoint"); return ERROR_OK; } - + vsllink_usb_bulkin = strtol(args[0], NULL, 0) | 0x80; - + return ERROR_OK; } @@ -1445,9 +1445,9 @@ LOG_ERROR("parameter error, should be one parameter for BULKOUT endpoint"); return ERROR_OK; } - + vsllink_usb_bulkout = strtol(args[0], NULL, 0); - + return ERROR_OK; } @@ -1458,9 +1458,9 @@ LOG_ERROR("parameter error, should be one parameter for interface number"); return ERROR_OK; } - + vsllink_usb_interface = strtol(args[0], NULL, 0); - + return ERROR_OK; } @@ -1483,7 +1483,7 @@ { int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length; int available_bytes = VSLLINK_BufferSize - vsllink_usb_out_buffer_idx; - + if (scans > available_scans || length > available_bytes) { vsllink_tap_execute(); @@ -1493,7 +1493,7 @@ { int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length; int available_bytes = tap_buffer_size * 8 - tap_length; - + if (scans > available_scans || length > available_bytes) { vsllink_tap_execute(); @@ -1504,12 +1504,12 @@ { last_tms = tms; int index = tap_length / 8; - + if (index < tap_buffer_size) { int bit_index = tap_length % 8; u8 bit = 1 << bit_index; - + if (tms) { tms_buffer[index] |= bit; @@ -1518,7 +1518,7 @@ { tms_buffer[index] &= ~bit; } - + if (tdi) { tdi_buffer[index] |= bit; @@ -1527,7 +1527,7 @@ { tdi_buffer[index] &= ~bit; } - + tap_length++; } else @@ -1540,7 +1540,7 @@ { pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length]; int i; - + if (offset > 0) { vsllink_usb_in_want_length += ((length + 7) >> 3) + 1; @@ -1553,19 +1553,19 @@ pending_scan_result->offset = offset; pending_scan_result->command = command; pending_scan_result->buffer = buffer; - + for (i = 0; i < ((length + 7) >> 3); i++) { vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = buffer[i]; } - + pending_scan_results_length++; } static void vsllink_tap_append_scan_dma(int length, u8 *buffer, scan_command_t *command) { pending_scan_result_t *pending_scan_result; int len_tmp, len_all, i; - + len_all = 0; while (len_all < length) { @@ -1577,20 +1577,20 @@ { len_tmp = length - len_all; } - + vsllink_tap_ensure_space(1, (len_tmp + 7) & ~7); - + pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length]; pending_scan_result->offset = tap_length; pending_scan_result->length = len_tmp; pending_scan_result->command = command; pending_scan_result->buffer = buffer + len_all / 8; - + for (i = 0; i < len_tmp; i++) { vsllink_tap_append_step(((len_all+i) < length-1 ? 0 : 1), (buffer[(len_all+i)/8] >> ((len_all+i)%8)) & 1); } - + pending_scan_results_length++; len_all += len_tmp; } @@ -1603,14 +1603,14 @@ int i; int result; int first = 0; - + if (vsllink_tms_data_len > 0) { if((tap_get_state() != TAP_RESET) && (tap_get_state() != TAP_IDLE) && (tap_get_state() != TAP_IRPAUSE) && (tap_get_state() != TAP_DRPAUSE)) { LOG_WARNING("%s is not in RESET or IDLE or PAUSR state", tap_state_name(tap_get_state())); } - + if (vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] & (1 << (vsllink_tms_data_len - 1))) { // last tms bit is '1' @@ -1626,7 +1626,7 @@ vsllink_tms_data_len = 0; } } - + if (vsllink_usb_out_buffer_idx > 3) { if (vsllink_usb_out_buffer[0] == VSLLINK_CMD_HW_JTAGSEQCMD) @@ -1634,9 +1634,9 @@ vsllink_usb_out_buffer[1] = (vsllink_usb_out_buffer_idx >> 0) & 0xff; vsllink_usb_out_buffer[2] = (vsllink_usb_out_buffer_idx >> 8) & 0xff; } - + result = vsllink_usb_message(vsllink_jtag_handle, vsllink_usb_out_buffer_idx, vsllink_usb_in_want_length); - + if (result == vsllink_usb_in_want_length) { for (i = 0; i < pending_scan_results_length; i++) @@ -1646,24 +1646,24 @@ int length = pending_scan_result->length; int offset = pending_scan_result->offset; scan_command_t *command = pending_scan_result->command; - + if (buffer != NULL) { // IRSHIFT or DRSHIFT buf_set_buf(vsllink_usb_in_buffer, first * 8 + offset, buffer, 0, length); first += (length + offset + 7) >> 3; - + DEBUG_JTAG_IO("JTAG scan read(%d bits):", length); #ifdef _DEBUG_JTAG_IO_ vsllink_debug_buffer(buffer, (length + 7) >> 3); #endif - + if (jtag_read_buffer(buffer, command) != ERROR_OK) { vsllink_tap_init(); return ERROR_JTAG_QUEUE_FAILED; } - + free(pending_scan_result->buffer); pending_scan_result->buffer = NULL; } @@ -1678,11 +1678,11 @@ LOG_ERROR("vsllink_tap_execute, wrong result %d, expected %d", result, vsllink_usb_in_want_length); return ERROR_JTAG_QUEUE_FAILED; } - + vsllink_tap_init(); } reset_command_pointer(); - + return ERROR_OK; } static int vsllink_tap_execute_dma(void) @@ -1690,7 +1690,7 @@ int byte_length; int i; int result; - + if (tap_length > 0) { /* Pad last byte so that tap_length is divisible by 8 */ @@ -1701,14 +1701,14 @@ vsllink_tap_append_step(last_tms, 0); } byte_length = tap_length / 8; - + vsllink_usb_out_buffer[0] = VSLLINK_CMD_HW_JTAGRAWCMD; vsllink_usb_out_buffer[1] = ((byte_length * 2 + 3) >> 0) & 0xff; // package size vsllink_usb_out_buffer[2] = ((byte_length * 2 + 3) >> 8) & 0xff; - + memcpy(&vsllink_usb_out_buffer[3], tdi_buffer, byte_length); memcpy(&vsllink_usb_out_buffer[3 + byte_length], tms_buffer, byte_length); - + result = vsllink_usb_message(vsllink_jtag_handle, 3 + 2 * byte_length, byte_length); if (result == byte_length) { @@ -1718,21 +1718,21 @@ u8 *buffer = pending_scan_result->buffer; int length = pending_scan_result->length; int first = pending_scan_result->offset; - + scan_command_t *command = pending_scan_result->command; buf_set_buf(vsllink_usb_in_buffer, first, buffer, 0, length); - + DEBUG_JTAG_IO("JTAG scan read(%d bits, from %d bits):", length, first); #ifdef _DEBUG_JTAG_IO_ vsllink_debug_buffer(buffer, (length + 7) >> 3); #endif - + if (jtag_read_buffer(buffer, command) != ERROR_OK) { vsllink_tap_init(); return ERROR_JTAG_QUEUE_FAILED; } - + if (pending_scan_result->buffer != NULL) { free(pending_scan_result->buffer); @@ -1744,10 +1744,10 @@ LOG_ERROR("vsllink_tap_execute, wrong result %d, expected %d", result, byte_length); return ERROR_JTAG_QUEUE_FAILED; } - + vsllink_tap_init(); } - + return ERROR_OK; } @@ -1760,19 +1760,19 @@ struct usb_bus *bus; struct usb_device *dev; int ret; - + vsllink_jtag_t *result; - + result = (vsllink_jtag_t*) malloc(sizeof(vsllink_jtag_t)); - + usb_init(); usb_find_busses(); usb_find_devices(); - + busses = usb_get_busses(); - + /* find vsllink_jtag device in usb bus */ - + for (bus = busses; bus; bus = bus->next) { for (dev = bus->devices; dev; dev = dev->next) @@ -1785,7 +1785,7 @@ LOG_ERROR("failed to open %04X:%04X, not enough permissions?", vsllink_usb_vid, vsllink_usb_pid); exit(-1); } - + /* usb_set_configuration required under win32 */ ret = usb_set_configuration(result->usb_handle, dev->config[0].bConfigurationValue); if (ret != 0) @@ -1799,19 +1799,19 @@ LOG_ERROR("fail to claim interface %d, %d returned", vsllink_usb_interface, ret); exit(-1); } - + #if 0 - /* + /* * This makes problems under Mac OS X. And is not needed * under Windows. Hopefully this will not break a linux build */ usb_set_altinterface(result->usb_handle, 0); -#endif +#endif return result; } } } - + free(result); return NULL; } @@ -1841,7 +1841,7 @@ static int vsllink_usb_message(vsllink_jtag_t *vsllink_jtag, int out_length, int in_length) { int result; - + result = vsllink_usb_write(vsllink_jtag, out_length); if (result == out_length) { @@ -1871,18 +1871,18 @@ static int vsllink_usb_write(vsllink_jtag_t *vsllink_jtag, int out_length) { int result; - + if (out_length > VSLLINK_BufferSize) { LOG_ERROR("vsllink_jtag_write illegal out_length=%d (max=%d)", out_length, VSLLINK_BufferSize); return -1; } - + result = usb_bulk_write(vsllink_jtag->usb_handle, vsllink_usb_bulkout, \ (char *)vsllink_usb_out_buffer, out_length, VSLLINK_USB_TIMEOUT); - + DEBUG_JTAG_IO("vsllink_usb_write, out_length = %d, result = %d", out_length, result); - + #ifdef _DEBUG_USB_COMMS_ LOG_DEBUG("USB out:"); vsllink_debug_buffer(vsllink_usb_out_buffer, out_length); @@ -1900,9 +1900,9 @@ { int result = usb_bulk_read(vsllink_jtag->usb_handle, vsllink_usb_bulkin, \ (char *)vsllink_usb_in_buffer, VSLLINK_BufferSize, VSLLINK_USB_TIMEOUT); - + DEBUG_JTAG_IO("vsllink_usb_read, result = %d", result); - + #ifdef _DEBUG_USB_COMMS_ LOG_DEBUG("USB in:"); vsllink_debug_buffer(vsllink_usb_in_buffer, result); @@ -1919,7 +1919,7 @@ char s[4]; int i; int j; - + for (i = 0; i < length; i += BYTES_PER_LINE) { snprintf(line, 5, "%04x", i); |
From: <zw...@ma...> - 2009-06-04 02:54:32
|
Author: zwelch Date: 2009-06-04 02:54:25 +0200 (Thu, 04 Jun 2009) New Revision: 2035 Modified: trunk/doc/openocd.texi Log: David Brownell <da...@pa...>: Convert the Interface/Dongle Config chapter's section on drivers to use the @deffn syntax, and integrate the presentation of the driver-specific commands with the relevant driver. Alphabetize. Cross-checked against the code ... several adapters were not listed, and a few commands weren't. (Maintainers for the versaloon and zy1000 drivers would be good candidates to add the commands missing from those sections...) Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-04 00:51:02 UTC (rev 2034) +++ trunk/doc/openocd.texi 2009-06-04 00:54:25 UTC (rev 2035) @@ -1302,40 +1302,27 @@ @node Interface - Dongle Configuration @chapter Interface - Dongle Configuration -Interface commands are normally found in an interface configuration -file which is sourced by your openocd.cfg file. These commands tell -OpenOCD what type of JTAG dongle you have and how to talk to it. -@section Simple Complete Interface Examples -@b{A Turtelizer FT2232 Based JTAG Dongle} -@verbatim -#interface -interface ft2232 -ft2232_device_desc "Turtelizer JTAG/RS232 Adapter A" -ft2232_layout turtelizer2 -ft2232_vid_pid 0x0403 0xbdc8 -@end verbatim -@b{A SEGGER Jlink} -@verbatim +JTAG Adapters/Interfaces/Dongles are normally configured +through commands in an interface configuration +file which is sourced by your @file{openocd.cfg} file, or +through a command line @option{-f interface/....cfg} option. + +@example +source [find interface/olimex-jtag-tiny.cfg] +@end example + +These commands tell +OpenOCD what type of JTAG adapter you have, and how to talk to it. +A few cases are so simple that you only need to say what driver to use: + +@example # jlink interface interface jlink -@end verbatim -@b{A Raisonance RLink} -@verbatim -# rlink interface -interface rlink -@end verbatim -@b{Parallel Port} -@verbatim -interface parport -parport_port 0xc8b8 -parport_cable wiggler -jtag_speed 0 -@end verbatim -@b{ARM-JTAG-EW} -@verbatim -interface arm-jtag-ew -@end verbatim +@end example +Most adapters need a bit more configuration than that. + + @section Interface Configuration The interface command tells OpenOCD what type of JTAG dongle you are @@ -1353,181 +1340,233 @@ @section Interface Drivers -Currently supported interface drivers are: +Each of the interface drivers listed here must be explicitly +enabled when OpenOCD is configured, in order to be made +available at run time. -@itemize @minus +@deffn {Interface Driver} {amt_jtagaccel} +Amontec Chameleon in its JTAG Accelerator configuration, +connected to a PC's EPP mode parallel port. +This defines some driver-specific commands: -@item @b{parport} -@* PC parallel port bit-banging (Wigglers, PLD download cable, ...) +@deffn {Config Command} {parport_port} number +Specifies either the address of the I/O port (default: 0x378 for LPT1) or +the number of the @file{/dev/parport} device. +@end deffn -@item @b{amt_jtagaccel} -@* Amontec Chameleon in its JTAG Accelerator configuration connected to a PC's EPP -mode parallel port +@deffn {Config Command} rtck [@option{enable}|@option{disable}] +Displays status of RTCK option. +Optionally sets that option first. +@end deffn +@end deffn -@item @b{ft2232} -@* FTDI FT2232 (USB) based devices using either the open-source libftdi or the binary only -FTD2XX driver. The FTD2XX is superior in performance, but not available on every -platform. The libftdi uses libusb, and should be portable to all systems that provide -libusb. +@deffn {Interface Driver} {arm-jtag-ew} +Olimex ARM-JTAG-EW USB adapter +This has one driver-specific command: -@item @b{ep93xx} -@*Cirrus Logic EP93xx based single-board computer bit-banging (in development) +@deffn Command {armjtagew_info} +Logs some status +@end deffn +@end deffn -@item @b{presto} -@* ASIX PRESTO USB JTAG programmer. +@deffn {Interface Driver} {at91rm9200} +Supports bitbanged JTAG from the local system, +presuming that system is an Atmel AT91rm9200 +and a specific set of GPIOs is used. +@c command: at91rm9200_device NAME +@c chooses among list of bit configs ... only one option +@end deffn -@item @b{usbprog} -@* usbprog is a freely programmable USB adapter. +@deffn {Interface Driver} {dummy} +A dummy software-only driver for debugging. +@end deffn -@item @b{gw16012} -@* Gateworks GW16012 JTAG programmer. +@deffn {Interface Driver} {ep93xx} +Cirrus Logic EP93xx based single-board computer bit-banging (in development) +@end deffn -@item @b{jlink} -@* Segger jlink USB adapter +@deffn {Interface Driver} {ft2232} +FTDI FT2232 (USB) based devices over one of the userspace libraries. +These interfaces have several commands, used to configure the driver +before initializing the JTAG scan chain: -@item @b{rlink} -@* Raisonance RLink USB adapter +@deffn {Config Command} {ft2232_device_desc} description +Provides the USB device description (the @emph{iProduct string}) +of the FTDI FT2232 device. If not +specified, the FTDI default value is used. This setting is only valid +if compiled with FTD2XX support. +@end deffn -@item @b{vsllink} -@* vsllink is part of Versaloon which is a versatile USB programmer. +@deffn {Config Command} {ft2232_serial} serial-number +Specifies the @var{serial-number} of the FTDI FT2232 device to use, +in case the vendor provides unique IDs and more than one FT2232 device +is connected to the host. +If not specified, serial numbers are not considered. +@end deffn -@item @b{arm-jtag-ew} -@* Olimex ARM-JTAG-EW USB adapter +@deffn {Config Command} {ft2232_layout} name +Each vendor's FT2232 device can use different GPIO signals +to control output-enables, reset signals, and LEDs. +Currently valid layout @var{name} values include: +@itemize @minus +@item @b{axm0432_jtag} Axiom AXM-0432 +@item @b{comstick} Hitex STR9 comstick +@item @b{cortino} Hitex Cortino JTAG interface +@item @b{evb_lm3s811} Luminary Micro EVB_LM3S811 as a JTAG interface +(bypassing onboard processor), no TRST or SRST signals on external connector +@item @b{flyswatter} Tin Can Tools Flyswatter +@item @b{icebear} ICEbear JTAG adapter from Section 5 +@item @b{jtagkey} Amontec JTAGkey and JTAGkey-Tiny (and compatibles) +@item @b{m5960} American Microsystems M5960 +@item @b{olimex-jtag} Olimex ARM-USB-OCD and ARM-USB-Tiny +@item @b{oocdlink} OOCDLink +@c oocdlink ~= jtagkey_prototype_v1 +@item @b{sheevaplug} Marvell Sheevaplug development kit +@item @b{signalyzer} Xverve Signalyzer +@item @b{stm32stick} Hitex STM32 Performance Stick +@item @b{turtelizer2} egnite Software turtelizer2 +@item @b{usbjtag} "USBJTAG-1" layout described in the OpenOCD diploma thesis @end itemize +@end deffn -@subsection parport options +@deffn {Config Command} {ft2232_vid_pid} [vid pid]+ +The vendor ID and product ID of the FTDI FT2232 device. If not specified, the FTDI +default values are used. +Currently, up to eight [@var{vid}, @var{pid}] pairs may be given, e.g. +@example +ft2232_vid_pid 0x0403 0xcff8 0x15ba 0x0003 +@end example +@end deffn -@itemize @bullet -@item @b{parport_port} <@var{number}> -@cindex parport_port -@*Either the address of the I/O port (default: 0x378 for LPT1) or the number of -the @file{/dev/parport} device +@deffn {Config Command} {ft2232_latency} ms +On some systems using FT2232 based JTAG interfaces the FT_Read function call in +ft2232_read() fails to return the expected number of bytes. This can be caused by +USB communication delays and has proved hard to reproduce and debug. Setting the +FT2232 latency timer to a larger value increases delays for short USB packets but it +also reduces the risk of timeouts before receiving the expected number of bytes. +The OpenOCD default value is 2 and for some systems a value of 10 has proved useful. +@end deffn -When using PPDEV to access the parallel port, use the number of the parallel port: -@option{parport_port 0} (the default). If @option{parport_port 0x378} is specified -you may encounter a problem. -@item @b{parport_cable} <@var{name}> -@cindex parport_cable -@*The layout of the parallel port cable used to connect to the target. -Currently supported cables are +For example, the interface config file for a +Turtelizer JTAG Adapter looks something like this: + +@example +interface ft2232 +ft2232_device_desc "Turtelizer JTAG/RS232 Adapter" +ft2232_layout turtelizer2 +ft2232_vid_pid 0x0403 0xbdc8 +@end example +@end deffn + +@deffn {Interface Driver} {gw16012} +Gateworks GW16012 JTAG programmer. +This has one driver-specific command: + +@deffn {Config Command} {parport_port} number +Specifies either the address of the I/O port (default: 0x378 for LPT1) or +the number of the @file{/dev/parport} device. +@end deffn +@end deffn + +@deffn {Interface Driver} {jlink} +Segger jlink USB adapter +@c command: jlink_info +@c dumps status +@c command: jlink_hw_jtag (2|3) +@c sets version 2 or 3 +@end deffn + +@deffn {Interface Driver} {parport} +Supports PC parallel port bit-banging cables: +Wigglers, PLD download cable, and more. +These interfaces have several commands, used to configure the driver +before initializing the JTAG scan chain: + +@deffn {Config Command} {parport_cable} name +The layout of the parallel port cable used to connect to the target. +Currently valid cable @var{name} values include: + @itemize @minus -@item @b{wiggler} -@cindex wiggler -The original Wiggler layout, also supported by several clones, such -as the Olimex ARM-JTAG -@item @b{wiggler2} -@cindex wiggler2 -Same as original wiggler except an led is fitted on D5. -@item @b{wiggler_ntrst_inverted} -@cindex wiggler_ntrst_inverted -Same as original wiggler except TRST is inverted. -@item @b{old_amt_wiggler} -@cindex old_amt_wiggler -The Wiggler configuration that comes with Amontec's Chameleon Programmer. The new -version available from the website uses the original Wiggler layout ('@var{wiggler}') -@item @b{chameleon} -@cindex chameleon -The Amontec Chameleon's CPLD when operated in configuration mode. This is only used to +@item @b{altium} Altium Universal JTAG cable. +@item @b{arm-jtag} Same as original wiggler except SRST and +TRST connections reversed and TRST is also inverted. +@item @b{chameleon} The Amontec Chameleon's CPLD when operated +in configuration mode. This is only used to program the Chameleon itself, not a connected target. -@item @b{dlc5} -@cindex dlc5 -The Xilinx Parallel cable III. -@item @b{triton} -@cindex triton -The parallel port adapter found on the 'Karo Triton 1 Development Board'. +@item @b{dlc5} The Xilinx Parallel cable III. +@item @b{flashlink} The ST Parallel cable. +@item @b{lattice} Lattice ispDOWNLOAD Cable +@item @b{old_amt_wiggler} The Wiggler configuration that comes with +some versions of +Amontec's Chameleon Programmer. The new version available from +the website uses the original Wiggler layout ('@var{wiggler}') +@item @b{triton} The parallel port adapter found on the +``Karo Triton 1 Development Board''. This is also the layout used by the HollyGates design (see @uref{http://www.lartmaker.nl/projects/jtag/}). -@item @b{flashlink} -@cindex flashlink -The ST Parallel cable. -@item @b{arm-jtag} -@cindex arm-jtag -Same as original wiggler except SRST and TRST connections reversed and -TRST is also inverted. -@item @b{altium} -@cindex altium -Altium Universal JTAG cable. +@item @b{wiggler} The original Wiggler layout, also supported by +several clones, such as the Olimex ARM-JTAG +@item @b{wiggler2} Same as original wiggler except an led is fitted on D5. +@item @b{wiggler_ntrst_inverted} Same as original wiggler except TRST is inverted. @end itemize -@item @b{parport_write_on_exit} <@var{on}|@var{off}> -@cindex parport_write_on_exit -@*This will configure the parallel driver to write a known value to the parallel -interface on exiting OpenOCD -@end itemize +@end deffn -@subsection amt_jtagaccel options -@itemize @bullet -@item @b{parport_port} <@var{number}> -@cindex parport_port -@*Either the address of the I/O port (default: 0x378 for LPT1) or the number of the -@file{/dev/parport} device -@end itemize -@subsection ft2232 options +@deffn {Config Command} {parport_port} number +Either the address of the I/O port (default: 0x378 for LPT1) or the number of +the @file{/dev/parport} device -@itemize @bullet -@item @b{ft2232_device_desc} <@var{description}> -@cindex ft2232_device_desc -@*The USB device description of the FTDI FT2232 device. If not -specified, the FTDI default value is used. This setting is only valid -if compiled with FTD2XX support. +When using PPDEV to access the parallel port, use the number of the parallel port: +@option{parport_port 0} (the default). If @option{parport_port 0x378} is specified +you may encounter a problem. +@end deffn -@b{TODO:} Confirm the following: On Windows the name needs to end with -a ``space A''? Or not? It has to do with the FTD2xx driver. When must -this be added and when must it not be added? Why can't the code in the -interface or in OpenOCD automatically add this if needed? -- Duane. +@deffn {Config Command} {parport_write_on_exit} (on|off) +This will configure the parallel driver to write a known +cable-specific value to the parallel interface on exiting OpenOCD +@end deffn -@item @b{ft2232_serial} <@var{serial-number}> -@cindex ft2232_serial -@*The serial number of the FTDI FT2232 device. If not specified, the FTDI default -values are used. -@item @b{ft2232_layout} <@var{name}> -@cindex ft2232_layout -@*The layout of the FT2232 GPIO signals used to control output-enables and reset -signals. Valid layouts are -@itemize @minus -@item @b{usbjtag} -"USBJTAG-1" layout described in the original OpenOCD diploma thesis -@item @b{jtagkey} -Amontec JTAGkey and JTAGkey-Tiny -@item @b{signalyzer} -Signalyzer -@item @b{olimex-jtag} -Olimex ARM-USB-OCD -@item @b{m5960} -American Microsystems M5960 -@item @b{evb_lm3s811} -Luminary Micro EVB_LM3S811 as a JTAG interface (not onboard processor), no TRST or -SRST signals on external connector -@item @b{comstick} -Hitex STR9 comstick -@item @b{stm32stick} -Hitex STM32 Performance Stick -@item @b{flyswatter} -Tin Can Tools Flyswatter -@item @b{turtelizer2} -egnite Software turtelizer2 -@item @b{oocdlink} -OOCDLink -@item @b{axm0432_jtag} -Axiom AXM-0432 -@item @b{cortino} -Hitex Cortino JTAG interface -@end itemize +For example, the interface configuration file for a +classic ``Wiggler'' cable might look something like this: -@item @b{ft2232_vid_pid} <@var{vid}> <@var{pid}> -@*The vendor ID and product ID of the FTDI FT2232 device. If not specified, the FTDI -default values are used. Multiple <@var{vid}>, <@var{pid}> pairs may be given, e.g. @example -ft2232_vid_pid 0x0403 0xcff8 0x15ba 0x0003 +interface parport +parport_port 0xc8b8 +parport_cable wiggler @end example -@item @b{ft2232_latency} <@var{ms}> -@*On some systems using FT2232 based JTAG interfaces the FT_Read function call in -ft2232_read() fails to return the expected number of bytes. This can be caused by -USB communication delays and has proved hard to reproduce and debug. Setting the -FT2232 latency timer to a larger value increases delays for short USB packets but it -also reduces the risk of timeouts before receiving the expected number of bytes. -The OpenOCD default value is 2 and for some systems a value of 10 has proved useful. -@end itemize +@end deffn +@deffn {Interface Driver} {presto} +ASIX PRESTO USB JTAG programmer. +@c command: presto_serial str +@c sets serial number +@end deffn + +@deffn {Interface Driver} {rlink} +Raisonance RLink USB adapter +@end deffn + +@deffn {Interface Driver} {usbprog} +usbprog is a freely programmable USB adapter. +@end deffn + +@deffn {Interface Driver} {vsllink} +vsllink is part of Versaloon which is a versatile USB programmer. + +@quotation Note +This defines quite a few driver-specific commands, +which are not currently documented here. +@end quotation +@end deffn + +@deffn {Interface Driver} {ZY1000} +This is the Zylin ZY1000 JTAG debugger. + +@quotation Note +This defines some driver-specific commands, +which are not currently documented here. +@end quotation +@end deffn + @anchor{JTAG Speed} @section JTAG Speed JTAG clock setup is part of system setup. |