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
|
Sep
|
Oct
|
Nov
|
Dec
|
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:51:13
|
Author: kc8apf Date: 2009-05-20 06:51:08 +0200 (Wed, 20 May 2009) New Revision: 1843 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - move scan_size in interface_jtag_add_ir_scan() into the scope of the inner loop and change it to unsigned Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-20 04:49:53 UTC (rev 1842) +++ trunk/src/jtag/jtag.c 2009-05-20 04:51:08 UTC (rev 1843) @@ -600,7 +600,6 @@ { jtag_tap_t *tap; int nth_tap; - int scan_size = 0; int num_taps = jtag_NumEnabledTaps(); @@ -631,7 +630,7 @@ assert(nth_tap < num_taps); - scan_size = tap->ir_length; + size_t scan_size = tap->ir_length; scan->fields[nth_tap].tap = tap; scan->fields[nth_tap].num_bits = scan_size; scan->fields[nth_tap].in_value = NULL; /* do not collect input for tap's in bypass */ |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:50:25
|
Author: kc8apf Date: 2009-05-20 06:49:53 +0200 (Wed, 20 May 2009) New Revision: 1842 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - simplify code in interface_jtag_add_ir_scan() by adding a local variable 'scan' to hold the scan_command_t Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-20 04:48:11 UTC (rev 1841) +++ trunk/src/jtag/jtag.c 2009-05-20 04:49:53 UTC (rev 1842) @@ -589,6 +589,13 @@ } } +/** + * Generate a list of scan fields with one entry for each TAP. + * + * If the input field list contains an instruction value for a TAP then that is used + * otherwise the TAP is set to bypass. + * + */ int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { jtag_tap_t *tap; @@ -597,20 +604,19 @@ int num_taps = jtag_NumEnabledTaps(); - /* allocate memory for a new list member */ - jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + jtag_queue_command(cmd); - - cmd->type = JTAG_SCAN; - /* allocate memory for ir scan command */ - cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); - cmd->cmd.scan->ir_scan = true; - cmd->cmd.scan->num_fields = num_taps; /* one field per device */ - cmd->cmd.scan->fields = cmd_queue_alloc(num_taps * sizeof(scan_field_t)); - cmd->cmd.scan->end_state = state; + cmd->type = JTAG_SCAN; + cmd->cmd.scan = scan; + scan->ir_scan = true; + scan->num_fields = num_taps; /* one field per device */ + scan->fields = cmd_queue_alloc(num_taps * sizeof(scan_field_t)); + scan->end_state = state; + nth_tap = -1; tap = NULL; for(;;){ @@ -625,10 +631,10 @@ assert(nth_tap < num_taps); - scan_size = tap->ir_length; - cmd->cmd.scan->fields[nth_tap].tap = tap; - cmd->cmd.scan->fields[nth_tap].num_bits = scan_size; - cmd->cmd.scan->fields[nth_tap].in_value = NULL; /* do not collect input for tap's in bypass */ + scan_size = tap->ir_length; + scan->fields[nth_tap].tap = tap; + scan->fields[nth_tap].num_bits = scan_size; + scan->fields[nth_tap].in_value = NULL; /* do not collect input for tap's in bypass */ /* search the list */ for (int j = 0; j < in_num_fields; j++) @@ -636,8 +642,8 @@ if (tap == in_fields[j].tap) { found = 1; - cmd->cmd.scan->fields[nth_tap].in_value = in_fields[j].in_value; - cmd->cmd.scan->fields[nth_tap].out_value = buf_cpy(in_fields[j].out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + scan->fields[nth_tap].in_value = in_fields[j].in_value; + scan->fields[nth_tap].out_value = buf_cpy(in_fields[j].out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); tap->bypass = 0; break; @@ -647,12 +653,12 @@ if (!found) { /* if a tap isn't listed, set it to BYPASS */ - cmd->cmd.scan->fields[nth_tap].out_value = buf_set_ones(cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + scan->fields[nth_tap].out_value = buf_set_ones(cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); tap->bypass = 1; } /* update device information */ - buf_cpy(cmd->cmd.scan->fields[nth_tap].out_value, tap->cur_instr, scan_size); + buf_cpy(scan->fields[nth_tap].out_value, tap->cur_instr, scan_size); } assert(nth_tap == (num_taps - 1)); |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:48:24
|
Author: kc8apf Date: 2009-05-20 06:48:11 +0200 (Wed, 20 May 2009) New Revision: 1841 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - rename local variable x to num_taps in interface_jtag_add_ir_scan Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-20 04:47:20 UTC (rev 1840) +++ trunk/src/jtag/jtag.c 2009-05-20 04:48:11 UTC (rev 1841) @@ -592,10 +592,11 @@ int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { jtag_tap_t *tap; - int x; int nth_tap; int scan_size = 0; + int num_taps = jtag_NumEnabledTaps(); + /* allocate memory for a new list member */ jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -606,9 +607,8 @@ /* allocate memory for ir scan command */ cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); cmd->cmd.scan->ir_scan = true; - x = jtag_NumEnabledTaps(); - cmd->cmd.scan->num_fields = x; /* one field per device */ - cmd->cmd.scan->fields = cmd_queue_alloc(x * sizeof(scan_field_t)); + cmd->cmd.scan->num_fields = num_taps; /* one field per device */ + cmd->cmd.scan->fields = cmd_queue_alloc(num_taps * sizeof(scan_field_t)); cmd->cmd.scan->end_state = state; nth_tap = -1; @@ -623,7 +623,7 @@ } nth_tap++; - assert(nth_tap < x ); + assert(nth_tap < num_taps); scan_size = tap->ir_length; cmd->cmd.scan->fields[nth_tap].tap = tap; @@ -654,8 +654,9 @@ /* update device information */ buf_cpy(cmd->cmd.scan->fields[nth_tap].out_value, tap->cur_instr, scan_size); } - assert(nth_tap == (x-1)); + assert(nth_tap == (num_taps - 1)); + return ERROR_OK; } |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:47:36
|
Author: kc8apf Date: 2009-05-20 06:47:20 +0200 (Wed, 20 May 2009) New Revision: 1840 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - rename input parameters 'num_fields' and 'fields' to 'in_num_fields' and 'in_fields' in all jtag.c interface functions Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-19 18:30:01 UTC (rev 1839) +++ trunk/src/jtag/jtag.c 2009-05-20 04:47:20 UTC (rev 1840) @@ -37,8 +37,8 @@ int jtag_flush_queue_count; /* count # of flushes for profiling / debugging purposes */ -static void jtag_add_scan_check(void (*jtag_add_scan)(int num_fields, scan_field_t *fields, tap_state_t state), - int num_fields, scan_field_t *fields, tap_state_t state); +static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state), + int in_num_fields, scan_field_t *in_fields, tap_state_t state); /* note that this is not marked as static as it must be available from outside jtag.c for those that implement the jtag_xxx() minidriver layer @@ -554,45 +554,44 @@ cmd_queue_cur_state = cmd_queue_end_state; } -void jtag_add_ir_scan_noverify(int num_fields, scan_field_t *fields, tap_state_t state) +void jtag_add_ir_scan_noverify(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { int retval; jtag_prelude(state); - retval=interface_jtag_add_ir_scan(num_fields, fields, cmd_queue_end_state); + retval=interface_jtag_add_ir_scan(in_num_fields, in_fields, cmd_queue_end_state); if (retval!=ERROR_OK) jtag_error=retval; } -void jtag_add_ir_scan(int num_fields, scan_field_t *fields, tap_state_t state) +void jtag_add_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { if (jtag_verify&&jtag_verify_capture_ir) { /* 8 x 32 bit id's is enough for all invoations */ - int j; - for (j = 0; j < num_fields; j++) + + for (int j = 0; j < in_num_fields; j++) { - fields[j].check_value=NULL; - fields[j].check_mask=NULL; + in_fields[j].check_value=NULL; + in_fields[j].check_mask=NULL; /* if we are to run a verification of the ir scan, we need to get the input back. * We may have to allocate space if the caller didn't ask for the input back. */ - fields[j].check_value=fields[j].tap->expected; - fields[j].check_mask=fields[j].tap->expected_mask; + in_fields[j].check_value=in_fields[j].tap->expected; + in_fields[j].check_mask=in_fields[j].tap->expected_mask; } - jtag_add_scan_check(jtag_add_ir_scan_noverify, num_fields, fields, state); + jtag_add_scan_check(jtag_add_ir_scan_noverify, in_num_fields, in_fields, state); } else { - jtag_add_ir_scan_noverify(num_fields, fields, state); + jtag_add_ir_scan_noverify(in_num_fields, in_fields, state); } } -int MINIDRIVER(interface_jtag_add_ir_scan)(int num_fields, scan_field_t *fields, tap_state_t state) +int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { jtag_tap_t *tap; - int j; int x; int nth_tap; int scan_size = 0; @@ -632,13 +631,13 @@ cmd->cmd.scan->fields[nth_tap].in_value = NULL; /* do not collect input for tap's in bypass */ /* search the list */ - for (j = 0; j < num_fields; j++) + for (int j = 0; j < in_num_fields; j++) { - if (tap == fields[j].tap) + if (tap == in_fields[j].tap) { found = 1; - cmd->cmd.scan->fields[nth_tap].in_value = fields[j].in_value; - cmd->cmd.scan->fields[nth_tap].out_value = buf_cpy(fields[j].out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + cmd->cmd.scan->fields[nth_tap].in_value = in_fields[j].in_value; + cmd->cmd.scan->fields[nth_tap].out_value = buf_cpy(in_fields[j].out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); tap->bypass = 0; break; @@ -660,18 +659,18 @@ return ERROR_OK; } -void jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, tap_state_t state) +void jtag_add_plain_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { int retval; jtag_prelude(state); - retval=interface_jtag_add_plain_ir_scan(num_fields, fields, cmd_queue_end_state); + retval=interface_jtag_add_plain_ir_scan(in_num_fields, in_fields, cmd_queue_end_state); if (retval!=ERROR_OK) jtag_error=retval; } -int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int num_fields, scan_field_t *fields, tap_state_t state) +int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { /* allocate memory for a new list member */ @@ -684,30 +683,30 @@ /* allocate memory for ir scan command */ cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); cmd->cmd.scan->ir_scan = true; - cmd->cmd.scan->num_fields = num_fields; - cmd->cmd.scan->fields = cmd_queue_alloc(num_fields * sizeof(scan_field_t)); + cmd->cmd.scan->num_fields = in_num_fields; + cmd->cmd.scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); cmd->cmd.scan->end_state = state; - for (int i = 0; i < num_fields; i++) + for (int i = 0; i < in_num_fields; i++) { - int num_bits = fields[i].num_bits; - int num_bytes = CEIL(fields[i].num_bits, 8); - cmd->cmd.scan->fields[i].tap = fields[i].tap; + int num_bits = in_fields[i].num_bits; + int num_bytes = CEIL(in_fields[i].num_bits, 8); + cmd->cmd.scan->fields[i].tap = in_fields[i].tap; cmd->cmd.scan->fields[i].num_bits = num_bits; - cmd->cmd.scan->fields[i].out_value = buf_cpy(fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); - cmd->cmd.scan->fields[i].in_value = fields[i].in_value; + cmd->cmd.scan->fields[i].out_value = buf_cpy(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); + cmd->cmd.scan->fields[i].in_value = in_fields[i].in_value; } return ERROR_OK; } -void jtag_add_dr_scan(int num_fields, scan_field_t *fields, tap_state_t state) +void jtag_add_dr_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { int retval; jtag_prelude(state); - retval=interface_jtag_add_dr_scan(num_fields, fields, cmd_queue_end_state); + retval=interface_jtag_add_dr_scan(in_num_fields, in_fields, cmd_queue_end_state); if (retval!=ERROR_OK) jtag_error=retval; } @@ -720,65 +719,68 @@ return jtag_check_value_inner(in, (u8 *)data1, (u8 *)data2, (int)data3); } -static void jtag_add_scan_check(void (*jtag_add_scan)(int num_fields, scan_field_t *fields, tap_state_t state), - int num_fields, scan_field_t *fields, tap_state_t state) +static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state), + int in_num_fields, scan_field_t *in_fields, tap_state_t state) { - for (int i=0; i<num_fields; i++) + for (int i = 0; i < in_num_fields; i++) { - fields[i].allocated=0; - fields[i].modified=0; - if ((fields[i].check_value!=NULL)&&(fields[i].in_value==NULL)) + in_fields[i].allocated = 0; + in_fields[i].modified = 0; + if ((in_fields[i].check_value != NULL) && (in_fields[i].in_value == NULL)) { - fields[i].modified=1; + in_fields[i].modified = 1; /* we need storage space... */ #ifdef HAVE_JTAG_MINIDRIVER_H - if (fields[i].num_bits<=32) + if (in_fields[i].num_bits <= 32) { /* This is enough space and we're executing this synchronously */ - fields[i].in_value=fields[i].intmp; + in_fields[i].in_value = in_fields[i].intmp; } else { - fields[i].in_value=(u8 *)malloc(CEIL(fields[i].num_bits, 8)); - fields[i].allocated=1; + in_fields[i].in_value = (u8 *)malloc(CEIL(in_fields[i].num_bits, 8)); + in_fields[i].allocated = 1; } #else - fields[i].in_value=(u8 *)cmd_queue_alloc(CEIL(fields[i].num_bits, 8)); + in_fields[i].in_value = (u8 *)cmd_queue_alloc(CEIL(in_fields[i].num_bits, 8)); #endif } } - jtag_add_scan(num_fields, fields, state); + jtag_add_scan(in_num_fields, in_fields, state); - for (int i=0; i<num_fields; i++) + for (int i = 0; i < in_num_fields; i++) { - if ((fields[i].check_value!=NULL)&&(fields[i].in_value!=NULL)) + if ((in_fields[i].check_value != NULL) && (in_fields[i].in_value != NULL)) { /* this is synchronous for a minidriver */ - jtag_add_callback4(jtag_check_value_mask_callback, fields[i].in_value, (jtag_callback_data_t)fields[i].check_value, (jtag_callback_data_t)fields[i].check_mask, (jtag_callback_data_t)fields[i].num_bits); + jtag_add_callback4(jtag_check_value_mask_callback, in_fields[i].in_value, + (jtag_callback_data_t)in_fields[i].check_value, + (jtag_callback_data_t)in_fields[i].check_mask, + (jtag_callback_data_t)in_fields[i].num_bits); } - if (fields[i].allocated) + if (in_fields[i].allocated) { - free(fields[i].in_value); + free(in_fields[i].in_value); } - if (fields[i].modified) + if (in_fields[i].modified) { - fields[i].in_value=NULL; + in_fields[i].in_value = NULL; } } } -void jtag_add_dr_scan_check(int num_fields, scan_field_t *fields, tap_state_t state) +void jtag_add_dr_scan_check(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { if (jtag_verify) { - jtag_add_scan_check(jtag_add_dr_scan, num_fields, fields, state); + jtag_add_scan_check(jtag_add_dr_scan, in_num_fields, in_fields, state); } else { - jtag_add_dr_scan(num_fields, fields, state); + jtag_add_dr_scan(in_num_fields, in_fields, state); } } -int MINIDRIVER(interface_jtag_add_dr_scan)(int num_fields, scan_field_t *fields, tap_state_t state) +int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { int j; int nth_tap; @@ -812,8 +814,8 @@ /* allocate memory for dr scan command */ cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); cmd->cmd.scan->ir_scan = false; - cmd->cmd.scan->num_fields = num_fields + bypass_devices; - cmd->cmd.scan->fields = cmd_queue_alloc((num_fields + bypass_devices) * sizeof(scan_field_t)); + cmd->cmd.scan->num_fields = in_num_fields + bypass_devices; + cmd->cmd.scan->fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t)); cmd->cmd.scan->end_state = state; tap = NULL; @@ -827,15 +829,15 @@ int found = 0; cmd->cmd.scan->fields[field_count].tap = tap; - for (j = 0; j < num_fields; j++) + for (j = 0; j < in_num_fields; j++) { - if (tap == fields[j].tap) + if (tap == in_fields[j].tap) { found = 1; - scan_size = fields[j].num_bits; + scan_size = in_fields[j].num_bits; cmd->cmd.scan->fields[field_count].num_bits = scan_size; - cmd->cmd.scan->fields[field_count].out_value = buf_cpy(fields[j].out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); - cmd->cmd.scan->fields[field_count].in_value = fields[j].in_value; + cmd->cmd.scan->fields[field_count].out_value = buf_cpy(in_fields[j].out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + cmd->cmd.scan->fields[field_count].in_value = in_fields[j].in_value; field_count++; } } @@ -874,7 +876,7 @@ } void MINIDRIVER(interface_jtag_add_dr_out)(jtag_tap_t *target_tap, - int num_fields, + int in_num_fields, const int *num_bits, const u32 *value, tap_state_t end_state) @@ -909,8 +911,8 @@ /* allocate memory for dr scan command */ cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); cmd->cmd.scan->ir_scan = false; - cmd->cmd.scan->num_fields = num_fields + bypass_devices; - cmd->cmd.scan->fields = cmd_queue_alloc((num_fields + bypass_devices) * sizeof(scan_field_t)); + cmd->cmd.scan->num_fields = in_num_fields + bypass_devices; + cmd->cmd.scan->fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t)); cmd->cmd.scan->end_state = end_state; tap = NULL; @@ -934,7 +936,7 @@ exit(-1); } #endif - for (j = 0; j < num_fields; j++) + for (j = 0; j < in_num_fields; j++) { u8 out_value[4]; scan_size = num_bits[j]; @@ -963,18 +965,18 @@ } } -void jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, tap_state_t state) +void jtag_add_plain_dr_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { int retval; jtag_prelude(state); - retval=interface_jtag_add_plain_dr_scan(num_fields, fields, cmd_queue_end_state); + retval=interface_jtag_add_plain_dr_scan(in_num_fields, in_fields, cmd_queue_end_state); if (retval!=ERROR_OK) jtag_error=retval; } -int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int num_fields, scan_field_t *fields, tap_state_t state) +int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { /* allocate memory for a new list member */ jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -986,18 +988,18 @@ /* allocate memory for scan command */ cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); cmd->cmd.scan->ir_scan = false; - cmd->cmd.scan->num_fields = num_fields; - cmd->cmd.scan->fields = cmd_queue_alloc(num_fields * sizeof(scan_field_t)); + cmd->cmd.scan->num_fields = in_num_fields; + cmd->cmd.scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); cmd->cmd.scan->end_state = state; - for (int i = 0; i < num_fields; i++) + for (int i = 0; i < in_num_fields; i++) { - int num_bits = fields[i].num_bits; - int num_bytes = CEIL(fields[i].num_bits, 8); - cmd->cmd.scan->fields[i].tap = fields[i].tap; + int num_bits = in_fields[i].num_bits; + int num_bytes = CEIL(in_fields[i].num_bits, 8); + cmd->cmd.scan->fields[i].tap = in_fields[i].tap; cmd->cmd.scan->fields[i].num_bits = num_bits; - cmd->cmd.scan->fields[i].out_value = buf_cpy(fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); - cmd->cmd.scan->fields[i].in_value = fields[i].in_value; + cmd->cmd.scan->fields[i].out_value = buf_cpy(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); + cmd->cmd.scan->fields[i].in_value = in_fields[i].in_value; } return ERROR_OK; |
From: <zw...@ma...> - 2009-05-19 20:30:06
|
Author: zwelch Date: 2009-05-19 20:30:01 +0200 (Tue, 19 May 2009) New Revision: 1839 Modified: trunk/doc/openocd.texi Log: Wookey <wo...@wo...>: add user documentation for echo command. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-05-19 17:57:44 UTC (rev 1838) +++ trunk/doc/openocd.texi 2009-05-19 18:30:01 UTC (rev 1839) @@ -2588,6 +2588,10 @@ openocd -c "fast enable" -c "interface dummy" -f target/str710.cfg @end example +@subsection echo <@var{message}> +@cindex echo +@*Output message to stdio. e.g. echo "Programming - please wait" + @subsection log_output <@var{file}> @cindex log_output @*Redirect logging to <file> (default: stderr) |
From: <mi...@ma...> - 2009-05-19 19:58:01
|
Author: mifi Date: 2009-05-19 19:57:44 +0200 (Tue, 19 May 2009) New Revision: 1838 Modified: trunk/src/target/target/lpc2294.cfg Log: Added jtag_nsrst_delay 200 and jtag_ntrst_delay 200 to the LPC2294 target. Modified: trunk/src/target/target/lpc2294.cfg =================================================================== --- trunk/src/target/target/lpc2294.cfg 2009-05-19 14:36:04 UTC (rev 1837) +++ trunk/src/target/target/lpc2294.cfg 2009-05-19 17:57:44 UTC (rev 1838) @@ -17,6 +17,9 @@ set _CPUTAPID 0xffffffff } +jtag_nsrst_delay 200 +jtag_ntrst_delay 200 + #use combined on interfaces or targets that can't set TRST/SRST separately reset_config trst_and_srst srst_pulls_trst |
From: <oh...@ma...> - 2009-05-19 16:36:06
|
Author: oharboe Date: 2009-05-19 16:36:04 +0200 (Tue, 19 May 2009) New Revision: 1837 Modified: trunk/src/helper/ioutil.c Log: fix warnings Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-05-19 11:53:05 UTC (rev 1836) +++ trunk/src/helper/ioutil.c 2009-05-19 14:36:04 UTC (rev 1837) @@ -218,6 +218,7 @@ return ERROR_INVALID_ARGUMENTS; } + int retval=ERROR_FAIL; FILE *config_file = NULL; config_file = fopen(args[0], "a"); if (config_file != NULL) @@ -227,17 +228,22 @@ for (i = 1; i < argc; i++) { - fwrite(args[i], strlen(args[i]), 1, config_file); + if (fwrite(args[i], strlen(args[i]), 1, config_file)!=strlen(args[i])) + break; if (i != argc - 1) { - fwrite(" ", 1, 1, config_file); + if (fwrite(" ", 1, 1, config_file)!=1) + break; } } - fwrite("\n", 1, 1, config_file); + if ((i==argc)&&(fwrite("\n", 1, 1, config_file)==1)) + { + retval=ERROR_OK; + } fclose(config_file); } - return ERROR_OK; + return retval; } |
From: oharboe at B. <oh...@ma...> - 2009-05-19 13:53:09
|
Author: oharboe Date: 2009-05-19 13:53:05 +0200 (Tue, 19 May 2009) New Revision: 1836 Modified: trunk/src/target/target/pxa270.cfg Log: Wookey <wo...@wo...> update syntax Modified: trunk/src/target/target/pxa270.cfg =================================================================== --- trunk/src/target/target/pxa270.cfg 2009-05-19 10:04:41 UTC (rev 1835) +++ trunk/src/target/target/pxa270.cfg 2009-05-19 11:53:05 UTC (rev 1836) @@ -12,6 +12,9 @@ set _ENDIAN little } +#IDs for pxa270. Choose one. Are there others?# +#set CPUTAPID 0x79265013 +#set CPUTAPID 0x49265013 if { [info exists CPUTAPID ] } { set _CPUTAPID $CPUTAPID } else { @@ -26,11 +29,7 @@ # set the jtag_ntrst_delay to the delay introduced by a reset circuit # the rest of the needed delays are built into the openocd program jtag_ntrst_delay 0 -#use combined on interfaces or targets that can't set TRST/SRST separately -reset_config trst_and_srst separate -#jtag scan chain - set _TARGETNAME [format "%s.cpu" $_CHIPNAME] jtag newtap $_CHIPNAME cpu -irlen 7 -ircapture 0x1 -irmask 0x7f -expected-id $_CPUTAPID @@ -38,7 +37,3 @@ # maps to PXA internal RAM. If you are using a PXA255 # you must initialize SDRAM or leave this option off $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x5c000000 -work-area-size 0x10000 -work-area-backup 0 - -#flash bank <driver> <base> <size> <chip_width> <bus_width> -# works for P30 flash -flash bank cfi 0x00000000 0x1000000 2 4 0 |
From: oharboe at B. <oh...@ma...> - 2009-05-19 12:04:41
|
Author: oharboe Date: 2009-05-19 12:04:41 +0200 (Tue, 19 May 2009) New Revision: 1835 Modified: trunk/src/flash/nand.c trunk/src/flash/nand.h Log: David Brownell <da...@pa...> NAND: update ids, "nand list" bugfix Modified: trunk/src/flash/nand.c =================================================================== --- trunk/src/flash/nand.c 2009-05-19 06:59:20 UTC (rev 1834) +++ trunk/src/flash/nand.c 2009-05-19 10:04:41 UTC (rev 1835) @@ -86,6 +86,7 @@ */ static nand_info_t nand_flash_ids[] = { + /* start "museum" IDs */ {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0}, {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0}, {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0}, @@ -101,6 +102,7 @@ {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0}, {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16}, {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16}, + /* end "museum" IDs */ {"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, 0}, {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, 0}, @@ -172,6 +174,7 @@ {NAND_MFR_RENESAS, "Renesas"}, {NAND_MFR_STMICRO, "ST Micro"}, {NAND_MFR_HYNIX, "Hynix"}, + {NAND_MFR_MICRON, "Micron"}, {0x0, NULL}, }; @@ -1062,7 +1065,7 @@ int handle_nand_list_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { nand_device_t *p; - int i = 0; + int i; if (!nand_devices) { @@ -1070,13 +1073,13 @@ return ERROR_OK; } - for (p = nand_devices; p; p = p->next) + for (p = nand_devices, i = 0; p; p = p->next, i++) { if (p->device) command_print(cmd_ctx, "#%i: %s (%s) pagesize: %i, buswidth: %i, erasesize: %i", - i++, p->device->name, p->manufacturer->name, p->page_size, p->bus_width, p->erase_size); + i, p->device->name, p->manufacturer->name, p->page_size, p->bus_width, p->erase_size); else - command_print(cmd_ctx, "#%i: not probed"); + command_print(cmd_ctx, "#%i: not probed", i); } return ERROR_OK; Modified: trunk/src/flash/nand.h =================================================================== --- trunk/src/flash/nand.h 2009-05-19 06:59:20 UTC (rev 1834) +++ trunk/src/flash/nand.h 2009-05-19 10:04:41 UTC (rev 1835) @@ -95,6 +95,7 @@ NAND_MFR_RENESAS = 0x07, NAND_MFR_STMICRO = 0x20, NAND_MFR_HYNIX = 0xad, + NAND_MFR_MICRON = 0x2c, }; typedef struct nand_manufacturer_s |
From: oharboe at B. <oh...@ma...> - 2009-05-19 08:59:26
|
Author: oharboe Date: 2009-05-19 08:59:20 +0200 (Tue, 19 May 2009) New Revision: 1834 Modified: trunk/src/jtag/jtag.c Log: added tms_sequence command to allow switching between old/new tms sequence Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-18 20:25:19 UTC (rev 1833) +++ trunk/src/jtag/jtag.c 2009-05-19 06:59:20 UTC (rev 1834) @@ -261,6 +261,7 @@ static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int handle_verify_jtag_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +static int handle_tms_sequence_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); jtag_tap_t *jtag_AllTaps(void) { @@ -2310,6 +2311,8 @@ COMMAND_ANY, "verify value captured during Capture-IR <enable|disable>"); register_command(cmd_ctx, NULL, "verify_jtag", handle_verify_jtag_command, COMMAND_ANY, "verify value capture <enable|disable>"); + register_command(cmd_ctx, NULL, "tms_sequence", handle_tms_sequence_command, + COMMAND_ANY, "choose short(default) or long tms_sequence <short|long>"); return ERROR_OK; } @@ -3129,6 +3132,7 @@ return ERROR_OK; } + int jtag_power_dropout(int *dropout) { return jtag->power_dropout(dropout); @@ -3248,19 +3252,12 @@ * * DRSHIFT->DRSHIFT and IRSHIFT->IRSHIFT have to be caught in interface specific code */ -static struct +struct tms_sequences { u8 bits; u8 bit_count; -} tms_seqs[6][6] = /* [from_state_ndx][to_state_ndx] */ -{ - /* value clocked to TMS to move from one of six stable states to another. - * N.B. OOCD clocks TMS from LSB first, so read these right-to-left. - * N.B. These values are tightly bound to the table in tap_get_tms_path_len(). - * N.B. Reset only needs to be 0b11111, but in JLink an even byte of 1's is more stable. - * These extra ones cause no TAP state problem, because we go into reset and stay in reset. - */ +}; /* * These macros allow us to specify TMS state transitions by bits rather than hex bytes. @@ -3280,7 +3277,31 @@ #define B8(bits,count) { ((u8)B8__(HEX__(bits))), (count) } -#if 1 && ((BUILD_FT2232_FTD2XX==1) || (BUILD_FT2232_LIBFTDI==1) || (BUILD_JLINK==1)) +static const struct tms_sequences old_tms_seqs[6][6] = /* [from_state_ndx][to_state_ndx] */ +{ + /* value clocked to TMS to move from one of six stable states to another. + * N.B. OOCD clocks TMS from LSB first, so read these right-to-left. + * N.B. These values are tightly bound to the table in tap_get_tms_path_len(). + * N.B. Reset only needs to be 0b11111, but in JLink an even byte of 1's is more stable. + * These extra ones cause no TAP state problem, because we go into reset and stay in reset. + */ + + + + /* to state: */ + /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ /* from state: */ + { B8(1111111,7), B8(0000000,7), B8(0010111,7), B8(0001010,7), B8(0011011,7), B8(0010110,7) }, /* RESET */ + { B8(1111111,7), B8(0000000,7), B8(0100101,7), B8(0000101,7), B8(0101011,7), B8(0001011,7) }, /* IDLE */ + { B8(1111111,7), B8(0110001,7), B8(0000000,7), B8(0000001,7), B8(0001111,7), B8(0101111,7) }, /* DRSHIFT */ + { B8(1111111,7), B8(0110000,7), B8(0100000,7), B8(0010111,7), B8(0011110,7), B8(0101111,7) }, /* DRPAUSE */ + { B8(1111111,7), B8(0110001,7), B8(0000111,7), B8(0010111,7), B8(0000000,7), B8(0000001,7) }, /* IRSHIFT */ + { B8(1111111,7), B8(0110000,7), B8(0011100,7), B8(0010111,7), B8(0011110,7), B8(0101111,7) }, /* IRPAUSE */ +}; + + + +static const struct tms_sequences short_tms_seqs[6][6] = /* [from_state_ndx][to_state_ndx] */ +{ /* this is the table submitted by Jeff Williams on 3/30/2009 with this comment: OK, I added Peter's version of the state table, and it works OK for @@ -3314,40 +3335,21 @@ { B8(1111111,7), B8(011,3), B8(00111,5), B8(010111,6), B8(001111,6), B8(01,2) }, /* IRSHIFT */ { B8(1111111,7), B8(011,3), B8(00111,5), B8(010111,6), B8(01,2), B8(0,1) } /* IRPAUSE */ -#else /* this is the old table, converted from hex and with the bit_count set to 7 for each combo, like before */ +}; - /* to state: */ - /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ /* from state: */ - { B8(1111111,7), B8(0000000,7), B8(0010111,7), B8(0001010,7), B8(0011011,7), B8(0010110,7) }, /* RESET */ - { B8(1111111,7), B8(0000000,7), B8(0100101,7), B8(0000101,7), B8(0101011,7), B8(0001011,7) }, /* IDLE */ - { B8(1111111,7), B8(0110001,7), B8(0000000,7), B8(0000001,7), B8(0001111,7), B8(0101111,7) }, /* DRSHIFT */ - { B8(1111111,7), B8(0110000,7), B8(0100000,7), B8(0010111,7), B8(0011110,7), B8(0101111,7) }, /* DRPAUSE */ - { B8(1111111,7), B8(0110001,7), B8(0000111,7), B8(0010111,7), B8(0000000,7), B8(0000001,7) }, /* IRSHIFT */ - { B8(1111111,7), B8(0110000,7), B8(0011100,7), B8(0010111,7), B8(0011110,7), B8(0101111,7) }, /* IRPAUSE */ +typedef const struct tms_sequences tms_table[6][6]; -#endif +static tms_table *tms_seqs=&short_tms_seqs; -#if 0 /* keeping old hex stuff for awhile, for reference */ - /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ - { 0x7f, 0x00, 0x17, 0x0a, 0x1b, 0x16 }, /* RESET */ - { 0x7f, 0x00, 0x25, 0x05, 0x2b, 0x0b }, /* IDLE */ - { 0x7f, 0x31, 0x00, 0x01, 0x0f, 0x2f }, /* DRSHIFT */ - { 0x7f, 0x30, 0x20, 0x17, 0x1e, 0x2f }, /* DRPAUSE */ - { 0x7f, 0x31, 0x07, 0x17, 0x00, 0x01 }, /* IRSHIFT */ - { 0x7f, 0x30, 0x1c, 0x17, 0x20, 0x2f } /* IRPAUSE */ -#endif -}; - - int tap_get_tms_path( tap_state_t from, tap_state_t to ) { - return tms_seqs[tap_move_ndx(from)][tap_move_ndx(to)].bits; + return (*tms_seqs)[tap_move_ndx(from)][tap_move_ndx(to)].bits; } int tap_get_tms_path_len( tap_state_t from, tap_state_t to ) { - return tms_seqs[tap_move_ndx(from)][tap_move_ndx(to)].bit_count; + return (*tms_seqs)[tap_move_ndx(from)][tap_move_ndx(to)].bit_count; } @@ -3607,5 +3609,29 @@ } #endif +static int handle_tms_sequence_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + if (argc == 1) + { + if (strcmp(args[0], "short") == 0) + { + tms_seqs=&short_tms_seqs; + } + else if (strcmp(args[0], "long") == 0) + { + tms_seqs=&old_tms_seqs; + } else + { + return ERROR_COMMAND_SYNTAX_ERROR; + } + } else if (argc != 0) + { + return ERROR_COMMAND_SYNTAX_ERROR; + } + command_print(cmd_ctx, "tms sequence is %s", (tms_seqs==&short_tms_seqs) ? "short": "long"); + + return ERROR_OK; +} + /*-----</Cable Helper API>--------------------------------------*/ |
From: <oh...@ma...> - 2009-05-18 22:25:24
|
Author: oharboe Date: 2009-05-18 22:25:19 +0200 (Mon, 18 May 2009) New Revision: 1833 Modified: trunk/src/jtag/arm-jtag-ew.c trunk/src/jtag/bitq.c trunk/src/jtag/gw16012.c trunk/src/jtag/rlink/rlink.c trunk/src/jtag/usbprog.c trunk/src/jtag/zy1000.c Log: use tap_get_tms_path_len() instead of fix # of 7. Not tested if this builds, but at least we're looking at a build error instead of a runtime error. Modified: trunk/src/jtag/arm-jtag-ew.c =================================================================== --- trunk/src/jtag/arm-jtag-ew.c 2009-05-18 20:22:55 UTC (rev 1832) +++ trunk/src/jtag/arm-jtag-ew.c 2009-05-18 20:25:19 UTC (rev 1833) @@ -333,8 +333,9 @@ int i; int 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 = 0; i < 7; i++) + for (i = 0; i < tms_count; i++) { tms = (tms_scan >> i) & 1; armjtagew_tap_append_step(tms, 0); Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2009-05-18 20:22:55 UTC (rev 1832) +++ trunk/src/jtag/bitq.c 2009-05-18 20:25:19 UTC (rev 1833) @@ -161,8 +161,9 @@ } tms_scan = tap_get_tms_path(tap_get_state(), new_state); + int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); - for (i = 0; i<7; i++) + for (i = 0; i<tms_count; i++) { bitq_io(tms_scan & 1, 0, 0); tms_scan >>= 1; Modified: trunk/src/jtag/gw16012.c =================================================================== --- trunk/src/jtag/gw16012.c 2009-05-18 20:22:55 UTC (rev 1832) +++ trunk/src/jtag/gw16012.c 2009-05-18 20:25:19 UTC (rev 1833) @@ -197,10 +197,11 @@ { 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()); gw16012_control(0x0); /* single-bit mode */ - for (i = 0; i < 7; i++) + for (i = 0; i < tms_count; i++) { tms = (tms_scan >> i) & 1; gw16012_data(tms << 1); /* output next TMS bit */ Modified: trunk/src/jtag/rlink/rlink.c =================================================================== --- trunk/src/jtag/rlink/rlink.c 2009-05-18 20:22:55 UTC (rev 1832) +++ trunk/src/jtag/rlink/rlink.c 2009-05-18 20:25:19 UTC (rev 1833) @@ -916,8 +916,9 @@ 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 = 0; i < 7; i++) + for (i = 0; i < tms_count; i++) { tms = (tms_scan >> i) & 1; tap_state_queue_append(tms); Modified: trunk/src/jtag/usbprog.c =================================================================== --- trunk/src/jtag/usbprog.c 2009-05-18 20:22:55 UTC (rev 1832) +++ trunk/src/jtag/usbprog.c 2009-05-18 20:25:19 UTC (rev 1833) @@ -247,9 +247,10 @@ { 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()); usbprog_jtag_write_tms(usbprog_jtag_handle, (char)tms_scan); - for (i = 0; i < 7; i++) + for (i = 0; i < tms_count; i++) { tms = (tms_scan >> i) & 1; } Modified: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2009-05-18 20:22:55 UTC (rev 1832) +++ trunk/src/jtag/zy1000.c 2009-05-18 20:25:19 UTC (rev 1833) @@ -686,8 +686,9 @@ /* test manual drive code on any target */ int tms; u8 tms_scan = tap_get_tms_path(t, state); + int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); - for (i = 0; i < 7; i++) + for (i = 0; i < tms_count; i++) { tms = (tms_scan >> i) & 1; waitIdle(); |
From: <zw...@ma...> - 2009-05-18 22:23:00
|
Author: zwelch Date: 2009-05-18 22:22:55 +0200 (Mon, 18 May 2009) New Revision: 1832 Modified: trunk/BUGS trunk/Doxyfile Log: Update BUGS file, adapting its content for the doxygen manual. Modified: trunk/BUGS =================================================================== --- trunk/BUGS 2009-05-18 20:21:53 UTC (rev 1831) +++ trunk/BUGS 2009-05-18 20:22:55 UTC (rev 1832) @@ -1,34 +1,46 @@ -Please report bugs by posting a message to +/** @page bugs Bug Reporting -op...@li.... +Please report bugs by subscribing to the OpenOCD mailing list and +posting a message with your report: + ope...@li... + To minimize work for OpenOCD developers, you can include all the information below. If you feel that some of the items below are unnecessary for a clear bug report, you leave them out. - - Target PCB/board description - Config scripts - OpenOCD command line - List of commands issued or GDB operations performed - Expected result - Actual result -- debug_level 3 logs -- If this is a regression, include logs for working and broken -version -- If this is a regression, please find out the precise version -that caused the regression. This can be done via a binary -search. E.g. if version 550 worked and 600 failed, then try -575, etc. +- Logs using @c debug_level 3 (e.g. add '-d 3' to the command line) +- If this is a regression, include logs for working and broken version +- If this is a regression, please find out the precise version that + caused the regression. This can be done via a binary search; For + example: if testing version 550 works but 600 fail, then try 575, etc. -- If OpenOCD is crashing, you can use GDB to get a trace: - -gdb --args openocd .... +- If OpenOCD is crashing, you can use GDB to get a trace:@par +@code +% gdb --args openocd .... (gdb) run (gdb) bt => here a stack trace is dumped. +@endcode -attach files directly to the posting. The mailing list knows to -transform attachments to links so you will not be bloating anyones -mail box. Keep attachments to <100kBytes. \ No newline at end of file +- To run or debug the in-tree executable (not recommended), you must + use libtool to set up the correct shared library paths: +@code + libtool gdb --args openocd .... +@endcode +or the more pedantic (and forward-compatible): +@code + libtool --mode=execute gdb --args openocd .... +@endcode +- Attach files directly to the posting. The mailing list knows to +transform attachments to links so you will not be bloating anyones mail +box. Please keep attachments to less than 100KB. + + */ Modified: trunk/Doxyfile =================================================================== --- trunk/Doxyfile 2009-05-18 20:21:53 UTC (rev 1831) +++ trunk/Doxyfile 2009-05-18 20:22:55 UTC (rev 1832) @@ -566,6 +566,7 @@ INPUT = doc/manual \ TODO \ + BUGS \ src \ config.h |
From: <oh...@ma...> - 2009-05-18 22:21:54
|
Author: oharboe Date: 2009-05-18 22:21:53 +0200 (Mon, 18 May 2009) New Revision: 1831 Modified: trunk/src/jtag/bitbang.c Log: use tap_get_tms_path_len() instead of fix # of 7. Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2009-05-18 19:33:00 UTC (rev 1830) +++ trunk/src/jtag/bitbang.c 2009-05-18 20:21:53 UTC (rev 1831) @@ -77,8 +77,9 @@ { int i=0, tms=0; u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); - - for (i = skip; i < 7; i++) + 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; bitbang_interface->write(0, tms, 0); |
From: <oh...@ma...> - 2009-05-18 21:33:05
|
Author: oharboe Date: 2009-05-18 21:33:00 +0200 (Mon, 18 May 2009) New Revision: 1830 Modified: trunk/TODO Log: removed solved mem2array problem. Added questions regarding ideas on making tcl-less builds of OpenOCD Modified: trunk/TODO =================================================================== --- trunk/TODO 2009-05-18 19:28:26 UTC (rev 1829) +++ trunk/TODO 2009-05-18 19:33:00 UTC (rev 1830) @@ -98,10 +98,10 @@ - investigate/implement "thin wrapper" to use eCos CFI drivers () - TCL - - mem2array bugs: - - Report: https://lists.berlios.de/pipermail/openocd-development/2009-May/006459.html - Isolate all TCL command support: - - Allow pure C CLI implementations using --disable-builtin-tcl + - Allow pure C CLI implementations using --disable-builtin-tcl. + Ref? How could this be made to work given targets extensive need + for events, etc.? What about the target library? - Allow full TCL support? add --with-tcl=/path/to/installed/tcl - Move TCL support in foo.* to foo_tcl.* (other ideas?) |
From: <oh...@ma...> - 2009-05-18 21:28:30
|
Author: oharboe Date: 2009-05-18 21:28:26 +0200 (Mon, 18 May 2009) New Revision: 1829 Modified: trunk/TODO Log: updated w/jtag_add_end_state() note. Modified: trunk/TODO =================================================================== --- trunk/TODO 2009-05-18 19:06:43 UTC (rev 1828) +++ trunk/TODO 2009-05-18 19:28:26 UTC (rev 1829) @@ -27,7 +27,12 @@ - update all drivers to use tap_get_tms_path_len API. - use tap_set_state everywhere to allow logging TAP state transitions - rename other tap_states to use standard JTAG names (suggested by ML) - - add TAP_UNKNOWN to augment TAP_INVALID? (suggested by ML/DH) + - retire jtag_add_end_state() and replace w/global variable. This also + removes TAP_INVALID as an argument to jtag_add_xxxx(). The global variable + as argument to jtag_add_xxxx() should eventually be phased out, but + the global variable is useful in an interim phase where one needs to + be bug by bug compatible before each change can be tested. Suggested + by . Michael Bruck also interested in this. - JTAG Interfaces: - autodetect devices present on the scan chain |
From: <zw...@ma...> - 2009-05-18 21:06:47
|
Author: zwelch Date: 2009-05-18 21:06:43 +0200 (Mon, 18 May 2009) New Revision: 1828 Modified: trunk/TODO Log: Update The List with recent progress; remove developer list from TODO. Modified: trunk/TODO =================================================================== --- trunk/TODO 2009-05-18 17:43:26 UTC (rev 1827) +++ trunk/TODO 2009-05-18 19:06:43 UTC (rev 1828) @@ -25,25 +25,21 @@ - JTAG/TAP changes: - update all drivers to use tap_get_tms_path_len API. - - link to posted patch: @missing - - rework TAP state table (started but still needs work) - - link to posted patch: @missing - use tap_set_state everywhere to allow logging TAP state transitions - rename other tap_states to use standard JTAG names (suggested by ML) - - write script that automate production of the series of 16-17 patches - - produce and distribute current series against the current trunk - - distribute script so developers can use on WC through live commits - - make live commits after giving sufficient notice to others - add TAP_UNKNOWN to augment TAP_INVALID? (suggested by ML/DH) - JTAG Interfaces: - autodetect devices present on the scan chain - implement 'discover_taps' command - FT2232 driver: (DH) - - integrate FTD2XX High-Speed Device Patch - - link to posted patch: @missing - - fix non-recoverability of cable connect/reconnect - - link to posted patch: @missing + - integrate FTD2XX High-Speed Device support + - PATCH: https://lists.berlios.de/pipermail/openocd-development/2009-April/005479.html + - massive set of changes (DH): + - fixes non-recoverability of cable connect/reconnect + - https://lists.berlios.de/pipermail/openocd-development/2009-May/006011.html + - further cleanup (DH): + - PATCH: https://lists.berlios.de/pipermail/openocd-development/2009-May/006112.html - fix outstanding bugs - J-Link driver: (ZW) - fix outstanding bugs @@ -62,6 +58,8 @@ - SWD - Target Support: + - general layer cleanup: + - https://lists.berlios.de/pipermail/openocd-development/2009-May/006590.html - ARM11 improvements (MB?) - fix single stepping (reported by ) - implement missing functionality (grep FNC_INFO_NOTIMPLEMENTED ...) @@ -89,15 +87,14 @@ - other targets? (suggestions always welcome) - CFI: - - speed enhancements (posted Apr 22 by NC) (??) - - link to patch: @missing - finish implementing bus width/chip width handling (suggested by NC) - - link to patch: @missing - factor vendor-specific code into separate source files - add new callback interface for vendor-specific code - investigate/implement "thin wrapper" to use eCos CFI drivers () - TCL + - mem2array bugs: + - Report: https://lists.berlios.de/pipermail/openocd-development/2009-May/006459.html - Isolate all TCL command support: - Allow pure C CLI implementations using --disable-builtin-tcl - Allow full TCL support? add --with-tcl=/path/to/installed/tcl @@ -145,32 +142,4 @@ https://developer.berlios.de/patch/?group_id=4148 - use bug tracking? we need something! -@verbatim -================================================================== -OpenOCD's Active Developers and Testers ------------------------------------------------------------------- - -** | Name | Status | Targets | Interfaces ----+-----------------+--------+------------------+---------------- -NC | Nico Coesel | * | AU1100 | * -DE | Duane Ellis | * | * | * -DH | Dick Hollenbeck | ? | * | FT2232 - | vind Harboe | * | * | ZY1000 -JK | Joern Keipf | * | * | FT2232H/FT4232HS? -JW | Jeff Williams | ? | MC1322x | J-Link -MA | Mariano Alvira | * | MC1322x | J-Link, FTDI -MB | Michael Bruck | * | ARM11 | * -ML | Magnus Lundin | * | * | * -RA | Rick Altherr | * | * | * -RD | Rene Doss | * | AT91SAM92xx | * -SQ | Simon Qian | * | AVR | * -ZW | Zach Welch | * | STR912 | J-Link - -Status Key: -* - Active Contributor -? - Missing In Action -V - On Vacation - -@endverbatim - */ |
From: kc8apf at B. <kc...@ma...> - 2009-05-18 19:43:28
|
Author: kc8apf Date: 2009-05-18 19:43:26 +0200 (Mon, 18 May 2009) New Revision: 1827 Modified: trunk/src/jtag/jtag.c Log: Enable non-7-cycle state table for FT2232 and JLink Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-18 17:42:36 UTC (rev 1826) +++ trunk/src/jtag/jtag.c 2009-05-18 17:43:26 UTC (rev 1827) @@ -3280,7 +3280,7 @@ #define B8(bits,count) { ((u8)B8__(HEX__(bits))), (count) } -#if 0 && ((BUILD_FT2232_FTD2XX==1) || (BUILD_FT2232_LIBFTDI==1) || (BUILD_JLINK==1)) +#if 1 && ((BUILD_FT2232_FTD2XX==1) || (BUILD_FT2232_LIBFTDI==1) || (BUILD_JLINK==1)) /* this is the table submitted by Jeff Williams on 3/30/2009 with this comment: OK, I added Peter's version of the state table, and it works OK for |
From: kc8apf at B. <kc...@ma...> - 2009-05-18 19:42:37
|
Author: kc8apf Date: 2009-05-18 19:42:36 +0200 (Mon, 18 May 2009) New Revision: 1826 Modified: trunk/src/jtag/jlink.c Log: JLink support for non-7-cycle state moves by Dick Hollenbeck <di...@so...> Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-05-18 17:41:27 UTC (rev 1825) +++ trunk/src/jtag/jlink.c 2009-05-18 17:42:36 UTC (rev 1826) @@ -39,6 +39,11 @@ #define JLINK_USB_TIMEOUT 1000 // See Section 1.3.2 of the Segger JLink USB protocol manual +/* 2048 is the max value we can use here */ +//#define JLINK_TAP_BUFFER_SIZE 2048 +#define JLINK_TAP_BUFFER_SIZE 256 +//#define JLINK_TAP_BUFFER_SIZE 384 + #define JLINK_IN_BUFFER_SIZE 2048 #define JLINK_OUT_BUFFER_SIZE 2*2048+4 #define JLINK_EMU_RESULT_BUFFER_SIZE 64 @@ -412,6 +417,8 @@ tap_state_t saved_end_state = tap_get_end_state(); + jlink_tap_ensure_space(1,num_cycles + 16); + /* only do a state_move when we're not already in IDLE */ if (tap_get_state() != TAP_IDLE) { @@ -438,7 +445,7 @@ { tap_state_t saved_end_state; - jlink_tap_ensure_space(1, scan_size + 8); + jlink_tap_ensure_space(1, scan_size + 16); saved_end_state = tap_get_end_state(); @@ -604,8 +611,6 @@ /***************************************************************************/ /* J-Link tap functions */ -/* 2048 is the max value we can use here */ -#define JLINK_TAP_BUFFER_SIZE 1024 static unsigned tap_length=0; static u8 tms_buffer[JLINK_TAP_BUFFER_SIZE]; @@ -634,7 +639,7 @@ static void jlink_tap_ensure_space(int scans, int bits) { int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length; - int available_bits = JLINK_TAP_BUFFER_SIZE * 8 - tap_length - 64; + int available_bits = JLINK_TAP_BUFFER_SIZE * 8 - tap_length - 32; if (scans > available_scans || bits > available_bits) { @@ -649,6 +654,7 @@ if (index >= JLINK_TAP_BUFFER_SIZE) { LOG_ERROR("jlink_tap_append_step: overflow"); + *(u32 *)0xFFFFFFFF = 0; exit(-1); } |
From: kc8apf at B. <kc...@ma...> - 2009-05-18 19:41:29
|
Author: kc8apf Date: 2009-05-18 19:41:27 +0200 (Mon, 18 May 2009) New Revision: 1825 Modified: trunk/src/jtag/ft2232.c Log: FT2232 support for non-7-cycle state moves by Dick Hollenbeck <di...@so...> Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-05-18 17:40:42 UTC (rev 1824) +++ trunk/src/jtag/ft2232.c 2009-05-18 17:41:27 UTC (rev 1825) @@ -5,6 +5,9 @@ * Copyright (C) 2008 by Spencer Oliver * * sp...@sp... * * * +* Copyright (C) 2009 by SoftPLC Corporation. http://softplc.com * +* Dick Hollenbeck <di...@so...> * +* * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -26,6 +29,9 @@ * found here: * http://www.ftdichip.com/Documents/AppNotes/AN2232C-01_MPSSE_Cmnd.pdf * Hereafter this is called the "MPSSE Spec". + * + * The datasheet for the ftdichip.com's FT2232D part is here: + * http://www.ftdichip.com/Documents/DataSheets/DS_FT2232D.pdf */ @@ -41,7 +47,14 @@ #include <windows.h> #endif +#include <assert.h> +#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) +#error "BUILD_FT2232_FTD2XX || BUILD_FT2232_LIBFTDI must be chosen" +#endif + /* FT2232 access library includes */ #if BUILD_FT2232_FTD2XX == 1 #include <ftd2xx.h> @@ -49,6 +62,9 @@ #include <ftdi.h> #endif +/* max TCK for the high speed devices 30000 kHz */ +#define FTDI_2232H_4232H_MAX_TCK 30000 + static int ft2232_execute_queue(void); static int ft2232_speed(int speed); @@ -76,12 +92,14 @@ static int ft2232_stableclocks(int num_cycles, jtag_command_t* cmd); -static char * ft2232_device_desc_A = NULL; -static char* ft2232_device_desc = NULL; -static char* ft2232_serial = NULL; -static char* ft2232_layout = NULL; -static unsigned char ft2232_latency = 2; +static char * ft2232_device_desc_A = NULL; +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; + #define MAX_USB_IDS 8 /* vid = pid = 0 marks the end of the list */ static u16 ft2232_vid[MAX_USB_IDS + 1] = { 0x0403, 0 }; @@ -103,9 +121,9 @@ 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 axm0432_jtag_init(void); +static int sheevaplug_init(void); +static int icebear_jtag_init(void); /* reset procedures for supported layouts */ static void usbjtag_reset(int trst, int srst); @@ -124,7 +142,7 @@ static void flyswatter_jtag_blink(void); static void turtle_jtag_blink(void); -ft2232_layout_t ft2232_layouts[] = +ft2232_layout_t ft2232_layouts[] = { { "usbjtag", usbjtag_init, usbjtag_reset, NULL }, { "jtagkey", jtagkey_init, jtagkey_reset, NULL }, @@ -152,7 +170,7 @@ static u8 high_direction = 0x0; #if BUILD_FT2232_FTD2XX == 1 -static FT_HANDLE ftdih = NULL; +static FT_HANDLE ftdih = NULL; #elif BUILD_FT2232_LIBFTDI == 1 static struct ftdi_context ftdic; #endif @@ -161,15 +179,143 @@ static jtag_command_t* first_unsent; /* next command that has to be sent */ static int require_send; + +/* http://urjtag.wiki.sourceforge.net/Cable+FT2232 says: + + "There is a significant difference between libftdi and libftd2xx. The latter + one allows to schedule up to 64*64 bytes of result data while libftdi fails + with more than 4*64. As a consequence, the FT2232 driver is forced to + perform around 16x more USB transactions for long command streams with TDO + capture when running with libftdi." + + No idea how we get + #define FT2232_BUFFER_SIZE 131072 + a comment would have been nice. +*/ + +#define FT2232_BUFFER_SIZE 131072 + static u8* ft2232_buffer = NULL; static int ft2232_buffer_size = 0; static int ft2232_read_pointer = 0; static int ft2232_expect_read = 0; -#define FT2232_BUFFER_SIZE 131072 -#define BUFFER_ADD ft2232_buffer[ft2232_buffer_size++] -#define BUFFER_READ ft2232_buffer[ft2232_read_pointer++] +/** + * Function buffer_write + * 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 ) +{ + assert( ft2232_buffer ); + assert( (unsigned) ft2232_buffer_size < (unsigned) FT2232_BUFFER_SIZE ); + ft2232_buffer[ft2232_buffer_size++] = val; +} +/** + * Function buffer_read + * returns a byte from the byte buffer. + */ +static inline u8 buffer_read(void) +{ + assert( ft2232_buffer ); + assert( ft2232_read_pointer < ft2232_buffer_size ); + return ft2232_buffer[ft2232_read_pointer++]; +} + + +/** + * Function clock_tms + * clocks out \a bit_count bits on the TMS line, starting with the least + * significant bit of tms_bits and progressing to more significant bits. + * Rigorous state transition logging is done here via tap_set_state(). + * + * @param pmsse_cmd is 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. + * + * @param tms_bits holds the sequence of bits to send. + * @param tms_count tells how many bits in the sequence. + * @param tdi_bit is a single bit which is passed on to TDI before the first TCK cycle + * and is 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 ) +{ + u8 tms_byte; + int i; + int tms_ndx; /* bit index into tms_byte */ + + assert( tms_count > 0 ); + +// 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) + tms_byte |= (1<<tms_ndx); + + /* always do state transitions in public view */ + 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 + also increment. + */ + ++tms_ndx; + + if( tms_ndx==7 || i==tms_count-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 + TMS/CS and is held static for the duration of TMS/CS clocking. + */ + buffer_write( tms_byte | (tdi_bit << 7) ); + } + } +} + + +/** + * Function get_tms_buffer_requirements + * returns what clock_tms() will consume if called with + * same \a bit_count. + */ +static inline int get_tms_buffer_requirements( int bit_count ) +{ + return ((bit_count + 6)/7) * 3; +} + + +/** + * Function move_to_state + * moves the TAP controller from the current state to a + * \a goal_state through a path given by tap_get_tms_path(). State transition + * logging is performed by delegation to clock_tms(). + * + * @param goal_state is the destination state for the move. + */ +static void move_to_state( tap_state_t goal_state ) +{ + tap_state_t start_state = tap_get_state(); + + /* 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. + */ + + /* do the 2 lookups */ + 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) ); + + clock_tms( 0x4b, tms_bits, tms_count, 0 ); +} + + jtag_interface_t ft2232_interface = { .name = "ft2232", @@ -186,7 +332,7 @@ { #if BUILD_FT2232_FTD2XX == 1 FT_STATUS status; - DWORD dw_bytes_written; + DWORD dw_bytes_written; if ( ( status = FT_Write(ftdih, buf, size, &dw_bytes_written) ) != FT_OK ) { *bytes_written = dw_bytes_written; @@ -269,7 +415,7 @@ int retval; u32 bytes_written; - 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 */ @@ -290,7 +436,7 @@ * AN2232C-01 Command Processor for * MPSSE and MCU Host Bus. Chapter 3.8 */ - *khz = 6000 / (1 + speed); + *khz = ft2232_max_tck / (1 + speed); return ERROR_OK; } @@ -311,9 +457,9 @@ * We will calc here with a multiplier * of 10 for better rounding later. */ - /* Calc speed, (6000 / khz) - 1 */ + /* Calc speed, (ft2232_max_tck / khz) - 1 */ /* Use 65000 for better rounding */ - *jtag_speed = (60000 / khz) - 10; + *jtag_speed = ((ft2232_max_tck*10) / khz) - 10; /* Add 0.9 for rounding */ *jtag_speed += 9; @@ -359,7 +505,7 @@ tap_set_end_state(state); else { - LOG_ERROR("BUG: %i is not a valid end state", state); + LOG_ERROR("BUG: %s is not a stable end state", tap_state_name(state)); exit(-1); } } @@ -373,19 +519,19 @@ while (num_bytes-- > 1) { - buffer[cur_byte] = BUFFER_READ; - cur_byte++; + buffer[cur_byte++] = buffer_read(); bits_left -= 8; } buffer[cur_byte] = 0x0; + /* There is one more partial byte left from the clock data in/out instructions */ if (bits_left > 1) { - buffer[cur_byte] = BUFFER_READ >> 1; + buffer[cur_byte] = buffer_read() >> 1; } - - buffer[cur_byte] = ( buffer[cur_byte] | ( (BUFFER_READ & 0x02) << 6 ) ) >> (8 - bits_left); + /* 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); } @@ -529,46 +675,44 @@ } -static void ft2232_add_pathmove(pathmove_command_t* cmd) +/** + * Function ft2232_add_pathmove + * moves the TAP controller from the current state to a new state through the + * given path, where path is an array of tap_state_t's. + * + * @param path is an array of tap_stat_t which gives the states to traverse through + * 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 ) { - int num_states = cmd->num_states; - int state_count = 0; + int tms_bits = 0; + int state_ndx; + tap_state_t walker = tap_get_state(); - while (num_states) + 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 ) { - u8 tms_byte = 0; /* zero this on each MPSSE batch */ + tap_state_t desired_next_state = path[state_ndx]; - int bit_count = 0; - - int num_states_batch = num_states > 7 ? 7 : num_states; - - /* command "Clock Data to TMS/CS Pin (no Read)" */ - BUFFER_ADD = 0x4b; - - /* number of states remaining */ - BUFFER_ADD = num_states_batch - 1; - - while (num_states_batch--) + 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 ) + tms_bits |= (1<<state_ndx); + else { - if (tap_state_transition(tap_get_state(), false) == cmd->path[state_count]) - buf_set_u32(&tms_byte, bit_count++, 1, 0x0); - else if (tap_state_transition(tap_get_state(), true) == cmd->path[state_count]) - buf_set_u32(&tms_byte, bit_count++, 1, 0x1); - else - { - LOG_ERROR( "BUG: %s -> %s isn't a valid TAP transition", tap_state_name( - tap_get_state() ), tap_state_name(cmd->path[state_count]) ); - exit(-1); - } - - tap_set_state(cmd->path[state_count]); - state_count++; - num_states--; + LOG_ERROR( "BUG: %s -> %s isn't a valid TAP transition", + tap_state_name(walker), tap_state_name(desired_next_state) ); + exit(-1); } - BUFFER_ADD = tms_byte; + walker = desired_next_state; } - + + clock_tms( 0x4b, tms_bits, num_states, 0 ); + tap_set_end_state(tap_get_state()); } @@ -580,26 +724,19 @@ int cur_byte = 0; int last_bit; - if ( !( ( !ir_scan && (tap_get_state() == TAP_DRSHIFT) ) - || ( ir_scan && (tap_get_state() == TAP_IRSHIFT) ) ) ) + if ( !ir_scan ) { - /* command "Clock Data to TMS/CS Pin (no Read)" */ - BUFFER_ADD = 0x4b; - - BUFFER_ADD = 0x6; /* scan 7 bits */ - - /* TMS data bits */ - if (ir_scan) + if (tap_get_state() != TAP_DRSHIFT) { - BUFFER_ADD = tap_get_tms_path(tap_get_state(), TAP_IRSHIFT); - tap_set_state(TAP_IRSHIFT); + move_to_state( TAP_DRSHIFT ); } - else + } + else + { + if (tap_get_state() != TAP_IRSHIFT) { - BUFFER_ADD = tap_get_tms_path(tap_get_state(), TAP_DRSHIFT); - tap_set_state(TAP_DRSHIFT); + move_to_state( TAP_IRSHIFT ); } - /* LOG_DEBUG("added TMS scan (no read)"); */ } /* add command for complete bytes */ @@ -609,34 +746,34 @@ if (type == SCAN_IO) { /* Clock Data Bytes In and Out LSB First */ - BUFFER_ADD = 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_ADD = 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_ADD = 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_ADD = (thisrun_bytes - 1) & 0xff; - BUFFER_ADD = ( (thisrun_bytes - 1) >> 8 ) & 0xff; + 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_ADD = buffer[cur_byte]; - cur_byte++; + buffer_write( buffer[cur_byte++] ); bits_left -= 8; } } @@ -658,24 +795,25 @@ if (type == SCAN_IO) { /* Clock Data Bits In and Out LSB First */ - BUFFER_ADD = 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_ADD = 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_ADD = 0x2a; + buffer_write( 0x2a ); /* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */ } - BUFFER_ADD = bits_left - 2; + + buffer_write( bits_left - 2 ); if (type != SCAN_IN) - BUFFER_ADD = buffer[cur_byte]; + buffer_write( buffer[cur_byte] ); } if ( ( ir_scan && (tap_get_end_state() == TAP_IRSHIFT) ) @@ -684,44 +822,57 @@ if (type == SCAN_IO) { /* Clock Data Bits In and Out LSB First */ - BUFFER_ADD = 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_ADD = 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_ADD = 0x2a; + buffer_write( 0x2a ); /* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */ } - BUFFER_ADD = 0x0; - BUFFER_ADD = last_bit; + buffer_write( 0x0 ); + buffer_write( last_bit ); } else { + int tms_bits; + int tms_count; + u8 mpsse_cmd; + /* move from Shift-IR/DR to end state */ if (type != SCAN_OUT) { + /* We always go to the PAUSE state in two step at the end of an IN or IO scan */ + /* This must be coordinated with the bit shifts in ft2232_read_scan */ + tms_bits = 0x01; + tms_count = 2; /* Clock Data to TMS/CS Pin with Read */ - BUFFER_ADD = 0x6b; + mpsse_cmd = 0x6b; /* LOG_DEBUG("added TMS scan (read)"); */ } 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() ); /* Clock Data to TMS/CS Pin (no Read) */ - BUFFER_ADD = 0x4b; + mpsse_cmd = 0x4b; /* LOG_DEBUG("added TMS scan (no read)"); */ } - BUFFER_ADD = 0x6; /* scan 7 bits */ - BUFFER_ADD = tap_get_tms_path( tap_get_state(), tap_get_end_state() ) | (last_bit << 7); - tap_set_state( tap_get_end_state() ); + 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() ); + } } @@ -746,14 +897,7 @@ if (tap_get_state() != TAP_DRSHIFT) { - /* command "Clock Data to TMS/CS Pin (no Read)" */ - BUFFER_ADD = 0x4b; - - BUFFER_ADD = 0x6; /* scan 7 bits */ - - /* TMS data bits */ - BUFFER_ADD = tap_get_tms_path(tap_get_state(), TAP_DRSHIFT); - tap_set_state(TAP_DRSHIFT); + move_to_state( TAP_DRSHIFT ); } if ( ( retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written) ) != ERROR_OK ) @@ -772,34 +916,34 @@ if (type == SCAN_IO) { /* Clock Data Bytes In and Out LSB First */ - BUFFER_ADD = 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_ADD = 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_ADD = 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_ADD = (thisrun_bytes - 1) & 0xff; - BUFFER_ADD = ( (thisrun_bytes - 1) >> 8 ) & 0xff; + 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_ADD = buffer[cur_byte]; + buffer_write( buffer[cur_byte] ); cur_byte++; bits_left -= 8; } @@ -843,24 +987,24 @@ if (type == SCAN_IO) { /* Clock Data Bits In and Out LSB First */ - BUFFER_ADD = 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_ADD = 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_ADD = 0x2a; + buffer_write( 0x2a ); /* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */ } - BUFFER_ADD = bits_left - 2; + buffer_write( bits_left - 2 ); if (type != SCAN_IN) - BUFFER_ADD = buffer[cur_byte]; + buffer_write( buffer[cur_byte] ); if (type != SCAN_OUT) thisrun_read += 2; @@ -871,42 +1015,45 @@ if (type == SCAN_IO) { /* Clock Data Bits In and Out LSB First */ - BUFFER_ADD = 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_ADD = 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_ADD = 0x2a; + buffer_write( 0x2a ); /* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */ } - BUFFER_ADD = 0x0; - BUFFER_ADD = 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() ); + u8 mpsse_cmd; + /* move from Shift-IR/DR to end state */ if (type != SCAN_OUT) { /* Clock Data to TMS/CS Pin with Read */ - BUFFER_ADD = 0x6b; + mpsse_cmd = 0x6b; /* LOG_DEBUG("added TMS scan (read)"); */ } else { /* Clock Data to TMS/CS Pin (no Read) */ - BUFFER_ADD = 0x4b; + mpsse_cmd = 0x4b; /* LOG_DEBUG("added TMS scan (no read)"); */ } - BUFFER_ADD = 0x6; - BUFFER_ADD = tap_get_tms_path( tap_get_state(), tap_get_end_state() ) | (last_bit << 7); - tap_set_state( tap_get_end_state() ); + + clock_tms( mpsse_cmd, tms_bits, tms_count, last_bit ); } if (type != SCAN_OUT) @@ -941,12 +1088,13 @@ int num_bytes = (scan_size - 1) / 8; if (tap_get_state() != TAP_DRSHIFT) - predicted_size += 3; + 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 */ { /* complete bytes */ predicted_size += CEIL(num_bytes, 65536) * 3; + /* remaining bits - 1 (up to 7) */ predicted_size += ( (scan_size - 1) % 8 ) ? 2 : 0; } @@ -954,6 +1102,7 @@ { /* complete bytes */ predicted_size += num_bytes + CEIL(num_bytes, 65536) * 3; + /* remaining bits -1 (up to 7) */ predicted_size += ( (scan_size - 1) % 8 ) ? 3 : 0; } @@ -1017,9 +1166,9 @@ } /* command "set data bits low byte" */ - BUFFER_ADD = 0x80; - BUFFER_ADD = low_output; - BUFFER_ADD = low_direction; + buffer_write( 0x80 ); + buffer_write( low_output ); + buffer_write( low_direction ); } @@ -1056,9 +1205,9 @@ } /* command "set data bits high byte" */ - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = 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); } @@ -1091,9 +1240,9 @@ } /* command "set data bits high byte" */ - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = 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); } @@ -1121,9 +1270,9 @@ } /* command "set data bits low byte" */ - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = 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); } @@ -1150,9 +1299,9 @@ } /* command "set data bits low byte" */ - BUFFER_ADD = 0x80; - BUFFER_ADD = low_output; - BUFFER_ADD = 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); } @@ -1171,9 +1320,9 @@ } /* command "set data bits low byte" */ - BUFFER_ADD = 0x80; - BUFFER_ADD = low_output; - BUFFER_ADD = 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); } @@ -1199,9 +1348,9 @@ } /* command "set data bits high byte" */ - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = 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); } @@ -1228,14 +1377,14 @@ } /* command "set data bits low byte" */ - BUFFER_ADD = 0x80; - BUFFER_ADD = low_output; - BUFFER_ADD = low_direction; + buffer_write( 0x80 ); + buffer_write( low_output ); + buffer_write( low_direction ); /* command "set data bits high byte" */ - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = 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); } @@ -1255,9 +1404,9 @@ high_output |= nSRSTnOE; /* command "set data bits high byte" */ - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = 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); } @@ -1266,7 +1415,7 @@ int retval; retval = ERROR_OK; - DEBUG_JTAG_IO("end_state: %i", cmd->cmd.end_state->end_state); + DEBUG_JTAG_IO("execute_end_state: %s", tap_state_name(cmd->cmd.end_state->end_state) ); if (cmd->cmd.end_state->end_state != TAP_INVALID) ft2232_end_state(cmd->cmd.end_state->end_state); @@ -1282,9 +1431,10 @@ int predicted_size = 0; retval = ERROR_OK; - DEBUG_JTAG_IO("runtest %i cycles, end in %i", + DEBUG_JTAG_IO("runtest %i cycles, end in %s", cmd->cmd.runtest->num_cycles, - cmd->cmd.runtest->end_state); + tap_state_name(cmd->cmd.runtest->end_state)); + /* only send the maximum buffer size that FT2232C can handle */ predicted_size = 0; if (tap_get_state() != TAP_IDLE) @@ -1303,27 +1453,24 @@ } if (tap_get_state() != TAP_IDLE) { - /* command "Clock Data to TMS/CS Pin (no Read)" */ - BUFFER_ADD = 0x4b; - BUFFER_ADD = 0x6; /* scan 7 bits */ - - /* TMS data bits */ - BUFFER_ADD = tap_get_tms_path(tap_get_state(), TAP_IDLE); - tap_set_state(TAP_IDLE); + move_to_state( TAP_IDLE ); require_send = 1; } i = cmd->cmd.runtest->num_cycles; while (i > 0) { + /* there are no state transitions in this code, so omit state tracking */ + /* command "Clock Data to TMS/CS Pin (no Read)" */ - BUFFER_ADD = 0x4b; + buffer_write( 0x4b ); /* scan 7 bits */ - BUFFER_ADD = (i > 7) ? 6 : (i - 1); + buffer_write( (i > 7) ? 6 : (i - 1) ); /* TMS data bits */ - BUFFER_ADD = 0x0; + buffer_write( 0x0 ); tap_set_state(TAP_IDLE); + i -= (i > 7) ? 7 : i; /* LOG_DEBUG("added TMS scan (no read)"); */ } @@ -1333,15 +1480,9 @@ if ( tap_get_state() != tap_get_end_state() ) { - /* command "Clock Data to TMS/CS Pin (no Read)" */ - BUFFER_ADD = 0x4b; - /* scan 7 bit */ - BUFFER_ADD = 0x6; - /* TMS data bits */ - BUFFER_ADD = tap_get_tms_path( tap_get_state(), tap_get_end_state() ); - tap_set_state( tap_get_end_state() ); - /* LOG_DEBUG("added TMS scan (no read)"); */ + 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() ) ); @@ -1350,11 +1491,11 @@ return retval; } + static int ft2232_execute_statemove(jtag_command_t *cmd) { - int retval; - int predicted_size = 0; - retval = ERROR_OK; + int predicted_size = 0; + int retval = ERROR_OK; DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state); @@ -1370,61 +1511,60 @@ if (cmd->cmd.statemove->end_state != TAP_INVALID) ft2232_end_state(cmd->cmd.statemove->end_state); - /* command "Clock Data to TMS/CS Pin (no Read)" */ - BUFFER_ADD = 0x4b; + /* move to end state */ + if ( tap_get_state() != tap_get_end_state() ) + { + move_to_state( tap_get_end_state() ); + require_send = 1; + } - BUFFER_ADD = 0x6; /* scan 7 bits */ - - /* TMS data bits */ - BUFFER_ADD = tap_get_tms_path( tap_get_state(), tap_get_end_state() ); - /* LOG_DEBUG("added TMS scan (no read)"); */ - tap_set_state( tap_get_end_state() ); - require_send = 1; -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG( "statemove: %s", tap_state_name( tap_get_end_state() ) ); -#endif - return retval; } static int ft2232_execute_pathmove(jtag_command_t *cmd) { - int retval; - int predicted_size = 0; - retval = ERROR_OK; + int predicted_size = 0; + int retval = ERROR_OK; - DEBUG_JTAG_IO("pathmove: %i states, end in %i", - cmd->cmd.pathmove->num_states, - cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]); + 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] ) + ); + /* only send the maximum buffer size that FT2232C can handle */ - predicted_size = 3 * CEIL(cmd->cmd.pathmove->num_states, 7); + predicted_size = 3 * CEIL(num_states, 7); if (ft2232_buffer_size + predicted_size + 1 > FT2232_BUFFER_SIZE) { if (ft2232_send_and_recv(first_unsent, cmd) != ERROR_OK) - retval = ERROR_JTAG_QUEUE_FAILED; + retval = ERROR_JTAG_QUEUE_FAILED; + require_send = 0; first_unsent = cmd; } - ft2232_add_pathmove(cmd->cmd.pathmove); + + ft2232_add_pathmove( path, num_states ); require_send = 1; -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG( "pathmove: %i states, end in %s", cmd->cmd.pathmove->num_states, - tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]) ); -#endif + return retval; } + static int ft2232_execute_scan(jtag_command_t *cmd) { - int retval; u8* buffer; int scan_size; /* size of IR or DR scan */ - enum scan_type type; int predicted_size = 0; - retval = ERROR_OK; + int retval = ERROR_OK; + enum scan_type type = jtag_scan_type(cmd->cmd.scan); + + DEBUG_JTAG_IO( "%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN", type ); + scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer); - type = jtag_scan_type(cmd->cmd.scan); + predicted_size = ft2232_predict_scan_out(scan_size, type); if ( (predicted_size + 1) > FT2232_BUFFER_SIZE ) { @@ -1544,17 +1684,17 @@ switch (cmd->type) { - case JTAG_END_STATE: retval = ft2232_execute_end_state(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); + case JTAG_END_STATE: retval = ft2232_execute_end_state(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); } return retval; } @@ -1604,10 +1744,10 @@ #if BUILD_FT2232_FTD2XX == 1 static int ft2232_init_ftd2xx(u16 vid, u16 pid, int more, int* try_more) { - FT_STATUS status; - DWORD openex_flags = 0; - char* openex_string = NULL; - u8 latency_timer; + FT_STATUS status; + 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); @@ -1785,6 +1925,7 @@ return ERROR_JTAG_INIT_FAILED; } + /* There is already a reset in ftdi_usb_open_desc, this should be redundant */ if (ftdi_usb_reset(&ftdic) < 0) { LOG_ERROR("unable to reset ftdi device"); @@ -1835,6 +1976,15 @@ ft2232_layout_t* cur_layout = ft2232_layouts; 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) ) { ft2232_layout = "usbjtag"; @@ -2395,7 +2545,7 @@ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'sheevaplug' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'sheevaplug' layout"); return ERROR_JTAG_INIT_FAILED; } @@ -2423,7 +2573,7 @@ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'sheevaplug' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'sheevaplug' layout"); return ERROR_JTAG_INIT_FAILED; } @@ -2446,9 +2596,9 @@ high_output |= 0x08; } - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = high_direction; + buffer_write( 0x82 ); + buffer_write( high_output ); + buffer_write( high_direction ); } @@ -2459,9 +2609,9 @@ */ high_output ^= 0x0c; - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = high_direction; + buffer_write( 0x82 ); + buffer_write( high_output ); + buffer_write( high_direction ); } @@ -2479,9 +2629,9 @@ high_output = 0x08; } - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = high_direction; + buffer_write( 0x82 ); + buffer_write( high_output ); + buffer_write( high_direction ); } @@ -2639,14 +2789,16 @@ first_unsent = cmd; } + /* there are no state transitions in this code, so omit state tracking */ + /* command "Clock Data to TMS/CS Pin (no Read)" */ - BUFFER_ADD = 0x4b; + buffer_write( 0x4b ); /* scan 7 bit */ - BUFFER_ADD = 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_ADD = tms; + buffer_write( tms ); require_send = 1; @@ -2656,6 +2808,7 @@ return retval; } + /* --------------------------------------------------------------------- * Support for IceBear JTAG adapter from Section5: * http://section5.ch/icebear @@ -2752,8 +2905,9 @@ } /* command "set data bits low byte" */ - BUFFER_ADD = 0x80; - BUFFER_ADD = low_output; - BUFFER_ADD = 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: kc8apf at B. <kc...@ma...> - 2009-05-18 19:40:44
|
Author: kc8apf Date: 2009-05-18 19:40:42 +0200 (Mon, 18 May 2009) New Revision: 1824 Modified: trunk/src/jtag/jtag.c Log: Fix fallout from r1818 Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-18 17:29:59 UTC (rev 1823) +++ trunk/src/jtag/jtag.c 2009-05-18 17:40:42 UTC (rev 1824) @@ -868,7 +868,7 @@ } /* field_count represents the true number of fields setup*/ - (*last_cmd)->cmd.scan->num_fields = field_count; + cmd->cmd.scan->num_fields = field_count; return ERROR_OK; } |
From: kc8apf at B. <kc...@ma...> - 2009-05-18 19:30:01
|
Author: kc8apf Date: 2009-05-18 19:29:59 +0200 (Mon, 18 May 2009) New Revision: 1823 Modified: trunk/src/jtag/jtag.c Log: Change last_comand_pointer to last_command_pointer by Michael Bruck <mb...@di...> Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-18 17:29:18 UTC (rev 1822) +++ trunk/src/jtag/jtag.c 2009-05-18 17:29:59 UTC (rev 1823) @@ -89,7 +89,7 @@ jtag_command_t *jtag_command_queue = NULL; -jtag_command_t **last_comand_pointer = &jtag_command_queue; +jtag_command_t **last_command_pointer = &jtag_command_queue; static jtag_tap_t *jtag_all_taps = NULL; enum reset_types jtag_reset_config = RESET_NONE; @@ -436,7 +436,7 @@ return &cmd->next;*/ - return last_comand_pointer; + return last_command_pointer; } @@ -450,7 +450,7 @@ (*last_cmd)->next = NULL; - last_comand_pointer = &((*last_cmd)->next); + last_command_pointer = &((*last_cmd)->next); } @@ -1557,7 +1557,7 @@ jtag_callback_queue_tail = NULL; jtag_command_queue = NULL; - last_comand_pointer = &jtag_command_queue; + last_command_pointer = &jtag_command_queue; return retval; } |
From: kc8apf at B. <kc...@ma...> - 2009-05-18 19:29:20
|
Author: kc8apf Date: 2009-05-18 19:29:18 +0200 (Mon, 18 May 2009) New Revision: 1822 Modified: trunk/src/svf/svf.c Log: Add jtag_queue_command() by Michael Bruck <mb...@di...> [8/8] Modified: trunk/src/svf/svf.c =================================================================== --- trunk/src/svf/svf.c 2009-05-18 17:29:01 UTC (rev 1821) +++ trunk/src/svf/svf.c 2009-05-18 17:29:18 UTC (rev 1822) @@ -695,9 +695,8 @@ } // not good to use this -extern jtag_command_t** jtag_get_last_command_p(void); extern void* cmd_queue_alloc(size_t size); -extern jtag_command_t **last_comand_pointer; +extern void jtag_queue_command(jtag_command_t * cmd); static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) { @@ -707,9 +706,6 @@ // tmp variable int i_tmp; - // not good to use this - jtag_command_t **last_cmd; - // for RUNTEST int run_count; float min_time, max_time; @@ -1180,15 +1176,15 @@ // enter into run_state if necessary if (last_state != svf_para.runtest_run_state) { - last_cmd = jtag_get_last_command_p(); - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->next = NULL; - (*last_cmd)->type = JTAG_STATEMOVE; - (*last_cmd)->cmd.statemove = cmd_queue_alloc(sizeof(statemove_command_t)); - (*last_cmd)->cmd.statemove->end_state = svf_para.runtest_run_state; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + + jtag_queue_command(cmd); + + cmd->type = JTAG_STATEMOVE; + cmd->cmd.statemove = cmd_queue_alloc(sizeof(statemove_command_t)); + cmd->cmd.statemove->end_state = svf_para.runtest_run_state; - cmd_queue_end_state = cmd_queue_cur_state = (*last_cmd)->cmd.statemove->end_state; + cmd_queue_end_state = cmd_queue_cur_state = cmd->cmd.statemove->end_state; } // call jtag_add_clocks @@ -1197,15 +1193,14 @@ if (svf_para.runtest_end_state != svf_para.runtest_run_state) { // move to end_state - last_cmd = jtag_get_last_command_p(); - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->next = NULL; - (*last_cmd)->type = JTAG_STATEMOVE; - (*last_cmd)->cmd.statemove = cmd_queue_alloc(sizeof(statemove_command_t)); - (*last_cmd)->cmd.statemove->end_state = svf_para.runtest_end_state; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + + jtag_queue_command(cmd); + cmd->type = JTAG_STATEMOVE; + cmd->cmd.statemove = cmd_queue_alloc(sizeof(statemove_command_t)); + cmd->cmd.statemove->end_state = svf_para.runtest_end_state; - cmd_queue_end_state = cmd_queue_cur_state = (*last_cmd)->cmd.statemove->end_state; + cmd_queue_end_state = cmd_queue_cur_state = cmd->cmd.statemove->end_state; } last_state = svf_para.runtest_end_state; #else @@ -1294,15 +1289,15 @@ if (svf_tap_state_is_stable(state)) { // TODO: move to state - last_cmd = jtag_get_last_command_p(); - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->next = NULL; - (*last_cmd)->type = JTAG_STATEMOVE; - (*last_cmd)->cmd.statemove = cmd_queue_alloc(sizeof(statemove_command_t)); - (*last_cmd)->cmd.statemove->end_state = state; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + + jtag_queue_command(cmd); + + cmd->type = JTAG_STATEMOVE; + cmd->cmd.statemove = cmd_queue_alloc(sizeof(statemove_command_t)); + cmd->cmd.statemove->end_state = state; - cmd_queue_end_state = cmd_queue_cur_state = (*last_cmd)->cmd.statemove->end_state; + cmd_queue_end_state = cmd_queue_cur_state = cmd->cmd.statemove->end_state; last_state = state; LOG_DEBUG("\tmove to %s by state_move", svf_tap_state_name[state]); |
From: kc8apf at B. <kc...@ma...> - 2009-05-18 19:29:02
|
Author: kc8apf Date: 2009-05-18 19:29:01 +0200 (Mon, 18 May 2009) New Revision: 1821 Modified: trunk/src/jtag/jtag.c Log: Add jtag_queue_command() by Michael Bruck <mb...@di...> [7/8] Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-18 17:28:42 UTC (rev 1820) +++ trunk/src/jtag/jtag.c 2009-05-18 17:29:01 UTC (rev 1821) @@ -1015,17 +1015,17 @@ int MINIDRIVER(interface_jtag_add_tlr)(void) { tap_state_t state = TAP_RESET; - jtag_command_t **last_cmd = jtag_get_last_command_p(); /* allocate memory for a new list member */ - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->next = NULL; - (*last_cmd)->type = JTAG_STATEMOVE; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->cmd.statemove = cmd_queue_alloc(sizeof(statemove_command_t)); - (*last_cmd)->cmd.statemove->end_state = state; + jtag_queue_command(cmd); + cmd->type = JTAG_STATEMOVE; + + cmd->cmd.statemove = cmd_queue_alloc(sizeof(statemove_command_t)); + cmd->cmd.statemove->end_state = state; + return ERROR_OK; } @@ -1069,39 +1069,36 @@ int MINIDRIVER(interface_jtag_add_pathmove)(int num_states, tap_state_t *path) { - jtag_command_t **last_cmd = jtag_get_last_command_p(); - int i; - /* allocate memory for a new list member */ - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->next = NULL; - (*last_cmd)->type = JTAG_PATHMOVE; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->cmd.pathmove = cmd_queue_alloc(sizeof(pathmove_command_t)); - (*last_cmd)->cmd.pathmove->num_states = num_states; - (*last_cmd)->cmd.pathmove->path = cmd_queue_alloc(sizeof(tap_state_t) * num_states); + jtag_queue_command(cmd); - for (i = 0; i < num_states; i++) - (*last_cmd)->cmd.pathmove->path[i] = path[i]; + cmd->type = JTAG_PATHMOVE; + cmd->cmd.pathmove = cmd_queue_alloc(sizeof(pathmove_command_t)); + cmd->cmd.pathmove->num_states = num_states; + cmd->cmd.pathmove->path = cmd_queue_alloc(sizeof(tap_state_t) * num_states); + + for (int i = 0; i < num_states; i++) + cmd->cmd.pathmove->path[i] = path[i]; + return ERROR_OK; } int MINIDRIVER(interface_jtag_add_runtest)(int num_cycles, tap_state_t state) { - jtag_command_t **last_cmd = jtag_get_last_command_p(); - /* allocate memory for a new list member */ - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->next = NULL; - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->type = JTAG_RUNTEST; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->cmd.runtest = cmd_queue_alloc(sizeof(runtest_command_t)); - (*last_cmd)->cmd.runtest->num_cycles = num_cycles; - (*last_cmd)->cmd.runtest->end_state = state; + jtag_queue_command(cmd); + cmd->type = JTAG_RUNTEST; + + cmd->cmd.runtest = cmd_queue_alloc(sizeof(runtest_command_t)); + cmd->cmd.runtest->num_cycles = num_cycles; + cmd->cmd.runtest->end_state = state; + return ERROR_OK; } @@ -1120,16 +1117,16 @@ int MINIDRIVER(interface_jtag_add_clocks)( int num_cycles ) { - jtag_command_t **last_cmd = jtag_get_last_command_p(); - /* allocate memory for a new list member */ - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->next = NULL; - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->type = JTAG_STABLECLOCKS; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->cmd.stableclocks = cmd_queue_alloc(sizeof(stableclocks_command_t)); - (*last_cmd)->cmd.stableclocks->num_cycles = num_cycles; + jtag_queue_command(cmd); + + cmd->type = JTAG_STABLECLOCKS; + + cmd->cmd.stableclocks = cmd_queue_alloc(sizeof(stableclocks_command_t)); + cmd->cmd.stableclocks->num_cycles = num_cycles; + return ERROR_OK; } @@ -1260,18 +1257,17 @@ int MINIDRIVER(interface_jtag_add_reset)(int req_trst, int req_srst) { - jtag_command_t **last_cmd = jtag_get_last_command_p(); - /* allocate memory for a new list member */ - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->next = NULL; - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->type = JTAG_RESET; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->cmd.reset = cmd_queue_alloc(sizeof(reset_command_t)); - (*last_cmd)->cmd.reset->trst = req_trst; - (*last_cmd)->cmd.reset->srst = req_srst; + jtag_queue_command(cmd); + cmd->type = JTAG_RESET; + + cmd->cmd.reset = cmd_queue_alloc(sizeof(reset_command_t)); + cmd->cmd.reset->trst = req_trst; + cmd->cmd.reset->srst = req_srst; + return ERROR_OK; } @@ -1286,17 +1282,16 @@ int MINIDRIVER(interface_jtag_add_sleep)(u32 us) { - jtag_command_t **last_cmd = jtag_get_last_command_p(); - /* allocate memory for a new list member */ - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->next = NULL; - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->type = JTAG_SLEEP; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->cmd.sleep = cmd_queue_alloc(sizeof(sleep_command_t)); - (*last_cmd)->cmd.sleep->us = us; + jtag_queue_command(cmd); + cmd->type = JTAG_SLEEP; + + cmd->cmd.sleep = cmd_queue_alloc(sizeof(sleep_command_t)); + cmd->cmd.sleep->us = us; + return ERROR_OK; } |
From: kc8apf at B. <kc...@ma...> - 2009-05-18 19:28:44
|
Author: kc8apf Date: 2009-05-18 19:28:42 +0200 (Mon, 18 May 2009) New Revision: 1820 Modified: trunk/src/jtag/jtag.c Log: Add jtag_queue_command() by Michael Bruck <mb...@di...> [6/8] Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-18 17:28:21 UTC (rev 1819) +++ trunk/src/jtag/jtag.c 2009-05-18 17:28:42 UTC (rev 1820) @@ -975,30 +975,28 @@ int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int num_fields, scan_field_t *fields, tap_state_t state) { - int i; - jtag_command_t **last_cmd = jtag_get_last_command_p(); - /* allocate memory for a new list member */ - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->next = NULL; - (*last_cmd)->type = JTAG_SCAN; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + jtag_queue_command(cmd); + + cmd->type = JTAG_SCAN; + /* allocate memory for scan command */ - (*last_cmd)->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); - (*last_cmd)->cmd.scan->ir_scan = false; - (*last_cmd)->cmd.scan->num_fields = num_fields; - (*last_cmd)->cmd.scan->fields = cmd_queue_alloc(num_fields * sizeof(scan_field_t)); - (*last_cmd)->cmd.scan->end_state = state; + cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); + cmd->cmd.scan->ir_scan = false; + cmd->cmd.scan->num_fields = num_fields; + cmd->cmd.scan->fields = cmd_queue_alloc(num_fields * sizeof(scan_field_t)); + cmd->cmd.scan->end_state = state; - for (i = 0; i < num_fields; i++) + for (int i = 0; i < num_fields; i++) { int num_bits = fields[i].num_bits; int num_bytes = CEIL(fields[i].num_bits, 8); - (*last_cmd)->cmd.scan->fields[i].tap = fields[i].tap; - (*last_cmd)->cmd.scan->fields[i].num_bits = num_bits; - (*last_cmd)->cmd.scan->fields[i].out_value = buf_cpy(fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); - (*last_cmd)->cmd.scan->fields[i].in_value = fields[i].in_value; + cmd->cmd.scan->fields[i].tap = fields[i].tap; + cmd->cmd.scan->fields[i].num_bits = num_bits; + cmd->cmd.scan->fields[i].out_value = buf_cpy(fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); + cmd->cmd.scan->fields[i].in_value = fields[i].in_value; } return ERROR_OK; |
From: kc8apf at B. <kc...@ma...> - 2009-05-18 19:28:28
|
Author: kc8apf Date: 2009-05-18 19:28:21 +0200 (Mon, 18 May 2009) New Revision: 1819 Modified: trunk/src/jtag/jtag.c Log: Add jtag_queue_command() by Michael Bruck <mb...@di...> [5/8] Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-18 17:28:00 UTC (rev 1818) +++ trunk/src/jtag/jtag.c 2009-05-18 17:28:21 UTC (rev 1819) @@ -883,7 +883,6 @@ int scan_size; int bypass_devices = 0; - jtag_command_t **last_cmd = jtag_get_last_command_p(); jtag_tap_t *tap; /* count devices in bypass */ @@ -900,17 +899,18 @@ } /* allocate memory for a new list member */ - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->next = NULL; - (*last_cmd)->type = JTAG_SCAN; + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + jtag_queue_command(cmd); + + cmd->type = JTAG_SCAN; + /* allocate memory for dr scan command */ - (*last_cmd)->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); - (*last_cmd)->cmd.scan->ir_scan = false; - (*last_cmd)->cmd.scan->num_fields = num_fields + bypass_devices; - (*last_cmd)->cmd.scan->fields = cmd_queue_alloc((num_fields + bypass_devices) * sizeof(scan_field_t)); - (*last_cmd)->cmd.scan->end_state = end_state; + cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); + cmd->cmd.scan->ir_scan = false; + cmd->cmd.scan->num_fields = num_fields + bypass_devices; + cmd->cmd.scan->fields = cmd_queue_alloc((num_fields + bypass_devices) * sizeof(scan_field_t)); + cmd->cmd.scan->end_state = end_state; tap = NULL; nth_tap = -1; @@ -920,7 +920,7 @@ break; } nth_tap++; - (*last_cmd)->cmd.scan->fields[field_count].tap = tap; + cmd->cmd.scan->fields[field_count].tap = tap; if (tap == target_tap) { @@ -938,9 +938,9 @@ u8 out_value[4]; scan_size = num_bits[j]; buf_set_u32(out_value, 0, scan_size, value[j]); - (*last_cmd)->cmd.scan->fields[field_count].num_bits = scan_size; - (*last_cmd)->cmd.scan->fields[field_count].out_value = buf_cpy(out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); - (*last_cmd)->cmd.scan->fields[field_count].in_value = NULL; + cmd->cmd.scan->fields[field_count].num_bits = scan_size; + cmd->cmd.scan->fields[field_count].out_value = buf_cpy(out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + cmd->cmd.scan->fields[field_count].in_value = NULL; field_count++; } } else @@ -954,9 +954,9 @@ } #endif /* program the scan field to 1 bit length, and ignore it's value */ - (*last_cmd)->cmd.scan->fields[field_count].num_bits = 1; - (*last_cmd)->cmd.scan->fields[field_count].out_value = NULL; - (*last_cmd)->cmd.scan->fields[field_count].in_value = NULL; + cmd->cmd.scan->fields[field_count].num_bits = 1; + cmd->cmd.scan->fields[field_count].out_value = NULL; + cmd->cmd.scan->fields[field_count].in_value = NULL; field_count++; } } |