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-21 06:54:40
|
Author: kc8apf Date: 2009-05-21 06:54:38 +0200 (Thu, 21 May 2009) New Revision: 1868 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> -jtag.c, interface_jtag_add_ir_scan() [1/2]: - remove temporary scan_size and use tap->ir_length instead - slight loop restructuring to reduce indentation level Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-21 04:53:07 UTC (rev 1867) +++ trunk/src/jtag/jtag.c 2009-05-21 04:54:38 UTC (rev 1868) @@ -643,23 +643,20 @@ { int found = 0; - size_t scan_size = tap->ir_length; - - /* search the list */ for (int j = 0; j < in_num_fields; j++) { - if (tap == in_fields[j].tap) - { - found = 1; + if (tap != in_fields[j].tap) + continue; - tap->bypass = 0; - - assert(in_fields[j].num_bits == tap->ir_length); /* input fields must have the same length as the TAP's IR */ + found = 1; - cmd_queue_scan_field_clone(field, in_fields + j); + tap->bypass = 0; - break; - } + assert(in_fields[j].num_bits == tap->ir_length); /* input fields must have the same length as the TAP's IR */ + + cmd_queue_scan_field_clone(field, in_fields + j); + + break; } if (!found) @@ -668,13 +665,13 @@ tap->bypass = 1; field->tap = tap; - field->num_bits = scan_size; - field->out_value = buf_set_ones(cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + field->num_bits = tap->ir_length; + field->out_value = buf_set_ones(cmd_queue_alloc(CEIL(tap->ir_length, 8)), tap->ir_length); field->in_value = NULL; /* do not collect input for tap's in bypass */ } /* update device information */ - buf_cpy(field->out_value, tap->cur_instr, scan_size); + buf_cpy(field->out_value, tap->cur_instr, tap->ir_length); field++; } |
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:53:09
|
Author: kc8apf Date: 2009-05-21 06:53:07 +0200 (Thu, 21 May 2009) New Revision: 1867 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> -jtag.c, interface_jtag_add_dr_out(): - use pointer 'field' instead of scan->fields[field_count] - restructure the main loop to clearly separate the two cases: TAP is not bypassed / TAP is bypassed (this is to keep the function similar to interface_jtag_add_dr_scan()) - fix bug where only the first output field has its tap field set - add asserts to verify that target_tap points to the one not bypassed TAP Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-21 04:50:00 UTC (rev 1866) +++ trunk/src/jtag/jtag.c 2009-05-21 04:53:07 UTC (rev 1867) @@ -916,8 +916,6 @@ const u32 *value, tap_state_t end_state) { - int field_count = 0; - /* count devices in bypass */ size_t bypass_devices = 0; @@ -943,47 +941,52 @@ scan->fields = out_fields; scan->end_state = end_state; + + bool target_tap_match = false; + + scan_field_t * field = out_fields; /* keep track where we insert data */ + + /* loop over all enabled TAPs */ + for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) { - scan->fields[field_count].tap = tap; + /* if TAP is not bypassed insert matching input fields */ - if (tap == target_tap) + if (!tap->bypass) { -#ifdef _DEBUG_JTAG_IO_ - /* if a device is listed, the BYPASS register must not be selected */ - if (tap->bypass) - { - LOG_ERROR("BUG: scan data for a device in BYPASS"); - exit(-1); - } -#endif + assert(tap == target_tap); /* target_tap must match the one not bypassed TAP */ + + target_tap_match = true; + for (int j = 0; j < in_num_fields; j++) { u8 out_value[4]; size_t scan_size = num_bits[j]; buf_set_u32(out_value, 0, scan_size, value[j]); - scan->fields[field_count].num_bits = scan_size; - scan->fields[field_count].out_value = buf_cpy(out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); - scan->fields[field_count].in_value = NULL; - field_count++; + + field->tap = tap; + field->num_bits = scan_size; + field->out_value = buf_cpy(out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + field->in_value = NULL; + + field++; } - } else + } + + /* if a TAP is bypassed, generated a dummy bit*/ + else { -#ifdef _DEBUG_JTAG_IO_ - /* if a device isn't listed, the BYPASS register should be selected */ - if (! tap->bypass) - { - LOG_ERROR("BUG: no scan data for a device not in BYPASS"); - exit(-1); - } -#endif - /* program the scan field to 1 bit length, and ignore it's value */ - scan->fields[field_count].num_bits = 1; - scan->fields[field_count].out_value = NULL; - scan->fields[field_count].in_value = NULL; - field_count++; + + field->tap = tap; + field->num_bits = 1; + field->out_value = NULL; + field->in_value = NULL; + + field++; } } + + assert(target_tap_match); /* target_tap should be enabled and not bypassed */ } |
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:50:03
|
Author: kc8apf Date: 2009-05-21 06:50:00 +0200 (Thu, 21 May 2009) New Revision: 1866 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> -jtag.c, interface_jtag_add_dr_scan(): - use pointer 'field' instead of scan->fields[field_count] - restructure the main loop to clearly separate the two cases: TAP is not bypassed / TAP is bypassed - add an assert that each non-bypassed TAP receives at least one field - add an assert that checks that no superfluous input fields were passed Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-21 04:48:15 UTC (rev 1865) +++ trunk/src/jtag/jtag.c 2009-05-21 04:50:00 UTC (rev 1866) @@ -827,9 +827,6 @@ */ int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { - int j; - int field_count = 0; - /* count devices in bypass */ size_t bypass_devices = 0; @@ -854,53 +851,46 @@ scan->fields = out_fields; scan->end_state = state; + + scan_field_t * field = out_fields; /* keep track where we insert data */ + + /* loop over all enabled TAPs */ + for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) { - int found = 0; + /* if TAP is not bypassed insert matching input fields */ - for (j = 0; j < in_num_fields; j++) + if (!tap->bypass) { - if (tap == in_fields[j].tap) + scan_field_t * start_field = field; /* keep initial position for assert() */ + + for (int j = 0; j < in_num_fields; j++) { - found = 1; - - cmd_queue_scan_field_clone(scan->fields + field_count, in_fields + j); + if (tap != in_fields[j].tap) + continue; - field_count++; + cmd_queue_scan_field_clone(field, in_fields + j); + + field++; } + + assert(field > start_field); /* must have at least one input field per not bypassed TAP */ } - if (!found) - { -#ifdef _DEBUG_JTAG_IO_ - /* if a device isn't listed, the BYPASS register should be selected */ - if (! tap->bypass) - { - LOG_ERROR("BUG: no scan data for a device not in BYPASS"); - exit(-1); - } -#endif - /* program the scan field to 1 bit length, and ignore it's value */ - scan->fields[field_count].tap = tap; - scan->fields[field_count].num_bits = 1; - scan->fields[field_count].out_value = NULL; - scan->fields[field_count].in_value = NULL; - field_count++; - } + + /* if a TAP is bypassed, generated a dummy bit*/ else { -#ifdef _DEBUG_JTAG_IO_ - /* if a device is listed, the BYPASS register must not be selected */ - if (tap->bypass) - { - LOG_ERROR("BUG: scan data for a device in BYPASS"); - exit(-1); - } -#endif + field->tap = tap; + field->num_bits = 1; + field->out_value = NULL; + field->in_value = NULL; + + field++; } } - /* field_count represents the true number of fields setup*/ - scan->num_fields = field_count; + assert(field == out_fields + scan->num_fields); /* no superfluous input fields permitted */ + return ERROR_OK; } |
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:48:17
|
Author: kc8apf Date: 2009-05-21 06:48:15 +0200 (Thu, 21 May 2009) New Revision: 1865 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> -jtag.c, interface_jtag_add_ir_scan(): - use pointer 'field' instead of scan->fields[nth_tap] - add assertion to ensure that input data has correct size for TAP's IR Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-21 04:45:57 UTC (rev 1864) +++ trunk/src/jtag/jtag.c 2009-05-21 04:48:15 UTC (rev 1865) @@ -618,10 +618,8 @@ */ int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { - int nth_tap; + size_t num_taps = jtag_NumEnabledTaps(); - int num_taps = jtag_NumEnabledTaps(); - jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); scan_field_t * out_fields = cmd_queue_alloc(num_taps * sizeof(scan_field_t)); @@ -636,16 +634,15 @@ scan->fields = out_fields; scan->end_state = state; - nth_tap = -1; + scan_field_t * field = out_fields; /* keep track where we insert data */ + + /* loop over all enabled TAPs */ + for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) { int found = 0; - nth_tap++; - - assert(nth_tap < num_taps); - size_t scan_size = tap->ir_length; /* search the list */ @@ -656,8 +653,10 @@ found = 1; tap->bypass = 0; + + assert(in_fields[j].num_bits == tap->ir_length); /* input fields must have the same length as the TAP's IR */ - cmd_queue_scan_field_clone(scan->fields + nth_tap, in_fields + j); + cmd_queue_scan_field_clone(field, in_fields + j); break; } @@ -665,20 +664,22 @@ if (!found) { - /* if a tap isn't listed, set it to BYPASS */ + /* if a TAP isn't listed in input fields, set it to BYPASS */ tap->bypass = 1; - scan->fields[nth_tap].tap = tap; - scan->fields[nth_tap].num_bits = scan_size; - scan->fields[nth_tap].out_value = buf_set_ones(cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); - scan->fields[nth_tap].in_value = NULL; /* do not collect input for tap's in bypass */ + field->tap = tap; + field->num_bits = scan_size; + field->out_value = buf_set_ones(cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + field->in_value = NULL; /* do not collect input for tap's in bypass */ } /* update device information */ - buf_cpy(scan->fields[nth_tap].out_value, tap->cur_instr, scan_size); + buf_cpy(field->out_value, tap->cur_instr, scan_size); + + field++; } - assert(nth_tap == (num_taps - 1)); + assert(field == out_fields + num_taps); /* paranoia: jtag_NumEnabledTaps() and jtag_NextEnabledTap() not in sync */ return ERROR_OK; } |
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:46:01
|
Author: kc8apf Date: 2009-05-21 06:45:57 +0200 (Thu, 21 May 2009) New Revision: 1864 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - jtag.c: consolidate output scan field initialization in scan functions - jtag.c: add cmd_queue_scan_field_clone() to handle 1:1 field copies - jtag.c: fix bug where only the first output field in a dr scan has its tap field set Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-21 04:43:48 UTC (rev 1863) +++ trunk/src/jtag/jtag.c 2009-05-21 04:45:57 UTC (rev 1864) @@ -531,6 +531,20 @@ cmd_queue_pages = NULL; } +/** + * Copy a scan_field_t for insertion into the queue. + * + * This allocates a new copy of out_value using cmd_queue_alloc. + */ +static void cmd_queue_scan_field_clone(scan_field_t * dst, const scan_field_t * src) +{ + dst->tap = src->tap; + dst->num_bits = src->num_bits; + dst->out_value = buf_cpy(src->out_value, cmd_queue_alloc(CEIL(src->num_bits, 8)), src->num_bits); + dst->in_value = src->in_value; +} + + static void jtag_prelude1(void) { if (jtag_trst == 1) @@ -633,9 +647,6 @@ assert(nth_tap < num_taps); 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 */ /* search the list */ for (int j = 0; j < in_num_fields; j++) @@ -643,10 +654,11 @@ if (tap == in_fields[j].tap) { found = 1; - 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; + + cmd_queue_scan_field_clone(scan->fields + nth_tap, in_fields + j); + break; } } @@ -654,8 +666,12 @@ if (!found) { /* if a tap isn't listed, set it to BYPASS */ + tap->bypass = 1; + + scan->fields[nth_tap].tap = tap; + scan->fields[nth_tap].num_bits = scan_size; scan->fields[nth_tap].out_value = buf_set_ones(cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); - tap->bypass = 1; + scan->fields[nth_tap].in_value = NULL; /* do not collect input for tap's in bypass */ } /* update device information */ @@ -707,14 +723,7 @@ scan->end_state = state; for (int i = 0; i < in_num_fields; i++) - { - int num_bits = in_fields[i].num_bits; - int num_bytes = CEIL(in_fields[i].num_bits, 8); - scan->fields[i].tap = in_fields[i].tap; - scan->fields[i].num_bits = num_bits; - scan->fields[i].out_value = buf_cpy(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); - scan->fields[i].in_value = in_fields[i].in_value; - } + cmd_queue_scan_field_clone(out_fields + i, in_fields + i); return ERROR_OK; } @@ -847,17 +856,15 @@ for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) { int found = 0; - scan->fields[field_count].tap = tap; for (j = 0; j < in_num_fields; j++) { if (tap == in_fields[j].tap) { found = 1; - size_t scan_size = in_fields[j].num_bits; - scan->fields[field_count].num_bits = scan_size; - scan->fields[field_count].out_value = buf_cpy(in_fields[j].out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); - scan->fields[field_count].in_value = in_fields[j].in_value; + + cmd_queue_scan_field_clone(scan->fields + field_count, in_fields + j); + field_count++; } } @@ -872,6 +879,7 @@ } #endif /* program the scan field to 1 bit length, and ignore it's value */ + scan->fields[field_count].tap = tap; scan->fields[field_count].num_bits = 1; scan->fields[field_count].out_value = NULL; scan->fields[field_count].in_value = NULL; @@ -1027,14 +1035,7 @@ scan->end_state = state; for (int i = 0; i < in_num_fields; i++) - { - int num_bits = in_fields[i].num_bits; - int num_bytes = CEIL(in_fields[i].num_bits, 8); - scan->fields[i].tap = in_fields[i].tap; - scan->fields[i].num_bits = num_bits; - scan->fields[i].out_value = buf_cpy(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); - scan->fields[i].in_value = in_fields[i].in_value; - } + cmd_queue_scan_field_clone(out_fields + i, in_fields + i); return ERROR_OK; } |
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:43:59
|
Author: kc8apf Date: 2009-05-21 06:43:48 +0200 (Thu, 21 May 2009) New Revision: 1863 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - jtag.c: remove unused variable 'nth_tap' from DR scan functions Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-21 04:43:01 UTC (rev 1862) +++ trunk/src/jtag/jtag.c 2009-05-21 04:43:48 UTC (rev 1863) @@ -818,7 +818,6 @@ int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { int j; - int nth_tap; int field_count = 0; /* count devices in bypass */ @@ -845,12 +844,8 @@ scan->fields = out_fields; scan->end_state = state; - nth_tap = -1; - for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) { - nth_tap++; - int found = 0; scan->fields[field_count].tap = tap; @@ -922,7 +917,6 @@ const u32 *value, tap_state_t end_state) { - int nth_tap; int field_count = 0; /* count devices in bypass */ @@ -950,11 +944,8 @@ scan->fields = out_fields; scan->end_state = end_state; - nth_tap = -1; - for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) { - nth_tap++; scan->fields[field_count].tap = tap; if (tap == target_tap) |
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:43:16
|
Author: kc8apf Date: 2009-05-21 06:43:01 +0200 (Thu, 21 May 2009) New Revision: 1862 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - jtag.c: Use single 'for' statement to iterate over list of TAPs in scan functions Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-21 04:41:50 UTC (rev 1861) +++ trunk/src/jtag/jtag.c 2009-05-21 04:43:01 UTC (rev 1862) @@ -604,7 +604,6 @@ */ int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { - jtag_tap_t *tap; int nth_tap; int num_taps = jtag_NumEnabledTaps(); @@ -624,15 +623,11 @@ scan->end_state = state; nth_tap = -1; - tap = NULL; - for(;;){ + + for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) + { int found = 0; - /* do this here so it is not forgotten */ - tap = jtag_NextEnabledTap(tap); - if( tap == NULL ){ - break; - } nth_tap++; assert(nth_tap < num_taps); @@ -824,22 +819,16 @@ { int j; int nth_tap; - int bypass_devices = 0; int field_count = 0; - jtag_tap_t *tap; - /* count devices in bypass */ - tap = NULL; - bypass_devices = 0; - for(;;){ - tap = jtag_NextEnabledTap(tap); - if( tap == NULL ){ - break; - } - if( tap->bypass ){ + + size_t bypass_devices = 0; + + for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) + { + if (tap->bypass) bypass_devices++; - } } jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -856,14 +845,12 @@ scan->fields = out_fields; scan->end_state = state; - tap = NULL; nth_tap = -1; - for(;;){ + + for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) + { nth_tap++; - tap = jtag_NextEnabledTap(tap); - if( tap == NULL ){ - break; - } + int found = 0; scan->fields[field_count].tap = tap; @@ -937,23 +924,18 @@ { int nth_tap; int field_count = 0; - int bypass_devices = 0; - jtag_tap_t *tap; - /* count devices in bypass */ - tap = NULL; - bypass_devices = 0; - for(;;){ - tap = jtag_NextEnabledTap(tap); - if( tap == NULL ){ - break; - } - if( tap->bypass ){ + + size_t bypass_devices = 0; + + for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) + { + if (tap->bypass) bypass_devices++; - } } + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); scan_field_t * out_fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t)); @@ -968,13 +950,10 @@ scan->fields = out_fields; scan->end_state = end_state; - tap = NULL; nth_tap = -1; - for(;;){ - tap = jtag_NextEnabledTap(tap); - if( tap == NULL ){ - break; - } + + for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap)) + { nth_tap++; scan->fields[field_count].tap = tap; |
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:42:10
|
Author: kc8apf Date: 2009-05-21 06:41:50 +0200 (Thu, 21 May 2009) New Revision: 1861 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - jtag.c: consolidate all memory allocations in scan functions in one block, add out_fields pointer to set stage for further changes Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-21 04:39:41 UTC (rev 1860) +++ trunk/src/jtag/jtag.c 2009-05-21 04:41:50 UTC (rev 1861) @@ -609,8 +609,9 @@ int num_taps = jtag_NumEnabledTaps(); - jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + scan_field_t * out_fields = cmd_queue_alloc(num_taps * sizeof(scan_field_t)); jtag_queue_command(cmd); @@ -619,7 +620,7 @@ 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->fields = out_fields; scan->end_state = state; nth_tap = -1; @@ -696,8 +697,9 @@ int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { - jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + scan_field_t * out_fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); jtag_queue_command(cmd); @@ -706,7 +708,7 @@ scan->ir_scan = true; scan->num_fields = in_num_fields; - scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); + scan->fields = out_fields; scan->end_state = state; for (int i = 0; i < in_num_fields; i++) @@ -840,8 +842,9 @@ } } - jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + scan_field_t * out_fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t)); jtag_queue_command(cmd); @@ -850,7 +853,7 @@ scan->ir_scan = false; scan->num_fields = in_num_fields + bypass_devices; - scan->fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t)); + scan->fields = out_fields; scan->end_state = state; tap = NULL; @@ -951,8 +954,9 @@ } } - jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + scan_field_t * out_fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t)); jtag_queue_command(cmd); @@ -961,7 +965,7 @@ scan->ir_scan = false; scan->num_fields = in_num_fields + bypass_devices; - scan->fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t)); + scan->fields = out_fields; scan->end_state = end_state; tap = NULL; @@ -1038,8 +1042,9 @@ */ int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { - jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); + scan_field_t * out_fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); jtag_queue_command(cmd); @@ -1048,7 +1053,7 @@ scan->ir_scan = false; scan->num_fields = in_num_fields; - scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); + scan->fields = out_fields; scan->end_state = state; for (int i = 0; i < in_num_fields; i++) |
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:39:46
|
Author: kc8apf Date: 2009-05-21 06:39:41 +0200 (Thu, 21 May 2009) New Revision: 1860 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Author: Michael Bruck <mb...@di...> - add 'const' qualifier to function parameters in jtag.c that are not to be modified or freed by the function Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-21 04:37:31 UTC (rev 1859) +++ trunk/src/jtag/jtag.c 2009-05-21 04:39:41 UTC (rev 1860) @@ -37,7 +37,7 @@ int jtag_flush_queue_count; /* count # of flushes for profiling / debugging purposes */ -static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state), +static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state), int in_num_fields, scan_field_t *in_fields, tap_state_t state); /* note that this is not marked as static as it must be available from outside jtag.c for those @@ -554,7 +554,7 @@ cmd_queue_cur_state = cmd_queue_end_state; } -void jtag_add_ir_scan_noverify(int in_num_fields, scan_field_t *in_fields, tap_state_t state) +void jtag_add_ir_scan_noverify(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { int retval; jtag_prelude(state); @@ -602,7 +602,7 @@ * see jtag_add_ir_scan() * */ -int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) +int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { jtag_tap_t *tap; int nth_tap; @@ -677,7 +677,7 @@ * This function assumes that the caller handles extra fields for bypassed TAPs * */ -void jtag_add_plain_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) +void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { int retval; @@ -693,7 +693,7 @@ * see jtag_add_plain_ir_scan() * */ -int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) +int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -731,7 +731,7 @@ return jtag_check_value_inner(in, (u8 *)data1, (u8 *)data2, (int)data3); } -static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state), +static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state), int in_num_fields, scan_field_t *in_fields, tap_state_t state) { for (int i = 0; i < in_num_fields; i++) @@ -802,7 +802,7 @@ * The bypass status of TAPs is set by jtag_add_ir_scan(). * */ -void jtag_add_dr_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) +void jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { int retval; @@ -818,7 +818,7 @@ * see jtag_add_dr_scan() * */ -int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) +int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { int j; int nth_tap; @@ -1020,7 +1020,7 @@ * This function assumes that the caller handles extra fields for bypassed TAPs * */ -void jtag_add_plain_dr_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) +void jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { int retval; @@ -1036,7 +1036,7 @@ * see jtag_add_plain_dr_scan() * */ -int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) +int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); @@ -1092,7 +1092,7 @@ return ERROR_OK; } -void jtag_add_pathmove(int num_states, tap_state_t *path) +void jtag_add_pathmove(int num_states, const tap_state_t *path) { tap_state_t cur_state = cmd_queue_cur_state; int i; @@ -1130,7 +1130,7 @@ jtag_error=retval; } -int MINIDRIVER(interface_jtag_add_pathmove)(int num_states, tap_state_t *path) +int MINIDRIVER(interface_jtag_add_pathmove)(int num_states, const tap_state_t *path) { /* allocate memory for a new list member */ jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -1367,7 +1367,7 @@ return; } -int jtag_scan_size(scan_command_t *cmd) +int jtag_scan_size(const scan_command_t *cmd) { int bit_count = 0; int i; @@ -1381,7 +1381,7 @@ return bit_count; } -int jtag_build_buffer(scan_command_t *cmd, u8 **buffer) +int jtag_build_buffer(const scan_command_t *cmd, u8 **buffer) { int bit_count = 0; int i; @@ -1425,7 +1425,7 @@ return bit_count; } -int jtag_read_buffer(u8 *buffer, scan_command_t *cmd) +int jtag_read_buffer(u8 *buffer, const scan_command_t *cmd) { int i; int bit_count = 0; @@ -1463,7 +1463,7 @@ return retval; } -static const char *jtag_tap_name(jtag_tap_t *tap) +static const char *jtag_tap_name(const jtag_tap_t *tap) { return (tap == NULL) ? "(unknown)" : tap->dotted_name; } @@ -1535,7 +1535,7 @@ -enum scan_type jtag_scan_type(scan_command_t *cmd) +enum scan_type jtag_scan_type(const scan_command_t *cmd) { int i; int type = 0; Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-05-21 04:37:31 UTC (rev 1859) +++ trunk/src/jtag/jtag.h 2009-05-21 04:39:41 UTC (rev 1860) @@ -561,9 +561,9 @@ */ extern void jtag_add_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); /* same as jtag_add_ir_scan except no verify is performed */ -extern void jtag_add_ir_scan_noverify(int num_fields, scan_field_t *fields, tap_state_t state); -extern int interface_jtag_add_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); -extern void jtag_add_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); +extern void jtag_add_ir_scan_noverify(int num_fields, const scan_field_t *fields, tap_state_t state); +extern int interface_jtag_add_ir_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate); +extern void jtag_add_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate); /* set in_value to point to 32 bits of memory to scan into. This function * is a way to handle the case of synchronous and asynchronous @@ -587,11 +587,11 @@ /* This version of jtag_add_dr_scan() uses the check_value/mask fields */ extern void jtag_add_dr_scan_check(int num_fields, scan_field_t* fields, tap_state_t endstate); -extern int interface_jtag_add_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); -extern void jtag_add_plain_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); -extern int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); -extern void jtag_add_plain_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); -extern int interface_jtag_add_plain_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); +extern int interface_jtag_add_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate); +extern void jtag_add_plain_ir_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate); +extern int interface_jtag_add_plain_ir_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate); +extern void jtag_add_plain_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate); +extern int interface_jtag_add_plain_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate); /* Simplest/typical callback - do some conversion on the data clocked in. @@ -705,8 +705,8 @@ * a partial implementation of pathmove would have little practical * application. */ -extern void jtag_add_pathmove(int num_states, tap_state_t* path); -extern int interface_jtag_add_pathmove(int num_states, tap_state_t* path); +extern void jtag_add_pathmove(int num_states, const tap_state_t* path); +extern int interface_jtag_add_pathmove(int num_states, const tap_state_t* path); /* go to TAP_IDLE, if we're not already there and cycle * precisely num_cycles in the TAP_IDLE after which move @@ -824,10 +824,10 @@ /* execute jtag queue and check value and use mask if mask is != NULL. invokes * jtag_set_error() with any error. */ extern void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask); -extern enum scan_type jtag_scan_type(scan_command_t* cmd); -extern int jtag_scan_size(scan_command_t* cmd); -extern int jtag_read_buffer(u8* buffer, scan_command_t* cmd); -extern int jtag_build_buffer(scan_command_t* cmd, u8** buffer); +extern enum scan_type jtag_scan_type(const scan_command_t* cmd); +extern int jtag_scan_size(const scan_command_t* cmd); +extern int jtag_read_buffer(u8* buffer, const scan_command_t* cmd); +extern int jtag_build_buffer(const scan_command_t* cmd, u8** buffer); extern void jtag_sleep(u32 us); extern int jtag_call_event_callbacks(enum jtag_event event); |
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:37:35
|
Author: kc8apf Date: 2009-05-21 06:37:31 +0200 (Thu, 21 May 2009) New Revision: 1859 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - add doxygen comments to scan commands in jtag.c - move jtag_add_dr_scan next to interface_jtag_add_dr_scan to keep these function pairs together Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-20 20:52:14 UTC (rev 1858) +++ trunk/src/jtag/jtag.c 2009-05-21 04:37:31 UTC (rev 1859) @@ -566,6 +566,15 @@ } +/** + * Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP. + * + * If the input field list contains an instruction value for a TAP then that is used + * otherwise the TAP is set to bypass. + * + * TAPs for which no fields are passed are marked as bypassed for subsequent DR SCANs. + * + */ 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) @@ -590,11 +599,8 @@ } /** - * Generate a list of scan fields with one entry for each TAP. + * see jtag_add_ir_scan() * - * 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) { @@ -665,6 +671,12 @@ return ERROR_OK; } +/** + * Duplicate the scan fields passed into the function into an IR SCAN command + * + * This function assumes that the caller handles extra fields for bypassed TAPs + * + */ void jtag_add_plain_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { int retval; @@ -676,6 +688,11 @@ jtag_error=retval; } + +/** + * see jtag_add_plain_ir_scan() + * + */ int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { @@ -705,18 +722,8 @@ return ERROR_OK; } -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(in_num_fields, in_fields, cmd_queue_end_state); - if (retval!=ERROR_OK) - jtag_error=retval; -} - - int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, int num_bits); static int jtag_check_value_mask_callback(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) @@ -785,6 +792,32 @@ } } + +/** + * Generate a DR SCAN using the fields passed to the function + * + * For not bypassed TAPs the function checks in_fields and uses fields specified there. + * For bypassed TAPs the function generates a dummy 1bit field. + * + * The bypass status of TAPs is set by jtag_add_ir_scan(). + * + */ +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(in_num_fields, in_fields, cmd_queue_end_state); + if (retval!=ERROR_OK) + jtag_error=retval; +} + + +/** + * see jtag_add_dr_scan() + * + */ int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { int j; @@ -877,6 +910,22 @@ return ERROR_OK; } + + +/** + * Generate a DR SCAN using the array of output values passed to the function + * + * This function assumes that the parameter target_tap specifies the one TAP + * that is not bypassed. All other TAPs must be bypassed and the function will + * generate a dummy 1bit field for them. + * + * For the target_tap a sequence of output-only fields will be generated where + * each field has the size num_bits and the field's values are taken from + * the array value. + * + * The bypass status of TAPs is set by jtag_add_ir_scan(). + * + */ void MINIDRIVER(interface_jtag_add_dr_out)(jtag_tap_t *target_tap, int in_num_fields, const int *num_bits, @@ -964,6 +1013,13 @@ } } + +/** + * Duplicate the scan fields passed into the function into a DR SCAN command + * + * This function assumes that the caller handles extra fields for bypassed TAPs + * + */ void jtag_add_plain_dr_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { int retval; @@ -975,6 +1031,11 @@ jtag_error=retval; } + +/** + * see jtag_add_plain_dr_scan() + * + */ int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -1003,6 +1064,7 @@ return ERROR_OK; } + void jtag_add_tlr(void) { jtag_prelude(TAP_RESET); |
From: <zw...@ma...> - 2009-05-20 22:52:19
|
Author: zwelch Date: 2009-05-20 22:52:14 +0200 (Wed, 20 May 2009) New Revision: 1858 Added: trunk/tools/logger.pl Modified: trunk/Makefile.am Log: Add 'docs' and 'doxygen' targets to top-level Makefile. Modified: trunk/Makefile.am =================================================================== --- trunk/Makefile.am 2009-05-20 09:01:01 UTC (rev 1857) +++ trunk/Makefile.am 2009-05-20 20:52:14 UTC (rev 1858) @@ -13,6 +13,14 @@ EXTRA_DIST = Doxyfile +docs: pdf html doxygen + +doxygen:: + doxygen Doxyfile 2>&1 | perl tools/logger.pl > doxygen.log + +doxygen-clean: + rm -f -r doxygen doxygen.log + MAINTAINERCLEANFILES = \ configure \ Makefile.in \ Added: trunk/tools/logger.pl =================================================================== --- trunk/tools/logger.pl 2009-05-20 09:01:01 UTC (rev 1857) +++ trunk/tools/logger.pl 2009-05-20 20:52:14 UTC (rev 1858) @@ -0,0 +1,34 @@ +#!/usr/bin/perl +# logger.pl: masks long meaningless output with pretty lines of dots +# Details: 1) reads lines from STDIN and echos them on STDOUT, +# 2) print a '.' to STDERR every $N lines. +# 3) print a newline after a sequence of $C dots + +use strict; +use warnings; + +# make sure all output gets displayed immediately +$| = 1; + +# TODO: add -n and -c options w/ zero checks) +# line and column limits +my $N = 10; +my $C = 72; + +# current line and column counters +my $n = 0; +my $c = 0; + +# read all lines from STDIN +while (<STDIN>) +{ + # echo line to output + print STDOUT $_; + # only display progress every Nth step + next unless ++$n % $N; + print STDERR "."; + # wrap at column C to provide fixed-width rows of dots + print STDERR "\n" unless ++$c % $C; +} + +print STDERR "\n" Property changes on: trunk/tools/logger.pl ___________________________________________________________________ Name: svn:eol-style + native |
From: <zw...@ma...> - 2009-05-20 11:01:05
|
Author: zwelch Date: 2009-05-20 11:01:01 +0200 (Wed, 20 May 2009) New Revision: 1857 Modified: trunk/doc/manual/server.txt Log: Add initial OpenOCD server documentation (Duane Ellis and myself). Modified: trunk/doc/manual/server.txt =================================================================== --- trunk/doc/manual/server.txt 2009-05-20 08:58:09 UTC (rev 1856) +++ trunk/doc/manual/server.txt 2009-05-20 09:01:01 UTC (rev 1857) @@ -7,8 +7,294 @@ - @subpage servertelnet - @subpage serverhttp -This section needs to be expanded. +@section serverdocsoverview Overview +What follows is a development history, and describes some of the intent +of why certain features exist within OpenOCD along with the reasoning +behind them. + +This roadmap section was written May 2009 - about 9 to 12 months +after some of this work had started, it attempts to document some of +the reasons why certain features exist within OpenOCD at that time. + +@section serverdocsbg Background + +In early 2008, Oyvind Harboe and Duane Ellis had talked about how to +create a reasonable GUI for OpenOCD - something that is non-invasive, +simple to use and maintain, and does not tie OpenOCD to many other +packages. It would be wrong to "spider web" requirements into other +external external packages. That makes it difficult for developers to +write new code and creates a support nightmare. + +In many ways, people had talked about the need for some type of +high-level interface to OpenOCD, because they only had two choices: +- the ability to script: via an external program the actions of OpenOCD. +- the ablity to write a complex internal commands: native 'commands' + inside of OpenOCD was complicated. + +Fundamentally, the basic problem with both of those would be solved +with a script language: + +-# <b>Internal</b>: simple, small, and self-contained. +-# <b>Cross Language</b>: script friendly front-end +-# <b>Cross Host</b>: GUI Host interface +-# <b>Cross Debugger</b>: GUI-like interface + +What follows hopefully shows how the plans to solve these problems +materialized and help to explain the grand roadmap plan. + +@subsection serverdocsjim Why JimTCL? The Internal Script Language + +At the time, the existing "command context schema" was proving itself +insufficient. However, the problem was also considered from another +direction: should OpenOCD be first class and the script second class? +Which one rules? + +In the end, OpenOCD won, the conclusion was that simpler will be better. +Let the script language be "good enough"; it would not need numerous +features. Imagine debugging an embedded Perl module while debugging +OpenOCD. Yuck. OpenOCD already has a complex enough build system, why +make it worse? + +The goal was to add a simple language that would be moderately easy to +work with and be self-contained. JimTCL is a single C and single H +file, allowing OpenOCD to avoid the spider web of dependent packages. + +@section serverdocstcl TCL Server Port + +The TCL Server port was added in mid-2008. With embedded TCL, we can +write scripts internally to help things, or we can write "C" code that +interfaces well with TCL. + +From there, the developers wanted to create an external front-end that +would be @a very usable and that that @a any language could utilize, +allowing simple front-ends to be (a) cross-platform (b) languag +agnostic, and (c) easy to develop and use. + +Simple ASCII protocols are easy. For example, HTTP, FTP (control), and +SMTP are all text-based. All of these examples are widely and +well-known, and they do not require high-speed or high-volume. They +also support a high degree of interoperability with multiple systems. +They are not human-centric protocols; more correctly, they are rigid, +terse, simple ASCII protocols that are emensely parsable by a script. + +Thus, the TCL server -- a 'machine' type socket interface -- was added +with the hope was it would output simple "name-value" pair type +data. At the time, simple name/value pairs seemed reasonably easier to +do at the time, though Maybe it should output JSON; + +See here: + + http://www.mail-archive.com/openocd-development%40lists.berlios.de/msg00248.html + +The hope was that one could write a script in what ever language you want +and do things with it! + +@section serverdocsgui GUI Like Interfaces + +A lot has been said about various "widigit-foo-gui-library is so +wonderful". Please refer back to the domino and spider web problem of +dependencies. Sure, you may well know the WhatEver-GUI library, but +most others will not (including the next contributer to OpenOCD). +How do we solve that problem? + +For example, Cygwin can be painful, Cygwin GUI packages want X11 +to be present, crossing the barrier between MinGW and Cygwin is +painful, let alone getting the GUI front end to work on MacOS, and +Linux, yuck yuck yuck. Painful. very very painful. + +What works easier and is less work is what is already present in every +platform? The answer: A web browser. In other words, OpenOCD could +serve out embedded web pages via "localhost" to your browser. + +Long before OpenOCD had a TCL command line, Zylin AS built their ZY1000 +devince with a built-in HTTP server. Later, they were willing to both +contribute and integrate most of that work into the main tree. + +@subsection serverdocsother Other Options Concidered + +What if a web browser is not acceptable ie: You want to write your own +front gadget in Eclipse, or KDevelop, or PerlTK, Ruby, or what ever +the latest and greatest Script De Jour is. + +- Option 1: Can we transport this extra data through the GDB server +protocol? In other words, can we extend the GDB server protocol? +No, Eclipse wants to talk to GDB directly and control the GDB port. + +- Option 2: SWIG front end (libopenocd): Would that work? + +That's painful - unless you design your api to be very simplistic - +every language has it's own set of wack-ness, parameter marshaling is +painful. + +What about "callbacks" and structures, and other mess. Imagine +debugging that system. When JimTCL was introduced Spencer Oliver had +quite a few well-put concerns (Summer 2008) about the idea of "TCL" +taking over OpenOCD. His concern is and was: how do you debug +something written in 2 different languages? A "SWIG" front-end is +unlikely to help that situation. + +@subsection serverdoccombined Combined: Socket & WebServer Benifits + +Seriously think about this question: What script language (or compiled +language) today cannot talk directly to a socket? Every thing in the +OpenOCD world can work a socket interface. Any host side tool can talk +to Localhost or remote host, however one might want to make it work. + +A socket interface is very simple. One could write a Java application +and serve it out via the embedded web server, could it - or something +like it talk to the built in TCL server? Yes, absolutely! We are on to +something here. + +@subsection serverdocplatforms Platform Permuntations + +Look at some permutations where OpenOCD can run; these "just work" if +the Socket Approach is used. + + +- Linux/Cygwin/MinGw/MacOSx/FreeBSD development Host Locally +- OpenOCD with some dongle on that host + + +- Linux/Cygwin/MingW/MacOS/FreeBSD development host +- DONGLE: tcpip based ARM-Linux perhaps at91rm9200 or ep93xx.c, running openocd. + + +- Windows cygwin/X desktop environment. +- Linux development host (via remote X11) +- Dongle: "eb93xx.c" based linux board + + +@subsection serverdocfuture Development Scale Out + +During 2008, Duane Ellis created some TCL scripts to display peripheral +register contents. For example, look at the sam7 TCL scripts, and the +stm32 TCL scripts. The hope was others would create more. + + +A good example of this is display/view the peripheral registers on +your embedded target. Lots of commercial embedded debug tools have +this, some can show the TIMER registers, the interrupt controller. + +What if the chip companies behind STM32, or PIC32, AT91SAM chips - +wanted to write something that makes working with their chip better, +easier, faster, etc. + +@a Question: How can we (the OpenOCD group) make that really fancy +stuff across multiple different host platforms? + +Remember: OpenOCD runs on: +-# Linux via USB, +-# ARM Linux - bit-banging GPIO pins +-# MacOSX +-# FreeBSD +-# Cygwin +-# MinGW32 +-# Ecos + +How can we get that to work? + +@subsection serverdocdebug What about Debugger Plugins? + +Really GDB is nice, it works, but it is not a good embedded debug tool. +OpenOCD cannot work in a GUI when one cannot get to its command line. +Some GDB front-end developers have pedantic designs that refuse any and +all access to the GDB command line (e.g. http://www.kdbg.org/todo.php). + +The TELNET interface to OpenOCD works, but the intent of that interface +is <b>human interaction</b>. It must remain available, developers depend +upon it, sometimes that is the only scheme available. + +As a small group of developers, supporting all the platforms and +targets in the debugger will be difficult, as there are enough problem +with the plethora of Dongles, Chips, and different target boards. +Yes, the TCL interface might be suitable, but it has not received much +love or attention. Perhaps it will after you read and understand this. + +One reason might be, this adds one more host side requirement to make +use of the feature. In other words, one could write a Python/TK +front-end, but it is only useable if you have Python/TK installed. +Maybe this can be done via Ecllipse, but not all developers use Ecplise. +Many devlopers use Emacs (possibly with GUD mode) or vim and will not +accept such an interface. The next developer reading this might be +using Insight (GDB-TK) - and somebody else - DDD.. + +There is no common host-side GDB front-end method. + +@section serverdocschallenge Front-End Scaling + +Maybe we are wrong - ie: OpenOCD + some TK tool + +Remember: OpenOCD is often (maybe 99.9%) of the time used with +GDB-REMOTE. There is always some front-end package - be it command-line +GDB under DDD, Eclipse, KDevelop, Emacs, or some other package +(e.g. IAR tools can talk to GDB servers). How can the OpenOCD +developers make that fancy target display GUI visible under 5 to 10 +different host-side GDB.. + +Sure - a <em>man on a mission</em> can make that work. The GUI might be +libopenocd + Perl/TK, or maybe an Eclipse Plug-in. +That is a development support nightmare for reasons described +above. We have enough support problems as it is with targets, dongles, +etc. + +@section serverdocshttpbg HTTP Server Background + +OpenOCD includes an HTTP server because most development environments +are likely contain a web browser. The web browser can talk to OpenOCD's +HTTP server and provide a high-level interfaces to the program. +Altogether, it provides a universally accessible GUI for OpenOCD. + +@section serverdocshtml Simple HTML Pages + +There is (or could be) a simple "Jim TCL" function to read a memory +location. If that can be tied into a TCL script that can modify the +HTTP text, then we have a simple script-based web server with a JTAG +engine under the hood. + +Imagine a web page - served from a small board with two buttons: +"LED_ON" and "LED_OFF", each click - turns the LED on or OFF, a very +simplistic idea. Little boards with web servers are great examples of +this: Ethernut is a good example and Contiki (not a board, an embedded +OS) is another example. + +One could create a simple: <b>Click here to display memory</b> or maybe +<b>click here to display the UART REGISTER BLOCK</b>; click again and see +each register explained in exquisit detail. + +For an STM32, one could create a simple HTML page, with simple +substitution text that the simple web server use to substitute the +HTML text JIMTCL_PEEK32( 0x12345678 ) with the value read from +memory. We end up with an HTML page that could list the contents of +every peripheral register on the target platform. + +That also is transportable, regardless of the OpenOCD host +platform: Linux/X86, Linux/ARM, FreeBSD, Cygwin, MingW, or MacOSX. +You could even port OpenOCD to an Google Android and use it as a +bit-bang dongle JTAG serving web pages. + +@subsection serverdocshtmladv Advanced HTML Pages + +Java or JavaScript could be used to talk back to the TCL port. One +could write a Java, AJAX, FLASH, or some other developer friendly +toolbox and get a real cross-platform GUI interface. Sure, the interface +is not native - but it is 100% cross-platform! + +OpenOCD current uses simple HTML pages; others might be an Adobe FLASH +expert, or a Java Expert. These possibilities could allow the pages +remain cross-platform but still provide a rich user-interface +experience. + +Don't forget it can also be very simple, exactly what one developer +can contribute, a set of very simple web pages. + +@subsection serverdocshtmlstatus HTTP/HTML Status + +As of May 2009, much of the HTML pages were contributed by Zylin AS, +hence they continue to retain some resemblance to the ZY1000 interface. + +Patches would be welcome to move these parts of the system forward. + */ /** @page servergdb OpenOCD GDB Server API |
From: <zw...@ma...> - 2009-05-20 10:58:12
|
Author: zwelch Date: 2009-05-20 10:58:09 +0200 (Wed, 20 May 2009) New Revision: 1856 Modified: trunk/doc/manual/main.txt Log: Add new TCL Primer under the main Technical Primer page. Modified: trunk/doc/manual/main.txt =================================================================== --- trunk/doc/manual/main.txt 2009-05-20 08:48:19 UTC (rev 1855) +++ trunk/doc/manual/main.txt 2009-05-20 08:58:09 UTC (rev 1856) @@ -18,6 +18,7 @@ They seek to provide information to pull novices up the learning curves associated with the fundamental technologies used by OpenOCD. +- @subpage primertcl - @subpage primerjtag Contributions or suggestions for new Technical Primers are welcome. |
From: <zw...@ma...> - 2009-05-20 10:48:25
|
Author: zwelch Date: 2009-05-20 10:48:19 +0200 (Wed, 20 May 2009) New Revision: 1855 Added: trunk/doc/manual/primer/tcl.txt Removed: trunk/src/tcl/README_ABOUT_TCL.txt Log: Move TCL overview from source tree to doxygen manual. Copied: trunk/doc/manual/primer/tcl.txt (from rev 1851, trunk/src/tcl/README_ABOUT_TCL.txt) =================================================================== --- trunk/src/tcl/README_ABOUT_TCL.txt 2009-05-20 06:18:40 UTC (rev 1851) +++ trunk/doc/manual/primer/tcl.txt 2009-05-20 08:48:19 UTC (rev 1855) @@ -0,0 +1,438 @@ +/** @page primertcl OpenOCD TCL Primer + +@verbatim + +**************************************** +**************************************** + +This is a short introduction to 'un-scare' you about the language +known as TCL. It is structured as a guided tour through the files +written by me [Duane Ellis] - in early July 2008 for OpenOCD. + +Which uses the "JIM" embedded Tcl clone-ish language. + +Thing described here are *totally* TCL generic... not Jim specific. + +The goal of this document is to encourage you to add your own set of +chips to the TCL package - and most importantly you should know where +you should put them - so they end up in an organized way. + +--Duane Ellis. + du...@du... + +**************************************** +**************************************** + +Adding "chip" support - Duane Ellis July 5 - 2008. + +The concept is this: + In your "openocd.cfg" file add something like this: + + source [find tcl/chip/VENDOR/FAMILY/NAME.tcl] + + For example... + source [find tcl/chip/atmel/at91/at91sam7x256.tcl] + + You'll notice that it makes use of: + + tcl/cpu/arm/<NAME>.tcl. + + Yes, that is where you should put "core" specific things. + Be careful and learn the difference: + + THE "CORE" - is not the entire chip! + +Definition: + That "file" listed above is called a "CHIP FILE". + + It may be standalone, or may need to "source" other "helper" files. + + The reference [7/5/2008] is the at91sam7x256.tcl file. + +**************************************** +**************************************** +=== TCL TOUR === +Open: at91sam7x256.tcl +=== TCL TOUR === + +A walk through --- For those who are new to TCL. + +Examine the file: at91sam7x256.tcl + +It starts with: + source [find path/filename.tcl] + +In TCL - this is very important. + + Rule #1 Everything is a string. + Rule #2 If you think other wise See #1. +Reminds you of: + Rule #1: The wife is correct. + Rule #2: If you think otherwise, See #1 + +Any text contained inside of [square-brackets] +is just like `back-ticks` in BASH. + +Hence, the [find FILENAME] executes the command find with a single +parameter the filename. + +======================================== + +Next you see a series of: + +set NAME VALUE + +It is mostly "obvious" what is going on. + +Exception: The arrays. + + You would *THINK* Tcl supports arrays. + In fact, multi-dim arrays. That is false. + + For the index for"FLASH(0,CHIPSELECT)" is actually the string + "0,CHIPSELECT". This is problematic. In the normal world, you think + of array indexes as integers. + + For example these are different: + + set foo(0x0c) 123 + set foo(12) 444 + + Why? Because 0x0c {lowercase} is a string. + Don't forget UPPER CASE. + + You must be careful - always... always... use simple decimal + numbers. When in doubt use 'expr' the evaluator. These are all the + same. + + set x 0x0c + set foo([expr $x]) "twelve" + + set x 12 + set foo([expr $x]) "twelve" + + set x "2 * 6" + set foo([expr $x]) "twelve" + +************************************************** +*************************************************** +=== TCL TOUR === +Open the file: "bitsbytes.tcl" + +There is some tricky things going on. +=============== + +First, there is a "for" loop - at level 0 +{level 0 means: out side of a proc/function} + +This means it is evaluated when the file is parsed. + +== SIDEBAR: About The FOR command == +In TCL, "FOR" is a funny thing, it is not what you think it is. + +Syntactically - FOR is a just a command, it is not language +construct like for(;;) in C... + +The "for" command takes 4 parameters. + (1) The "initial command" to execute. + (2) the test "expression" + (3) the "next command" + (4) the "body command" of the FOR loop. + +Notice I used the words "command" and "expression" above. + +The FOR command: +1) executes the "initial command" +2) evaluates the expression if 0 it stops. +3) executes the "body command" +4) executes the "next command" +5) Goto Step 2. + +As show, each of these items are in {curly-braces}. This means they +are passed as they are - KEY-POINT: un evaluated to the FOR +command. Think of it like escaping the backticks in Bash so that the +"under-lying" command can evaluate the contents. In this case, the FOR +COMMAND. + +== END: SIDEBAR: About The FOR command == + +You'll see two lines: + +LINE1: + set vn [format "BIT%d" $x] + +Format is like "sprintf". Because of the [brackets], it becomes what +you think. But here's how: + +First - the line is parsed - for {braces}. In this case, there are +none. The, the parser looks for [brackets] and finds them. The, +parser then evaluates the contents of the [brackets], and replaces +them. It is alot this bash statement. + + EXPORT vn=`date` + +LINE 2 & 3 + set $vn [expr (1024 * $x)] + global $vn + +In line 1, we dynamically created a variable name. Here, we are +assigning it a value. Lastly Line 3 we force the variable to be +global, not "local" the the "for command body" + +=============== +The PROCS + +proc create_mask { MSB LSB } { + ... body .... +} + +Like "for" - PROC is really just a command that takes 3 parameters. +The (1) NAME of the function, a (2) LIST of parameters, and a (3) BODY + +Again, this is at "level 0" so it is a global function. (Yes, TCL +supports local functions, you put them inside of a function} + +You'll see in some cases, I nest [brackets] alot and in others I'm +lazy or wanted it to be more clear... it is a matter of choice. +=============== + + +************************************************** +*************************************************** +=== TCL TOUR === +Open the file: "memory.tcl" +=============== + +Here is where I setup some 'memory definitions' that various targets can use. + +For example - there is an "unknown" memory region. + +All memory regions must have 2 things: + + (1) N_<name> + (2) NAME( array ) + And the array must have some specific names: + ( <idx>, THING ) + Where: THING is one of: + CHIPSELECT + BASE + LEN + HUMAN + TYPE + RWX - the access ability. + WIDTH - the accessible width. + + ie: Some regions of memory are not 'word' + accessible. + +The function "address_info" - given an address should +tell you about the address. + + [as of this writing: 7/5/2008 I have done + only a little bit with this -Duane] + +=== +MAJOR FUNCTION: +== + +proc memread32 { ADDR } +proc memread16 { ADDR } +proc memread8 { ADDR } + +All read memory - and return the contents. + +[ FIXME: 7/5/2008 - I need to create "memwrite" functions] + +************************************************** +*************************************************** +=== TCL TOUR === +Open the file: "mmr_helpers.tcl" +=============== + +This file is used to display and work with "memory mapped registers" + +For example - 'show_mmr32_reg' is given the NAME of the register to +display. The assumption is - the NAME is a global variable holding the +address of that MMR. + +The code does some tricks. The [set [set NAME]] is the TCL way +of doing double variable interpolation - like makefiles... + +In a makefile or shell script you may have seen this: + + FOO_linux = "Penguins rule" + FOO_winXP = "Broken Glass" + FOO_mac = "I like cat names" + + # Pick one + BUILD = linux + #BUILD = winXP + #BUILD = mac + FOO = ${FOO_${BUILD}} + +The "double [set] square bracket" thing is the TCL way, nothing more. + +---- + +The IF statement - and "CATCH" . + +Notice this IF COMMAND - (not statement) is like this: +[7/5/2008 it is this way] + + if ![catch { command } msg ] { + ...something... + } else { + error [format string...] + } + +The "IF" command expects either 2 params, or 4 params. + + === Sidebar: About "commands" === + + Take a look at the internals of "jim.c" + Look for the function: Jim_IfCoreCommand() + And all those other "CoreCommands" + + You'll notice - they all have "argc" and "argv" + + Yea, the entire thing is done that way. + + IF is a command. SO is "FOR" and "WHILE" and "DO" and the + others. That is why I keep using the phase it is a "command" + + === END: Sidebar: About "commands" === + +Parameter 1 to the IF command is expected to be an expression. + +As such, I do not need to wrap it in {braces}. + +In this case, the "expression" is the result of the "CATCH" command. + +CATCH - is an error catcher. + +You give CATCH 1 or 2 parameters. + The first 1st parameter is the "code to execute" + The 2nd (optional) is where to put the error message. + + CATCH returns 0 on success, 1 for failure. + The "![catch command]" is self explaintory. + + +The 3rd parameter to IF must be exactly "else" or "elseif" [I lied +above, the IF command can take many parameters they just have to +be joined by exactly the words "else" or "elseif". + +The 4th parameter contains: + + "error [format STRING....]" + +This lets me modify the previous lower level error by tacking more +text onto the end of it. In this case, i want to add the MMR register +name to make my error message look better. + +--------- +Back to something inside show_mmr32_reg{}. + +You'll see something 'set fn show_${NAME}_helper' Here I am +constructing a 'function name' Then - I look it up to see if it +exists. {the function: "proc_exists" does this} + +And - if it does - I call the function. + +In "C" it is alot like using: 'sprintf()' to construct a function name +string, then using "dlopen()" and "dlsym()" to look it up - and get a +function pointer - and calling the function pointer. + +In this case - I execute a dynamic command. You can do some cool +tricks with interpretors. + +---------- + +Function: show_mmr32_bits() + +In this case, we use the special TCL command "upvar" which tcl's way +of passing things by reference. In this case, we want to reach up into +the callers lexical scope and find the array named "NAMES" + +The rest of the function is pretty straight forward. + +First - we figure out the longest name. +Then print 4 rows of 8bits - with names. + + +************************************************** +*************************************************** +=== TCL TOUR === +Open the file: "chips/atmel/at91/usarts.tcl" +=============== + +First - about the AT91SAM series - all of the usarts +are basically identical... + +Second - there can be many of them. + +In this case - I do some more TCL tricks to dynamically +create functions out of thin air. + +Some assumptions: + +The "CHIP" file has defined some variables in a proper form. + +ie: AT91C_BASE_US0 - for usart0, + AT91C_BASE_US1 - for usart1 + ... And so on ... + +Near the end of the file - look for a large "foreach" loop that +looks like this: + + foreach WHO { US0 US1 US2 US3 US4 .... } { + + } + +In this case, I'm trying to figure out what USARTs exist. + +Step 1 - is to determine if the NAME has been defined. +ie: Does AT91C_BASE_USx - where X is some number exist? + +The "info exists VARNAME" tells you if the variable exists. Then - +inside the IF statement... There is another loop. This loop is the +name of various "sub-registers" within the USART. + +Some more trick are played with the [set VAR] backtick evaluation stuff. +And we create two variables + +We calculate and create the global variable name for every subregister in the USART. +And - declare that variable as GLOBAL so the world can find it. + +Then - we dynamically create a function - based on the register name. + +Look carefully at how that is done. You'll notice the FUNCTION BODY is +a string - not something in {braces}. Why? This is because we need TCL +to evaluate the contents of that string "*NOW*" - when $vn exists not +later, when the function "show_FOO" is invoked. + +Lastly - we build a "str" of commands - and create a single function - +with the generated list of commands for the entire USART. + +With that little bit of code - I now have a bunch of functions like: + + show_US0, show_US1, show_US2, .... etc ... + + And show_US0_MR, show_US0_IMR ... etc... + +And - I have this for every USART... without having to create tons of +boiler plate yucky code. + +**************************************** +**************************************** +END of the Tcl Intro and Walk Through +**************************************** +**************************************** + +FUTURE PLANS + + Some "GPIO" functions... + +@endverbatim + + */ Deleted: trunk/src/tcl/README_ABOUT_TCL.txt =================================================================== --- trunk/src/tcl/README_ABOUT_TCL.txt 2009-05-20 08:44:37 UTC (rev 1854) +++ trunk/src/tcl/README_ABOUT_TCL.txt 2009-05-20 08:48:19 UTC (rev 1855) @@ -1,430 +0,0 @@ -**************************************** -**************************************** - -This is a short introduction to 'un-scare' you about the language -known as TCL. It is structured as a guided tour through the files -written by me [Duane Ellis] - in early July 2008 for OpenOCD. - -Which uses the "JIM" embedded Tcl clone-ish language. - -Thing described here are *totally* TCL generic... not Jim specific. - -The goal of this document is to encourage you to add your own set of -chips to the TCL package - and most importantly you should know where -you should put them - so they end up in an organized way. - ---Duane Ellis. - du...@du... - -**************************************** -**************************************** - -Adding "chip" support - Duane Ellis July 5 - 2008. - -The concept is this: - In your "openocd.cfg" file add something like this: - - source [find tcl/chip/VENDOR/FAMILY/NAME.tcl] - - For example... - source [find tcl/chip/atmel/at91/at91sam7x256.tcl] - - You'll notice that it makes use of: - - tcl/cpu/arm/<NAME>.tcl. - - Yes, that is where you should put "core" specific things. - Be careful and learn the difference: - - THE "CORE" - is not the entire chip! - -Definition: - That "file" listed above is called a "CHIP FILE". - - It may be standalone, or may need to "source" other "helper" files. - - The reference [7/5/2008] is the at91sam7x256.tcl file. - -**************************************** -**************************************** -=== TCL TOUR === -Open: at91sam7x256.tcl -=== TCL TOUR === - -A walk through --- For those who are new to TCL. - -Examine the file: at91sam7x256.tcl - -It starts with: - source [find path/filename.tcl] - -In TCL - this is very important. - - Rule #1 Everything is a string. - Rule #2 If you think other wise See #1. -Reminds you of: - Rule #1: The wife is correct. - Rule #2: If you think otherwise, See #1 - -Any text contained inside of [square-brackets] -is just like `back-ticks` in BASH. - -Hence, the [find FILENAME] executes the command find with a single -parameter the filename. - -======================================== - -Next you see a series of: - -set NAME VALUE - -It is mostly "obvious" what is going on. - -Exception: The arrays. - - You would *THINK* Tcl supports arrays. - In fact, multi-dim arrays. That is false. - - For the index for"FLASH(0,CHIPSELECT)" is actually the string - "0,CHIPSELECT". This is problematic. In the normal world, you think - of array indexes as integers. - - For example these are different: - - set foo(0x0c) 123 - set foo(12) 444 - - Why? Because 0x0c {lowercase} is a string. - Don't forget UPPER CASE. - - You must be careful - always... always... use simple decimal - numbers. When in doubt use 'expr' the evaluator. These are all the - same. - - set x 0x0c - set foo([expr $x]) "twelve" - - set x 12 - set foo([expr $x]) "twelve" - - set x "2 * 6" - set foo([expr $x]) "twelve" - -************************************************** -*************************************************** -=== TCL TOUR === -Open the file: "bitsbytes.tcl" - -There is some tricky things going on. -=============== - -First, there is a "for" loop - at level 0 -{level 0 means: out side of a proc/function} - -This means it is evaluated when the file is parsed. - -== SIDEBAR: About The FOR command == -In TCL, "FOR" is a funny thing, it is not what you think it is. - -Syntactically - FOR is a just a command, it is not language -construct like for(;;) in C... - -The "for" command takes 4 parameters. - (1) The "initial command" to execute. - (2) the test "expression" - (3) the "next command" - (4) the "body command" of the FOR loop. - -Notice I used the words "command" and "expression" above. - -The FOR command: -1) executes the "initial command" -2) evaluates the expression if 0 it stops. -3) executes the "body command" -4) executes the "next command" -5) Goto Step 2. - -As show, each of these items are in {curly-braces}. This means they -are passed as they are - KEY-POINT: un evaluated to the FOR -command. Think of it like escaping the backticks in Bash so that the -"under-lying" command can evaluate the contents. In this case, the FOR -COMMAND. - -== END: SIDEBAR: About The FOR command == - -You'll see two lines: - -LINE1: - set vn [format "BIT%d" $x] - -Format is like "sprintf". Because of the [brackets], it becomes what -you think. But here's how: - -First - the line is parsed - for {braces}. In this case, there are -none. The, the parser looks for [brackets] and finds them. The, -parser then evaluates the contents of the [brackets], and replaces -them. It is alot this bash statement. - - EXPORT vn=`date` - -LINE 2 & 3 - set $vn [expr (1024 * $x)] - global $vn - -In line 1, we dynamically created a variable name. Here, we are -assigning it a value. Lastly Line 3 we force the variable to be -global, not "local" the the "for command body" - -=============== -The PROCS - -proc create_mask { MSB LSB } { - ... body .... -} - -Like "for" - PROC is really just a command that takes 3 parameters. -The (1) NAME of the function, a (2) LIST of parameters, and a (3) BODY - -Again, this is at "level 0" so it is a global function. (Yes, TCL -supports local functions, you put them inside of a function} - -You'll see in some cases, I nest [brackets] alot and in others I'm -lazy or wanted it to be more clear... it is a matter of choice. -=============== - - -************************************************** -*************************************************** -=== TCL TOUR === -Open the file: "memory.tcl" -=============== - -Here is where I setup some 'memory definitions' that various targets can use. - -For example - there is an "unknown" memory region. - -All memory regions must have 2 things: - - (1) N_<name> - (2) NAME( array ) - And the array must have some specific names: - ( <idx>, THING ) - Where: THING is one of: - CHIPSELECT - BASE - LEN - HUMAN - TYPE - RWX - the access ability. - WIDTH - the accessible width. - - ie: Some regions of memory are not 'word' - accessible. - -The function "address_info" - given an address should -tell you about the address. - - [as of this writing: 7/5/2008 I have done - only a little bit with this -Duane] - -=== -MAJOR FUNCTION: -== - -proc memread32 { ADDR } -proc memread16 { ADDR } -proc memread8 { ADDR } - -All read memory - and return the contents. - -[ FIXME: 7/5/2008 - I need to create "memwrite" functions] - -************************************************** -*************************************************** -=== TCL TOUR === -Open the file: "mmr_helpers.tcl" -=============== - -This file is used to display and work with "memory mapped registers" - -For example - 'show_mmr32_reg' is given the NAME of the register to -display. The assumption is - the NAME is a global variable holding the -address of that MMR. - -The code does some tricks. The [set [set NAME]] is the TCL way -of doing double variable interpolation - like makefiles... - -In a makefile or shell script you may have seen this: - - FOO_linux = "Penguins rule" - FOO_winXP = "Broken Glass" - FOO_mac = "I like cat names" - - # Pick one - BUILD = linux - #BUILD = winXP - #BUILD = mac - FOO = ${FOO_${BUILD}} - -The "double [set] square bracket" thing is the TCL way, nothing more. - ----- - -The IF statement - and "CATCH" . - -Notice this IF COMMAND - (not statement) is like this: -[7/5/2008 it is this way] - - if ![catch { command } msg ] { - ...something... - } else { - error [format string...] - } - -The "IF" command expects either 2 params, or 4 params. - - === Sidebar: About "commands" === - - Take a look at the internals of "jim.c" - Look for the function: Jim_IfCoreCommand() - And all those other "CoreCommands" - - You'll notice - they all have "argc" and "argv" - - Yea, the entire thing is done that way. - - IF is a command. SO is "FOR" and "WHILE" and "DO" and the - others. That is why I keep using the phase it is a "command" - - === END: Sidebar: About "commands" === - -Parameter 1 to the IF command is expected to be an expression. - -As such, I do not need to wrap it in {braces}. - -In this case, the "expression" is the result of the "CATCH" command. - -CATCH - is an error catcher. - -You give CATCH 1 or 2 parameters. - The first 1st parameter is the "code to execute" - The 2nd (optional) is where to put the error message. - - CATCH returns 0 on success, 1 for failure. - The "![catch command]" is self explaintory. - - -The 3rd parameter to IF must be exactly "else" or "elseif" [I lied -above, the IF command can take many parameters they just have to -be joined by exactly the words "else" or "elseif". - -The 4th parameter contains: - - "error [format STRING....]" - -This lets me modify the previous lower level error by tacking more -text onto the end of it. In this case, i want to add the MMR register -name to make my error message look better. - ---------- -Back to something inside show_mmr32_reg{}. - -You'll see something 'set fn show_${NAME}_helper' Here I am -constructing a 'function name' Then - I look it up to see if it -exists. {the function: "proc_exists" does this} - -And - if it does - I call the function. - -In "C" it is alot like using: 'sprintf()' to construct a function name -string, then using "dlopen()" and "dlsym()" to look it up - and get a -function pointer - and calling the function pointer. - -In this case - I execute a dynamic command. You can do some cool -tricks with interpretors. - ----------- - -Function: show_mmr32_bits() - -In this case, we use the special TCL command "upvar" which tcl's way -of passing things by reference. In this case, we want to reach up into -the callers lexical scope and find the array named "NAMES" - -The rest of the function is pretty straight forward. - -First - we figure out the longest name. -Then print 4 rows of 8bits - with names. - - -************************************************** -*************************************************** -=== TCL TOUR === -Open the file: "chips/atmel/at91/usarts.tcl" -=============== - -First - about the AT91SAM series - all of the usarts -are basically identical... - -Second - there can be many of them. - -In this case - I do some more TCL tricks to dynamically -create functions out of thin air. - -Some assumptions: - -The "CHIP" file has defined some variables in a proper form. - -ie: AT91C_BASE_US0 - for usart0, - AT91C_BASE_US1 - for usart1 - ... And so on ... - -Near the end of the file - look for a large "foreach" loop that -looks like this: - - foreach WHO { US0 US1 US2 US3 US4 .... } { - - } - -In this case, I'm trying to figure out what USARTs exist. - -Step 1 - is to determine if the NAME has been defined. -ie: Does AT91C_BASE_USx - where X is some number exist? - -The "info exists VARNAME" tells you if the variable exists. Then - -inside the IF statement... There is another loop. This loop is the -name of various "sub-registers" within the USART. - -Some more trick are played with the [set VAR] backtick evaluation stuff. -And we create two variables - -We calculate and create the global variable name for every subregister in the USART. -And - declare that variable as GLOBAL so the world can find it. - -Then - we dynamically create a function - based on the register name. - -Look carefully at how that is done. You'll notice the FUNCTION BODY is -a string - not something in {braces}. Why? This is because we need TCL -to evaluate the contents of that string "*NOW*" - when $vn exists not -later, when the function "show_FOO" is invoked. - -Lastly - we build a "str" of commands - and create a single function - -with the generated list of commands for the entire USART. - -With that little bit of code - I now have a bunch of functions like: - - show_US0, show_US1, show_US2, .... etc ... - - And show_US0_MR, show_US0_IMR ... etc... - -And - I have this for every USART... without having to create tons of -boiler plate yucky code. - -**************************************** -**************************************** -END of the Tcl Intro and Walk Through -**************************************** -**************************************** - -FUTURE PLANS - - Some "GPIO" functions... |
From: <zw...@ma...> - 2009-05-20 10:44:43
|
Author: zwelch Date: 2009-05-20 10:44:37 +0200 (Wed, 20 May 2009) New Revision: 1854 Modified: trunk/doc/Makefile.am Log: Fix doc/Makefile.am dist-hook to include all sections of manual. Modified: trunk/doc/Makefile.am =================================================================== --- trunk/doc/Makefile.am 2009-05-20 08:43:18 UTC (rev 1853) +++ trunk/doc/Makefile.am 2009-05-20 08:44:37 UTC (rev 1854) @@ -6,5 +6,9 @@ dist-hook: mkdir $(distdir)/manual cp -p $(srcdir)/manual/*.txt $(distdir)/manual + for i in $$(cd $(srcdir)/manual/ && ls -d */); do \ + mkdir $(distdir)/manual/$$i; \ + cp -p $(srcdir)/manual/$$i/* $(distdir)/manual/$$i/; \ + done MAINTAINERCLEANFILES = Makefile.in mdate-sh texinfo.tex |
From: <zw...@ma...> - 2009-05-20 10:43:28
|
Author: zwelch Date: 2009-05-20 10:43:18 +0200 (Wed, 20 May 2009) New Revision: 1853 Added: trunk/doc/manual/target/ trunk/doc/manual/target/notarm.txt Removed: trunk/src/non-arm-targets.txt Modified: trunk/doc/manual/target.txt Log: Move non-arm target overview from source tree to doxygen manual. Copied: trunk/doc/manual/target/notarm.txt (from rev 1851, trunk/src/non-arm-targets.txt) =================================================================== --- trunk/src/non-arm-targets.txt 2009-05-20 06:18:40 UTC (rev 1851) +++ trunk/doc/manual/target/notarm.txt 2009-05-20 08:43:18 UTC (rev 1853) @@ -0,0 +1,71 @@ +/** @page targetnotarm OpenOCD Non-ARM Targets + +This page describes outstanding issues w.r.t. non-ARM targets. + +@section targetnotarmflash Flash drivers + +The flash drivers contain ARM32 code that is used +to execute code on the target. + +This needs to be handled in some CPU independent +manner. + +The ocl and ecos flash drivers compile the flash +driver code to run on the target on the developer +machine. + +The ocl and ecos flash drivers should be unified +and instructions should be written on how to +compile the target flash drivers. Perhaps +using automake? + + +eCos has CFI driver that could probably be compiled +for all targets. The trick is to figure out a +way to make the compiled flash drivers work +on all target memory maps + sort out all the +little details + +@section targetnotarm32v64 32 vs. 64 bit + +Currently OpenOCD only supports 32 bit targets. + +Adding 64 bit support would be nice but there +hasn't been any call for it in the openocd development +mailing list + +@section targetnotarmsupport Target Support + +target.h is relatively CPU agnostic and +the intention is to move in the direction of less +instruction set specific. + +Non-CPU targets are also supported, but there isn't +a lot of activity on it in the mailing list currently. +An example is FPGA programming support via JTAG, +but also flash chips can be programmed directly +using JTAG. + +@section targetnotarmphy non-JTAG physical layer + +JTAG is not the only physical protocol used to talk to +CPUs. + +OpenOCD does not today have targets that use non-JTAG. + +The actual physical layer is a relatively modest part +of the total OpenOCD system. + + +@section targetnotarmppc PowerPC + +there exists open source implementations of powerpc +target manipulation, but there hasn't been a lot +of activity in the mailing list. + +@section targetnotarmmips MIPS + +Currently OpenOCD has a MIPS target defined. This is the +first non-ARM example of a CPU target + + */ Modified: trunk/doc/manual/target.txt =================================================================== --- trunk/doc/manual/target.txt 2009-05-20 08:16:50 UTC (rev 1852) +++ trunk/doc/manual/target.txt 2009-05-20 08:43:18 UTC (rev 1853) @@ -23,12 +23,6 @@ */ -/** @page targetnotarm OpenOCD Non-ARM Targets - -This section needs to describe OpenOCD's non-ARM target support. - - */ - /** @page targetregister OpenOCD Target Register API This section needs to describe OpenOCD's Target Register API, as Deleted: trunk/src/non-arm-targets.txt =================================================================== --- trunk/src/non-arm-targets.txt 2009-05-20 08:16:50 UTC (rev 1852) +++ trunk/src/non-arm-targets.txt 2009-05-20 08:43:18 UTC (rev 1853) @@ -1,76 +0,0 @@ -Some outstanding issues w.r.t. non-ARM32 targets -================================================ -This file describes outstanding issues w.r.t. -non-ARM32 targets. - -Ideas & patches welcome! - - - - -Flash drivers -------------- -The flash drivers contain ARM32 code that is used -to execute code on the target. - -This needs to be handled in some CPU independent -manner. - -The ocl and ecos flash drivers compile the flash -driver code to run on the target on the developer -machine. - -The ocl and ecos flash drivers should be unified -and instructions should be written on how to -compile the target flash drivers. Perhaps -using automake? - - - -eCos has CFI driver that could probably be compiled -for all targets. The trick is to figure out a -way to make the compiled flash drivers work -on all target memory maps + sort out all the -little details - -32 vs. 64 bit -------------- -Currently OpenOCD only supports 32 bit targets. - -Adding 64 bit support would be nice but there -hasn't been any call for it in the openocd development -mailing list - -target support --------------- -target.h is relatively CPU agnostic and -the intention is to move in the direction of less -instruction set specific. - -Non-CPU targets are also supported, but there isn't -a lot of activity on it in the mailing list currently. -An example is FPGA programming support via JTAG, -but also flash chips can be programmed directly -using JTAG. - -non-JTAG physical layer ------------------------ -JTAG is not the only physical protocol used to talk to -CPUs. - -OpenOCD does not today have targets that use non-JTAG. - -The actual physical layer is a relatively modest part -of the total OpenOCD system. - - -PowerPC -------- -there exists open source implementations of powerpc -target manipulation, but there hasn't been a lot -of activity in the mailing list. - -MIPS ----- -Currently OpenOCD has a MIPS target defined. This is the -first non-ARM example of a CPU target \ No newline at end of file |
From: <zw...@ma...> - 2009-05-20 10:16:57
|
Author: zwelch Date: 2009-05-20 10:16:50 +0200 (Wed, 20 May 2009) New Revision: 1852 Added: trunk/doc/manual/scripting.txt Removed: trunk/src/scripting.txt Log: Move scripting overview from source tree to doxygen manual. Copied: trunk/doc/manual/scripting.txt (from rev 1851, trunk/src/scripting.txt) =================================================================== --- trunk/src/scripting.txt 2009-05-20 06:18:40 UTC (rev 1851) +++ trunk/doc/manual/scripting.txt 2009-05-20 08:16:50 UTC (rev 1852) @@ -0,0 +1,80 @@ +/** @page scripting OpenOCD Scripting Overview + +@section What scripting will not do + +The scripting support is intended for developers of OpenOCD. +It is not the intention that normal OpenOCD users will +use tcl scripting extensively, write lots of clever scripts, +or contribute back to OpenOCD. + +Target scripts can contain new procedures that end users may +tinker to their needs without really understanding tcl. + +Since end users are not expected to mess with the scripting +language, the choice of language is not terribly important +to those same end users. + +Jim Tcl was chosen as it was easy to integrate, works +great in an embedded environment and vind Harboe +had experience with it. + +@section Uses of scripting + +Default implementation of procedures in tcl/procedures.tcl. + +- Polymorphic commands for target scripts. + - there will be added some commands in Tcl that the target + scripts can replace. + - produce <productionfile> <serialnumber>. Default implementation + is to ignore serial number and write a raw binary file + to beginning of first flash. Target script can dictate + file format and structure of serialnumber. Tcl allows + an argument to consist of e.g. a list so the structure of + the serial number is not limited to a single string. + - reset handling. Precise control of how srst, trst & + tms is handled. +- replace some parts of the current command line handler. + This is only to simplify the implementation of OpenOCD + and will have no externally visible consequences. + Tcl has an advantage in that it's syntax is backwards + compatible with the current OpenOCD syntax. +- external scripting. Low level tcl functions will be defined + that return machine readable output. These low level tcl + functions constitute the tcl api. flash_banks is such + a low level tcl proc. "flash banks" is an example of + a command that has human readable output. The human + readable output is expected to change inbetween versions + of OpenOCD. The output from flash_banks may not be + in the preferred form for the client. The client then + has two choices a) parse the output from flash_banks + or b) write a small piece of tcl to output the + flash_banks output to a more suitable form. The latter may + be simpler. + + +@section External scripting + +The embedded Jim Tcl interpreter in OpenOCD is very limited +compared to any full scale PC hosted scripting language. + +The goal is to keep the internal Jim Tcl interpreter as +small as possible and allow any advanced scripting, +especially scripting that interacts with the host, +run on the host and talk to OpenOCD via the TCP/IP +scripting connection. + +Another problem with Jim Tcl is that there is no debugger +for it. + +With a bit of trickery it should be possible to run Jim +Tcl scripts under a Tcl interpreter on a PC. The advantage +would be that the Jim Tcl scripts could be debugged using +a standard PC Tcl debugger. + +The rough idea is to write an unknown proc that sends +unknown commands to OpenOCD. + +Basically a PC version of startup.tcl. Patches most +gratefully accepted! :-) + + */ Deleted: trunk/src/scripting.txt =================================================================== --- trunk/src/scripting.txt 2009-05-20 06:18:40 UTC (rev 1851) +++ trunk/src/scripting.txt 2009-05-20 08:16:50 UTC (rev 1852) @@ -1,80 +0,0 @@ -Plan for hosted scripting support in OpenOCD -============================================ - -What scripting will not do -========================== -It is not the intention that normal OpenOCD users will -use tcl scripting extensively, write lots of clever scripts, -or contribute back to OpenOCD. - -The scripting support is intended for developers of OpenOCD. - -Target scripts can contain new procedures that end users may -tinker to their needs without really understanding tcl. - -Since end users are not expected to mess with the scripting -language, the choice of language is not terribly important -to those same end users. - -Jim Tcl was chosen as it was easy to integrate, works -great in an embedded environment and vind Harboe -had experience with it. - -Uses of scripting -================= -Default implementation of procedures in tcl/procedures.tcl. - -- Polymorphic commands for target scripts. - - there will be added some commands in Tcl that the target - scripts can replace. - - produce <productionfile> <serialnumber>. Default implementation - is to ignore serial number and write a raw binary file - to beginning of first flash. Target script can dictate - file format and structure of serialnumber. Tcl allows - an argument to consist of e.g. a list so the structure of - the serial number is not limited to a single string. - - reset handling. Precise control of how srst, trst & - tms is handled. -- replace some parts of the current command line handler. - This is only to simplify the implementation of OpenOCD - and will have no externally visible consequences. - Tcl has an advantage in that it's syntax is backwards - compatible with the current OpenOCD syntax. -- external scripting. Low level tcl functions will be defined - that return machine readable output. These low level tcl - functions constitute the tcl api. flash_banks is such - a low level tcl proc. "flash banks" is an example of - a command that has human readable output. The human - readable output is expected to change inbetween versions - of OpenOCD. The output from flash_banks may not be - in the preferred form for the client. The client then - has two choices a) parse the output from flash_banks - or b) write a small piece of tcl to output the - flash_banks output to a more suitable form. The latter may - be simpler. - - -External scripting -================== -The embedded Jim Tcl interpreter in OpenOCD is very limited -compared to any full scale PC hosted scripting language. - -The goal is to keep the internal Jim Tcl interpreter as -small as possible and allow any advanced scripting, -especially scripting that interacts with the host, -run on the host and talk to OpenOCD via the TCP/IP -scripting connection. - -Another problem with Jim Tcl is that there is no debugger -for it. - -With a bit of trickery it should be possible to run Jim -Tcl scripts under a Tcl interpreter on a PC. The advantage -would be that the Jim Tcl scripts could be debugged using -a standard PC Tcl debugger. - -The rough idea is to write an unknown proc that sends -unknown commands to OpenOCD. - -Basically a PC version of startup.tcl. Patches most -gratefully accepted! :-) |
From: oharboe at B. <oh...@ma...> - 2009-05-20 08:18:43
|
Author: oharboe Date: 2009-05-20 08:18:40 +0200 (Wed, 20 May 2009) New Revision: 1851 Modified: trunk/src/jtag/jtag.c Log: Spencer Oliver <sp...@sp...> use 7 tms out of reset Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-20 05:07:34 UTC (rev 1850) +++ trunk/src/jtag/jtag.c 2009-05-20 06:18:40 UTC (rev 1851) @@ -3328,10 +3328,10 @@ /* to state: */ /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ /* from state: */ - { B8(1111111,7), B8(0000000,7), B8(00101,5), B8(01010,5), B8(001101,6), B8(010110,6) }, /* RESET */ + { 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(001,3), B8(0101,4), B8(0011,4), B8(01011,5) }, /* IDLE */ - { B8(1111111,7), B8(011,3), B8(00111,5), B8(01,2), B8(001111,6), B8(0101111,7) }, /* DRSHIFT */ - { B8(1111111,7), B8(011,3), B8(01,2), B8(0,1), B8(001111,6), B8(0101111,7) }, /* DRPAUSE */ + { B8(1111111,7), B8(011,3), B8(00111,5), B8(01,2), B8(001111,6), B8(0101111,7) }, /* DRSHIFT */ + { B8(1111111,7), B8(011,3), B8(01,2), B8(0,1), B8(001111,6), B8(0101111,7) }, /* DRPAUSE */ { 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 */ |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 07:07:38
|
Author: kc8apf Date: 2009-05-20 07:07:34 +0200 (Wed, 20 May 2009) New Revision: 1850 Modified: trunk/src/target/mips32.c trunk/src/target/mips32.h trunk/src/target/mips_ejtag.c trunk/src/target/mips_ejtag.h trunk/src/target/mips_m4k.c Log: Author: Spencer Oliver <sp...@sp...> - Bring the mips step/resume interrupt handling inline with the rest of openocd. Modified: trunk/src/target/mips32.c =================================================================== --- trunk/src/target/mips32.c 2009-05-20 04:55:01 UTC (rev 1849) +++ trunk/src/target/mips32.c 2009-05-20 05:07:34 UTC (rev 1850) @@ -420,3 +420,41 @@ return ERROR_OK; } + +int mips32_enable_interrupts(struct target_s *target, int enable) +{ + int retval; + int update = 0; + u32 dcr; + + /* read debug control register */ + if ((retval = target_read_u32(target, EJTAG_DCR, &dcr)) != ERROR_OK) + return retval; + + if (enable) + { + if (!(dcr & (1<<4))) + { + /* enable interrupts */ + dcr |= (1<<4); + update = 1; + } + } + else + { + if (dcr & (1<<4)) + { + /* disable interrupts */ + dcr &= ~(1<<4); + update = 1; + } + } + + if (update) + { + if ((retval = target_write_u32(target, EJTAG_DCR, dcr)) != ERROR_OK) + return retval; + } + + return ERROR_OK; +} Modified: trunk/src/target/mips32.h =================================================================== --- trunk/src/target/mips32.h 2009-05-20 04:55:01 UTC (rev 1849) +++ trunk/src/target/mips32.h 2009-05-20 05:07:34 UTC (rev 1850) @@ -131,6 +131,7 @@ extern reg_cache_t *mips32_build_reg_cache(target_t *target); extern int mips32_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_params, u32 entry_point, u32 exit_point, int timeout_ms, void *arch_info); extern int mips32_configure_break_unit(struct target_s *target); +extern int mips32_enable_interrupts(struct target_s *target, int enable); extern int mips32_examine(struct target_s *target); extern int mips32_register_commands(struct command_context_s *cmd_ctx); Modified: trunk/src/target/mips_ejtag.c =================================================================== --- trunk/src/target/mips_ejtag.c 2009-05-20 04:55:01 UTC (rev 1849) +++ trunk/src/target/mips_ejtag.c 2009-05-20 05:07:34 UTC (rev 1850) @@ -216,13 +216,11 @@ return ERROR_OK; } -int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info, int enable_interrupts) +int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info) { u32 inst; inst = MIPS32_DRET; - - /* TODO : enable/disable interrrupts */ - + /* execute our dret instruction */ mips32_pracc_exec(ejtag_info, 1, &inst, 0, NULL, 0, NULL, 0); Modified: trunk/src/target/mips_ejtag.h =================================================================== --- trunk/src/target/mips_ejtag.h 2009-05-20 04:55:01 UTC (rev 1849) +++ trunk/src/target/mips_ejtag.h 2009-05-20 05:07:34 UTC (rev 1850) @@ -108,7 +108,7 @@ extern int mips_ejtag_set_instr(mips_ejtag_t *ejtag_info, int new_instr, void *delete_me_and_submit_patch); extern int mips_ejtag_enter_debug(mips_ejtag_t *ejtag_info); -extern int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info, int enable_interrupts); +extern int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info); extern int mips_ejtag_get_impcode(mips_ejtag_t *ejtag_info, u32 *impcode, in_handler_t handler); extern int mips_ejtag_get_idcode(mips_ejtag_t *ejtag_info, u32 *idcode, in_handler_t handler); extern int mips_ejtag_drscan_32(mips_ejtag_t *ejtag_info, u32 *data); Modified: trunk/src/target/mips_m4k.c =================================================================== --- trunk/src/target/mips_m4k.c 2009-05-20 04:55:01 UTC (rev 1849) +++ trunk/src/target/mips_m4k.c 2009-05-20 05:07:34 UTC (rev 1850) @@ -344,8 +344,11 @@ /* configure single step mode */ mips_ejtag_config_step(ejtag_info, 1); + /* disable interrupts while stepping */ + mips32_enable_interrupts(target, 0); + /* exit debug mode */ - mips_ejtag_exit_debug(ejtag_info, 1); + mips_ejtag_exit_debug(ejtag_info); mips_m4k_debug_entry(target); @@ -397,8 +400,11 @@ } } - /* exit debug mode - enable interrupts if required */ - mips_ejtag_exit_debug(ejtag_info, !debug_execution); + /* enable interrupts if we are running */ + mips32_enable_interrupts(target, !debug_execution); + + /* exit debug mode */ + mips_ejtag_exit_debug(ejtag_info); target->debug_reason = DBG_REASON_NOTHALTED; /* registers are now invalid */ @@ -452,8 +458,11 @@ target_call_event_callbacks(target, TARGET_EVENT_RESUMED); + /* disable interrupts while stepping */ + mips32_enable_interrupts(target, 0); + /* exit debug mode */ - mips_ejtag_exit_debug(ejtag_info, 1); + mips_ejtag_exit_debug(ejtag_info); /* registers are now invalid */ mips32_invalidate_core_regs(target); |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:55:08
|
Author: kc8apf Date: 2009-05-20 06:55:01 +0200 (Wed, 20 May 2009) New Revision: 1849 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - simplify code in interface_jtag_add_plain_dr_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:54:15 UTC (rev 1848) +++ trunk/src/jtag/jtag.c 2009-05-20 04:55:01 UTC (rev 1849) @@ -977,28 +977,27 @@ 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)); + 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; + cmd->type = JTAG_SCAN; + cmd->cmd.scan = scan; - /* 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 = in_num_fields; - cmd->cmd.scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); - cmd->cmd.scan->end_state = state; + scan->ir_scan = false; + scan->num_fields = in_num_fields; + scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); + scan->end_state = state; for (int i = 0; i < in_num_fields; i++) { 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(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); - cmd->cmd.scan->fields[i].in_value = in_fields[i].in_value; + scan->fields[i].tap = in_fields[i].tap; + scan->fields[i].num_bits = num_bits; + scan->fields[i].out_value = buf_cpy(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); + scan->fields[i].in_value = in_fields[i].in_value; } return ERROR_OK; |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:54:18
|
Author: kc8apf Date: 2009-05-20 06:54:15 +0200 (Wed, 20 May 2009) New Revision: 1848 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - move scan_size in interface_jtag_add_dr_out() into the scope of the inner loop and change it to unsigned - move loop variable j into for scope Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-20 04:53:34 UTC (rev 1847) +++ trunk/src/jtag/jtag.c 2009-05-20 04:54:15 UTC (rev 1848) @@ -885,7 +885,6 @@ { int nth_tap; int field_count = 0; - int scan_size; int bypass_devices = 0; jtag_tap_t *tap; @@ -928,7 +927,6 @@ if (tap == target_tap) { - int j; #ifdef _DEBUG_JTAG_IO_ /* if a device is listed, the BYPASS register must not be selected */ if (tap->bypass) @@ -937,10 +935,10 @@ exit(-1); } #endif - for (j = 0; j < in_num_fields; j++) + for (int j = 0; j < in_num_fields; j++) { u8 out_value[4]; - scan_size = num_bits[j]; + size_t scan_size = num_bits[j]; buf_set_u32(out_value, 0, scan_size, value[j]); scan->fields[field_count].num_bits = scan_size; scan->fields[field_count].out_value = buf_cpy(out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:53:37
|
Author: kc8apf Date: 2009-05-20 06:53:34 +0200 (Wed, 20 May 2009) New Revision: 1847 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - simplify code in interface_jtag_add_dr_out() 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:53:00 UTC (rev 1846) +++ trunk/src/jtag/jtag.c 2009-05-20 04:53:34 UTC (rev 1847) @@ -903,19 +903,18 @@ } } - /* 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; + cmd->type = JTAG_SCAN; + cmd->cmd.scan = scan; - /* 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 = 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; + scan->ir_scan = false; + scan->num_fields = in_num_fields + bypass_devices; + scan->fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t)); + scan->end_state = end_state; tap = NULL; nth_tap = -1; @@ -925,7 +924,7 @@ break; } nth_tap++; - cmd->cmd.scan->fields[field_count].tap = tap; + scan->fields[field_count].tap = tap; if (tap == target_tap) { @@ -943,9 +942,9 @@ u8 out_value[4]; scan_size = num_bits[j]; buf_set_u32(out_value, 0, scan_size, value[j]); - 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; + scan->fields[field_count].num_bits = scan_size; + scan->fields[field_count].out_value = buf_cpy(out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + scan->fields[field_count].in_value = NULL; field_count++; } } else @@ -959,9 +958,9 @@ } #endif /* program the scan field to 1 bit length, and ignore it's value */ - 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; + scan->fields[field_count].num_bits = 1; + scan->fields[field_count].out_value = NULL; + scan->fields[field_count].in_value = NULL; field_count++; } } |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:53:03
|
Author: kc8apf Date: 2009-05-20 06:53:00 +0200 (Wed, 20 May 2009) New Revision: 1846 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - move scan_size in interface_jtag_add_dr_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:52:26 UTC (rev 1845) +++ trunk/src/jtag/jtag.c 2009-05-20 04:53:00 UTC (rev 1846) @@ -791,7 +791,6 @@ int nth_tap; int bypass_devices = 0; int field_count = 0; - int scan_size; jtag_tap_t *tap; @@ -837,7 +836,7 @@ if (tap == in_fields[j].tap) { found = 1; - scan_size = in_fields[j].num_bits; + size_t scan_size = in_fields[j].num_bits; scan->fields[field_count].num_bits = scan_size; scan->fields[field_count].out_value = buf_cpy(in_fields[j].out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); scan->fields[field_count].in_value = in_fields[j].in_value; |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:52:29
|
Author: kc8apf Date: 2009-05-20 06:52:26 +0200 (Wed, 20 May 2009) New Revision: 1845 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - simplify code in interface_jtag_add_dr_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:51:46 UTC (rev 1844) +++ trunk/src/jtag/jtag.c 2009-05-20 04:52:26 UTC (rev 1845) @@ -808,20 +808,18 @@ } } - /* allocate memory for a new list member */ + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); - jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - jtag_queue_command(cmd); - cmd->type = JTAG_SCAN; + cmd->type = JTAG_SCAN; + cmd->cmd.scan = scan; - /* 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 = 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; + scan->ir_scan = false; + scan->num_fields = in_num_fields + bypass_devices; + scan->fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t)); + scan->end_state = state; tap = NULL; nth_tap = -1; @@ -832,7 +830,7 @@ break; } int found = 0; - cmd->cmd.scan->fields[field_count].tap = tap; + scan->fields[field_count].tap = tap; for (j = 0; j < in_num_fields; j++) { @@ -840,9 +838,9 @@ { found = 1; 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(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; + scan->fields[field_count].num_bits = scan_size; + scan->fields[field_count].out_value = buf_cpy(in_fields[j].out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); + scan->fields[field_count].in_value = in_fields[j].in_value; field_count++; } } @@ -857,9 +855,9 @@ } #endif /* program the scan field to 1 bit length, and ignore it's value */ - 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; + scan->fields[field_count].num_bits = 1; + scan->fields[field_count].out_value = NULL; + scan->fields[field_count].in_value = NULL; field_count++; } else @@ -876,7 +874,7 @@ } /* field_count represents the true number of fields setup*/ - cmd->cmd.scan->num_fields = field_count; + scan->num_fields = field_count; return ERROR_OK; } |
From: kc8apf at B. <kc...@ma...> - 2009-05-20 06:51:58
|
Author: kc8apf Date: 2009-05-20 06:51:46 +0200 (Wed, 20 May 2009) New Revision: 1844 Modified: trunk/src/jtag/jtag.c Log: Author: Michael Bruck <mb...@di...> - simplify code in interface_jtag_add_plain_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:51:08 UTC (rev 1843) +++ trunk/src/jtag/jtag.c 2009-05-20 04:51:46 UTC (rev 1844) @@ -678,29 +678,28 @@ 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 */ - 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; + cmd->type = JTAG_SCAN; + cmd->cmd.scan = 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 = in_num_fields; - cmd->cmd.scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); - cmd->cmd.scan->end_state = state; + scan->ir_scan = true; + scan->num_fields = in_num_fields; + scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t)); + scan->end_state = state; for (int i = 0; i < in_num_fields; i++) { 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(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); - cmd->cmd.scan->fields[i].in_value = in_fields[i].in_value; + scan->fields[i].tap = in_fields[i].tap; + scan->fields[i].num_bits = num_bits; + scan->fields[i].out_value = buf_cpy(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); + scan->fields[i].in_value = in_fields[i].in_value; } return ERROR_OK; |