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
(54) |
Sep
(47) |
Oct
(15) |
Nov
(58) |
Dec
|
|
From: oharboe at B. <oh...@ma...> - 2009-06-04 13:33:38
|
Author: oharboe
Date: 2009-06-04 13:33:36 +0200 (Thu, 04 Jun 2009)
New Revision: 2042
Modified:
trunk/src/flash/str9xpec.c
trunk/src/jtag/jtag.c
trunk/src/target/arm11.h
trunk/src/target/arm720t.c
trunk/src/target/arm7tdmi.c
trunk/src/target/arm920t.c
trunk/src/target/arm926ejs.c
trunk/src/target/arm966e.c
trunk/src/target/arm9tdmi.c
trunk/src/target/arm_adi_v5.c
trunk/src/target/arm_jtag.c
trunk/src/target/embeddedice.c
trunk/src/target/embeddedice.h
trunk/src/target/etb.c
trunk/src/target/etm.c
trunk/src/target/feroceon.c
trunk/src/target/mips_ejtag.c
trunk/src/target/xscale.c
Log:
remove TAP_INVALID as argument to jtag_add_xxx() fn's
Modified: trunk/src/flash/str9xpec.c
===================================================================
--- trunk/src/flash/str9xpec.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/flash/str9xpec.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -539,7 +539,7 @@
field.out_value = NULL;
field.in_value = &status;
- jtag_add_dr_scan(1, &field, TAP_INVALID);
+ jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID));
jtag_execute_queue();
} while(!(status & ISC_STATUS_BUSY));
@@ -620,7 +620,7 @@
field.out_value = §or;
field.in_value = NULL;
- jtag_add_dr_scan(1, &field, TAP_INVALID);
+ jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID));
return ERROR_OK;
}
@@ -717,7 +717,7 @@
field.out_value = NULL;
field.in_value = scanbuf;
- jtag_add_dr_scan(1, &field, TAP_INVALID);
+ jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID));
jtag_execute_queue();
status = buf_get_u32(scanbuf, 0, 8);
@@ -767,7 +767,7 @@
field.out_value = NULL;
field.in_value = scanbuf;
- jtag_add_dr_scan(1, &field, TAP_INVALID);
+ jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID));
jtag_execute_queue();
status = buf_get_u32(scanbuf, 0, 8);
@@ -959,7 +959,7 @@
field.out_value = NULL;
field.in_value = &status;
- jtag_add_dr_scan(1, &field, TAP_INVALID);
+ jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID));
jtag_execute_queue();
} while(!(status & ISC_STATUS_BUSY));
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/jtag/jtag.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -2228,7 +2228,7 @@
return ERROR_COMMAND_SYNTAX_ERROR;
}
- jtag_add_runtest(strtol(args[0], NULL, 0), TAP_INVALID);
+ jtag_add_runtest(strtol(args[0], NULL, 0), jtag_add_end_state(TAP_INVALID));
jtag_execute_queue();
return ERROR_OK;
Modified: trunk/src/target/arm11.h
===================================================================
--- trunk/src/target/arm11.h 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/arm11.h 2009-06-04 11:33:36 UTC (rev 2042)
@@ -47,7 +47,7 @@
23 * ARM11_REGCACHE_MODEREGS + \
9 * ARM11_REGCACHE_FREGS)
-#define ARM11_TAP_DEFAULT TAP_INVALID
+#define ARM11_TAP_DEFAULT jtag_add_end_state(TAP_INVALID)
#define CHECK_RETVAL(action) \
Modified: trunk/src/target/arm720t.c
===================================================================
--- trunk/src/target/arm720t.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/arm720t.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -119,15 +119,15 @@
if (in)
{
fields[1].in_value = (u8 *)in;
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(arm7flip32, (u8 *)in);
} else
{
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
}
if (clock)
- jtag_add_runtest(0, TAP_INVALID);
+ jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID));
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
if((retval = jtag_execute_queue()) != ERROR_OK)
Modified: trunk/src/target/arm7tdmi.c
===================================================================
--- trunk/src/target/arm7tdmi.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/arm7tdmi.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -147,9 +147,9 @@
2,
arm7tdmi_num_bits,
values,
- TAP_INVALID);
+ jtag_add_end_state(TAP_INVALID));
- jtag_add_runtest(0, TAP_INVALID);
+ jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID));
return ERROR_OK;
}
@@ -187,11 +187,11 @@
fields[1].out_value = NULL;
fields[1].in_value = (u8 *)in;
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(arm7flip32, (u8 *)in);
- jtag_add_runtest(0, TAP_INVALID);
+ jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID));
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
@@ -277,11 +277,11 @@
fields[1].out_value = NULL;
jtag_alloc_in_value32(&fields[1]);
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback4(arm7endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[1].in_value);
- jtag_add_runtest(0, TAP_INVALID);
+ jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID));
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
Modified: trunk/src/target/arm920t.c
===================================================================
--- trunk/src/target/arm920t.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/arm920t.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -127,11 +127,11 @@
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;
- jtag_add_dr_scan(4, fields, TAP_INVALID);
+ jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID));
fields[1].in_value = (u8 *)value;
- jtag_add_dr_scan(4, fields, TAP_INVALID);
+ jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(arm_le_to_h_u32, (u8 *)value);
@@ -180,7 +180,7 @@
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;
- jtag_add_dr_scan(4, fields, TAP_INVALID);
+ jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID));
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, value);
@@ -227,7 +227,7 @@
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;
- jtag_add_dr_scan(4, fields, TAP_INVALID);
+ jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID));
arm9tdmi_clock_out(jtag_info, arm_opcode, 0, NULL, 0);
arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 1);
Modified: trunk/src/target/arm926ejs.c
===================================================================
--- trunk/src/target/arm926ejs.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/arm926ejs.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -157,7 +157,7 @@
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;
- jtag_add_dr_scan(4, fields, TAP_INVALID);
+ jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID));
/*TODO: add timeout*/
do
@@ -165,7 +165,7 @@
/* rescan with NOP, to wait for the access to complete */
access = 0;
nr_w_buf = 0;
- jtag_add_dr_scan(4, fields, TAP_INVALID);
+ jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(arm_le_to_h_u32, (u8 *)value);
@@ -227,14 +227,14 @@
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;
- jtag_add_dr_scan(4, fields, TAP_INVALID);
+ jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID));
/*TODO: add timeout*/
do
{
/* rescan with NOP, to wait for the access to complete */
access = 0;
nr_w_buf = 0;
- jtag_add_dr_scan(4, fields, TAP_INVALID);
+ jtag_add_dr_scan(4, fields, jtag_add_end_state(TAP_INVALID));
if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
Modified: trunk/src/target/arm966e.c
===================================================================
--- trunk/src/target/arm966e.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/arm966e.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -189,11 +189,11 @@
fields[2].out_value = &nr_w_buf;
fields[2].in_value = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
fields[1].in_value = (u8 *)value;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(arm_le_to_h_u32, (u8 *)value);
@@ -244,7 +244,7 @@
fields[2].out_value = &nr_w_buf;
fields[2].in_value = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, value);
Modified: trunk/src/target/arm9tdmi.c
===================================================================
--- trunk/src/target/arm9tdmi.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/arm9tdmi.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -204,16 +204,16 @@
if (in)
{
fields[0].in_value=(u8 *)in;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(arm_le_to_h_u32, (u8 *)in);
}
else
{
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
}
- jtag_add_runtest(0, TAP_INVALID);
+ jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID));
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
@@ -263,11 +263,11 @@
fields[2].out_value = NULL;
fields[2].in_value = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(arm_le_to_h_u32, (u8 *)in);
- jtag_add_runtest(0, TAP_INVALID);
+ jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID));
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
@@ -330,11 +330,11 @@
fields[2].out_value = NULL;
fields[2].in_value = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback4(arm9endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[0].in_value);
- jtag_add_runtest(0, TAP_INVALID);
+ jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID));
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
Modified: trunk/src/target/arm_adi_v5.c
===================================================================
--- trunk/src/target/arm_adi_v5.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/arm_adi_v5.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -83,7 +83,7 @@
fields[1].out_value = outvalue;
fields[1].in_value = invalue;
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
return ERROR_OK;
}
@@ -118,13 +118,13 @@
if (invalue)
{
fields[1].in_value = (u8 *)invalue;
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(arm_le_to_h_u32, (u8 *)invalue);
} else
{
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
}
return ERROR_OK;
Modified: trunk/src/target/arm_jtag.c
===================================================================
--- trunk/src/target/arm_jtag.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/arm_jtag.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -53,13 +53,13 @@
if (no_verify_capture==NULL)
{
- jtag_add_ir_scan(1, &field, TAP_INVALID);
+ jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID));
} else
{
/* FIX!!!! this is a kludge!!! arm926ejs.c should reimplement this arm_jtag_set_instr to
* have special verification code.
*/
- jtag_add_ir_scan_noverify(1, &field, TAP_INVALID);
+ jtag_add_ir_scan_noverify(1, &field, jtag_add_end_state(TAP_INVALID));
}
}
@@ -86,7 +86,7 @@
1,
num_bits,
values,
- TAP_INVALID);
+ jtag_add_end_state(TAP_INVALID));
jtag_info->cur_scan_chain = new_scan_chain;
}
Modified: trunk/src/target/embeddedice.c
===================================================================
--- trunk/src/target/embeddedice.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/embeddedice.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -266,7 +266,7 @@
fields[2].check_value = NULL;
fields[2].check_mask = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
fields[0].in_value = reg->value;
fields[0].check_value = check_value;
@@ -278,7 +278,7 @@
*/
buf_set_u32(fields[1].out_value, 0, 5, embeddedice_reg_arch_info[EICE_COMMS_CTRL]);
- jtag_add_dr_scan_check(3, fields, TAP_INVALID);
+ jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_INVALID));
return ERROR_OK;
}
@@ -314,7 +314,7 @@
buf_set_u32(fields[2].out_value, 0, 1, 0);
fields[2].in_value = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
while (size > 0)
{
@@ -325,7 +325,7 @@
buf_set_u32(fields[1].out_value, 0, 5, embeddedice_reg_arch_info[EICE_COMMS_CTRL]);
fields[0].in_value = (u8 *)data;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(arm_le_to_h_u32, (u8 *)data);
data++;
@@ -420,7 +420,7 @@
while (size > 0)
{
buf_set_u32(fields[0].out_value, 0, 32, *data);
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
data++;
size--;
@@ -471,11 +471,11 @@
buf_set_u32(fields[2].out_value, 0, 1, 0);
fields[2].in_value = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
gettimeofday(&lap, NULL);
do
{
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
if ((retval = jtag_execute_queue()) != ERROR_OK)
return retval;
Modified: trunk/src/target/embeddedice.h
===================================================================
--- trunk/src/target/embeddedice.h 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/embeddedice.h 2009-06-04 11:33:36 UTC (rev 2042)
@@ -121,7 +121,7 @@
3,
embeddedice_num_bits,
values,
- TAP_INVALID);
+ jtag_add_end_state(TAP_INVALID));
}
void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count);
Modified: trunk/src/target/etb.c
===================================================================
--- trunk/src/target/etb.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/etb.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -63,7 +63,7 @@
field.in_value = NULL;
- jtag_add_ir_scan(1, &field, TAP_INVALID);
+ jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID));
free(field.out_value);
}
@@ -86,7 +86,7 @@
/* select INTEST instruction */
etb_set_instr(etb, 0x2);
- jtag_add_dr_scan(1, &field, TAP_INVALID);
+ jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID));
etb->cur_scan_chain = new_scan_chain;
@@ -190,7 +190,7 @@
buf_set_u32(fields[2].out_value, 0, 1, 0);
fields[2].in_value = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
for (i = 0; i < num_frames; i++)
{
@@ -204,7 +204,7 @@
buf_set_u32(fields[1].out_value, 0, 7, 0);
fields[0].in_value = (u8 *)(data+i);
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
jtag_add_callback(etb_getbuf, (u8 *)(data+i));
}
@@ -252,7 +252,7 @@
fields[2].check_value = NULL;
fields[2].check_mask = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
/* read the identification register in the second run, to make sure we
* don't read the ETB data register twice, skipping every second entry
@@ -262,7 +262,7 @@
fields[0].check_value = check_value;
fields[0].check_mask = check_mask;
- jtag_add_dr_scan_check(3, fields, TAP_INVALID);
+ jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_INVALID));
free(fields[1].out_value);
free(fields[2].out_value);
Modified: trunk/src/target/etm.c
===================================================================
--- trunk/src/target/etm.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/etm.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -347,13 +347,13 @@
fields[2].check_value = NULL;
fields[2].check_mask = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
fields[0].in_value = reg->value;
fields[0].check_value = check_value;
fields[0].check_mask = check_mask;
- jtag_add_dr_scan_check(3, fields, TAP_INVALID);
+ jtag_add_dr_scan_check(3, fields, jtag_add_end_state(TAP_INVALID));
free(fields[1].out_value);
free(fields[2].out_value);
@@ -430,7 +430,7 @@
buf_set_u32(fields[2].out_value, 0, 1, 1);
fields[2].in_value = NULL;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
return ERROR_OK;
}
Modified: trunk/src/target/feroceon.c
===================================================================
--- trunk/src/target/feroceon.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/feroceon.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -159,9 +159,9 @@
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
- /* no jtag_add_runtest(0, TAP_INVALID) here */
+ /* no jtag_add_runtest(0, jtag_add_end_state(TAP_INVALID)) here */
return ERROR_OK;
}
Modified: trunk/src/target/mips_ejtag.c
===================================================================
--- trunk/src/target/mips_ejtag.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/mips_ejtag.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -50,7 +50,7 @@
- jtag_add_ir_scan(1, &field, TAP_INVALID);
+ jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID));
}
return ERROR_OK;
@@ -73,7 +73,7 @@
- jtag_add_dr_scan(1, &field, TAP_INVALID);
+ jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID));
if (jtag_execute_queue() != ERROR_OK)
{
@@ -100,7 +100,7 @@
- jtag_add_dr_scan(1, &field, TAP_INVALID);
+ jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID));
if (jtag_execute_queue() != ERROR_OK)
{
@@ -131,7 +131,7 @@
- jtag_add_dr_scan(1, &field, TAP_INVALID);
+ jtag_add_dr_scan(1, &field, jtag_add_end_state(TAP_INVALID));
if ((retval = jtag_execute_queue()) != ERROR_OK)
{
Modified: trunk/src/target/xscale.c
===================================================================
--- trunk/src/target/xscale.c 2009-06-04 07:05:22 UTC (rev 2041)
+++ trunk/src/target/xscale.c 2009-06-04 11:33:36 UTC (rev 2042)
@@ -212,7 +212,7 @@
u8 tmp[4];
field.in_value = tmp;
- jtag_add_ir_scan(1, &field, TAP_INVALID);
+ jtag_add_ir_scan(1, &field, jtag_add_end_state(TAP_INVALID));
/* FIX!!!! isn't this check superfluous? verify_ircapture handles this? */
jtag_check_value_mask(&field, tap->expected, tap->expected_mask);
@@ -262,7 +262,7 @@
u8 tmp2;
fields[2].in_value = &tmp2;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask);
@@ -285,7 +285,7 @@
jtag_add_end_state(TAP_IDLE);
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
/* DANGER!!! this must be here. It will make sure that the arguments
* to jtag_set_check_value() does not go out of scope! */
@@ -347,7 +347,7 @@
jtag_add_end_state(TAP_IDLE);
xscale_jtag_set_instr(xscale->jtag_info.tap, xscale->jtag_info.dbgtx);
- jtag_add_runtest(1, TAP_INVALID); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */
+ jtag_add_runtest(1, jtag_add_end_state(TAP_INVALID)); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */
/* repeat until all words have been collected */
int attempts=0;
@@ -725,7 +725,7 @@
u8 tmp2;
fields[2].in_value = &tmp2;
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ jtag_add_dr_scan(3, fields, jtag_add_end_state(TAP_INVALID));
jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask);
@@ -800,7 +800,7 @@
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
fields[0].num_bits = 32;
fields[0].out_value = packet;
@@ -816,7 +816,7 @@
memcpy(&value, packet, sizeof(u32));
cmd = parity(value);
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
}
jtag_execute_queue();
@@ -862,7 +862,7 @@
- jtag_add_dr_scan(2, fields, TAP_INVALID);
+ jtag_add_dr_scan(2, fields, jtag_add_end_state(TAP_INVALID));
return ERROR_OK;
}
|
|
From: oharboe at B. <oh...@ma...> - 2009-06-04 09:05:28
|
Author: oharboe
Date: 2009-06-04 09:05:22 +0200 (Thu, 04 Jun 2009)
New Revision: 2041
Modified:
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
Log:
jtag_add_end_state() now returns the value of the global variable and does not modify the global variable if passed TAP_INVALID. This patch has no effect on the current code and is just to prepare upcoming patches.
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-04 06:56:22 UTC (rev 2040)
+++ trunk/src/jtag/jtag.c 2009-06-04 07:05:22 UTC (rev 2041)
@@ -773,13 +773,16 @@
}
}
-void jtag_add_end_state(tap_state_t state)
+tap_state_t jtag_add_end_state(tap_state_t state)
{
- cmd_queue_end_state = state;
- if ((cmd_queue_end_state == TAP_DRSHIFT)||(cmd_queue_end_state == TAP_IRSHIFT))
+ if ((state == TAP_DRSHIFT)||(state == TAP_IRSHIFT))
{
LOG_ERROR("BUG: TAP_DRSHIFT/IRSHIFT can't be end state. Calling code should use a larger scan field");
}
+
+ if (state!=TAP_INVALID)
+ cmd_queue_end_state = state;
+ return cmd_queue_end_state;
}
void jtag_add_sleep(u32 us)
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-04 06:56:22 UTC (rev 2040)
+++ trunk/src/jtag/jtag.h 2009-06-04 07:05:22 UTC (rev 2041)
@@ -488,7 +488,16 @@
*/
extern void jtag_add_reset(int req_tlr_or_trst, int srst);
-extern void jtag_add_end_state(tap_state_t endstate);
+
+/**
+ * Function jtag_add_stable_clocks
+ *
+ * Set a global variable to \a state if \a state != TAP_INVALID.
+ *
+ * Return the value of the global variable.
+ *
+ **/
+extern tap_state_t jtag_add_end_state(tap_state_t state);
extern void jtag_add_sleep(u32 us);
|
|
From: oharboe at B. <oh...@ma...> - 2009-06-04 08:56:25
|
Author: oharboe
Date: 2009-06-04 08:56:22 +0200 (Thu, 04 Jun 2009)
New Revision: 2040
Modified:
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
Log:
JTAG_TRST_ASSERTED event cleanup. More clear where and when it is invoked and some duplicate(harmless) invocations avoided.
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-04 01:22:23 UTC (rev 2039)
+++ trunk/src/jtag/jtag.c 2009-06-04 06:56:22 UTC (rev 2040)
@@ -385,17 +385,14 @@
return ERROR_OK;
}
-static void jtag_prelude1(void)
+static void jtag_checks(void)
{
assert(jtag_trst == 0);
-
- if (cmd_queue_end_state == TAP_RESET)
- jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
}
static void jtag_prelude(tap_state_t state)
{
- jtag_prelude1();
+ jtag_checks();
if (state != TAP_INVALID)
jtag_add_end_state(state);
@@ -596,6 +593,8 @@
retval=interface_jtag_add_tlr();
if (retval!=ERROR_OK)
jtag_error=retval;
+
+ jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
}
void jtag_add_pathmove(int num_states, const tap_state_t *path)
@@ -628,7 +627,7 @@
cur_state = path[i];
}
- jtag_prelude1();
+ jtag_checks();
retval = interface_jtag_add_pathmove(num_states, path);
cmd_queue_cur_state = path[num_states - 1];
@@ -663,7 +662,7 @@
if( num_cycles > 0 )
{
- jtag_prelude1();
+ jtag_checks();
retval = interface_jtag_add_clocks(num_cycles);
if (retval != ERROR_OK)
@@ -755,7 +754,6 @@
LOG_DEBUG("JTAG reset with RESET instead of TRST");
jtag_add_end_state(TAP_RESET);
jtag_add_tlr();
- jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
return;
}
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-04 01:22:23 UTC (rev 2039)
+++ trunk/src/jtag/jtag.h 2009-06-04 06:56:22 UTC (rev 2040)
@@ -218,6 +218,17 @@
LINE_PUSH_PULL = 0x1,
};
+/*
+ * There are three cases when JTAG_TRST_ASSERTED callback is invoked. The
+ * event is invoked *after* TRST is asserted(or queued rather). It is illegal
+ * to communicate with the JTAG interface during the callback(as there is
+ * currently a queue being built).
+ *
+ * - TMS reset
+ * - SRST pulls TRST
+ * - TRST asserted
+ *
+ **/
enum jtag_event {
JTAG_TRST_ASSERTED
};
|
|
From: <zw...@ma...> - 2009-06-04 03:22:26
|
Author: zwelch
Date: 2009-06-04 03:22:23 +0200 (Thu, 04 Jun 2009)
New Revision: 2039
Modified:
trunk/doc/openocd.texi
Log:
David Brownell <da...@pa...>:
Update the "General Commands" (a.k.a. "random stuff") chapter,
and associated chunks of other text:
- Switch to @deffn and review everything that's documented
- Improve descriptions of reset events, with reference to
the setup.tcl code which issues them.
- Move one zy1000-specific command to that driver's doc.
- There is no "script" command; remove its doc.
NOTE: Some things missing from this bit of work are:
1- Reviewing the code to catch various *missing* functions,
mostly from "target.c"
2- Alphabetizing and organizing. This chapter is a real
grab-bag with no evident focus or structural principle.
3- Hole-filling and bugfixing with respect to messaging/logging.
Example, what principle could possibly justify the tcl command
output going into the server output/log instead of just the
telnet session?
4- Not just for this chapter ... but there should be a section
with descriptions of all the supported image file formats,
so every image command can just reference that section.
Modified: trunk/doc/openocd.texi
===================================================================
--- trunk/doc/openocd.texi 2009-06-04 01:17:27 UTC (rev 2038)
+++ trunk/doc/openocd.texi 2009-06-04 01:22:23 UTC (rev 2039)
@@ -1565,8 +1565,14 @@
This defines some driver-specific commands,
which are not currently documented here.
@end quotation
+
+@deffn Command power [@option{on}|@option{off}]
+Turn power switch to target on/off.
+No arguments: print status.
@end deffn
+@end deffn
+
@anchor{JTAG Speed}
@section JTAG Speed
JTAG clock setup is part of system setup.
@@ -2308,26 +2314,33 @@
@item @b{old-pre_resume}
@* DO NOT USE THIS: Used internally
@item @b{reset-assert-pre}
-@* Before reset is asserted on the tap.
+@* Issued as part of @command{reset} processing
+after SRST and/or TRST were activated and deactivated,
+but before reset is asserted on the tap.
@item @b{reset-assert-post}
-@* Reset is now asserted on the tap.
+@* Issued as part of @command{reset} processing
+when reset is asserted on the tap.
@item @b{reset-deassert-pre}
-@* Reset is about to be released on the tap
+@* Issued as part of @command{reset} processing
+when reset is about to be released on the tap.
@item @b{reset-deassert-post}
-@* Reset has been released on the tap
+@* Issued as part of @command{reset} processing
+when reset has been released on the tap.
@item @b{reset-end}
-@* Currently not used.
+@* Issued as the final step in @command{reset} processing.
@item @b{reset-halt-post}
@* Currently not usd
@item @b{reset-halt-pre}
@* Currently not used
@item @b{reset-init}
@* Used by @b{reset init} command for board-specific initialization.
+This event fires after @emph{reset-deassert-post}.
This is where you would configure PLLs and clocking, set up DRAM so
you can download programs that don't fit in on-chip SRAM, set up pin
multiplexing, and so on.
@item @b{reset-start}
-@* Currently not used
+@* Issued as part of @command{reset} processing
+before either SRST or TRST are activated.
@item @b{reset-wait-pos}
@* Currently not used
@item @b{reset-wait-pre}
@@ -3472,28 +3485,38 @@
@section Daemon Commands
-@subsection sleep [@var{msec}]
-@cindex sleep
-@*Wait for n milliseconds before resuming. Useful in connection with script files
-(@var{script} command and @var{target_script} configuration).
+@deffn Command sleep msec [@option{busy}]
+Wait for at least @var{msec} milliseconds before resuming.
+If @option{busy} is passed, busy-wait instead of sleeping.
+(This option is strongly discouraged.)
+Useful in connection with script files
+(@command{script} command and @command{target_name} configuration).
+@end deffn
-@subsection shutdown
-@cindex shutdown
-@*Close the OpenOCD daemon, disconnecting all clients (GDB, telnet, other).
+@deffn Command shutdown
+Close the OpenOCD daemon, disconnecting all clients (GDB, telnet, other).
+@end deffn
@anchor{debug_level}
-@subsection debug_level [@var{n}]
-@cindex debug_level
-@*Display or adjust debug level to n<0-3>
+@deffn Command debug_level [n]
+@cindex message level
+Display debug level.
+If @var{n} (from 0..3) is provided, then set it to that level.
+This affects the kind of messages sent to the server log.
+Level 0 is error messages only;
+level 1 adds warnings;
+level 2 (the default) adds informational messages;
+and level 3 adds debugging messages.
+@end deffn
-@subsection fast [@var{enable|disable}]
-@cindex fast
-@*Default disabled. Set default behaviour of OpenOCD to be "fast and dangerous". For instance ARM7/9 DCC memory
-downloads and fast memory access will work if the JTAG interface isn't too fast and
-the core doesn't run at a too low frequency. Note that this option only changes the default
-and that the indvidual options, like DCC memory downloads, can be enabled and disabled
-individually.
+@deffn Command fast [enable|disable]
+Default disabled.
+Set default behaviour of OpenOCD to be "fast and dangerous".
+At this writing, this only affects the defaults for two ARM7/ARM9 parameters:
+fast memory access, and DCC downloads. Those parameters may still be
+individually overridden.
+
The target specific "dangerous" optimisation tweaking options may come and go
as more robust and user friendly ways are found to ensure maximum throughput
and robustness with a minimum of configuration.
@@ -3503,192 +3526,265 @@
@example
openocd -c "fast enable" -c "interface dummy" -f target/str710.cfg
@end example
+@end deffn
-@subsection echo <@var{message}>
-@cindex echo
-@*Output message to stdio. e.g. echo "Programming - please wait"
+@deffn Command echo message
+Logs a message at "user" priority.
+Output @var{message} to stdout.
+@example
+echo "Downloading kernel -- please wait"
+@end example
+@end deffn
-@subsection log_output <@var{file}>
-@cindex log_output
-@*Redirect logging to <file> (default: stderr)
+@deffn Command log_output [filename]
+Redirect logging to @var{filename};
+the initial log output channel is stderr.
+@end deffn
-@subsection script <@var{file}>
-@cindex script
-@*Execute commands from <file>
-See also: ``source [find FILENAME]''
+@section Target State handling
+@cindex reset
+@cindex halt
+@cindex target initialization
-@section Target state handling
-@subsection power <@var{on}|@var{off}>
-@cindex reg
-@*Turn power switch to target on/off.
-No arguments: print status.
-Not all interfaces support this.
+In this section ``target'' refers to a CPU configured as
+shown earlier (@pxref{CPU Configuration}).
+These commands, like many, implicitly refer to
+a @dfn{current target} which is used to perform the
+various operations. The current target may be changed
+by using @command{targets} command with the name of the
+target which should become current.
-@subsection reg [@option{#}|@option{name}] [value]
-@cindex reg
-@*Access a single register by its number[@option{#}] or by its [@option{name}].
-No arguments: list all available registers for the current target.
-Number or name argument: display a register.
-Number or name and value arguments: set register value.
+@deffn Command reg [(number|name) [value]]
+Access a single register by @var{number} or by its @var{name}.
-@subsection poll [@option{on}|@option{off}]
-@cindex poll
-@*Poll the target for its current state. If the target is in debug mode, architecture
+@emph{With no arguments}:
+list all available registers for the current target,
+showing number, name, size, value, and cache status.
+
+@emph{With number/name}: display that register's value.
+
+@emph{With both number/name and value}: set register's value.
+
+Cores may have surprisingly many registers in their
+Debug and trace infrastructure:
+
+@example
+> reg
+(0) r0 (/32): 0x0000D3C2 (dirty: 1, valid: 1)
+(1) r1 (/32): 0xFD61F31C (dirty: 0, valid: 1)
+(2) r2 (/32): 0x00022551 (dirty: 0, valid: 1)
+...
+(164) ETM_CONTEXTID_COMPARATOR_MASK (/32): \
+ 0x00000000 (dirty: 0, valid: 0)
+>
+@end example
+@end deffn
+
+@deffn Command poll [@option{on}|@option{off}]
+Poll the current target for its current state.
+If that target is in debug mode, architecture
specific information about the current state is printed. An optional parameter
allows continuous polling to be enabled and disabled.
-@subsection halt [@option{ms}]
-@cindex halt
-@*Send a halt request to the target and wait for it to halt for up to [@option{ms}] milliseconds.
-Default [@option{ms}] is 5 seconds if no arg given.
-Optional arg @option{ms} is a timeout in milliseconds. Using 0 as the [@option{ms}]
-will stop OpenOCD from waiting.
+@example
+> poll
+target state: halted
+target halted in ARM state due to debug-request, \
+ current mode: Supervisor
+cpsr: 0x800000d3 pc: 0x11081bfc
+MMU: disabled, D-Cache: disabled, I-Cache: enabled
+>
+@end example
+@end deffn
-@subsection wait_halt [@option{ms}]
-@cindex wait_halt
-@*Wait for the target to enter debug mode. Optional [@option{ms}] is
-a timeout in milliseconds. Default [@option{ms}] is 5 seconds if no
-arg is given.
+@deffn Command halt [ms]
+@deffnx Command wait_halt [ms]
+The @command{halt} command first sends a halt request to the target,
+which @command{wait_halt} doesn't.
+Otherwise these behave the same: wait up to @var{ms} milliseconds,
+or 5 seconds if there is no parameter, for the target to halt
+(and enter debug mode).
+Using 0 as the @var{ms} parameter prevents OpenOCD from waiting.
+@end deffn
-@subsection resume [@var{address}]
-@cindex resume
-@*Resume the target at its current code position, or at an optional address.
+@deffn Command resume [address]
+Resume the target at its current code position,
+or the optional @var{address} if it is provided.
OpenOCD will wait 5 seconds for the target to resume.
+@end deffn
-@subsection step [@var{address}]
-@cindex step
-@*Single-step the target at its current code position, or at an optional address.
+@deffn Command step [address]
+Single-step the target at its current code position,
+or the optional @var{address} if it is provided.
+@end deffn
@anchor{Reset Command}
-@subsection reset [@option{run}|@option{halt}|@option{init}]
-@cindex reset
-@*Perform a hard-reset. The optional parameter specifies what should
+@deffn Command reset
+@deffnx Command {reset run}
+@deffnx Command {reset halt}
+@deffnx Command {reset init}
+Perform as hard a reset as possible, using SRST if possible.
+@emph{All defined targets will be reset, and target
+events will fire during the reset sequence.}
+
+The optional parameter specifies what should
happen after the reset.
If there is no parameter, a @command{reset run} is executed.
The other options will not work on all systems.
@xref{Reset Configuration}.
+
@itemize @minus
-@item @b{run}
-@cindex reset run
-@*Let the target run.
-@item @b{halt}
-@cindex reset halt
-@*Immediately halt the target (works only with certain configurations).
-@item @b{init}
-@cindex reset init
-@*Immediately halt the target, and execute the reset script (works only with certain
-configurations)
+@item @b{run} Let the target run
+@item @b{halt} Immediately halt the target
+@item @b{init} Immediately halt the target, and execute the reset-init script
@end itemize
+@end deffn
-@subsection soft_reset_halt
-@cindex reset
-@*Requesting target halt and executing a soft reset. This is often used
+@deffn Command soft_reset_halt
+Requesting target halt and executing a soft reset. This is often used
when a target cannot be reset and halted. The target, after reset is
released begins to execute code. OpenOCD attempts to stop the CPU and
then sets the program counter back to the reset vector. Unfortunately
the code that was executed may have left the hardware in an unknown
state.
+@end deffn
+@section I/O Utilities
+These commands are available when
+OpenOCD is built with @option{--enable-ioutil}.
+They are mainly useful on embedded targets;
+PC type hosts have complimentary tools.
+
+@emph{Note:} there are several more such commands.
+
+@deffn Command meminfo
+Display available RAM memory on OpenOCD host.
+Used in OpenOCD regression testing scripts.
+@end deffn
+
@anchor{Memory access}
@section Memory access commands
-@subsection meminfo
-display available RAM memory on OpenOCD host. Used in OpenOCD regression testing scripts. Mainly
-useful on embedded targets, PC type hosts have complimentary tools like Valgrind to address
-resource tracking problems.
-@subsection Memory peek/poke type commands
+@cindex memory access
+
These commands allow accesses of a specific size to the memory
system. Often these are used to configure the current target in some
-special way. For example - one may need to write certian values to the
+special way. For example - one may need to write certain values to the
SDRAM controller to enable SDRAM.
@enumerate
-@item To change the current target see the ``targets'' (plural) command
-@item In system level scripts these commands are deprecated, please use the TARGET object versions.
+@item Use the @command{targets} (plural) command
+to change the current target.
+@item In system level scripts these commands are deprecated.
+Please use their TARGET object siblings to avoid making assumptions
+about what TAP is the current target, or about MMU configuration.
@end enumerate
-@itemize @bullet
-@item @b{mdw} <@var{addr}> [@var{count}]
-@cindex mdw
-@*display memory words (32bit)
-@item @b{mdh} <@var{addr}> [@var{count}]
-@cindex mdh
-@*display memory half-words (16bit)
-@item @b{mdb} <@var{addr}> [@var{count}]
-@cindex mdb
-@*display memory bytes (8bit)
-@item @b{mww} <@var{addr}> <@var{value}>
-@cindex mww
-@*write memory word (32bit)
-@item @b{mwh} <@var{addr}> <@var{value}>
-@cindex mwh
-@*write memory half-word (16bit)
-@item @b{mwb} <@var{addr}> <@var{value}>
-@cindex mwb
-@*write memory byte (8bit)
-@end itemize
+@deffn Command mdw addr [count]
+@deffnx Command mdh addr [count]
+@deffnx Command mdb addr [count]
+Display contents of address @var{addr}, as
+32-bit words (@command{mdw}), 16-bit halfwords (@command{mdh}),
+or 8-bit bytes (@command{mdb}).
+If @var{count} is specified, displays that many units.
+@end deffn
+@deffn Command mww addr word
+@deffnx Command mwh addr halfword
+@deffnx Command mwb addr byte
+Writes the specified @var{word} (32 bits),
+@var{halfword} (16 bits), or @var{byte} (8-bit) pattern,
+at the specified address @var{addr}.
+@end deffn
+
+
@anchor{Image access}
@section Image loading commands
-@anchor{load_image}
-@subsection load_image
-@b{load_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}]
-@cindex load_image
-@*Load image <@var{file}> to target memory at <@var{address}>
-@subsection fast_load_image
-@b{fast_load_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}]
-@cindex fast_load_image
-@*Normally you should be using @b{load_image} or GDB load. However, for
+@cindex image loading
+@cindex image dumping
+
+@anchor{dump_image}
+@deffn Command {dump_image} filename address size
+Dump @var{size} bytes of target memory starting at @var{address} to the
+binary file named @var{filename}.
+@end deffn
+
+@deffn Command {fast_load}
+Loads an image stored in memory by @command{fast_load_image} to the
+current target. Must be preceeded by fast_load_image.
+@end deffn
+
+@deffn Command {fast_load_image} filename address [@option{bin}|@option{ihex}|@option{elf}]
+Normally you should be using @command{load_image} or GDB load. However, for
testing purposes or when I/O overhead is significant(OpenOCD running on an embedded
host), storing the image in memory and uploading the image to the target
can be a way to upload e.g. multiple debug sessions when the binary does not change.
-Arguments are the same as @b{load_image}, but the image is stored in OpenOCD host
+Arguments are the same as @command{load_image}, but the image is stored in OpenOCD host
memory, i.e. does not affect target. This approach is also useful when profiling
target programming performance as I/O and target programming can easily be profiled
separately.
-@subsection fast_load
-@b{fast_load}
-@cindex fast_image
-@*Loads an image stored in memory by @b{fast_load_image} to the current target. Must be preceeded by fast_load_image.
-@anchor{dump_image}
-@subsection dump_image
-@b{dump_image} <@var{file}> <@var{address}> <@var{size}>
-@cindex dump_image
-@*Dump <@var{size}> bytes of target memory starting at <@var{address}> to a
-(binary) <@var{file}>.
-@subsection verify_image
-@b{verify_image} <@var{file}> <@var{address}> [@option{bin}|@option{ihex}|@option{elf}]
-@cindex verify_image
-@*Verify <@var{file}> against target memory starting at <@var{address}>.
+@end deffn
+
+@anchor{load_image}
+@deffn Command {load_image} filename address [@option{bin}|@option{ihex}|@option{elf}]
+Load image from file @var{filename} to target memory at @var{address}.
+The file format may optionally be specified
+(@option{bin}, @option{ihex}, or @option{elf})
+@end deffn
+
+@deffn Command {verify_image} filename address [@option{bin}|@option{ihex}|@option{elf}]
+Verify @var{filename} against target memory starting at @var{address}.
+The file format may optionally be specified
+(@option{bin}, @option{ihex}, or @option{elf})
This will first attempt a comparison using a CRC checksum, if this fails it will try a binary compare.
+@end deffn
-@section Breakpoint commands
-@cindex Breakpoint commands
-@itemize @bullet
-@item @b{bp} <@var{addr}> <@var{len}> [@var{hw}]
-@cindex bp
-@*set breakpoint <address> <length> [hw]
-@item @b{rbp} <@var{addr}>
-@cindex rbp
-@*remove breakpoint <adress>
-@item @b{wp} <@var{addr}> <@var{len}> <@var{r}|@var{w}|@var{a}> [@var{value}] [@var{mask}]
-@cindex wp
-@*set watchpoint <address> <length> <r/w/a> [value] [mask]
-@item @b{rwp} <@var{addr}>
-@cindex rwp
-@*remove watchpoint <adress>
-@end itemize
+@section Breakpoint and Watchpoint commands
+@cindex breakpoint
+@cindex watchpoint
+CPUs often make debug modules accessible through JTAG, with
+hardware support for a handful of code breakpoints and data
+watchpoints.
+In addition, CPUs almost always support software breakpoints.
+
+@deffn Command {bp} [address len [@option{hw}]]
+With no parameters, lists all active breakpoints.
+Else sets a breakpoint on code execution starting
+at @var{address} for @var{length} bytes.
+This is a software breakpoint, unless @option{hw} is specified
+in which case it will be a hardware breakpoint.
+@end deffn
+
+@deffn Command {rbp} address
+Remove the breakpoint at @var{address}.
+@end deffn
+
+@deffn Command {rwp} address
+Remove data watchpoint on @var{address}
+@end deffn
+
+@deffn Command {wp} [address len [(@option{r}|@option{w}|@option{a}) [value [mask]]]
+With no parameters, lists all active watchpoints.
+Else sets a data watchpoint on data from @var{address} for @var{length} bytes.
+The watch point is an "access" watchpoint unless
+the @option{r} or @option{w} parameter is provided,
+defining it as respectively a read or write watchpoint.
+If a @var{value} is provided, that value is used when determining if
+the watchpoint should trigger. The value may be first be masked
+using @var{mask} to mark ``don't care'' fields.
+@end deffn
+
@section Misc Commands
-@cindex Other Target Commands
-@itemize
-@item @b{profile} <@var{seconds}> <@var{gmon.out}>
+@cindex profiling
-Profiling samples the CPU's program counter as quickly as possible, which is useful for non-intrusive stochastic profiling.
+@deffn Command {profile} seconds filename
+Profiling samples the CPU's program counter as quickly as possible,
+which is useful for non-intrusive stochastic profiling.
+Saves up to 10000 sampines in @file{filename} using ``gmon.out'' format.
+@end deffn
-@end itemize
-
@node Architecture and Core Commands
@chapter Architecture and Core Commands
@cindex Architecture Specific Commands
|
|
From: <zw...@ma...> - 2009-06-04 03:17:30
|
Author: zwelch
Date: 2009-06-04 03:17:27 +0200 (Thu, 04 Jun 2009)
New Revision: 2038
Modified:
trunk/src/jtag/ft2232.c
Log:
David Brownell <da...@pa...>:
Remove pernicious whitespace from ft2232 driver; as usual,
end-of-line noise, but here also much line-internal stuff.
Modified: trunk/src/jtag/ft2232.c
===================================================================
--- trunk/src/jtag/ft2232.c 2009-06-04 01:16:43 UTC (rev 2037)
+++ trunk/src/jtag/ft2232.c 2009-06-04 01:17:27 UTC (rev 2038)
@@ -52,7 +52,7 @@
#if (BUILD_FT2232_FTD2XX==1 && BUILD_FT2232_LIBFTDI==1)
#error "BUILD_FT2232_FTD2XX && BUILD_FT2232_LIBFTDI are mutually exclusive"
-#elif(BUILD_FT2232_FTD2XX!=1 && BUILD_FT2232_LIBFTDI!=1)
+#elif (BUILD_FT2232_FTD2XX!=1 && BUILD_FT2232_LIBFTDI!=1)
#error "BUILD_FT2232_FTD2XX || BUILD_FT2232_LIBFTDI must be chosen"
#endif
@@ -101,8 +101,8 @@
static char* ft2232_device_desc = NULL;
static char* ft2232_serial = NULL;
static char* ft2232_layout = NULL;
-static u8 ft2232_latency = 2;
-static unsigned ft2232_max_tck = 6000;
+static u8 ft2232_latency = 2;
+static unsigned ft2232_max_tck = 6000;
#define MAX_USB_IDS 8
@@ -119,17 +119,17 @@
} ft2232_layout_t;
/* init procedures for supported layouts */
-static int usbjtag_init(void);
-static int jtagkey_init(void);
-static int olimex_jtag_init(void);
-static int flyswatter_init(void);
-static int turtle_init(void);
-static int comstick_init(void);
-static int stm32stick_init(void);
-static int axm0432_jtag_init(void);
-static int sheevaplug_init(void);
-static int icebear_jtag_init(void);
-static int cortino_jtag_init(void);
+static int usbjtag_init(void);
+static int jtagkey_init(void);
+static int olimex_jtag_init(void);
+static int flyswatter_init(void);
+static int turtle_init(void);
+static int comstick_init(void);
+static int stm32stick_init(void);
+static int axm0432_jtag_init(void);
+static int sheevaplug_init(void);
+static int icebear_jtag_init(void);
+static int cortino_jtag_init(void);
/* reset procedures for supported layouts */
static void usbjtag_reset(int trst, int srst);
@@ -177,8 +177,8 @@
static u8 high_direction = 0x0;
#if BUILD_FT2232_FTD2XX == 1
-static FT_HANDLE ftdih = NULL;
-static FT_DEVICE ftdi_device = 0;
+static FT_HANDLE ftdih = NULL;
+static FT_DEVICE ftdi_device = 0;
#elif BUILD_FT2232_LIBFTDI == 1
static struct ftdi_context ftdic;
#endif
@@ -213,10 +213,10 @@
* writes a byte into the byte buffer, "ft2232_buffer", which must be sent later.
* @param val is the byte to send.
*/
-static inline void buffer_write( u8 val )
+static inline void buffer_write(u8 val)
{
- assert( ft2232_buffer );
- assert( (unsigned) ft2232_buffer_size < (unsigned) FT2232_BUFFER_SIZE );
+ assert(ft2232_buffer);
+ assert((unsigned) ft2232_buffer_size < (unsigned) FT2232_BUFFER_SIZE);
ft2232_buffer[ft2232_buffer_size++] = val;
}
@@ -226,8 +226,8 @@
*/
static inline u8 buffer_read(void)
{
- assert( ft2232_buffer );
- assert( ft2232_read_pointer < ft2232_buffer_size );
+ assert(ft2232_buffer);
+ assert(ft2232_read_pointer < ft2232_buffer_size);
return ft2232_buffer[ft2232_read_pointer++];
}
@@ -238,51 +238,51 @@
* Rigorous state transition logging is done here via tap_set_state().
*
* @param mpsse_cmd One of the MPSSE TMS oriented commands such as
- * 0x4b or 0x6b. See the MPSSE spec referenced above for their
- * functionality. The MPSSE command "Clock Data to TMS/CS Pin (no Read)"
- * is often used for this, 0x4b.
+ * 0x4b or 0x6b. See the MPSSE spec referenced above for their
+ * functionality. The MPSSE command "Clock Data to TMS/CS Pin (no Read)"
+ * is often used for this, 0x4b.
*
* @param tms_bits Holds the sequence of bits to send.
* @param tms_count Tells how many bits in the sequence.
* @param tdi_bit A single bit to pass on to TDI before the first TCK
- * cycle and held static for the duration of TMS clocking.
+ * cycle and held static for the duration of TMS clocking.
*
* See the MPSSE spec referenced above.
*/
-static void clock_tms( u8 mpsse_cmd, int tms_bits, int tms_count, bool tdi_bit )
+static void clock_tms(u8 mpsse_cmd, int tms_bits, int tms_count, bool tdi_bit)
{
u8 tms_byte;
int i;
int tms_ndx; /* bit index into tms_byte */
- assert( tms_count > 0 );
+ assert(tms_count > 0);
-// LOG_DEBUG("mpsse cmd=%02x, tms_bits=0x%08x, bit_count=%d", mpsse_cmd, tms_bits, tms_count );
+// LOG_DEBUG("mpsse cmd=%02x, tms_bits=0x%08x, bit_count=%d", mpsse_cmd, tms_bits, tms_count);
for (tms_byte = tms_ndx = i = 0; i < tms_count; ++i, tms_bits>>=1)
{
bool bit = tms_bits & 1;
- if(bit)
+ if (bit)
tms_byte |= (1<<tms_ndx);
/* always do state transitions in public view */
- tap_set_state( tap_state_transition(tap_get_state(), bit) );
+ tap_set_state(tap_state_transition(tap_get_state(), bit));
- /* we wrote a bit to tms_byte just above, increment bit index. if bit was zero
+ /* we wrote a bit to tms_byte just above, increment bit index. if bit was zero
also increment.
*/
++tms_ndx;
- if( tms_ndx==7 || i==tms_count-1 )
+ if (tms_ndx==7 || i==tms_count-1)
{
- buffer_write( mpsse_cmd );
- buffer_write( tms_ndx - 1 );
+ buffer_write(mpsse_cmd);
+ buffer_write(tms_ndx - 1);
- /* Bit 7 of the byte is passed on to TDI/DO before the first TCK/SK of
+ /* Bit 7 of the byte is passed on to TDI/DO before the first TCK/SK of
TMS/CS and is held static for the duration of TMS/CS clocking.
*/
- buffer_write( tms_byte | (tdi_bit << 7) );
+ buffer_write(tms_byte | (tdi_bit << 7));
}
}
}
@@ -293,7 +293,7 @@
* returns what clock_tms() will consume if called with
* same \a bit_count.
*/
-static inline int get_tms_buffer_requirements( int bit_count )
+static inline int get_tms_buffer_requirements(int bit_count)
{
return ((bit_count + 6)/7) * 3;
}
@@ -307,11 +307,11 @@
*
* @param goal_state is the destination state for the move.
*/
-static void move_to_state( tap_state_t goal_state )
+static void move_to_state(tap_state_t goal_state)
{
- tap_state_t start_state = tap_get_state();
+ tap_state_t start_state = tap_get_state();
- /* goal_state is 1/2 of a tuple/pair of states which allow convenient
+ /* goal_state is 1/2 of a tuple/pair of states which allow convenient
lookup of the required TMS pattern to move to this state from the
start state.
*/
@@ -320,30 +320,30 @@
int tms_bits = tap_get_tms_path(start_state, goal_state);
int tms_count = tap_get_tms_path_len(start_state, goal_state);
- DEBUG_JTAG_IO( "start=%s goal=%s", tap_state_name(start_state), tap_state_name(goal_state) );
+ DEBUG_JTAG_IO("start=%s goal=%s", tap_state_name(start_state), tap_state_name(goal_state));
- clock_tms( 0x4b, tms_bits, tms_count, 0 );
+ clock_tms(0x4b, tms_bits, tms_count, 0);
}
jtag_interface_t ft2232_interface =
{
- .name = "ft2232",
- .execute_queue = ft2232_execute_queue,
- .speed = ft2232_speed,
- .speed_div = ft2232_speed_div,
- .khz = ft2232_khz,
- .register_commands = ft2232_register_commands,
- .init = ft2232_init,
- .quit = ft2232_quit,
+ .name = "ft2232",
+ .execute_queue = ft2232_execute_queue,
+ .speed = ft2232_speed,
+ .speed_div = ft2232_speed_div,
+ .khz = ft2232_khz,
+ .register_commands = ft2232_register_commands,
+ .init = ft2232_init,
+ .quit = ft2232_quit,
};
static int ft2232_write(u8* buf, int size, u32* bytes_written)
{
#if BUILD_FT2232_FTD2XX == 1
FT_STATUS status;
- DWORD dw_bytes_written;
- if ( ( status = FT_Write(ftdih, buf, size, &dw_bytes_written) ) != FT_OK )
+ DWORD dw_bytes_written;
+ if ((status = FT_Write(ftdih, buf, size, &dw_bytes_written)) != FT_OK)
{
*bytes_written = dw_bytes_written;
LOG_ERROR("FT_Write returned: %lu", status);
@@ -356,10 +356,10 @@
}
#elif BUILD_FT2232_LIBFTDI == 1
int retval;
- if ( ( retval = ftdi_write_data(&ftdic, buf, size) ) < 0 )
+ if ((retval = ftdi_write_data(&ftdic, buf, size)) < 0)
{
*bytes_written = 0;
- LOG_ERROR( "ftdi_write_data: %s", ftdi_get_error_string(&ftdic) );
+ LOG_ERROR("ftdi_write_data: %s", ftdi_get_error_string(&ftdic));
return ERROR_JTAG_DEVICE_ERROR;
}
else
@@ -379,10 +379,10 @@
int timeout = 5;
*bytes_read = 0;
- while ( (*bytes_read < size) && timeout-- )
+ while ((*bytes_read < size) && timeout--)
{
- if ( ( status = FT_Read(ftdih, buf + *bytes_read, size -
- *bytes_read, &dw_bytes_read) ) != FT_OK )
+ if ((status = FT_Read(ftdih, buf + *bytes_read, size -
+ *bytes_read, &dw_bytes_read)) != FT_OK)
{
*bytes_read = 0;
LOG_ERROR("FT_Read returned: %lu", status);
@@ -396,12 +396,12 @@
int timeout = 100;
*bytes_read = 0;
- while ( (*bytes_read < size) && timeout-- )
+ while ((*bytes_read < size) && timeout--)
{
- if ( ( retval = ftdi_read_data(&ftdic, buf + *bytes_read, size - *bytes_read) ) < 0 )
+ if ((retval = ftdi_read_data(&ftdic, buf + *bytes_read, size - *bytes_read)) < 0)
{
*bytes_read = 0;
- LOG_ERROR( "ftdi_read_data: %s", ftdi_get_error_string(&ftdic) );
+ LOG_ERROR("ftdi_read_data: %s", ftdi_get_error_string(&ftdic));
return ERROR_JTAG_DEVICE_ERROR;
}
*bytes_read += retval;
@@ -467,12 +467,12 @@
ft2232_adaptive_clocking(speed);
- buf[0] = 0x86; /* command "set divisor" */
+ buf[0] = 0x86; /* command "set divisor" */
buf[1] = speed & 0xff; /* valueL (0=6MHz, 1=3MHz, 2=2.0MHz, ...*/
buf[2] = (speed >> 8) & 0xff; /* valueH */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( retval = ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((retval = ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't set FT2232 TCK speed");
return retval;
@@ -583,13 +583,13 @@
buffer[cur_byte] = 0x0;
- /* There is one more partial byte left from the clock data in/out instructions */
+ /* There is one more partial byte left from the clock data in/out instructions */
if (bits_left > 1)
{
buffer[cur_byte] = buffer_read() >> 1;
}
/* This shift depends on the length of the clock data to tms instruction, insterted at end of the scan, now fixed to a two step transition in ft2232_add_scan */
- buffer[cur_byte] = ( buffer[cur_byte] | ( ( (buffer_read()) << 1 ) & 0x80 )) >> (8 - bits_left);
+ buffer[cur_byte] = (buffer[cur_byte] | (((buffer_read()) << 1) & 0x80)) >> (8 - bits_left);
}
@@ -638,7 +638,7 @@
gettimeofday(&start, NULL);
#endif
- if ( ( retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written) ) != ERROR_OK )
+ if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK)
{
LOG_ERROR("couldn't write MPSSE commands to FT2232");
return retval;
@@ -657,7 +657,7 @@
gettimeofday(&inter2, NULL);
#endif
- if ( ( retval = ft2232_read(ft2232_buffer, ft2232_expect_read, &bytes_read) ) != ERROR_OK )
+ if ((retval = ft2232_read(ft2232_buffer, ft2232_expect_read, &bytes_read)) != ERROR_OK)
{
LOG_ERROR("couldn't read from FT2232");
return retval;
@@ -742,34 +742,34 @@
* ending with the last state at path[num_states-1]
* @param num_states is the count of state steps to move through
*/
-static void ft2232_add_pathmove( tap_state_t* path, int num_states )
+static void ft2232_add_pathmove(tap_state_t* path, int num_states)
{
int tms_bits = 0;
int state_ndx;
tap_state_t walker = tap_get_state();
- assert( (unsigned) num_states <= 32u ); /* tms_bits only holds 32 bits */
+ assert((unsigned) num_states <= 32u); /* tms_bits only holds 32 bits */
/* this loop verifies that the path is legal and logs each state in the path */
- for( state_ndx = 0; state_ndx < num_states; ++state_ndx )
+ for (state_ndx = 0; state_ndx < num_states; ++state_ndx)
{
tap_state_t desired_next_state = path[state_ndx];
- if (tap_state_transition(walker, false) == desired_next_state )
+ if (tap_state_transition(walker, false) == desired_next_state)
; /* bit within tms_bits at index state_ndx is already zero */
- else if (tap_state_transition(walker, true) == desired_next_state )
+ else if (tap_state_transition(walker, true) == desired_next_state)
tms_bits |= (1<<state_ndx);
else
{
- LOG_ERROR( "BUG: %s -> %s isn't a valid TAP transition",
- tap_state_name(walker), tap_state_name(desired_next_state) );
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition",
+ tap_state_name(walker), tap_state_name(desired_next_state));
exit(-1);
}
walker = desired_next_state;
}
- clock_tms( 0x4b, tms_bits, num_states, 0 );
+ clock_tms(0x4b, tms_bits, num_states, 0);
tap_set_end_state(tap_get_state());
}
@@ -782,18 +782,18 @@
int cur_byte = 0;
int last_bit;
- if ( !ir_scan )
+ if (!ir_scan)
{
if (tap_get_state() != TAP_DRSHIFT)
{
- move_to_state( TAP_DRSHIFT );
+ move_to_state(TAP_DRSHIFT);
}
}
else
{
if (tap_get_state() != TAP_IRSHIFT)
{
- move_to_state( TAP_IRSHIFT );
+ move_to_state(TAP_IRSHIFT);
}
}
@@ -804,34 +804,34 @@
if (type == SCAN_IO)
{
/* Clock Data Bytes In and Out LSB First */
- buffer_write( 0x39 );
+ buffer_write(0x39);
/* LOG_DEBUG("added TDI bytes (io %i)", num_bytes); */
}
else if (type == SCAN_OUT)
{
/* Clock Data Bytes Out on -ve Clock Edge LSB First (no Read) */
- buffer_write( 0x19 );
+ buffer_write(0x19);
/* LOG_DEBUG("added TDI bytes (o)"); */
}
else if (type == SCAN_IN)
{
/* Clock Data Bytes In on +ve Clock Edge LSB First (no Write) */
- buffer_write( 0x28 );
+ buffer_write(0x28);
/* LOG_DEBUG("added TDI bytes (i %i)", num_bytes); */
}
thisrun_bytes = (num_bytes > 65537) ? 65536 : (num_bytes - 1);
num_bytes -= thisrun_bytes;
- buffer_write( (u8) (thisrun_bytes - 1) );
- buffer_write( (u8) ((thisrun_bytes - 1) >> 8) );
+ buffer_write((u8) (thisrun_bytes - 1));
+ buffer_write((u8) ((thisrun_bytes - 1) >> 8));
if (type != SCAN_IN)
{
/* add complete bytes */
while (thisrun_bytes-- > 0)
{
- buffer_write( buffer[cur_byte++] );
+ buffer_write(buffer[cur_byte++]);
bits_left -= 8;
}
}
@@ -843,7 +843,7 @@
/* the most signifcant bit is scanned during TAP movement */
if (type != SCAN_IN)
- last_bit = ( buffer[cur_byte] >> (bits_left - 1) ) & 0x1;
+ last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1;
else
last_bit = 0;
@@ -853,50 +853,50 @@
if (type == SCAN_IO)
{
/* Clock Data Bits In and Out LSB First */
- buffer_write( 0x3b );
+ buffer_write(0x3b);
/* LOG_DEBUG("added TDI bits (io) %i", bits_left - 1); */
}
else if (type == SCAN_OUT)
{
/* Clock Data Bits Out on -ve Clock Edge LSB First (no Read) */
- buffer_write( 0x1b );
+ buffer_write(0x1b);
/* LOG_DEBUG("added TDI bits (o)"); */
}
else if (type == SCAN_IN)
{
/* Clock Data Bits In on +ve Clock Edge LSB First (no Write) */
- buffer_write( 0x2a );
+ buffer_write(0x2a);
/* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */
}
- buffer_write( bits_left - 2 );
+ buffer_write(bits_left - 2);
if (type != SCAN_IN)
- buffer_write( buffer[cur_byte] );
+ buffer_write(buffer[cur_byte]);
}
- if ( ( ir_scan && (tap_get_end_state() == TAP_IRSHIFT) )
- || ( !ir_scan && (tap_get_end_state() == TAP_DRSHIFT) ) )
+ if (( ir_scan && (tap_get_end_state() == TAP_IRSHIFT))
+ || (!ir_scan && (tap_get_end_state() == TAP_DRSHIFT)))
{
if (type == SCAN_IO)
{
/* Clock Data Bits In and Out LSB First */
- buffer_write( 0x3b );
+ buffer_write(0x3b);
/* LOG_DEBUG("added TDI bits (io) %i", bits_left - 1); */
}
else if (type == SCAN_OUT)
{
/* Clock Data Bits Out on -ve Clock Edge LSB First (no Read) */
- buffer_write( 0x1b );
+ buffer_write(0x1b);
/* LOG_DEBUG("added TDI bits (o)"); */
}
else if (type == SCAN_IN)
{
/* Clock Data Bits In on +ve Clock Edge LSB First (no Write) */
- buffer_write( 0x2a );
+ buffer_write(0x2a);
/* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */
}
- buffer_write( 0x0 );
- buffer_write( last_bit );
+ buffer_write(0x0);
+ buffer_write(last_bit);
}
else
{
@@ -917,19 +917,19 @@
}
else
{
- tms_bits = tap_get_tms_path( tap_get_state(), tap_get_end_state() );
- tms_count = tap_get_tms_path_len( tap_get_state(), tap_get_end_state() );
+ tms_bits = tap_get_tms_path(tap_get_state(), tap_get_end_state());
+ tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state());
/* Clock Data to TMS/CS Pin (no Read) */
mpsse_cmd = 0x4b;
/* LOG_DEBUG("added TMS scan (no read)"); */
}
- clock_tms( mpsse_cmd, tms_bits, tms_count, last_bit );
+ clock_tms(mpsse_cmd, tms_bits, tms_count, last_bit);
}
-
+
if (tap_get_state() != tap_get_end_state())
{
- move_to_state( tap_get_end_state() );
+ move_to_state(tap_get_end_state());
}
}
@@ -940,7 +940,7 @@
int bits_left = scan_size;
int cur_byte = 0;
int last_bit;
- u8* receive_buffer = malloc( CEIL(scan_size, 8) );
+ u8* receive_buffer = malloc(CEIL(scan_size, 8));
u8* receive_pointer = receive_buffer;
u32 bytes_written;
u32 bytes_read;
@@ -955,10 +955,10 @@
if (tap_get_state() != TAP_DRSHIFT)
{
- move_to_state( TAP_DRSHIFT );
+ move_to_state(TAP_DRSHIFT);
}
- if ( ( retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written) ) != ERROR_OK )
+ if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK)
{
LOG_ERROR("couldn't write MPSSE commands to FT2232");
exit(-1);
@@ -974,34 +974,34 @@
if (type == SCAN_IO)
{
/* Clock Data Bytes In and Out LSB First */
- buffer_write( 0x39 );
+ buffer_write(0x39);
/* LOG_DEBUG("added TDI bytes (io %i)", num_bytes); */
}
else if (type == SCAN_OUT)
{
/* Clock Data Bytes Out on -ve Clock Edge LSB First (no Read) */
- buffer_write( 0x19 );
+ buffer_write(0x19);
/* LOG_DEBUG("added TDI bytes (o)"); */
}
else if (type == SCAN_IN)
{
/* Clock Data Bytes In on +ve Clock Edge LSB First (no Write) */
- buffer_write( 0x28 );
+ buffer_write(0x28);
/* LOG_DEBUG("added TDI bytes (i %i)", num_bytes); */
}
thisrun_bytes = (num_bytes > 65537) ? 65536 : (num_bytes - 1);
thisrun_read = thisrun_bytes;
num_bytes -= thisrun_bytes;
- buffer_write( (u8) (thisrun_bytes - 1) );
- buffer_write( (u8) ( (thisrun_bytes - 1) >> 8 ));
+ buffer_write((u8) (thisrun_bytes - 1));
+ buffer_write((u8) ((thisrun_bytes - 1) >> 8));
if (type != SCAN_IN)
{
/* add complete bytes */
while (thisrun_bytes-- > 0)
{
- buffer_write( buffer[cur_byte] );
+ buffer_write(buffer[cur_byte]);
cur_byte++;
bits_left -= 8;
}
@@ -1011,7 +1011,7 @@
bits_left -= 8 * (thisrun_bytes);
}
- if ( ( retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written) ) != ERROR_OK )
+ if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK)
{
LOG_ERROR("couldn't write MPSSE commands to FT2232");
exit(-1);
@@ -1021,7 +1021,7 @@
if (type != SCAN_OUT)
{
- if ( ( retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read) ) != ERROR_OK )
+ if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK)
{
LOG_ERROR("couldn't read from FT2232");
exit(-1);
@@ -1035,7 +1035,7 @@
/* the most signifcant bit is scanned during TAP movement */
if (type != SCAN_IN)
- last_bit = ( buffer[cur_byte] >> (bits_left - 1) ) & 0x1;
+ last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1;
else
last_bit = 0;
@@ -1045,24 +1045,24 @@
if (type == SCAN_IO)
{
/* Clock Data Bits In and Out LSB First */
- buffer_write( 0x3b );
+ buffer_write(0x3b);
/* LOG_DEBUG("added TDI bits (io) %i", bits_left - 1); */
}
else if (type == SCAN_OUT)
{
/* Clock Data Bits Out on -ve Clock Edge LSB First (no Read) */
- buffer_write( 0x1b );
+ buffer_write(0x1b);
/* LOG_DEBUG("added TDI bits (o)"); */
}
else if (type == SCAN_IN)
{
/* Clock Data Bits In on +ve Clock Edge LSB First (no Write) */
- buffer_write( 0x2a );
+ buffer_write(0x2a);
/* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */
}
- buffer_write( bits_left - 2 );
+ buffer_write(bits_left - 2);
if (type != SCAN_IN)
- buffer_write( buffer[cur_byte] );
+ buffer_write(buffer[cur_byte]);
if (type != SCAN_OUT)
thisrun_read += 2;
@@ -1073,28 +1073,28 @@
if (type == SCAN_IO)
{
/* Clock Data Bits In and Out LSB First */
- buffer_write( 0x3b );
+ buffer_write(0x3b);
/* LOG_DEBUG("added TDI bits (io) %i", bits_left - 1); */
}
else if (type == SCAN_OUT)
{
/* Clock Data Bits Out on -ve Clock Edge LSB First (no Read) */
- buffer_write( 0x1b );
+ buffer_write(0x1b);
/* LOG_DEBUG("added TDI bits (o)"); */
}
else if (type == SCAN_IN)
{
/* Clock Data Bits In on +ve Clock Edge LSB First (no Write) */
- buffer_write( 0x2a );
+ buffer_write(0x2a);
/* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */
}
- buffer_write( 0x0 );
- buffer_write( last_bit );
+ buffer_write(0x0);
+ buffer_write(last_bit);
}
else
{
- int tms_bits = tap_get_tms_path( tap_get_state(), tap_get_end_state() );
- int tms_count = tap_get_tms_path_len( tap_get_state(), tap_get_end_state() );
+ int tms_bits = tap_get_tms_path(tap_get_state(), tap_get_end_state());
+ int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state());
u8 mpsse_cmd;
/* move from Shift-IR/DR to end state */
@@ -1111,13 +1111,13 @@
/* LOG_DEBUG("added TMS scan (no read)"); */
}
- clock_tms( mpsse_cmd, tms_bits, tms_count, last_bit );
+ clock_tms(mpsse_cmd, tms_bits, tms_count, last_bit);
}
if (type != SCAN_OUT)
thisrun_read += 1;
- if ( ( retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written) ) != ERROR_OK )
+ if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK)
{
LOG_ERROR("couldn't write MPSSE commands to FT2232");
exit(-1);
@@ -1127,7 +1127,7 @@
if (type != SCAN_OUT)
{
- if ( ( retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read) ) != ERROR_OK )
+ if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK)
{
LOG_ERROR("couldn't read from FT2232");
exit(-1);
@@ -1146,7 +1146,7 @@
int num_bytes = (scan_size - 1) / 8;
if (tap_get_state() != TAP_DRSHIFT)
- predicted_size += get_tms_buffer_requirements( tap_get_tms_path_len( tap_get_state(), TAP_DRSHIFT) );
+ predicted_size += get_tms_buffer_requirements(tap_get_tms_path_len(tap_get_state(), TAP_DRSHIFT));
if (type == SCAN_IN) /* only from device to host */
{
@@ -1154,7 +1154,7 @@
predicted_size += CEIL(num_bytes, 65536) * 3;
/* remaining bits - 1 (up to 7) */
- predicted_size += ( (scan_size - 1) % 8 ) ? 2 : 0;
+ predicted_size += ((scan_size - 1) % 8) ? 2 : 0;
}
else /* host to device, or bidirectional */
{
@@ -1162,7 +1162,7 @@
predicted_size += num_bytes + CEIL(num_bytes, 65536) * 3;
/* remaining bits -1 (up to 7) */
- predicted_size += ( (scan_size - 1) % 8 ) ? 3 : 0;
+ predicted_size += ((scan_size - 1) % 8) ? 3 : 0;
}
return predicted_size;
@@ -1179,7 +1179,7 @@
predicted_size += (CEIL(scan_size, 8) > 1) ? (CEIL(scan_size, 8) - 1) : 0;
/* remaining bits - 1 */
- predicted_size += ( (scan_size - 1) % 8 ) ? 1 : 0;
+ predicted_size += ((scan_size - 1) % 8) ? 1 : 0;
/* last bit (from TMS scan) */
predicted_size += 1;
@@ -1224,9 +1224,9 @@
}
/* command "set data bits low byte" */
- buffer_write( 0x80 );
- buffer_write( low_output );
- buffer_write( low_direction );
+ buffer_write(0x80);
+ buffer_write(low_output);
+ buffer_write(low_direction);
}
@@ -1263,9 +1263,9 @@
}
/* command "set data bits high byte" */
- buffer_write( 0x82 );
- buffer_write( high_output );
- buffer_write( high_direction );
+ buffer_write(0x82);
+ buffer_write(high_output);
+ buffer_write(high_direction);
LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output,
high_direction);
}
@@ -1298,9 +1298,9 @@
}
/* command "set data bits high byte" */
- buffer_write( 0x82 );
- buffer_write( high_output );
- buffer_write( high_direction );
+ buffer_write(0x82);
+ buffer_write(high_output);
+ buffer_write(high_direction);
LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output,
high_direction);
}
@@ -1328,9 +1328,9 @@
}
/* command "set data bits low byte" */
- buffer_write( 0x82 );
- buffer_write( high_output );
- buffer_write( high_direction );
+ buffer_write(0x82);
+ buffer_write(high_output);
+ buffer_write(high_direction);
LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output,
high_direction);
}
@@ -1357,9 +1357,9 @@
}
/* command "set data bits low byte" */
- buffer_write( 0x80 );
- buffer_write( low_output );
- buffer_write( low_direction );
+ buffer_write(0x80);
+ buffer_write(low_output);
+ buffer_write(low_direction);
LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", trst, srst, low_output, low_direction);
}
@@ -1378,9 +1378,9 @@
}
/* command "set data bits low byte" */
- buffer_write( 0x80 );
- buffer_write( low_output );
- buffer_write( low_direction );
+ buffer_write(0x80);
+ buffer_write(low_output);
+ buffer_write(low_direction);
LOG_DEBUG("srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", srst, low_output, low_direction);
}
@@ -1406,9 +1406,9 @@
}
/* command "set data bits high byte" */
- buffer_write( 0x82 );
- buffer_write( high_output );
- buffer_write( high_direction );
+ buffer_write(0x82);
+ buffer_write(high_output);
+ buffer_write(high_direction);
LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output,
high_direction);
}
@@ -1435,14 +1435,14 @@
}
/* command "set data bits low byte" */
- buffer_write( 0x80 );
- buffer_write( low_output );
- buffer_write( low_direction );
+ buffer_write(0x80);
+ buffer_write(low_output);
+ buffer_write(low_direction);
/* command "set data bits high byte" */
- buffer_write( 0x82 );
- buffer_write( high_output );
- buffer_write( high_direction );
+ buffer_write(0x82);
+ buffer_write(high_output);
+ buffer_write(high_direction);
LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output,
high_direction);
}
@@ -1462,9 +1462,9 @@
high_output |= nSRSTnOE;
/* command "set data bits high byte" */
- buffer_write( 0x82 );
- buffer_write( high_output );
- buffer_write( high_direction );
+ buffer_write(0x82);
+ buffer_write(high_output);
+ buffer_write(high_direction);
LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction);
}
@@ -1484,9 +1484,9 @@
if (tap_get_state() != TAP_IDLE)
predicted_size += 3;
predicted_size += 3 * CEIL(cmd->cmd.runtest->num_cycles, 7);
- if ( cmd->cmd.runtest->end_state != TAP_IDLE)
+ if (cmd->cmd.runtest->end_state != TAP_IDLE)
predicted_size += 3;
- if ( tap_get_end_state() != TAP_IDLE)
+ if (tap_get_end_state() != TAP_IDLE)
predicted_size += 3;
if (ft2232_buffer_size + predicted_size + 1 > FT2232_BUFFER_SIZE)
{
@@ -1497,7 +1497,7 @@
}
if (tap_get_state() != TAP_IDLE)
{
- move_to_state( TAP_IDLE );
+ move_to_state(TAP_IDLE);
require_send = 1;
}
i = cmd->cmd.runtest->num_cycles;
@@ -1506,13 +1506,13 @@
/* there are no state transitions in this code, so omit state tracking */
/* command "Clock Data to TMS/CS Pin (no Read)" */
- buffer_write( 0x4b );
+ buffer_write(0x4b);
/* scan 7 bits */
- buffer_write( (i > 7) ? 6 : (i - 1) );
+ buffer_write((i > 7) ? 6 : (i - 1));
/* TMS data bits */
- buffer_write( 0x0 );
+ buffer_write(0x0);
tap_set_state(TAP_IDLE);
i -= (i > 7) ? 7 : i;
@@ -1521,14 +1521,14 @@
ft2232_end_state(cmd->cmd.runtest->end_state);
- if ( tap_get_state() != tap_get_end_state() )
+ if (tap_get_state() != tap_get_end_state())
{
- move_to_state( tap_get_end_state() );
+ move_to_state(tap_get_end_state());
}
require_send = 1;
#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG( "runtest: %i, end in %s", cmd->cmd.runtest->num_cycles, tap_state_name( tap_get_end_state() ) );
+ LOG_DEBUG("runtest: %i, end in %s", cmd->cmd.runtest->num_cycles, tap_state_name(tap_get_end_state()));
#endif
return retval;
@@ -1537,8 +1537,8 @@
static int ft2232_execute_statemove(jtag_command_t *cmd)
{
- int predicted_size = 0;
- int retval = ERROR_OK;
+ int predicted_size = 0;
+ int retval = ERROR_OK;
DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
@@ -1554,9 +1554,9 @@
ft2232_end_state(cmd->cmd.statemove->end_state);
/* move to end state */
- if ( tap_get_state() != tap_get_end_state() )
+ if (tap_get_state() != tap_get_end_state())
{
- move_to_state( tap_get_end_state() );
+ move_to_state(tap_get_end_state());
require_send = 1;
}
@@ -1565,15 +1565,15 @@
static int ft2232_execute_pathmove(jtag_command_t *cmd)
{
- int predicted_size = 0;
+ int predicted_size = 0;
int retval = ERROR_OK;
tap_state_t* path = cmd->cmd.pathmove->path;
int num_states = cmd->cmd.pathmove->num_states;
DEBUG_JTAG_IO("pathmove: %i states, current: %s end: %s", num_states,
- tap_state_name( tap_get_state() ),
- tap_state_name( path[num_states-1] )
+ tap_state_name(tap_get_state()),
+ tap_state_name(path[num_states-1])
);
/* only send the maximum buffer size that FT2232C can handle */
@@ -1587,7 +1587,7 @@
first_unsent = cmd;
}
- ft2232_add_pathmove( path, num_states );
+ ft2232_add_pathmove(path, num_states);
require_send = 1;
return retval;
@@ -1603,12 +1603,12 @@
enum scan_type type = jtag_scan_type(cmd->cmd.scan);
- DEBUG_JTAG_IO( "%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN", type );
+ DEBUG_JTAG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN", type);
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
predicted_size = ft2232_predict_scan_out(scan_size, type);
- if ( (predicted_size + 1) > FT2232_BUFFER_SIZE )
+ if ((predicted_size + 1) > FT2232_BUFFER_SIZE)
{
LOG_DEBUG("oversized ft2232 scan (predicted_size > FT2232_BUFFER_SIZE)");
/* unsent commands before this */
@@ -1643,8 +1643,8 @@
if (buffer)
free(buffer);
#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG( "%s scan, %i bits, end in %s", (cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size,
- tap_state_name( tap_get_end_state() ) );
+ LOG_DEBUG("%s scan, %i bits, end in %s", (cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size,
+ tap_state_name(tap_get_end_state()));
#endif
return retval;
@@ -1690,7 +1690,7 @@
first_unsent = cmd->next;
jtag_sleep(cmd->cmd.sleep->us);
#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG( "sleep %i usec while in %s", cmd->cmd.sleep->us, tap_state_name( tap_get_state() ) );
+ LOG_DEBUG("sleep %i usec while in %s", cmd->cmd.sleep->us, tap_state_name(tap_get_state()));
#endif
return retval;
@@ -1707,7 +1707,7 @@
if (ft2232_stableclocks(cmd->cmd.stableclocks->num_cycles, cmd) != ERROR_OK)
retval = ERROR_JTAG_QUEUE_FAILED;
#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG( "clocks %i while in %s", cmd->cmd.stableclocks->num_cycles, tap_state_name( tap_get_state() ) );
+ LOG_DEBUG("clocks %i while in %s", cmd->cmd.stableclocks->num_cycles, tap_state_name(tap_get_state()));
#endif
return retval;
@@ -1720,13 +1720,13 @@
switch (cmd->type)
{
- case JTAG_RESET: retval = ft2232_execute_reset(cmd); break;
- case JTAG_RUNTEST: retval = ft2232_execute_runtest(cmd); break;
- case JTAG_STATEMOVE: retval = ft2232_execute_statemove(cmd); break;
- case JTAG_PATHMOVE: retval = ft2232_execute_pathmove(cmd); break;
- case JTAG_SCAN: retval = ft2232_execute_scan(cmd); break;
- case JTAG_SLEEP: retval = ft2232_execute_sleep(cmd); break;
- case JTAG_STABLECLOCKS: retval = ft2232_execute_stableclocks(cmd); break;
+ case JTAG_RESET: retval = ft2232_execute_reset(cmd); break;
+ case JTAG_RUNTEST: retval = ft2232_execute_runtest(cmd); break;
+ case JTAG_STATEMOVE: retval = ft2232_execute_statemove(cmd); break;
+ case JTAG_PATHMOVE: retval = ft2232_execute_pathmove(cmd); break;
+ case JTAG_SCAN: retval = ft2232_execute_scan(cmd); break;
+ case JTAG_SLEEP: retval = ft2232_execute_sleep(cmd); break;
+ case JTAG_STABLECLOCKS: retval = ft2232_execute_stableclocks(cmd); break;
default:
LOG_ERROR("BUG: unknown JTAG command type encountered");
exit(-1);
@@ -1779,19 +1779,19 @@
#if BUILD_FT2232_FTD2XX == 1
static int ft2232_init_ftd2xx(u16 vid, u16 pid, int more, int* try_more)
{
- FT_STATUS status;
+ FT_STATUS status;
DWORD deviceID;
char SerialNumber[16];
- char Description[64];
- DWORD openex_flags = 0;
- char* openex_string = NULL;
- u8 latency_timer;
+ char Description[64];
+ DWORD openex_flags = 0;
+ char* openex_string = NULL;
+ u8 latency_timer;
LOG_DEBUG("'ft2232' interface using FTD2XX with '%s' layout (%4.4x:%4.4x)", ft2232_layout, vid, pid);
#if IS_WIN32 == 0
/* Add non-standard Vid/Pid to the linux driver */
- if ( ( status = FT_SetVIDPID(vid, pid) ) != FT_OK )
+ if ((status = FT_SetVIDPID(vid, pid)) != FT_OK)
{
LOG_WARNING("couldn't add %4.4x:%4.4x", vid, pid);
}
@@ -1822,27 +1822,27 @@
}
status = FT_OpenEx(openex_string, openex_flags, &ftdih);
- if( status != FT_OK ){
+ if (status != FT_OK) {
// under Win32, the FTD2XX driver appends an "A" to the end
// of the description, if we tried by the desc, then
// try by the alternate "A" description.
- if( openex_string == ft2232_device_desc ){
+ if (openex_string == ft2232_device_desc) {
// Try the alternate method.
openex_string = ft2232_device_desc_A;
status = FT_OpenEx(openex_string, openex_flags, &ftdih);
- if( status == FT_OK ){
+ if (status == FT_OK) {
// yea, the "alternate" method worked!
} else {
// drat, give the user a meaningfull message.
// telling the use we tried *BOTH* methods.
LOG_WARNING("Unable to open FTDI Device tried: '%s' and '%s'\n",
ft2232_device_desc,
- ft2232_device_desc_A );
+ ft2232_device_desc_A);
}
}
}
- if ( status != FT_OK )
+ if (status != FT_OK)
{
DWORD num_devices;
@@ -1856,7 +1856,7 @@
status = FT_ListDevices(&num_devices, NULL, FT_LIST_NUMBER_ONLY);
if (status == FT_OK)
{
- char** desc_array = malloc( sizeof(char*) * (num_devices + 1) );
+ char** desc_array = malloc(sizeof(char*) * (num_devices + 1));
u32 i;
for (i = 0; i < num_devices; i++)
@@ -1885,13 +1885,13 @@
return ERROR_JTAG_INIT_FAILED;
}
- if ( ( status = FT_SetLatencyTimer(ftdih, ft2232_latency) ) != FT_OK )
+ if ((status = FT_SetLatencyTimer(ftdih, ft2232_latency)) != FT_OK)
{
LOG_ERROR("unable to set latency timer: %lu", status);
return ERROR_JTAG_INIT_FAILED;
}
- if ( ( status = FT_GetLatencyTimer(ftdih, &latency_timer) ) != FT_OK )
+ if ((status = FT_GetLatencyTimer(ftdih, &latency_timer)) != FT_OK)
{
LOG_ERROR("unable to get latency timer: %lu", status);
return ERROR_JTAG_INIT_FAILED;
@@ -1901,19 +1901,19 @@
LOG_DEBUG("current latency timer: %i", latency_timer);
}
- if ( ( status = FT_SetTimeouts(ftdih, 5000, 5000) ) != FT_OK )
+ if ((status = FT_SetTimeouts(ftdih, 5000, 5000)) != FT_OK)
{
LOG_ERROR("unable to set timeouts: %lu", status);
return ERROR_JTAG_INIT_FAILED;
}
- if ( ( status = FT_SetBitMode(ftdih, 0x0b, 2) ) != FT_OK )
+ if ((status = FT_SetBitMode(ftdih, 0x0b, 2)) != FT_OK)
{
LOG_ERROR("unable to enable bit i/o mode: %lu", status);
return ERROR_JTAG_INIT_FAILED;
}
- if ( ( status = FT_GetDeviceInfo(ftdih, &ftdi_device, &deviceID, SerialNumber, Description, NULL) ) != FT_OK )
+ if ((status = FT_GetDeviceInfo(ftdih, &ftdi_device, &deviceID, SerialNumber, Description, NULL)) != FT_OK)
{
LOG_ERROR("unable to get FT_GetDeviceInfo: %lu", status);
return ERROR_JTAG_INIT_FAILED;
@@ -1942,7 +1942,7 @@
{
FT_STATUS status;
- if ( ( status = FT_Purge(ftdih, FT_PURGE_RX | FT_PURGE_TX) ) != FT_OK )
+ if ((status = FT_Purge(ftdih, FT_PURGE_RX | FT_PURGE_TX)) != FT_OK)
{
LOG_ERROR("error purging ftd2xx device: %lu", status);
return ERROR_JTAG_INIT_FAILED;
@@ -2036,15 +2036,15 @@
int i;
if (tap_get_tms_path_len(TAP_IRPAUSE,TAP_IRPAUSE)==7)
- {
+ {
LOG_DEBUG("ft2232 interface using 7 step jtag state transitions");
}
else
{
LOG_DEBUG("ft2232 interface using shortest path jtag state transitions");
-
+
}
- if ( (ft2232_layout == NULL) || (ft2232_layout[0] == 0) )
+ if ((ft2232_layout == NULL) || (ft2232_layout[0] == 0))
{
ft2232_layout = "usbjtag";
LOG_WARNING("No ft2232 layout specified, using default 'usbjtag'");
@@ -2102,7 +2102,7 @@
ft2232_speed(jtag_speed);
buf[0] = 0x85; /* Disconnect TDI/DO to TDO/DI for Loopback */
- if ( ( ( retval = ft2232_write(buf, 1, &bytes_written) ) != ERROR_OK ) || (bytes_written != 1) )
+ if (((retval = ft2232_write(buf, 1, &bytes_written)) != ERROR_OK) || (bytes_written != 1))
{
LOG_ERROR("couldn't write to FT2232 to disable loopback");
return ERROR_JTAG_INIT_FAILED;
@@ -2183,7 +2183,7 @@
buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'USBJTAG' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2207,7 +2207,7 @@
buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2253,7 +2253,7 @@
buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'Dicarlo' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2277,7 +2277,7 @@
buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2290,8 +2290,8 @@
nSRST = 0x02;
nSRSTnOE = 0x08;
}
- else if ( (strcmp(layout->name, "jtagkey_prototype_v1") == 0)
- || (strcmp(layout->name, "oocdlink") == 0) )
+ else if ((strcmp(layout->name, "jtagkey_prototype_v1") == 0)
+ || (strcmp(layout->name, "oocdlink") == 0))
{
nTRST = 0x02;
nTRSTnOE = 0x1;
@@ -2335,7 +2335,7 @@
buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2359,7 +2359,7 @@
buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'Olimex' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2426,7 +2426,7 @@
buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE[12]=out, n[ST]srst=out */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2449,7 +2449,7 @@
buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2473,7 +2473,7 @@
buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2490,7 +2490,7 @@
buf[2] = high_direction;
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2514,7 +2514,7 @@
buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'comstick' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2534,7 +2534,7 @@
buf[2] = high_direction;
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'comstick' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2558,7 +2558,7 @@
buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2578,7 +2578,7 @@
buf[2] = high_direction;
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2639,7 +2639,7 @@
return ERROR_OK;
}
-static int cortino_jtag_init(void)
+static int cortino_jtag_init(void)
{
u8 buf[3];
u32 bytes_written;
@@ -2653,7 +2653,7 @@
buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'cortino' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2673,7 +2673,7 @@
buf[2] = high_direction;
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout");
return ERROR_JTAG_INIT_FAILED;
@@ -2698,9 +2698,9 @@
high_output |= 0x08;
}
- buffer_write( 0x82 );
- buffer_write( high_output );
- buffer_write( high_direction );
+ buffer_write(0x82);
+ buffer_write(high_output);
+ buffer_write(high_direction);
}
@@ -2711,9 +2711,9 @@
*/
high_output ^= 0x0c;
- buffer_write( 0x82 );
- buffer_write( high_output );
- buffer_write( high_direction );
+ buffer_write(0x82);
+ buffer_write(high_output);
+ buffer_write(high_direction);
}
@@ -2731,9 +2731,9 @@
high_output = 0x08;
}
- buffer_write( 0x82 );
- buffer_write( high_output );
- buffer_write( high_direction );
+ buffer_write(0x82);
+ buffer_write(high_output);
+ buffer_write(high_direction);
}
@@ -2763,23 +2763,23 @@
if (argc == 1)
{
ft2232_device_desc = strdup(args[0]);
- cp = strchr( ft2232_device_desc, 0 );
+ cp = strchr(ft2232_device_desc, 0);
// under Win32, the FTD2XX driver appends an "A" to the end
// of the description, this examines the given desc
// and creates the 'missing' _A or non_A variable.
- if( (cp[-1] == 'A') && (cp[-2]==' ') ){
+ if ((cp[-1] == 'A') && (cp[-2]==' ')) {
// it was, so make this the "A" version.
ft2232_device_desc_A = ft2232_device_desc;
// and *CREATE* the non-A version.
- strcpy( buf, ft2232_device_desc );
- cp = strchr( buf, 0 );
+ strcpy(buf, ft2232_device_desc);
+ cp = strchr(buf, 0);
cp[-2] = 0;
- ft2232_device_desc = strdup( buf );
+ ft2232_device_desc = strdup(buf);
} else {
// <space>A not defined
// so create it
- sprintf( buf, "%s A", ft2232_device_desc );
- ft2232_device_desc_A = strdup( buf );
+ sprintf(buf, "%s A", ft2232_device_desc);
+ ft2232_device_desc_A = strdup(buf);
}
}
else
@@ -2828,7 +2828,7 @@
"(maximum is %d pairs)", MAX_USB_IDS);
argc = MAX_USB_IDS * 2;
}
- if ( argc < 2 || (argc & 1) )
+ if (argc < 2 || (argc & 1))
{
LOG_WARNING("incomplete ft2232_vid_pid configuration directive");
if (argc < 2)
@@ -2892,13 +2892,13 @@
/* there are no state transitions in this code, so omit state tracking */
/* command "Clock Data to TMS/CS Pin (no Read)" */
- buffer_write( 0x4b );
+ buffer_write(0x4b);
/* scan 7 bit */
- buffer_write( bitcount_per_command - 1 );
+ buffer_write(bitcount_per_command - 1);
/* TMS data bits are either all zeros or ones to stay in the current stable state */
- buffer_write( tms );
+ buffer_write(tms);
require_send = 1;
@@ -2911,7 +2911,7 @@
/* ---------------------------------------------------------------------
* Support for IceBear JTAG adapter from Section5:
- * http://section5.ch/icebear
+ * http://section5.ch/icebear
*
* Author: Sten, de...@sa...
*/
@@ -2961,7 +2961,7 @@
buf[2] = low_direction;
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) {
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) {
LOG_ERROR("couldn't initialize FT2232 with 'IceBear' layout (low)");
return ERROR_JTAG_INIT_FAILED;
}
@@ -2976,7 +2976,7 @@
buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) {
+ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) {
LOG_ERROR("couldn't initialize FT2232 with 'IceBear' layout (high)");
return ERROR_JTAG_INIT_FAILED;
}
@@ -3005,9 +3005,9 @@
}
/* command "set data bits low byte" */
- buffer_write( 0x80 );
- buffer_write( low_output );
- buffer_write( low_direction );
+ buffer_write(0x80);
+ buffer_write(low_output);
+ buffer_write(low_direction);
LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", trst, srst, low_output, low_direction);
}
|
|
From: <zw...@ma...> - 2009-06-04 03:16:47
|
Author: zwelch
Date: 2009-06-04 03:16:43 +0200 (Thu, 04 Jun 2009)
New Revision: 2037
Modified:
trunk/src/jtag/ft2232.c
Log:
David Brownell <da...@pa...>:
Minor cleanup of FT2232:
- make Olimex glue warn about Olimex issues instead of JTAGkey issues;
- make some data static+const;
- don't export some internal symbols.
Modified: trunk/src/jtag/ft2232.c
===================================================================
--- trunk/src/jtag/ft2232.c 2009-06-04 00:56:41 UTC (rev 2036)
+++ trunk/src/jtag/ft2232.c 2009-06-04 01:16:43 UTC (rev 2037)
@@ -148,7 +148,7 @@
static void flyswatter_jtag_blink(void);
static void turtle_jtag_blink(void);
-ft2232_layout_t ft2232_layouts[] =
+static const ft2232_layout_t ft2232_layouts[] =
{
{ "usbjtag", usbjtag_init, usbjtag_reset, NULL },
{ "jtagkey", jtagkey_init, jtagkey_reset, NULL },
@@ -170,7 +170,7 @@
static u8 nTRST, nTRSTnOE, nSRST, nSRSTnOE;
-static ft2232_layout_t* layout;
+static const ft2232_layout_t *layout;
static u8 low_output = 0x0;
static u8 low_direction = 0x0;
static u8 high_output = 0x0;
@@ -558,7 +558,7 @@
}
-void ft2232_end_state(tap_state_t state)
+static void ft2232_end_state(tap_state_t state)
{
if (tap_is_state_stable(state))
tap_set_end_state(state);
@@ -775,7 +775,7 @@
}
-void ft2232_add_scan(bool ir_scan, enum scan_type type, u8* buffer, int scan_size)
+static void ft2232_add_scan(bool ir_scan, enum scan_type type, u8* buffer, int scan_size)
{
int num_bytes = (scan_size + 7) / 8;
int bits_left = scan_size;
@@ -2032,7 +2032,7 @@
u8 buf[1];
int retval;
u32 bytes_written;
- ft2232_layout_t* cur_layout = ft2232_layouts;
+ const ft2232_layout_t* cur_layout = ft2232_layouts;
int i;
if (tap_get_tms_path_len(TAP_IRPAUSE,TAP_IRPAUSE)==7)
@@ -2361,7 +2361,7 @@
if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
{
- LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'Olimex' layout");
return ERROR_JTAG_INIT_FAILED;
}
@@ -2402,9 +2402,9 @@
buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
- if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) )
+ if ((ft2232_write(buf, 3, &bytes_written) != ERROR_OK) || (bytes_written != 3))
{
- LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'Olimex' layout");
return ERROR_JTAG_INIT_FAILED;
}
|
|
From: <zw...@ma...> - 2009-06-04 02:56:50
|
Author: zwelch
Date: 2009-06-04 02:56:41 +0200 (Thu, 04 Jun 2009)
New Revision: 2036
Modified:
trunk/src/jtag/arm-jtag-ew.c
trunk/src/jtag/bitbang.c
trunk/src/jtag/ep93xx.c
trunk/src/jtag/jlink.c
trunk/src/jtag/jtag.c
trunk/src/jtag/parport.c
trunk/src/jtag/presto.c
trunk/src/jtag/vsllink.c
Log:
David Brownell <da...@pa...>:
Remove pernicious whitespace from src/jtag/*c files; mostly
the end-of-line flavor for now, although there's more.
Modified: trunk/src/jtag/arm-jtag-ew.c
===================================================================
--- trunk/src/jtag/arm-jtag-ew.c 2009-06-04 00:54:25 UTC (rev 2035)
+++ trunk/src/jtag/arm-jtag-ew.c 2009-06-04 00:56:41 UTC (rev 2036)
@@ -1,4 +1,4 @@
-// vim:ts=4 sw=4:
+// vim:ts=4 sw=4:
/***************************************************************************
* Copyright (C) 2009 by Dimitar Dimitrov <di...@gm...> *
@@ -222,14 +222,14 @@
usb_out_buffer[0] = CMD_GET_TCK_FREQUENCY;
result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4);
speed_real = (int)buf_get_u32(usb_in_buffer,0,32);
- if(result < 0)
+ if(result < 0)
{
LOG_ERROR("ARM-JTAG-EW getting speed failed (%d)", result);
return ERROR_JTAG_DEVICE_ERROR;
- }
+ }
else
{
- LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed, speed_real);
+ LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed, speed_real);
}
return ERROR_OK;
@@ -334,7 +334,7 @@
for (i = 0; i < num_states; i++)
{
/*
- * TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode.
+ * TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode.
* Either handle that here, or update the documentation with examples
* how to fix that in the configuration files.
*/
@@ -504,7 +504,7 @@
usb_out_buffer[0] = CMD_GET_VERSION;
result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4+15+256);
- if (result != 0)
+ if (result != 0)
{
LOG_ERROR("ARM-JTAG-EW command CMD_GET_VERSION failed (%d)\n", result);
return ERROR_JTAG_DEVICE_ERROR;
@@ -791,7 +791,7 @@
if (result == out_length)
{
result = armjtagew_usb_read(armjtagew_jtag, in_length);
- if (result != in_length)
+ if (result != in_length)
{
LOG_ERROR("usb_bulk_read failed (requested=%d, result=%d)", in_length, result);
return -1;
Modified: trunk/src/jtag/bitbang.c
===================================================================
--- trunk/src/jtag/bitbang.c 2009-06-04 00:54:25 UTC (rev 2035)
+++ trunk/src/jtag/bitbang.c 2009-06-04 00:56:41 UTC (rev 2036)
@@ -79,7 +79,7 @@
int i=0, tms=0;
u8 tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state());
-
+
for (i = skip; i < tms_count; i++)
{
tms = (tms_scan >> i) & 1;
Modified: trunk/src/jtag/ep93xx.c
===================================================================
--- trunk/src/jtag/ep93xx.c 2009-06-04 00:54:25 UTC (rev 2035)
+++ trunk/src/jtag/ep93xx.c 2009-06-04 00:56:41 UTC (rev 2036)
@@ -53,13 +53,13 @@
struct timespec ep93xx_zzzz;
-jtag_interface_t ep93xx_interface =
+jtag_interface_t ep93xx_interface =
{
.name = "ep93xx",
.execute_queue = bitbang_execute_queue,
- .speed = ep93xx_speed,
+ .speed = ep93xx_speed,
.register_commands = ep93xx_register_commands,
.init = ep93xx_init,
.quit = ep93xx_quit,
@@ -84,12 +84,12 @@
output_value |= TCK_BIT;
else
output_value &= ~TCK_BIT;
-
+
if (tms)
output_value |= TMS_BIT;
else
output_value &= ~TMS_BIT;
-
+
if (tdi)
output_value |= TDI_BIT;
else
@@ -111,7 +111,7 @@
output_value |= SRST_BIT;
else if (srst == 1)
output_value &= ~SRST_BIT;
-
+
*gpio_data_register = output_value;
nanosleep(&ep93xx_zzzz, NULL);
}
@@ -153,7 +153,7 @@
{
int ret;
- bitbang_interface = &ep93xx_bitbang;
+ bitbang_interface = &ep93xx_bitbang;
ep93xx_zzzz.tv_sec = 0;
ep93xx_zzzz.tv_nsec = 10000000;
@@ -203,7 +203,7 @@
gpio_data_direction_register = gpio_controller + 0x18;
LOG_INFO("gpio_data_register = %p\n", gpio_data_register);
- LOG_INFO("gpio_data_direction_reg = %p\n", gpio_data_direction_register);
+ LOG_INFO("gpio_data_direction_reg = %p\n", gpio_data_direction_register);
/*
* Configure bit 0 (TDO) as an input, and bits 1-5 (TDI, TCK
* TMS, TRST, SRST) as outputs. Drive TDI and TCK low, and
Modified: trunk/src/jtag/jlink.c
===================================================================
--- trunk/src/jtag/jlink.c 2009-06-04 00:54:25 UTC (rev 2035)
+++ trunk/src/jtag/jlink.c 2009-06-04 00:56:41 UTC (rev 2036)
@@ -59,24 +59,24 @@
static u8 usb_emu_result_buffer[JLINK_EMU_RESULT_BUFFER_SIZE];
/* Constants for JLink command */
-#define EMU_CMD_VERSION 0x01
-#define EMU_CMD_SET_SPEED 0x05
-#define EMU_CMD_GET_STATE 0x07
+#define EMU_CMD_VERSION 0x01
+#define EMU_CMD_SET_SPEED 0x05
+#define EMU_CMD_GET_STATE 0x07
#define EMU_CMD_HW_CLOCK 0xc8
-#define EMU_CMD_HW_TMS0 0xc9
-#define EMU_CMD_HW_TMS1 0xca
-#define EMU_CMD_HW_JTAG2 0xce
-#define EMU_CMD_HW_JTAG3 0xcf
+#define EMU_CMD_HW_TMS0 0xc9
+#define EMU_CMD_HW_TMS1 0xca
+#define EMU_CMD_HW_JTAG2 0xce
+#define EMU_CMD_HW_JTAG3 0xcf
#define EMU_CMD_GET_MAX_MEM_BLOCK 0xd4
-#define EMU_CMD_HW_RESET0 0xdc
-#define EMU_CMD_HW_RESET1 0xdd
-#define EMU_CMD_HW_TRST0 0xde
-#define EMU_CMD_HW_TRST1 0xdf
-#define EMU_CMD_GET_CAPS 0xe8
-#define EMU_CMD_GET_HW_VERSION 0xf0
+#define EMU_CMD_HW_RESET0 0xdc
+#define EMU_CMD_HW_RESET1 0xdd
+#define EMU_CMD_HW_TRST0 0xde
+#define EMU_CMD_HW_TRST1 0xdf
+#define EMU_CMD_GET_CAPS 0xe8
+#define EMU_CMD_GET_HW_VERSION 0xf0
/* bits return from EMU_CMD_GET_CAPS */
-#define EMU_CAP_GET_HW_VERSION 1
+#define EMU_CAP_GET_HW_VERSION 1
#define EMU_CAP_GET_MAX_BLOCK_SIZE 11
/* max speed 12MHz v5.0 jlink */
@@ -294,7 +294,7 @@
static int jlink_register_commands(struct command_context_s *cmd_ctx)
{
- register_command(cmd_ctx, NULL, "jlink_info",
+ register_command(cmd_ctx, NULL, "jlink_info",
&jlink_handle_jlink_info_command, COMMAND_EXEC,
"query jlink info");
register_command(cmd_ctx, NULL, "jlink_hw_jtag",
@@ -307,7 +307,7 @@
{
int check_cnt;
int i;
-
+
jlink_jtag_handle = jlink_usb_open();
if (jlink_jtag_handle == 0)
@@ -343,12 +343,12 @@
jlink_speed(jtag_speed);
/* v5/6 jlink seems to have an issue if the first tap move
- * is not divisible by 8, so we send a TLR on first power up */
+ * is not divisible by 8, so we send a TLR on first power up */
for (i = 0; i < 8; i++) {
jlink_tap_append_step(1, 0);
}
jlink_tap_execute();
-
+
return ERROR_OK;
}
@@ -567,7 +567,7 @@
LOG_ERROR("J-Link command EMU_CMD_VERSION impossible return length 0x%0x", len);
len = JLINK_IN_BUFFER_SIZE;
}
-
+
result = jlink_usb_read(jlink_jtag_handle, len);
if (result != len)
{
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-04 00:54:25 UTC (rev 2035)
+++ trunk/src/jtag/jtag.c 2009-06-04 00:56:41 UTC (rev 2036)
@@ -2658,7 +2658,7 @@
jtag_add_pathmove(tms_count, moves);
}
- /* else state must be immediately reachable in one clock cycle, and does not
+ /* else state must be immediately reachable in one clock cycle, and does not
need to be a stable state.
*/
else if( tap_state_transition(cur_state, true) == goal_state
Modified: trunk/src/jtag/parport.c
===================================================================
--- trunk/src/jtag/parport.c 2009-06-04 00:54:25 UTC (rev 2035)
+++ trunk/src/jtag/parport.c 2009-06-04 00:56:41 UTC (rev 2036)
@@ -75,8 +75,8 @@
u8 LED_MASK; /* data port bit for LED */
} cable_t;
-static cable_t cables[] =
-{
+static cable_t cables[] =
+{
/* name tdo trst tms tck tdi srst o_inv i_inv init exit led */
{ "wiggler", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x80, 0x00 },
{ "wiggler2", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x00, 0x20 },
@@ -135,13 +135,13 @@
static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-jtag_interface_t parport_interface =
+jtag_interface_t parport_interface =
{
.name = "parport",
-
+
.execute_queue = bitbang_execute_queue,
- .speed = parport_speed,
+ .speed = parport_speed,
.register_commands = parport_register_commands,
.init = parport_init,
.quit = parport_quit,
@@ -158,7 +158,7 @@
static int parport_read(void)
{
int data = 0;
-
+
#if PARPORT_USE_PPDEV == 1
ioctl(device_handle, PPRSTATUS, & data);
#else
@@ -190,22 +190,22 @@
static void parport_write(int tck, int tms, int tdi)
{
int i = jtag_speed + 1;
-
+
if (tck)
dataport_value |= cable->TCK_MASK;
else
dataport_value &= ~cable->TCK_MASK;
-
+
if (tms)
dataport_value |= cable->TMS_MASK;
else
dataport_value &= ~cable->TMS_MASK;
-
+
if (tdi)
dataport_value |= cable->TDI_MASK;
else
dataport_value &= ~cable->TDI_MASK;
-
+
while (i-- > 0)
parport_write_data();
}
@@ -224,10 +224,10 @@
dataport_value |= cable->SRST_MASK;
else if (srst == 1)
dataport_value &= ~cable->SRST_MASK;
-
+
parport_write_data();
}
-
+
/* turn LED on parport adapter on (1) or off (0) */
static void parport_led(int on)
{
@@ -261,7 +261,7 @@
{
HANDLE h;
OSVERSIONINFO version;
-
+
version.dwOSVersionInfoSize = sizeof version;
if (!GetVersionEx( &version )) {
errno = EINVAL;
@@ -269,15 +269,15 @@
}
if (version.dwPlatformId != VER_PLATFORM_WIN32_NT)
return 0;
-
+
h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if (h == INVALID_HANDLE_VALUE) {
errno = ENODEV;
return -1;
}
-
+
CloseHandle( h );
-
+
return 0;
}
#endif
@@ -289,15 +289,15 @@
char buffer[256];
int i = 0;
#endif
-
+
cur_cable = cables;
-
+
if ((parport_cable == NULL) || (parport_cable[0] == 0))
{
parport_cable = "wiggler";
LOG_WARNING("No parport cable specified, using default 'wiggler'");
}
-
+
while (cur_cable->name)
{
if (strcmp(cur_cable->name, parport_cable) == 0)
@@ -313,9 +313,9 @@
LOG_ERROR("No matching cable found for %s", parport_cable);
return ERROR_JTAG_INIT_FAILED;
}
-
+
dataport_value = cable->PORT_INIT;
-
+
#if PARPORT_USE_PPDEV == 1
if (device_handle > 0)
{
@@ -374,10 +374,10 @@
parport_port = 0x378;
LOG_WARNING("No parport port specified, using default '0x378' (LPT1)");
}
-
+
dataport = parport_port;
statusport = parport_port + 1;
-
+
LOG_DEBUG("requesting privileges for parallel port 0x%lx...", dataport);
#if PARPORT_USE_GIVEIO == 1
if (parport_get_giveio_access() != 0)
@@ -389,21 +389,21 @@
return ERROR_JTAG_INIT_FAILED;
}
LOG_DEBUG("...privileges granted");
-
+
/* make sure parallel port is in right mode (clear tristate and interrupt */
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
outb(parport_port + 2, 0x0);
#else
outb(0x0, parport_port + 2);
#endif
-
+
#endif /* PARPORT_USE_PPDEV */
-
+
parport_reset(0, 0);
parport_write(0, 0, 0);
parport_led(1);
- bitbang_interface = &parport_bitbang;
+ bitbang_interface = &parport_bitbang;
return ERROR_OK;
}
@@ -417,13 +417,13 @@
dataport_value = cable->PORT_EXIT;
parport_write_data();
}
-
+
if (parport_cable)
{
free(parport_cable);
parport_cable = NULL;
}
-
+
return ERROR_OK;
}
@@ -461,11 +461,11 @@
command_print(cmd_ctx, "usage: parport_write_on_exit <on|off>");
return ERROR_OK;
}
-
+
if (strcmp(args[0], "on") == 0)
parport_exit = 1;
else if (strcmp(args[0], "off") == 0)
parport_exit = 0;
-
+
return ERROR_OK;
}
Modified: trunk/src/jtag/presto.c
===================================================================
--- trunk/src/jtag/presto.c 2009-06-04 00:54:25 UTC (rev 2035)
+++ trunk/src/jtag/presto.c 2009-06-04 00:56:41 UTC (rev 2036)
@@ -117,7 +117,7 @@
int jtag_tdi_count;
int jtag_speed;
-
+
} presto_t;
static presto_t presto_state;
@@ -420,7 +420,7 @@
presto->jtag_tdi_count=0;
presto->jtag_speed=0;
-
+
#if BUILD_PRESTO_FTD2XX == 1
return presto_open_ftd2xx(req_serial);
#elif BUILD_PRESTO_LIBFTDI == 1
@@ -575,7 +575,7 @@
presto_sendbyte(presto->jtag_tdi_data);
presto->jtag_tdi_count = 0;
presto->jtag_tdi_data = 0;
-
+
return 0;
}
@@ -586,7 +586,7 @@
presto_sendbyte(0xCA);
presto->jtag_tck = 0;
}
-
+
return 0;
}
@@ -711,7 +711,7 @@
if (khz >= 3000) *jtag_speed = 0;
else *jtag_speed = (1000+khz-1)/khz;
-
+
return 0;
}
@@ -725,26 +725,26 @@
if (speed == 0) *khz = 3000;
else *khz = 1000/speed;
-
+
return 0;
}
static int presto_jtag_speed(int speed)
{
int khz;
-
+
if (presto_jtag_speed_div(speed, &khz))
{
return ERROR_INVALID_ARGUMENTS;
}
presto->jtag_speed = speed;
-
+
if (khz%1000 == 0)
LOG_INFO("setting speed to %d, max. TCK freq. is %d MHz", speed, khz/1000);
else
LOG_INFO("setting speed to %d, max. TCK freq. is %d kHz", speed, khz);
-
+
return 0;
}
Modified: trunk/src/jtag/vsllink.c
===================================================================
--- trunk/src/jtag/vsllink.c 2009-06-04 00:54:25 UTC (rev 2035)
+++ trunk/src/jtag/vsllink.c 2009-06-04 00:56:41 UTC (rev 2036)
@@ -91,7 +91,7 @@
* 3: Pause-DR
* 4: Shift-IR
* 5: Pause-IR
- *
+ *
* SD->SD and SI->SI have to be caught in interface specific code
*/
static u8 VSLLINK_tap_move[6][6] =
@@ -300,29 +300,29 @@
case JTAG_RUNTEST:
DEBUG_JTAG_IO( "runtest %i cycles, end in %s", cmd->cmd.runtest->num_cycles, \
tap_state_name(cmd->cmd.runtest->end_state));
-
+
vsllink_end_state(cmd->cmd.runtest->end_state);
vsllink_runtest(cmd->cmd.runtest->num_cycles);
break;
-
+
case JTAG_STATEMOVE:
DEBUG_JTAG_IO("statemove end in %s", tap_state_name(cmd->cmd.statemove->end_state));
-
+
vsllink_end_state(cmd->cmd.statemove->end_state);
vsllink_state_move();
break;
-
+
case JTAG_PATHMOVE:
DEBUG_JTAG_IO("pathmove: %i states, end in %s", \
cmd->cmd.pathmove->num_states, \
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
-
+
vsllink_path_move(cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path);
break;
-
+
case JTAG_SCAN:
vsllink_end_state(cmd->cmd.scan->end_state);
-
+
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
if (cmd->cmd.scan->ir_scan)
{
@@ -332,34 +332,34 @@
{
DEBUG_JTAG_IO("JTAG Scan write DR(%d bits), end in %s:", scan_size, tap_state_name(cmd->cmd.scan->end_state));
}
-
+
#ifdef _DEBUG_JTAG_IO_
vsllink_debug_buffer(buffer, (scan_size + 7) >> 3);
#endif
-
+
type = jtag_scan_type(cmd->cmd.scan);
-
+
vsllink_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size, cmd->cmd.scan);
break;
-
+
case JTAG_RESET:
DEBUG_JTAG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
-
+
vsllink_tap_execute();
-
+
if (cmd->cmd.reset->trst == 1)
{
tap_set_state(TAP_RESET);
}
vsllink_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
break;
-
+
case JTAG_SLEEP:
DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us);
vsllink_tap_execute();
jtag_sleep(cmd->cmd.sleep->us);
break;
-
+
case JTAG_STABLECLOCKS:
DEBUG_JTAG_IO("add %d clocks", cmd->cmd.stableclocks->num_cycles);
switch(tap_get_state())
@@ -383,27 +383,27 @@
}
vsllink_stableclocks(cmd->cmd.stableclocks->num_cycles, scan_size);
break;
-
+
default:
LOG_ERROR("BUG: unknown JTAG command type encountered: %d", cmd->type);
exit(-1);
}
cmd = cmd->next;
}
-
+
return vsllink_tap_execute();
}
static int vsllink_speed(int speed)
{
int result;
-
+
vsllink_usb_out_buffer[0] = VSLLINK_CMD_SET_SPEED;
vsllink_usb_out_buffer[1] = (speed >> 0) & 0xff;
vsllink_usb_out_buffer[2] = (speed >> 8) & 0xFF;
-
+
result = vsllink_usb_write(vsllink_jtag_handle, 3);
-
+
if (result == 3)
{
return ERROR_OK;
@@ -413,21 +413,21 @@
LOG_ERROR("VSLLink setting speed failed (%d)", result);
return ERROR_JTAG_DEVICE_ERROR;
}
-
+
return ERROR_OK;
}
static int vsllink_khz(int khz, int *jtag_speed)
{
*jtag_speed = khz;
-
+
return ERROR_OK;
}
static int vsllink_speed_div(int jtag_speed, int *khz)
{
*khz = jtag_speed;
-
+
return ERROR_OK;
}
@@ -436,7 +436,7 @@
int check_cnt, to_tmp;
int result;
char version_str[100];
-
+
vsllink_usb_in_buffer = malloc(VSLLINK_BufferSize);
vsllink_usb_out_buffer = malloc(VSLLINK_BufferSize);
if ((vsllink_usb_in_buffer == NULL) || (vsllink_usb_out_buffer == NULL))
@@ -444,16 +444,16 @@
LOG_ERROR("Not enough memory");
exit(-1);
}
-
+
vsllink_jtag_handle = vsllink_usb_open();
-
+
if (vsllink_jtag_handle == 0)
{
LOG_ERROR("Can't find USB JTAG Interface! Please check connection and permissions.");
return ERROR_JTAG_INIT_FAILED;
}
LOG_DEBUG("vsllink found on %04X:%04X", vsllink_usb_vid, vsllink_usb_pid);
-
+
to_tmp = VSLLINK_USB_TIMEOUT;
VSLLINK_USB_TIMEOUT = 100;
check_cnt = 0;
@@ -461,20 +461,20 @@
{
vsllink_simple_command(0x00);
result = vsllink_usb_read(vsllink_jtag_handle);
-
+
if (result > 2)
{
vsllink_usb_in_buffer[result] = 0;
VSLLINK_BufferSize = vsllink_usb_in_buffer[0] + (vsllink_usb_in_buffer[1] << 8);
strncpy(version_str, (char *)vsllink_usb_in_buffer + 2, sizeof(version_str));
LOG_INFO("%s", version_str);
-
+
// free the pre-alloc memroy
free(vsllink_usb_in_buffer);
free(vsllink_usb_out_buffer);
vsllink_usb_in_buffer = NULL;
vsllink_usb_out_buffer = NULL;
-
+
// alloc new memory
vsllink_usb_in_buffer = malloc(VSLLINK_BufferSize);
vsllink_usb_out_buffer = malloc(VSLLINK_BufferSize);
@@ -512,7 +512,7 @@
exit(-1);
}
VSLLINK_USB_TIMEOUT = to_tmp;
-
+
// connect to vsllink
vsllink_connect();
// initialize function pointers
@@ -523,11 +523,11 @@
vsllink_path_move = vsllink_path_move_normal;
vsllink_stableclocks = vsllink_stableclocks_normal;
vsllink_scan = vsllink_scan_normal;
-
+
vsllink_tap_init = vsllink_tap_init_normal;
vsllink_tap_execute = vsllink_tap_execute_normal;
vsllink_tap_ensure_space = vsllink_tap_ensure_space_normal;
-
+
LOG_INFO("vsllink run in NORMAL mode");
}
else
@@ -537,14 +537,14 @@
vsllink_path_move = vsllink_path_move_dma;
vsllink_stableclocks = vsllink_stableclocks_dma;
vsllink_scan = vsllink_scan_dma;
-
+
vsllink_tap_init = vsllink_tap_init_dma;
vsllink_tap_execute = vsllink_tap_execute_dma;
vsllink_tap_ensure_space = vsllink_tap_ensure_space_dma;
-
+
LOG_INFO("vsllink run in DMA mode");
}
-
+
// Set SRST and TRST to output, Set USR1 and USR2 to input
vsllink_usb_out_buffer[0] = VSLLINK_CMD_SET_PORTDIR;
vsllink_usb_out_buffer[1] = JTAG_PINMSK_SRST | JTAG_PINMSK_TRST | JTAG_PINMSK_USR1 | JTAG_PINMSK_USR2;
@@ -554,13 +554,13 @@
LOG_ERROR("VSLLink USB send data error");
exit(-1);
}
-
+
vsllink_reset(0, 0);
-
+
LOG_INFO("VSLLink JTAG Interface ready");
-
+
vsllink_tap_init();
-
+
return ERROR_OK;
}
@@ -577,13 +577,13 @@
LOG_ERROR("VSLLink USB send data error");
exit(-1);
}
-
+
// disconnect
vsllink_disconnect();
vsllink_usb_close(vsllink_jtag_handle);
vsllink_jtag_handle = NULL;
}
-
+
if (vsllink_usb_in_buffer != NULL)
{
free(vsllink_usb_in_buffer);
@@ -594,7 +594,7 @@
free(vsllink_usb_out_buffer);
vsllink_usb_out_buffer = NULL;
}
-
+
return ERROR_OK;
}
@@ -609,7 +609,7 @@
static int vsllink_connect(void)
{
char vsllink_str[100];
-
+
vsllink_usb_out_buffer[0] = VSLLINK_CMD_CONN;
vsllink_usb_out_buffer[1] = vsllink_mode;
vsllink_usb_message(vsllink_jtag_handle, 2, 0);
@@ -618,7 +618,7 @@
strncpy(vsllink_str, (char *)vsllink_usb_in_buffer + 2, sizeof(vsllink_str));
LOG_INFO("%s", vsllink_str);
}
-
+
return ERROR_OK;
}
@@ -630,7 +630,7 @@
u16 tms2;
insert_insignificant_operation_t *insert = \
&VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())];
-
+
if (((tap_get_state() != TAP_RESET) && (tap_get_state() != TAP_IDLE) && (tap_get_state() != TAP_DRPAUSE) && (tap_get_state() != TAP_IRPAUSE)) || \
(vsllink_tms_data_len <= 0) || (vsllink_tms_data_len >= 8) || \
(vsllink_tms_cmd_pos == NULL))
@@ -638,7 +638,7 @@
LOG_ERROR("There MUST be some bugs in the driver");
exit(-1);
}
-
+
tms2 = (tms_scan & VSLLINK_BIT_MSK[insert->insert_position]) << \
vsllink_tms_data_len;
if (insert->insert_value == 1)
@@ -648,10 +648,10 @@
}
tms2 |= (tms_scan >> insert->insert_position) << \
(8 + insert->insert_position);
-
+
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (tms2 >> 0) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms2 >> 8) & 0xff;
-
+
vsllink_tms_data_len = 0;
vsllink_tms_cmd_pos = NULL;
}
@@ -679,11 +679,11 @@
else
{
vsllink_tap_ensure_space(0, 2);
-
+
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_TMSBYTE;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
}
-
+
tap_set_state(tap_get_end_state());
}
static void vsllink_state_move_dma(void)
@@ -692,21 +692,21 @@
insert_insignificant_operation_t *insert = \
&VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())];
u8 tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
-
+
if (tap_get_state() == TAP_RESET)
{
vsllink_tap_ensure_space(0, 8);
-
+
for (i = 0; i < 8; i++)
{
vsllink_tap_append_step(1, 0);
}
}
-
+
if (insert_length > 0)
{
vsllink_tap_ensure_space(0, 16);
-
+
for (i = 0; i < insert->insert_position; i++)
{
vsllink_tap_append_step((tms_scan >> i) & 1, 0);
@@ -723,13 +723,13 @@
else
{
vsllink_tap_ensure_space(0, 8);
-
+
for (i = 0; i < 8; i++)
{
vsllink_tap_append_step((tms_scan >> i) & 1, 0);
}
}
-
+
tap_set_state(tap_get_end_state());
}
@@ -737,7 +737,7 @@
static void vsllink_add_path(int start, int num, tap_state_t *path)
{
int i;
-
+
for (i = start; i < (start + num); i++)
{
if ((i & 7) == 0)
@@ -748,7 +748,7 @@
}
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = 0;
}
-
+
if (path[i - start] == tap_state_transition(tap_get_state(), true))
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] |= 1 << (i & 7);
@@ -769,14 +769,14 @@
vsllink_usb_out_buffer_idx++;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = 0;
}
-
+
tap_set_end_state(tap_get_state());
}
static void vsllink_path_move_normal(int num_states, tap_state_t *path)
{
int i, tms_len, tms_cmd_pos, path_idx = 0;
-
+
if (vsllink_tms_data_len > 0)
{
// there are vsllink_tms_data_len more tms bits to be shifted
@@ -827,7 +827,7 @@
// end last tms shift command
vsllink_add_path(vsllink_tms_data_len, num_states, path);
}
-
+
vsllink_tms_data_len = (vsllink_tms_data_len + num_states) & 7;
if (vsllink_tms_data_len == 0)
{
@@ -838,19 +838,19 @@
else
{
vsllink_add_path(vsllink_tms_data_len, 16 - vsllink_tms_data_len, path);
-
+
path += 16 - vsllink_tms_data_len;
num_states -= 16 - vsllink_tms_data_len;
vsllink_tms_data_len = 0;
vsllink_tms_cmd_pos = NULL;
}
}
-
+
if (num_states > 0)
{
// Normal operation, don't need to append tms data
vsllink_tms_data_len = num_states & 7;
-
+
while (num_states > 0)
{
if (num_states > ((VSLLINK_CMDJTAGSEQ_LENMSK + 1) * 8))
@@ -865,13 +865,13 @@
vsllink_tap_ensure_space(0, tms_len + 2);
tms_cmd_pos = vsllink_usb_out_buffer_idx;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_TMSBYTE | (tms_len - 1);
-
+
vsllink_add_path(0, i, path + path_idx);
-
+
path_idx += i;
num_states -= i;
}
-
+
if (vsllink_tms_data_len > 0)
{
if (tms_len < (VSLLINK_CMDJTAGSEQ_LENMSK + 1))
@@ -882,7 +882,7 @@
else
{
vsllink_usb_out_buffer[tms_cmd_pos]--;
-
+
tms_len = vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx];
vsllink_tap_ensure_space(0, 3);
vsllink_tms_cmd_pos = &vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx];
@@ -895,7 +895,7 @@
static void vsllink_path_move_dma(int num_states, tap_state_t *path)
{
int i, j = 0;
-
+
if (tap_length & 7)
{
if ((8 - (tap_length & 7)) < num_states)
@@ -925,11 +925,11 @@
}
num_states -= j;
}
-
+
if (num_states > 0)
{
vsllink_tap_ensure_space(0, num_states);
-
+
for (i = 0; i < num_states; i++)
{
if (path[j + i] == tap_state_transition(tap_get_state(), false))
@@ -948,7 +948,7 @@
tap_set_state(path[j + i]);
}
}
-
+
tap_set_end_state(tap_get_state());
}
@@ -956,7 +956,7 @@
{
int tms_len;
u16 tms_append_byte;
-
+
if (vsllink_tms_data_len > 0)
{
// there are vsllink_tms_data_len more tms bits to be shifted
@@ -1022,7 +1022,7 @@
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF);
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (u8)(tms_append_byte >> 8);
}
-
+
vsllink_tms_data_len = tms_len & 7;
if (vsllink_tms_data_len == 0)
{
@@ -1035,14 +1035,14 @@
// more shifts will be needed
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF);
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (u8)(tms_append_byte >> 8);
-
+
num_cycles -= 16 - vsllink_tms_data_len;
vsllink_tms_data_len = 0;
vsllink_tms_cmd_pos = NULL;
}
}
// from here vsllink_tms_data_len == 0 or num_cycles == 0
-
+
if (vsllink_tms_data_len > 0)
{
// num_cycles == 0
@@ -1075,17 +1075,17 @@
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms_len >> 8) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms_len >> 16) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms_len >> 24) & 0xff;
-
+
vsllink_usb_in_want_length += 1;
pending_scan_results_buffer[pending_scan_results_length].buffer = NULL;
pending_scan_results_length++;
-
+
if (tms_len > 0xFFFF)
{
vsllink_tap_execute();
}
}
-
+
// post-process
vsllink_tms_data_len = num_cycles & 7;
if (vsllink_tms_data_len > 0)
@@ -1109,7 +1109,7 @@
static void vsllink_stableclocks_dma(int num_cycles, int tms)
{
int i, cur_cycles;
-
+
if (tap_length & 7)
{
if ((8 - (tap_length & 7)) < num_cycles)
@@ -1126,7 +1126,7 @@
}
num_cycles -= cur_cycles;
}
-
+
while (num_cycles > 0)
{
if (num_cycles > 8 * tap_buffer_size)
@@ -1137,14 +1137,14 @@
{
cur_cycles = num_cycles;
}
-
+
vsllink_tap_ensure_space(0, cur_cycles);
-
+
for (i = 0; i < cur_cycles; i++)
{
vsllink_tap_append_step(tms, 0);
}
-
+
num_cycles -= cur_cycles;
}
}
@@ -1152,16 +1152,16 @@
static void vsllink_runtest(int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
-
+
if (tap_get_state() != TAP_IDLE)
{
// enter into IDLE state
vsllink_end_state(TAP_IDLE);
vsllink_state_move();
}
-
+
vsllink_stableclocks(num_cycles, 0);
-
+
// post-process
// set end_state
vsllink_end_state(saved_end_state);
@@ -1177,24 +1177,24 @@
tap_state_t saved_end_state;
u8 bits_left, tms_tmp, tdi_len;
int i;
-
+
if (0 == scan_size )
{
return;
}
-
+
tdi_len = ((scan_size + 7) >> 3);
if ((tdi_len + 7) > VSLLINK_BufferSize)
{
LOG_ERROR("Your implementation of VSLLink has not enough buffer");
exit(-1);
}
-
+
saved_end_state = tap_get_end_state();
-
+
/* Move to appropriate scan state */
vsllink_end_state(ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT);
-
+
if (vsllink_tms_data_len > 0)
{
if (tap_get_state() == tap_get_end_state())
@@ -1216,16 +1216,16 @@
tms_tmp = vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx];
*vsllink_tms_cmd_pos -= 2;
}
-
+
vsllink_tap_ensure_space(1, tdi_len + 7);
- // VSLLINK_CMDJTAGSEQ_SCAN ored by 1 means that tms_before is valid
+ // VSLLINK_CMDJTAGSEQ_SCAN ored by 1 means that tms_before is valid
// which is merged from the last tms shift command
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN | 1;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 0) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 8) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = tms_tmp;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = buffer[0] << (8 - vsllink_tms_data_len);
-
+
for (i = 0; i < tdi_len; i++)
{
buffer[i] >>= 8 - vsllink_tms_data_len;
@@ -1234,7 +1234,7 @@
buffer[i] += buffer[i + 1] << vsllink_tms_data_len;
}
}
-
+
vsllink_tap_append_scan_normal(scan_size - vsllink_tms_data_len, buffer, command, vsllink_tms_data_len);
scan_size -= 8 - vsllink_tms_data_len;
vsllink_tms_data_len = 0;
@@ -1243,31 +1243,31 @@
{
vsllink_state_move();
vsllink_tap_ensure_space(1, tdi_len + 5);
-
+
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tdi_len >> 0) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tdi_len >> 8) & 0xff;
-
+
vsllink_tap_append_scan_normal(scan_size, buffer, command, 0);
}
}
else
{
vsllink_tap_ensure_space(1, tdi_len + 7);
-
+
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN | 1;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 0) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1)>> 8) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 0;
-
+
vsllink_tap_append_scan_normal(scan_size, buffer, command, 8);
}
vsllink_end_state(saved_end_state);
-
+
bits_left = scan_size & 0x07;
tap_set_state(ir_scan ? TAP_IRPAUSE : TAP_DRPAUSE);
-
+
if (bits_left > 0)
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 1 << (bits_left - 1);
@@ -1276,7 +1276,7 @@
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 1 << 7;
}
-
+
if (tap_get_state() != tap_get_end_state())
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
@@ -1285,31 +1285,31 @@
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 0;
}
-
+
tap_set_state(tap_get_end_state());
}
static void vsllink_scan_dma(bool ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
{
tap_state_t saved_end_state;
-
+
saved_end_state = tap_get_end_state();
-
+
/* Move to appropriate scan state */
vsllink_end_state(ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT);
-
+
vsllink_state_move();
vsllink_end_state(saved_end_state);
-
+
/* Scan */
vsllink_tap_append_scan_dma(scan_size, buffer, command);
-
+
tap_set_state(ir_scan ? TAP_IRPAUSE : TAP_DRPAUSE);
while (tap_length % 8 != 0)
{
// more 0s in Pause
vsllink_tap_append_step(0, 0);
}
-
+
if (tap_get_state() != tap_get_end_state())
{
vsllink_state_move();
@@ -1319,9 +1319,9 @@
static void vsllink_reset(int trst, int srst)
{
int result;
-
+
LOG_DEBUG("trst: %i, srst: %i", trst, srst);
-
+
/* Signals are active low */
vsllink_usb_out_buffer[0] = VSLLINK_CMD_SET_PORT;
vsllink_usb_out_buffer[1] = JTAG_PINMSK_SRST | JTAG_PINMSK_TRST;
@@ -1334,7 +1334,7 @@
{
vsllink_usb_out_buffer[2] |= JTAG_PINMSK_TRST;
}
-
+
result = vsllink_usb_write(vsllink_jtag_handle, 3);
if (result != 3)
{
@@ -1345,12 +1345,12 @@
static void vsllink_simple_command(u8 command)
{
int result;
-
+
DEBUG_JTAG_IO("0x%02x", command);
-
+
vsllink_usb_out_buffer[0] = command;
result = vsllink_usb_write(vsllink_jtag_handle, 1);
-
+
if (result != 1)
{
LOG_ERROR("VSLLink command 0x%02x failed (%d)", command, result);
@@ -1359,19 +1359,19 @@
static int vsllink_register_commands(struct command_context_s *cmd_ctx)
{
- register_command(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command,
+ register_command(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command,
COMMAND_CONFIG, NULL);
- register_command(cmd_ctx, NULL, "vsllink_usb_pid", vsllink_handle_usb_pid_command,
+ register_command(cmd_ctx, NULL, "vsllink_usb_pid", vsllink_handle_usb_pid_command,
COMMAND_CONFIG, NULL);
- register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", vsllink_handle_usb_bulkin_command,
+ register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", vsllink_handle_usb_bulkin_command,
COMMAND_CONFIG, NULL);
- register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", vsllink_handle_usb_bulkout_command,
+ register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", vsllink_handle_usb_bulkout_command,
COMMAND_CONFIG, NULL);
- register_command(cmd_ctx, NULL, "vsllink_usb_interface", vsllink_handle_usb_interface_command,
+ register_command(cmd_ctx, NULL, "vsllink_usb_interface", vsllink_handle_usb_interface_command,
COMMAND_CONFIG, NULL);
- register_command(cmd_ctx, NULL, "vsllink_mode", vsllink_handle_mode_command,
+ register_command(cmd_ctx, NULL, "vsllink_mode", vsllink_handle_mode_command,
COMMAND_CONFIG, NULL);
-
+
return ERROR_OK;
}
@@ -1381,7 +1381,7 @@
LOG_ERROR("parameter error, should be one parameter for VID");
return ERROR_FAIL;
}
-
+
if (!strcmp(args[0], "normal"))
{
vsllink_mode = VSLLINK_MODE_NORMAL;
@@ -1395,7 +1395,7 @@
LOG_ERROR("invalid vsllink_mode: %s", args[0]);
return ERROR_FAIL;
}
-
+
return ERROR_OK;
}
@@ -1406,9 +1406,9 @@
LOG_ERROR("parameter error, should be one parameter for VID");
return ERROR_OK;
}
-
+
vsllink_usb_vid = strtol(args[0], NULL, 0);
-
+
return ERROR_OK;
}
@@ -1419,9 +1419,9 @@
LOG_ERROR("parameter error, should be one parameter for PID");
return ERROR_OK;
}
-
+
vsllink_usb_pid = strtol(args[0], NULL, 0);
-
+
return ERROR_OK;
}
@@ -1432,9 +1432,9 @@
LOG_ERROR("parameter error, should be one parameter for BULKIN endpoint");
return ERROR_OK;
}
-
+
vsllink_usb_bulkin = strtol(args[0], NULL, 0) | 0x80;
-
+
return ERROR_OK;
}
@@ -1445,9 +1445,9 @@
LOG_ERROR("parameter error, should be one parameter for BULKOUT endpoint");
return ERROR_OK;
}
-
+
vsllink_usb_bulkout = strtol(args[0], NULL, 0);
-
+
return ERROR_OK;
}
@@ -1458,9 +1458,9 @@
LOG_ERROR("parameter error, should be one parameter for interface number");
return ERROR_OK;
}
-
+
vsllink_usb_interface = strtol(args[0], NULL, 0);
-
+
return ERROR_OK;
}
@@ -1483,7 +1483,7 @@
{
int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length;
int available_bytes = VSLLINK_BufferSize - vsllink_usb_out_buffer_idx;
-
+
if (scans > available_scans || length > available_bytes)
{
vsllink_tap_execute();
@@ -1493,7 +1493,7 @@
{
int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length;
int available_bytes = tap_buffer_size * 8 - tap_length;
-
+
if (scans > available_scans || length > available_bytes)
{
vsllink_tap_execute();
@@ -1504,12 +1504,12 @@
{
last_tms = tms;
int index = tap_length / 8;
-
+
if (index < tap_buffer_size)
{
int bit_index = tap_length % 8;
u8 bit = 1 << bit_index;
-
+
if (tms)
{
tms_buffer[index] |= bit;
@@ -1518,7 +1518,7 @@
{
tms_buffer[index] &= ~bit;
}
-
+
if (tdi)
{
tdi_buffer[index] |= bit;
@@ -1527,7 +1527,7 @@
{
tdi_buffer[index] &= ~bit;
}
-
+
tap_length++;
}
else
@@ -1540,7 +1540,7 @@
{
pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
int i;
-
+
if (offset > 0)
{
vsllink_usb_in_want_length += ((length + 7) >> 3) + 1;
@@ -1553,19 +1553,19 @@
pending_scan_result->offset = offset;
pending_scan_result->command = command;
pending_scan_result->buffer = buffer;
-
+
for (i = 0; i < ((length + 7) >> 3); i++)
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = buffer[i];
}
-
+
pending_scan_results_length++;
}
static void vsllink_tap_append_scan_dma(int length, u8 *buffer, scan_command_t *command)
{
pending_scan_result_t *pending_scan_result;
int len_tmp, len_all, i;
-
+
len_all = 0;
while (len_all < length)
{
@@ -1577,20 +1577,20 @@
{
len_tmp = length - len_all;
}
-
+
vsllink_tap_ensure_space(1, (len_tmp + 7) & ~7);
-
+
pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
pending_scan_result->offset = tap_length;
pending_scan_result->length = len_tmp;
pending_scan_result->command = command;
pending_scan_result->buffer = buffer + len_all / 8;
-
+
for (i = 0; i < len_tmp; i++)
{
vsllink_tap_append_step(((len_all+i) < length-1 ? 0 : 1), (buffer[(len_all+i)/8] >> ((len_all+i)%8)) & 1);
}
-
+
pending_scan_results_length++;
len_all += len_tmp;
}
@@ -1603,14 +1603,14 @@
int i;
int result;
int first = 0;
-
+
if (vsllink_tms_data_len > 0)
{
if((tap_get_state() != TAP_RESET) && (tap_get_state() != TAP_IDLE) && (tap_get_state() != TAP_IRPAUSE) && (tap_get_state() != TAP_DRPAUSE))
{
LOG_WARNING("%s is not in RESET or IDLE or PAUSR state", tap_state_name(tap_get_state()));
}
-
+
if (vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] & (1 << (vsllink_tms_data_len - 1)))
{
// last tms bit is '1'
@@ -1626,7 +1626,7 @@
vsllink_tms_data_len = 0;
}
}
-
+
if (vsllink_usb_out_buffer_idx > 3)
{
if (vsllink_usb_out_buffer[0] == VSLLINK_CMD_HW_JTAGSEQCMD)
@@ -1634,9 +1634,9 @@
vsllink_usb_out_buffer[1] = (vsllink_usb_out_buffer_idx >> 0) & 0xff;
vsllink_usb_out_buffer[2] = (vsllink_usb_out_buffer_idx >> 8) & 0xff;
}
-
+
result = vsllink_usb_message(vsllink_jtag_handle, vsllink_usb_out_buffer_idx, vsllink_usb_in_want_length);
-
+
if (result == vsllink_usb_in_want_length)
{
for (i = 0; i < pending_scan_results_length; i++)
@@ -1646,24 +1646,24 @@
int length = pending_scan_result->length;
int offset = pending_scan_result->offset;
scan_command_t *command = pending_scan_result->command;
-
+
if (buffer != NULL)
{
// IRSHIFT or DRSHIFT
buf_set_buf(vsllink_usb_in_buffer, first * 8 + offset, buffer, 0, length);
first += (length + offset + 7) >> 3;
-
+
DEBUG_JTAG_IO("JTAG scan read(%d bits):", length);
#ifdef _DEBUG_JTAG_IO_
vsllink_debug_buffer(buffer, (length + 7) >> 3);
#endif
-
+
if (jtag_read_buffer(buffer, command) != ERROR_OK)
{
vsllink_tap_init();
return ERROR_JTAG_QUEUE_FAILED;
}
-
+
free(pending_scan_result->buffer);
pending_scan_result->buffer = NULL;
}
@@ -1678,11 +1678,11 @@
LOG_ERROR("vsllink_tap_execute, wrong result %d, expected %d", result, vsllink_usb_in_want_length);
return ERROR_JTAG_QUEUE_FAILED;
}
-
+
vsllink_tap_init();
}
reset_command_pointer();
-
+
return ERROR_OK;
}
static int vsllink_tap_execute_dma(void)
@@ -1690,7 +1690,7 @@
int byte_length;
int i;
int result;
-
+
if (tap_length > 0)
{
/* Pad last byte so that tap_length is divisible by 8 */
@@ -1701,14 +1701,14 @@
vsllink_tap_append_step(last_tms, 0);
}
byte_length = tap_length / 8;
-
+
vsllink_usb_out_buffer[0] = VSLLINK_CMD_HW_JTAGRAWCMD;
vsllink_usb_out_buffer[1] = ((byte_length * 2 + 3) >> 0) & 0xff; // package size
vsllink_usb_out_buffer[2] = ((byte_length * 2 + 3) >> 8) & 0xff;
-
+
memcpy(&vsllink_usb_out_buffer[3], tdi_buffer, byte_length);
memcpy(&vsllink_usb_out_buffer[3 + byte_length], tms_buffer, byte_length);
-
+
result = vsllink_usb_message(vsllink_jtag_handle, 3 + 2 * byte_length, byte_length);
if (result == byte_length)
{
@@ -1718,21 +1718,21 @@
u8 *buffer = pending_scan_result->buffer;
int length = pending_scan_result->length;
int first = pending_scan_result->offset;
-
+
scan_command_t *command = pending_scan_result->command;
buf_set_buf(vsllink_usb_in_buffer, first, buffer, 0, length);
-
+
DEBUG_JTAG_IO("JTAG scan read(%d bits, from %d bits):", length, first);
#ifdef _DEBUG_JTAG_IO_
vsllink_debug_buffer(buffer, (length + 7) >> 3);
#endif
-
+
if (jtag_read_buffer(buffer, command) != ERROR_OK)
{
vsllink_tap_init();
return ERROR_JTAG_QUEUE_FAILED;
}
-
+
if (pending_scan_result->buffer != NULL)
{
free(pending_scan_result->buffer);
@@ -1744,10 +1744,10 @@
LOG_ERROR("vsllink_tap_execute, wrong result %d, expected %d", result, byte_length);
return ERROR_JTAG_QUEUE_FAILED;
}
-
+
vsllink_tap_init();
}
-
+
return ERROR_OK;
}
@@ -1760,19 +1760,19 @@
struct usb_bus *bus;
struct usb_device *dev;
int ret;
-
+
vsllink_jtag_t *result;
-
+
result = (vsllink_jtag_t*) malloc(sizeof(vsllink_jtag_t));
-
+
usb_init();
usb_find_busses();
usb_find_devices();
-
+
busses = usb_get_busses();
-
+
/* find vsllink_jtag device in usb bus */
-
+
for (bus = busses; bus; bus = bus->next)
{
for (dev = bus->devices; dev; dev = dev->next)
@@ -1785,7 +1785,7 @@
LOG_ERROR("failed to open %04X:%04X, not enough permissions?", vsllink_usb_vid, vsllink_usb_pid);
exit(-1);
}
-
+
/* usb_set_configuration required under win32 */
ret = usb_set_configuration(result->usb_handle, dev->config[0].bConfigurationValue);
if (ret != 0)
@@ -1799,19 +1799,19 @@
LOG_ERROR("fail to claim interface %d, %d returned", vsllink_usb_interface, ret);
exit(-1);
}
-
+
#if 0
- /*
+ /*
* This makes problems under Mac OS X. And is not needed
* under Windows. Hopefully this will not break a linux build
*/
usb_set_altinterface(result->usb_handle, 0);
-#endif
+#endif
return result;
}
}
}
-
+
free(result);
return NULL;
}
@@ -1841,7 +1841,7 @@
static int vsllink_usb_message(vsllink_jtag_t *vsllink_jtag, int out_length, int in_length)
{
int result;
-
+
result = vsllink_usb_write(vsllink_jtag, out_length);
if (result == out_length)
{
@@ -1871,18 +1871,18 @@
static int vsllink_usb_write(vsllink_jtag_t *vsllink_jtag, int out_length)
{
int result;
-
+
if (out_length > VSLLINK_BufferSize)
{
LOG_ERROR("vsllink_jtag_write illegal out_length=%d (max=%d)", out_length, VSLLINK_BufferSize);
return -1;
}
-
+
result = usb_bulk_write(vsllink_jtag->usb_handle, vsllink_usb_bulkout, \
(char *)vsllink_usb_out_buffer, out_length, VSLLINK_USB_TIMEOUT);
-
+
DEBUG_JTAG_IO("vsllink_usb_write, out_length = %d, result = %d", out_length, result);
-
+
#ifdef _DEBUG_USB_COMMS_
LOG_DEBUG("USB out:");
vsllink_debug_buffer(vsllink_usb_out_buffer, out_length);
@@ -1900,9 +1900,9 @@
{
int result = usb_bulk_read(vsllink_jtag->usb_handle, vsllink_usb_bulkin, \
(char *)vsllink_usb_in_buffer, VSLLINK_BufferSize, VSLLINK_USB_TIMEOUT);
-
+
DEBUG_JTAG_IO("vsllink_usb_read, result = %d", result);
-
+
#ifdef _DEBUG_USB_COMMS_
LOG_DEBUG("USB in:");
vsllink_debug_buffer(vsllink_usb_in_buffer, result);
@@ -1919,7 +1919,7 @@
char s[4];
int i;
int j;
-
+
for (i = 0; i < length; i += BYTES_PER_LINE)
{
snprintf(line, 5, "%04x", i);
|
|
From: <zw...@ma...> - 2009-06-04 02:54:32
|
Author: zwelch
Date: 2009-06-04 02:54:25 +0200 (Thu, 04 Jun 2009)
New Revision: 2035
Modified:
trunk/doc/openocd.texi
Log:
David Brownell <da...@pa...>:
Convert the Interface/Dongle Config chapter's section
on drivers to use the @deffn syntax, and integrate the
presentation of the driver-specific commands with the
relevant driver. Alphabetize.
Cross-checked against the code ... several adapters were
not listed, and a few commands weren't.
(Maintainers for the versaloon and zy1000 drivers would be
good candidates to add the commands missing from those
sections...)
Modified: trunk/doc/openocd.texi
===================================================================
--- trunk/doc/openocd.texi 2009-06-04 00:51:02 UTC (rev 2034)
+++ trunk/doc/openocd.texi 2009-06-04 00:54:25 UTC (rev 2035)
@@ -1302,40 +1302,27 @@
@node Interface - Dongle Configuration
@chapter Interface - Dongle Configuration
-Interface commands are normally found in an interface configuration
-file which is sourced by your openocd.cfg file. These commands tell
-OpenOCD what type of JTAG dongle you have and how to talk to it.
-@section Simple Complete Interface Examples
-@b{A Turtelizer FT2232 Based JTAG Dongle}
-@verbatim
-#interface
-interface ft2232
-ft2232_device_desc "Turtelizer JTAG/RS232 Adapter A"
-ft2232_layout turtelizer2
-ft2232_vid_pid 0x0403 0xbdc8
-@end verbatim
-@b{A SEGGER Jlink}
-@verbatim
+JTAG Adapters/Interfaces/Dongles are normally configured
+through commands in an interface configuration
+file which is sourced by your @file{openocd.cfg} file, or
+through a command line @option{-f interface/....cfg} option.
+
+@example
+source [find interface/olimex-jtag-tiny.cfg]
+@end example
+
+These commands tell
+OpenOCD what type of JTAG adapter you have, and how to talk to it.
+A few cases are so simple that you only need to say what driver to use:
+
+@example
# jlink interface
interface jlink
-@end verbatim
-@b{A Raisonance RLink}
-@verbatim
-# rlink interface
-interface rlink
-@end verbatim
-@b{Parallel Port}
-@verbatim
-interface parport
-parport_port 0xc8b8
-parport_cable wiggler
-jtag_speed 0
-@end verbatim
-@b{ARM-JTAG-EW}
-@verbatim
-interface arm-jtag-ew
-@end verbatim
+@end example
+Most adapters need a bit more configuration than that.
+
+
@section Interface Configuration
The interface command tells OpenOCD what type of JTAG dongle you are
@@ -1353,181 +1340,233 @@
@section Interface Drivers
-Currently supported interface drivers are:
+Each of the interface drivers listed here must be explicitly
+enabled when OpenOCD is configured, in order to be made
+available at run time.
-@itemize @minus
+@deffn {Interface Driver} {amt_jtagaccel}
+Amontec Chameleon in its JTAG Accelerator configuration,
+connected to a PC's EPP mode parallel port.
+This defines some driver-specific commands:
-@item @b{parport}
-@* PC parallel port bit-banging (Wigglers, PLD download cable, ...)
+@deffn {Config Command} {parport_port} number
+Specifies either the address of the I/O port (default: 0x378 for LPT1) or
+the number of the @file{/dev/parport} device.
+@end deffn
-@item @b{amt_jtagaccel}
-@* Amontec Chameleon in its JTAG Accelerator configuration connected to a PC's EPP
-mode parallel port
+@deffn {Config Command} rtck [@option{enable}|@option{disable}]
+Displays status of RTCK option.
+Optionally sets that option first.
+@end deffn
+@end deffn
-@item @b{ft2232}
-@* FTDI FT2232 (USB) based devices using either the open-source libftdi or the binary only
-FTD2XX driver. The FTD2XX is superior in performance, but not available on every
-platform. The libftdi uses libusb, and should be portable to all systems that provide
-libusb.
+@deffn {Interface Driver} {arm-jtag-ew}
+Olimex ARM-JTAG-EW USB adapter
+This has one driver-specific command:
-@item @b{ep93xx}
-@*Cirrus Logic EP93xx based single-board computer bit-banging (in development)
+@deffn Command {armjtagew_info}
+Logs some status
+@end deffn
+@end deffn
-@item @b{presto}
-@* ASIX PRESTO USB JTAG programmer.
+@deffn {Interface Driver} {at91rm9200}
+Supports bitbanged JTAG from the local system,
+presuming that system is an Atmel AT91rm9200
+and a specific set of GPIOs is used.
+@c command: at91rm9200_device NAME
+@c chooses among list of bit configs ... only one option
+@end deffn
-@item @b{usbprog}
-@* usbprog is a freely programmable USB adapter.
+@deffn {Interface Driver} {dummy}
+A dummy software-only driver for debugging.
+@end deffn
-@item @b{gw16012}
-@* Gateworks GW16012 JTAG programmer.
+@deffn {Interface Driver} {ep93xx}
+Cirrus Logic EP93xx based single-board computer bit-banging (in development)
+@end deffn
-@item @b{jlink}
-@* Segger jlink USB adapter
+@deffn {Interface Driver} {ft2232}
+FTDI FT2232 (USB) based devices over one of the userspace libraries.
+These interfaces have several commands, used to configure the driver
+before initializing the JTAG scan chain:
-@item @b{rlink}
-@* Raisonance RLink USB adapter
+@deffn {Config Command} {ft2232_device_desc} description
+Provides the USB device description (the @emph{iProduct string})
+of the FTDI FT2232 device. If not
+specified, the FTDI default value is used. This setting is only valid
+if compiled with FTD2XX support.
+@end deffn
-@item @b{vsllink}
-@* vsllink is part of Versaloon which is a versatile USB programmer.
+@deffn {Config Command} {ft2232_serial} serial-number
+Specifies the @var{serial-number} of the FTDI FT2232 device to use,
+in case the vendor provides unique IDs and more than one FT2232 device
+is connected to the host.
+If not specified, serial numbers are not considered.
+@end deffn
-@item @b{arm-jtag-ew}
-@* Olimex ARM-JTAG-EW USB adapter
+@deffn {Config Command} {ft2232_layout} name
+Each vendor's FT2232 device can use different GPIO signals
+to control output-enables, reset signals, and LEDs.
+Currently valid layout @var{name} values include:
+@itemize @minus
+@item @b{axm0432_jtag} Axiom AXM-0432
+@item @b{comstick} Hitex STR9 comstick
+@item @b{cortino} Hitex Cortino JTAG interface
+@item @b{evb_lm3s811} Luminary Micro EVB_LM3S811 as a JTAG interface
+(bypassing onboard processor), no TRST or SRST signals on external connector
+@item @b{flyswatter} Tin Can Tools Flyswatter
+@item @b{icebear} ICEbear JTAG adapter from Section 5
+@item @b{jtagkey} Amontec JTAGkey and JTAGkey-Tiny (and compatibles)
+@item @b{m5960} American Microsystems M5960
+@item @b{olimex-jtag} Olimex ARM-USB-OCD and ARM-USB-Tiny
+@item @b{oocdlink} OOCDLink
+@c oocdlink ~= jtagkey_prototype_v1
+@item @b{sheevaplug} Marvell Sheevaplug development kit
+@item @b{signalyzer} Xverve Signalyzer
+@item @b{stm32stick} Hitex STM32 Performance Stick
+@item @b{turtelizer2} egnite Software turtelizer2
+@item @b{usbjtag} "USBJTAG-1" layout described in the OpenOCD diploma thesis
@end itemize
+@end deffn
-@subsection parport options
+@deffn {Config Command} {ft2232_vid_pid} [vid pid]+
+The vendor ID and product ID of the FTDI FT2232 device. If not specified, the FTDI
+default values are used.
+Currently, up to eight [@var{vid}, @var{pid}] pairs may be given, e.g.
+@example
+ft2232_vid_pid 0x0403 0xcff8 0x15ba 0x0003
+@end example
+@end deffn
-@itemize @bullet
-@item @b{parport_port} <@var{number}>
-@cindex parport_port
-@*Either the address of the I/O port (default: 0x378 for LPT1) or the number of
-the @file{/dev/parport} device
+@deffn {Config Command} {ft2232_latency} ms
+On some systems using FT2232 based JTAG interfaces the FT_Read function call in
+ft2232_read() fails to return the expected number of bytes. This can be caused by
+USB communication delays and has proved hard to reproduce and debug. Setting the
+FT2232 latency timer to a larger value increases delays for short USB packets but it
+also reduces the risk of timeouts before receiving the expected number of bytes.
+The OpenOCD default value is 2 and for some systems a value of 10 has proved useful.
+@end deffn
-When using PPDEV to access the parallel port, use the number of the parallel port:
-@option{parport_port 0} (the default). If @option{parport_port 0x378} is specified
-you may encounter a problem.
-@item @b{parport_cable} <@var{name}>
-@cindex parport_cable
-@*The layout of the parallel port cable used to connect to the target.
-Currently supported cables are
+For example, the interface config file for a
+Turtelizer JTAG Adapter looks something like this:
+
+@example
+interface ft2232
+ft2232_device_desc "Turtelizer JTAG/RS232 Adapter"
+ft2232_layout turtelizer2
+ft2232_vid_pid 0x0403 0xbdc8
+@end example
+@end deffn
+
+@deffn {Interface Driver} {gw16012}
+Gateworks GW16012 JTAG programmer.
+This has one driver-specific command:
+
+@deffn {Config Command} {parport_port} number
+Specifies either the address of the I/O port (default: 0x378 for LPT1) or
+the number of the @file{/dev/parport} device.
+@end deffn
+@end deffn
+
+@deffn {Interface Driver} {jlink}
+Segger jlink USB adapter
+@c command: jlink_info
+@c dumps status
+@c command: jlink_hw_jtag (2|3)
+@c sets version 2 or 3
+@end deffn
+
+@deffn {Interface Driver} {parport}
+Supports PC parallel port bit-banging cables:
+Wigglers, PLD download cable, and more.
+These interfaces have several commands, used to configure the driver
+before initializing the JTAG scan chain:
+
+@deffn {Config Command} {parport_cable} name
+The layout of the parallel port cable used to connect to the target.
+Currently valid cable @var{name} values include:
+
@itemize @minus
-@item @b{wiggler}
-@cindex wiggler
-The original Wiggler layout, also supported by several clones, such
-as the Olimex ARM-JTAG
-@item @b{wiggler2}
-@cindex wiggler2
-Same as original wiggler except an led is fitted on D5.
-@item @b{wiggler_ntrst_inverted}
-@cindex wiggler_ntrst_inverted
-Same as original wiggler except TRST is inverted.
-@item @b{old_amt_wiggler}
-@cindex old_amt_wiggler
-The Wiggler configuration that comes with Amontec's Chameleon Programmer. The new
-version available from the website uses the original Wiggler layout ('@var{wiggler}')
-@item @b{chameleon}
-@cindex chameleon
-The Amontec Chameleon's CPLD when operated in configuration mode. This is only used to
+@item @b{altium} Altium Universal JTAG cable.
+@item @b{arm-jtag} Same as original wiggler except SRST and
+TRST connections reversed and TRST is also inverted.
+@item @b{chameleon} The Amontec Chameleon's CPLD when operated
+in configuration mode. This is only used to
program the Chameleon itself, not a connected target.
-@item @b{dlc5}
-@cindex dlc5
-The Xilinx Parallel cable III.
-@item @b{triton}
-@cindex triton
-The parallel port adapter found on the 'Karo Triton 1 Development Board'.
+@item @b{dlc5} The Xilinx Parallel cable III.
+@item @b{flashlink} The ST Parallel cable.
+@item @b{lattice} Lattice ispDOWNLOAD Cable
+@item @b{old_amt_wiggler} The Wiggler configuration that comes with
+some versions of
+Amontec's Chameleon Programmer. The new version available from
+the website uses the original Wiggler layout ('@var{wiggler}')
+@item @b{triton} The parallel port adapter found on the
+``Karo Triton 1 Development Board''.
This is also the layout used by the HollyGates design
(see @uref{http://www.lartmaker.nl/projects/jtag/}).
-@item @b{flashlink}
-@cindex flashlink
-The ST Parallel cable.
-@item @b{arm-jtag}
-@cindex arm-jtag
-Same as original wiggler except SRST and TRST connections reversed and
-TRST is also inverted.
-@item @b{altium}
-@cindex altium
-Altium Universal JTAG cable.
+@item @b{wiggler} The original Wiggler layout, also supported by
+several clones, such as the Olimex ARM-JTAG
+@item @b{wiggler2} Same as original wiggler except an led is fitted on D5.
+@item @b{wiggler_ntrst_inverted} Same as original wiggler except TRST is inverted.
@end itemize
-@item @b{parport_write_on_exit} <@var{on}|@var{off}>
-@cindex parport_write_on_exit
-@*This will configure the parallel driver to write a known value to the parallel
-interface on exiting OpenOCD
-@end itemize
+@end deffn
-@subsection amt_jtagaccel options
-@itemize @bullet
-@item @b{parport_port} <@var{number}>
-@cindex parport_port
-@*Either the address of the I/O port (default: 0x378 for LPT1) or the number of the
-@file{/dev/parport} device
-@end itemize
-@subsection ft2232 options
+@deffn {Config Command} {parport_port} number
+Either the address of the I/O port (default: 0x378 for LPT1) or the number of
+the @file{/dev/parport} device
-@itemize @bullet
-@item @b{ft2232_device_desc} <@var{description}>
-@cindex ft2232_device_desc
-@*The USB device description of the FTDI FT2232 device. If not
-specified, the FTDI default value is used. This setting is only valid
-if compiled with FTD2XX support.
+When using PPDEV to access the parallel port, use the number of the parallel port:
+@option{parport_port 0} (the default). If @option{parport_port 0x378} is specified
+you may encounter a problem.
+@end deffn
-@b{TODO:} Confirm the following: On Windows the name needs to end with
-a ``space A''? Or not? It has to do with the FTD2xx driver. When must
-this be added and when must it not be added? Why can't the code in the
-interface or in OpenOCD automatically add this if needed? -- Duane.
+@deffn {Config Command} {parport_write_on_exit} (on|off)
+This will configure the parallel driver to write a known
+cable-specific value to the parallel interface on exiting OpenOCD
+@end deffn
-@item @b{ft2232_serial} <@var{serial-number}>
-@cindex ft2232_serial
-@*The serial number of the FTDI FT2232 device. If not specified, the FTDI default
-values are used.
-@item @b{ft2232_layout} <@var{name}>
-@cindex ft2232_layout
-@*The layout of the FT2232 GPIO signals used to control output-enables and reset
-signals. Valid layouts are
-@itemize @minus
-@item @b{usbjtag}
-"USBJTAG-1" layout described in the original OpenOCD diploma thesis
-@item @b{jtagkey}
-Amontec JTAGkey and JTAGkey-Tiny
-@item @b{signalyzer}
-Signalyzer
-@item @b{olimex-jtag}
-Olimex ARM-USB-OCD
-@item @b{m5960}
-American Microsystems M5960
-@item @b{evb_lm3s811}
-Luminary Micro EVB_LM3S811 as a JTAG interface (not onboard processor), no TRST or
-SRST signals on external connector
-@item @b{comstick}
-Hitex STR9 comstick
-@item @b{stm32stick}
-Hitex STM32 Performance Stick
-@item @b{flyswatter}
-Tin Can Tools Flyswatter
-@item @b{turtelizer2}
-egnite Software turtelizer2
-@item @b{oocdlink}
-OOCDLink
-@item @b{axm0432_jtag}
-Axiom AXM-0432
-@item @b{cortino}
-Hitex Cortino JTAG interface
-@end itemize
+For example, the interface configuration file for a
+classic ``Wiggler'' cable might look something like this:
-@item @b{ft2232_vid_pid} <@var{vid}> <@var{pid}>
-@*The vendor ID and product ID of the FTDI FT2232 device. If not specified, the FTDI
-default values are used. Multiple <@var{vid}>, <@var{pid}> pairs may be given, e.g.
@example
-ft2232_vid_pid 0x0403 0xcff8 0x15ba 0x0003
+interface parport
+parport_port 0xc8b8
+parport_cable wiggler
@end example
-@item @b{ft2232_latency} <@var{ms}>
-@*On some systems using FT2232 based JTAG interfaces the FT_Read function call in
-ft2232_read() fails to return the expected number of bytes. This can be caused by
-USB communication delays and has proved hard to reproduce and debug. Setting the
-FT2232 latency timer to a larger value increases delays for short USB packets but it
-also reduces the risk of timeouts before receiving the expected number of bytes.
-The OpenOCD default value is 2 and for some systems a value of 10 has proved useful.
-@end itemize
+@end deffn
+@deffn {Interface Driver} {presto}
+ASIX PRESTO USB JTAG programmer.
+@c command: presto_serial str
+@c sets serial number
+@end deffn
+
+@deffn {Interface Driver} {rlink}
+Raisonance RLink USB adapter
+@end deffn
+
+@deffn {Interface Driver} {usbprog}
+usbprog is a freely programmable USB adapter.
+@end deffn
+
+@deffn {Interface Driver} {vsllink}
+vsllink is part of Versaloon which is a versatile USB programmer.
+
+@quotation Note
+This defines quite a few driver-specific commands,
+which are not currently documented here.
+@end quotation
+@end deffn
+
+@deffn {Interface Driver} {ZY1000}
+This is the Zylin ZY1000 JTAG debugger.
+
+@quotation Note
+This defines some driver-specific commands,
+which are not currently documented here.
+@end quotation
+@end deffn
+
@anchor{JTAG Speed}
@section JTAG Speed
JTAG clock setup is part of system setup.
|
|
From: <zw...@ma...> - 2009-06-04 02:51:18
|
Author: zwelch
Date: 2009-06-04 02:51:02 +0200 (Thu, 04 Jun 2009)
New Revision: 2034
Modified:
trunk/doc/openocd.texi
Log:
David Brownell <da...@pa...>:
Convert the str9xpec driver info to use @deffn; alphabetize;
add the missing part_id command.
Convert the mflash support to use @deffn; alphabetize.
Modified: trunk/doc/openocd.texi
===================================================================
--- trunk/doc/openocd.texi 2009-06-03 16:36:01 UTC (rev 2033)
+++ trunk/doc/openocd.texi 2009-06-04 00:51:02 UTC (rev 2034)
@@ -2953,113 +2953,124 @@
has been locked. Halting the core is not required for the @option{str9xpec} driver
as mentioned above, just issue the commands above manually or from a telnet prompt.
-@subsubsection str9xpec driver options
-
-@b{flash bank str9xpec} <@var{base}> <@var{size}> 0 0 <@var{target}>
-@*Before using the flash commands the turbo mode must be enabled using str9xpec
-@option{enable_turbo} <@var{num>.}
-
+@deffn {Flash Driver} str9xpec
Only use this driver for locking/unlocking the device or configuring the option bytes.
Use the standard str9 driver for programming.
+Before using the flash commands the turbo mode must be enabled using the
+@command{str9xpec enable_turbo} command.
-@subsubsection str9xpec specific commands
-@cindex str9xpec specific commands
-These are flash specific commands when using the str9xpec driver.
+Several str9xpec-specific commands are defined:
-@itemize @bullet
-@item @b{str9xpec enable_turbo} <@var{num}>
-@cindex str9xpec enable_turbo
-@*enable turbo mode, will simply remove the str9 from the chain and talk
+@deffn Command {str9xpec disable_turbo} num
+Restore the str9 into JTAG chain.
+@end deffn
+
+@deffn Command {str9xpec enable_turbo} num
+Enable turbo mode, will simply remove the str9 from the chain and talk
directly to the embedded flash controller.
-@item @b{str9xpec disable_turbo} <@var{num}>
-@cindex str9xpec disable_turbo
-@*restore the str9 into JTAG chain.
-@item @b{str9xpec lock} <@var{num}>
-@cindex str9xpec lock
-@*lock str9 device. The str9 will only respond to an unlock command that will
+@end deffn
+
+@deffn Command {str9xpec lock} num
+Lock str9 device. The str9 will only respond to an unlock command that will
erase the device.
-@item @b{str9xpec unlock} <@var{num}>
-@cindex str9xpec unlock
-@*unlock str9 device.
-@item @b{str9xpec options_read} <@var{num}>
-@cindex str9xpec options_read
-@*read str9 option bytes.
-@item @b{str9xpec options_write} <@var{num}>
-@cindex str9xpec options_write
-@*write str9 option bytes.
-@end itemize
+@end deffn
-@subsubsection STR9 option byte configuration
-@cindex STR9 option byte configuration
+@deffn Command {str9xpec part_id} num
+Prints the part identifier for bank @var{num}.
+@end deffn
-@itemize @bullet
-@item @b{str9xpec options_cmap} <@var{num}> <@option{bank0}|@option{bank1}>
-@cindex str9xpec options_cmap
-@*configure str9 boot bank.
-@item @b{str9xpec options_lvdthd} <@var{num}> <@option{2.4v}|@option{2.7v}>
-@cindex str9xpec options_lvdthd
-@*configure str9 lvd threshold.
-@item @b{str9xpec options_lvdsel} <@var{num}> <@option{vdd}|@option{vdd_vddq}>
-@cindex str9xpec options_lvdsel
-@*configure str9 lvd source.
-@item @b{str9xpec options_lvdwarn} <@var{bank}> <@option{vdd}|@option{vdd_vddq}>
-@cindex str9xpec options_lvdwarn
-@*configure str9 lvd reset warning source.
-@end itemize
+@deffn Command {str9xpec options_cmap} num (@option{bank0}|@option{bank1})
+Configure str9 boot bank.
+@end deffn
+@deffn Command {str9xpec options_lvdsel} num (@option{vdd}|@option{vdd_vddq})
+Configure str9 lvd source.
+@end deffn
+
+@deffn Command {str9xpec options_lvdthd} num (@option{2.4v}|@option{2.7v})
+Configure str9 lvd threshold.
+@end deffn
+
+@deffn Command {str9xpec options_lvdwarn} bank (@option{vdd}|@option{vdd_vddq})
+Configure str9 lvd reset warning source.
+@end deffn
+
+@deffn Command {str9xpec options_read} num
+Read str9 option bytes.
+@end deffn
+
+@deffn Command {str9xpec options_write} num
+Write str9 option bytes.
+@end deffn
+
+@deffn Command {str9xpec unlock} num
+unlock str9 device.
+@end deffn
+
+@end deffn
+
+
@section mFlash
@subsection mFlash Configuration
@cindex mFlash Configuration
-@b{mflash bank} <@var{soc}> <@var{base}> <@var{RST pin}> <@var{target}>
-@cindex mflash bank
-@*Configures a mflash for <@var{soc}> host bank at
-<@var{base}>. Pin number format is dependent on host GPIO calling convention.
-Currently, mflash bank support s3c2440 and pxa270.
-(ex. of s3c2440) mflash <@var{RST pin}> is GPIO B1.
+@deffn {Config Command} {mflash bank} soc base RST_pin target
+Configures a mflash for @var{soc} host bank at
+address @var{base}.
+The pin number format depends on the host GPIO naming convention.
+Currently, the mflash driver supports s3c2440 and pxa270.
+Example for s3c2440 mflash where @var{RST pin} is GPIO B1:
+
@example
mflash bank s3c2440 0x10000000 1b 0
@end example
-(ex. of pxa270) mflash <@var{RST pin}> is GPIO 43.
+Example for pxa270 mflash where @var{RST pin} is GPIO 43:
@example
mflash bank pxa270 0x08000000 43 0
@end example
+@end deffn
@subsection mFlash commands
@cindex mFlash commands
-@itemize @bullet
-@item @b{mflash probe}
-@cindex mflash probe
-@*Probe mflash.
-@item @b{mflash write} <@var{num}> <@var{file}> <@var{offset}>
-@cindex mflash write
-@*Write the binary <@var{file}> to mflash bank <@var{num}>, starting at
-<@var{offset}> bytes from the beginning of the bank.
-@item @b{mflash dump} <@var{num}> <@var{file}> <@var{offset}> <@var{size}>
-@cindex mflash dump
-@*Dump <size> bytes, starting at <@var{offset}> bytes from the beginning of the <@var{num}> bank
-to a <@var{file}>.
-@item @b{mflash config pll} <@var{frequency}>
-@cindex mflash config pll
-@*Configure mflash pll. <@var{frequency}> is input frequency of mflash. The order is Hz.
+@deffn Command {mflash config pll} frequency
+Configure mflash PLL.
+The @var{frequency} is the mflash input frequency, in Hz.
Issuing this command will erase mflash's whole internal nand and write new pll.
After this command, mflash needs power-on-reset for normal operation.
If pll was newly configured, storage and boot(optional) info also need to be update.
-@item @b{mflash config boot}
-@cindex mflash config boot
-@*Configure bootable option. If bootable option is set, mflash offer the first 8 sectors
+@end deffn
+
+@deffn Command {mflash config boot}
+Configure bootable option.
+If bootable option is set, mflash offer the first 8 sectors
(4kB) for boot.
-@item @b{mflash config storage}
-@cindex mflash config storage
-@*Configure storage information. For the normal storage operation, this information must be
+@end deffn
+
+@deffn Command {mflash config storage}
+Configure storage information.
+For the normal storage operation, this information must be
written.
-@end itemize
+@end deffn
+@deffn Command {mflash dump} num filename offset size
+Dump @var{size} bytes, starting at @var{offset} bytes from the
+beginning of the bank @var{num}, to the file named @var{filename}.
+@end deffn
+
+@deffn Command {mflash probe}
+Probe mflash.
+@end deffn
+
+@deffn Command {mflash write} num filename offset
+Write the binary file @var{filename} to mflash bank @var{num}, starting at
+@var{offset} bytes from the beginning of the bank.
+@end deffn
+
@node NAND Flash Commands
@chapter NAND Flash Commands
@cindex NAND
|
|
From: <oh...@ma...> - 2009-06-03 18:36:14
|
Author: oharboe
Date: 2009-06-03 18:36:01 +0200 (Wed, 03 Jun 2009)
New Revision: 2033
Modified:
trunk/src/jtag/jtag.c
Log:
use assert() for obscure check on illegal arguments upon trst being asserted while commands are queued
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-03 12:12:21 UTC (rev 2032)
+++ trunk/src/jtag/jtag.c 2009-06-03 16:36:01 UTC (rev 2033)
@@ -387,12 +387,7 @@
static void jtag_prelude1(void)
{
- if (jtag_trst == 1)
- {
- LOG_WARNING("JTAG command queued, while TRST is low (TAP in reset)");
- jtag_error=ERROR_JTAG_TRST_ASSERTED;
- return;
- }
+ assert(jtag_trst == 0);
if (cmd_queue_end_state == TAP_RESET)
jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
|
|
From: oharboe at B. <oh...@ma...> - 2009-06-03 14:12:23
|
Author: oharboe
Date: 2009-06-03 14:12:21 +0200 (Wed, 03 Jun 2009)
New Revision: 2032
Modified:
trunk/src/jtag/bitq.c
Log:
remove unused code path.
Modified: trunk/src/jtag/bitq.c
===================================================================
--- trunk/src/jtag/bitq.c 2009-06-03 07:55:56 UTC (rev 2031)
+++ trunk/src/jtag/bitq.c 2009-06-03 12:12:21 UTC (rev 2032)
@@ -138,9 +138,6 @@
void bitq_end_state(tap_state_t state)
{
- if (state==TAP_INVALID)
- return;
-
if (!tap_is_state_stable(state))
{
LOG_ERROR("BUG: %i is not a valid end state", state);
|
|
From: oharboe at B. <oh...@ma...> - 2009-06-03 09:55:57
|
Author: oharboe
Date: 2009-06-03 09:55:56 +0200 (Wed, 03 Jun 2009)
New Revision: 2031
Modified:
trunk/configure.in
trunk/src/jtag/zy1000.c
zy1000/trunk/build/buildocd.sh
zy1000/trunk/build/include/jtag_minidriver.h
Log:
catchup with jtag refactoring.
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-06-03 07:06:37 UTC (rev 2030)
+++ trunk/configure.in 2009-06-03 07:55:56 UTC (rev 2031)
@@ -454,7 +454,6 @@
fi
if test $build_ecosboard = yes; then
- build_bitbang=yes
AC_DEFINE(BUILD_ECOSBOARD, 1, [1 if you want eCosBoard.])
else
AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.])
Modified: trunk/src/jtag/zy1000.c
===================================================================
--- trunk/src/jtag/zy1000.c 2009-06-03 07:06:37 UTC (rev 2030)
+++ trunk/src/jtag/zy1000.c 2009-06-03 07:55:56 UTC (rev 2031)
@@ -23,7 +23,6 @@
#include "embeddedice.h"
#include "minidriver.h"
#include "interface.h"
-#include "bitbang.h"
#include <cyg/hal/hal_io.h> // low level i/o
#include <cyg/hal/hal_diag.h>
@@ -117,7 +116,7 @@
jtag_interface_t zy1000_interface =
{
.name = "ZY1000",
- .execute_queue = bitbang_execute_queue,
+ .execute_queue = NULL,
.speed = zy1000_speed,
.register_commands = zy1000_register_commands,
.init = zy1000_init,
@@ -128,15 +127,6 @@
.srst_asserted = zy1000_srst_asserted,
};
-bitbang_interface_t zy1000_bitbang =
-{
- .read = zy1000_read,
- .write = zy1000_write,
- .reset = zy1000_reset
-};
-
-
-
static void zy1000_write(int tck, int tms, int tdi)
{
@@ -368,8 +358,6 @@
zy1000_reset(0, 0);
zy1000_speed(jtag_speed);
- bitbang_interface = &zy1000_bitbang;
-
return ERROR_OK;
}
Modified: zy1000/trunk/build/buildocd.sh
===================================================================
--- zy1000/trunk/build/buildocd.sh 2009-06-03 07:06:37 UTC (rev 2030)
+++ zy1000/trunk/build/buildocd.sh 2009-06-03 07:55:56 UTC (rev 2031)
@@ -19,7 +19,7 @@
rm -rf /tmp/ecosboard/build
mkdir /tmp/ecosboard/build
cd /tmp/ecosboard/build
-$OPENOCD/../../openocd/configure --disable-werror --enable-ioutil --host=arm-elf --includedir=/tmp/ecosboard/ecos/install/include/ --enable-ecosboard --prefix=/tmp/ecosboard/ocdinstall
+$OPENOCD/../../openocd/configure --disable-bitbang --disable-werror --enable-ioutil --host=arm-elf --includedir=/tmp/ecosboard/ecos/install/include/ --enable-ecosboard --prefix=/tmp/ecosboard/ocdinstall
echo >makephi.sh sh $OPENOCD/makephi.sh
echo >>makephi.sh sh $OPENOCD/makefw.sh
make
Modified: zy1000/trunk/build/include/jtag_minidriver.h
===================================================================
--- zy1000/trunk/build/include/jtag_minidriver.h 2009-06-03 07:06:37 UTC (rev 2030)
+++ zy1000/trunk/build/include/jtag_minidriver.h 2009-06-03 07:55:56 UTC (rev 2031)
@@ -205,6 +205,6 @@
}
}
-#define jtag_add_callback(callback, in) callback(in)
+#define interface_jtag_add_callback(callback, in) callback(in)
-#define jtag_add_callback4(callback, in, data1, data2, data3) jtag_set_error(callback(in, data1, data2, data3))
+#define interface_jtag_add_callback4(callback, in, data1, data2, data3) jtag_set_error(callback(in, data1, data2, data3))
|
|
From: <zw...@ma...> - 2009-06-03 09:06:53
|
Author: zwelch Date: 2009-06-03 09:06:37 +0200 (Wed, 03 Jun 2009) New Revision: 2030 Added: trunk/src/jtag/commands.c Modified: trunk/src/jtag/Makefile.am trunk/src/jtag/jtag.c Log: Move JTAG command handling implementation into its own source file. Modified: trunk/src/jtag/Makefile.am =================================================================== --- trunk/src/jtag/Makefile.am 2009-06-03 06:29:09 UTC (rev 2029) +++ trunk/src/jtag/Makefile.am 2009-06-03 07:06:37 UTC (rev 2030) @@ -54,7 +54,7 @@ if MINIDRIVER DRIVERFILES = else -DRIVERFILES = jtag_driver.c +DRIVERFILES = jtag_driver.c commands.c endif if AT91RM9200 Added: trunk/src/jtag/commands.c =================================================================== --- trunk/src/jtag/commands.c 2009-06-03 06:29:09 UTC (rev 2029) +++ trunk/src/jtag/commands.c 2009-06-03 07:06:37 UTC (rev 2030) @@ -0,0 +1,259 @@ +/*************************************************************************** + * Copyright (C) 2005 by Dominic Rath * + * Dom...@gm... * + * * + * Copyright (C) 2007,2008 Øyvind Harboe * + * oyv...@zy... * + * * + * Copyright (C) 2009 SoftPLC Corporation * + * http://softplc.com * + * di...@so... * + * * + * Copyright (C) 2009 Zachary T Welch * + * zw...@su... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "commands.h" + +typedef struct cmd_queue_page_s +{ + void *address; + size_t used; + struct cmd_queue_page_s *next; +} cmd_queue_page_t; + +#define CMD_QUEUE_PAGE_SIZE (1024 * 1024) +static cmd_queue_page_t *cmd_queue_pages = NULL; + +jtag_command_t *jtag_command_queue = NULL; +static jtag_command_t **next_command_pointer = &jtag_command_queue; + +void jtag_queue_command(jtag_command_t * cmd) +{ + // this command goes on the end, so ensure the queue terminates + cmd->next = NULL; + + jtag_command_t **last_cmd = next_command_pointer; + assert(NULL != last_cmd); + assert(NULL == *last_cmd); + *last_cmd = cmd; + + // store location where the next command pointer will be stored + next_command_pointer = &cmd->next; +} + +void* cmd_queue_alloc(size_t size) +{ + cmd_queue_page_t **p_page = &cmd_queue_pages; + int offset; + u8 *t; + + /* + * WARNING: + * We align/round the *SIZE* per below + * so that all pointers returned by + * this function are reasonably well + * aligned. + * + * If we did not, then an "odd-length" request would cause the + * *next* allocation to be at an *odd* address, and because + * this function has the same type of api as malloc() - we + * must also return pointers that have the same type of + * alignment. + * + * What I do not/have is a reasonable portable means + * to align by... + * + * The solution here, is based on these suggestions. + * http://gcc.gnu.org/ml/gcc-help/2008-12/msg00041.html + * + */ + union worse_case_align { + int i; + long l; + float f; + void *v; + }; +#define ALIGN_SIZE (sizeof(union worse_case_align)) + + /* The alignment process. */ + size = (size + ALIGN_SIZE -1) & (~(ALIGN_SIZE-1)); + /* Done... */ + + if (*p_page) + { + while ((*p_page)->next) + p_page = &((*p_page)->next); + if (CMD_QUEUE_PAGE_SIZE - (*p_page)->used < size) + p_page = &((*p_page)->next); + } + + if (!*p_page) + { + *p_page = malloc(sizeof(cmd_queue_page_t)); + (*p_page)->used = 0; + (*p_page)->address = malloc(CMD_QUEUE_PAGE_SIZE); + (*p_page)->next = NULL; + } + + offset = (*p_page)->used; + (*p_page)->used += size; + + t=(u8 *)((*p_page)->address); + return t + offset; +} + +void cmd_queue_free(void) +{ + cmd_queue_page_t *page = cmd_queue_pages; + + while (page) + { + cmd_queue_page_t *last = page; + free(page->address); + page = page->next; + free(last); + } + + cmd_queue_pages = NULL; +} + +void jtag_command_queue_reset(void) +{ + cmd_queue_free(); + + jtag_command_queue = NULL; + next_command_pointer = &jtag_command_queue; +} + +enum scan_type jtag_scan_type(const scan_command_t *cmd) +{ + int i; + int type = 0; + + for (i = 0; i < cmd->num_fields; i++) + { + if (cmd->fields[i].in_value) + type |= SCAN_IN; + if (cmd->fields[i].out_value) + type |= SCAN_OUT; + } + + return type; +} + +int jtag_scan_size(const scan_command_t *cmd) +{ + int bit_count = 0; + int i; + + /* count bits in scan command */ + for (i = 0; i < cmd->num_fields; i++) + { + bit_count += cmd->fields[i].num_bits; + } + + return bit_count; +} + +int jtag_build_buffer(const scan_command_t *cmd, u8 **buffer) +{ + int bit_count = 0; + int i; + + bit_count = jtag_scan_size(cmd); + *buffer = calloc(1,CEIL(bit_count, 8)); + + bit_count = 0; + +#ifdef _DEBUG_JTAG_IO_ + LOG_DEBUG("%s num_fields: %i", cmd->ir_scan ? "IRSCAN" : "DRSCAN", cmd->num_fields); +#endif + + for (i = 0; i < cmd->num_fields; i++) + { + if (cmd->fields[i].out_value) + { +#ifdef _DEBUG_JTAG_IO_ + char* char_buf = buf_to_str(cmd->fields[i].out_value, (cmd->fields[i].num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : cmd->fields[i].num_bits, 16); +#endif + buf_set_buf(cmd->fields[i].out_value, 0, *buffer, bit_count, cmd->fields[i].num_bits); +#ifdef _DEBUG_JTAG_IO_ + LOG_DEBUG("fields[%i].out_value[%i]: 0x%s", i, cmd->fields[i].num_bits, char_buf); + free(char_buf); +#endif + } + else + { +#ifdef _DEBUG_JTAG_IO_ + LOG_DEBUG("fields[%i].out_value[%i]: NULL", i, cmd->fields[i].num_bits); +#endif + } + + bit_count += cmd->fields[i].num_bits; + } + +#ifdef _DEBUG_JTAG_IO_ + //LOG_DEBUG("bit_count totalling: %i", bit_count ); +#endif + + return bit_count; +} + +int jtag_read_buffer(u8 *buffer, const scan_command_t *cmd) +{ + int i; + int bit_count = 0; + int retval; + + /* we return ERROR_OK, unless a check fails, or a handler reports a problem */ + retval = ERROR_OK; + + for (i = 0; i < cmd->num_fields; i++) + { + /* if neither in_value nor in_handler + * are specified we don't have to examine this field + */ + if (cmd->fields[i].in_value) + { + int num_bits = cmd->fields[i].num_bits; + u8 *captured = buf_set_buf(buffer, bit_count, malloc(CEIL(num_bits, 8)), 0, num_bits); + +#ifdef _DEBUG_JTAG_IO_ + char *char_buf = buf_to_str(captured, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16); + LOG_DEBUG("fields[%i].in_value[%i]: 0x%s", i, num_bits, char_buf); + free(char_buf); +#endif + + if (cmd->fields[i].in_value) + { + buf_cpy(captured, cmd->fields[i].in_value, num_bits); + } + + free(captured); + } + bit_count += cmd->fields[i].num_bits; + } + + return retval; +} + + Property changes on: trunk/src/jtag/commands.c ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-03 06:29:09 UTC (rev 2029) +++ trunk/src/jtag/jtag.c 2009-06-03 07:06:37 UTC (rev 2030) @@ -47,16 +47,6 @@ */ int jtag_error=ERROR_OK; -typedef struct cmd_queue_page_s -{ - void *address; - size_t used; - struct cmd_queue_page_s *next; -} cmd_queue_page_t; - -#define CMD_QUEUE_PAGE_SIZE (1024 * 1024) -static cmd_queue_page_t *cmd_queue_pages = NULL; - char* jtag_event_strings[] = { "JTAG controller reset (RESET or TRST)" @@ -72,8 +62,6 @@ int jtag_trst = 0; int jtag_srst = 0; -jtag_command_t *jtag_command_queue = NULL; -static jtag_command_t **next_command_pointer = &jtag_command_queue; static jtag_tap_t *jtag_all_taps = NULL; enum reset_types jtag_reset_config = RESET_NONE; @@ -397,104 +385,6 @@ return ERROR_OK; } -void jtag_queue_command(jtag_command_t * cmd) -{ - // this command goes on the end, so ensure the queue terminates - cmd->next = NULL; - - jtag_command_t **last_cmd = next_command_pointer; - assert(NULL != last_cmd); - assert(NULL == *last_cmd); - *last_cmd = cmd; - - // store location where the next command pointer will be stored - next_command_pointer = &cmd->next; -} - -void* cmd_queue_alloc(size_t size) -{ - cmd_queue_page_t **p_page = &cmd_queue_pages; - int offset; - u8 *t; - - /* - * WARNING: - * We align/round the *SIZE* per below - * so that all pointers returned by - * this function are reasonably well - * aligned. - * - * If we did not, then an "odd-length" request would cause the - * *next* allocation to be at an *odd* address, and because - * this function has the same type of api as malloc() - we - * must also return pointers that have the same type of - * alignment. - * - * What I do not/have is a reasonable portable means - * to align by... - * - * The solution here, is based on these suggestions. - * http://gcc.gnu.org/ml/gcc-help/2008-12/msg00041.html - * - */ - union worse_case_align { - int i; - long l; - float f; - void *v; - }; -#define ALIGN_SIZE (sizeof(union worse_case_align)) - - /* The alignment process. */ - size = (size + ALIGN_SIZE -1) & (~(ALIGN_SIZE-1)); - /* Done... */ - - if (*p_page) - { - while ((*p_page)->next) - p_page = &((*p_page)->next); - if (CMD_QUEUE_PAGE_SIZE - (*p_page)->used < size) - p_page = &((*p_page)->next); - } - - if (!*p_page) - { - *p_page = malloc(sizeof(cmd_queue_page_t)); - (*p_page)->used = 0; - (*p_page)->address = malloc(CMD_QUEUE_PAGE_SIZE); - (*p_page)->next = NULL; - } - - offset = (*p_page)->used; - (*p_page)->used += size; - - t=(u8 *)((*p_page)->address); - return t + offset; -} - -void cmd_queue_free(void) -{ - cmd_queue_page_t *page = cmd_queue_pages; - - while (page) - { - cmd_queue_page_t *last = page; - free(page->address); - page = page->next; - free(last); - } - - cmd_queue_pages = NULL; -} - -void jtag_command_queue_reset(void) -{ - cmd_queue_free(); - - jtag_command_queue = NULL; - next_command_pointer = &jtag_command_queue; -} - static void jtag_prelude1(void) { if (jtag_trst == 1) @@ -908,102 +798,6 @@ return; } -int jtag_scan_size(const scan_command_t *cmd) -{ - int bit_count = 0; - int i; - - /* count bits in scan command */ - for (i = 0; i < cmd->num_fields; i++) - { - bit_count += cmd->fields[i].num_bits; - } - - return bit_count; -} - -int jtag_build_buffer(const scan_command_t *cmd, u8 **buffer) -{ - int bit_count = 0; - int i; - - bit_count = jtag_scan_size(cmd); - *buffer = calloc(1,CEIL(bit_count, 8)); - - bit_count = 0; - -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("%s num_fields: %i", cmd->ir_scan ? "IRSCAN" : "DRSCAN", cmd->num_fields); -#endif - - for (i = 0; i < cmd->num_fields; i++) - { - if (cmd->fields[i].out_value) - { -#ifdef _DEBUG_JTAG_IO_ - char* char_buf = buf_to_str(cmd->fields[i].out_value, (cmd->fields[i].num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : cmd->fields[i].num_bits, 16); -#endif - buf_set_buf(cmd->fields[i].out_value, 0, *buffer, bit_count, cmd->fields[i].num_bits); -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("fields[%i].out_value[%i]: 0x%s", i, cmd->fields[i].num_bits, char_buf); - free(char_buf); -#endif - } - else - { -#ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("fields[%i].out_value[%i]: NULL", i, cmd->fields[i].num_bits); -#endif - } - - bit_count += cmd->fields[i].num_bits; - } - -#ifdef _DEBUG_JTAG_IO_ - //LOG_DEBUG("bit_count totalling: %i", bit_count ); -#endif - - return bit_count; -} - -int jtag_read_buffer(u8 *buffer, const scan_command_t *cmd) -{ - int i; - int bit_count = 0; - int retval; - - /* we return ERROR_OK, unless a check fails, or a handler reports a problem */ - retval = ERROR_OK; - - for (i = 0; i < cmd->num_fields; i++) - { - /* if neither in_value nor in_handler - * are specified we don't have to examine this field - */ - if (cmd->fields[i].in_value) - { - int num_bits = cmd->fields[i].num_bits; - u8 *captured = buf_set_buf(buffer, bit_count, malloc(CEIL(num_bits, 8)), 0, num_bits); - -#ifdef _DEBUG_JTAG_IO_ - char *char_buf = buf_to_str(captured, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16); - LOG_DEBUG("fields[%i].in_value[%i]: 0x%s", i, num_bits, char_buf); - free(char_buf); -#endif - - if (cmd->fields[i].in_value) - { - buf_cpy(captured, cmd->fields[i].in_value, num_bits); - } - - free(captured); - } - bit_count += cmd->fields[i].num_bits; - } - - return retval; -} - static const char *jtag_tap_name(const jtag_tap_t *tap) { return (tap == NULL) ? "(unknown)" : tap->dotted_name; @@ -1076,22 +870,6 @@ -enum scan_type jtag_scan_type(const scan_command_t *cmd) -{ - int i; - int type = 0; - - for (i = 0; i < cmd->num_fields; i++) - { - if (cmd->fields[i].in_value) - type |= SCAN_IN; - if (cmd->fields[i].out_value) - type |= SCAN_OUT; - } - - return type; -} - int default_interface_jtag_execute_queue(void) { if (NULL == jtag) |
|
From: <zw...@ma...> - 2009-06-03 08:29:34
|
Author: zwelch
Date: 2009-06-03 08:29:09 +0200 (Wed, 03 Jun 2009)
New Revision: 2029
Modified:
trunk/src/jtag/amt_jtagaccel.c
trunk/src/jtag/arm-jtag-ew.c
trunk/src/jtag/at91rm9200.c
trunk/src/jtag/bitbang.c
trunk/src/jtag/bitq.c
trunk/src/jtag/bitq.h
trunk/src/jtag/dummy.c
trunk/src/jtag/ep93xx.c
trunk/src/jtag/ft2232.c
trunk/src/jtag/gw16012.c
trunk/src/jtag/jlink.c
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
trunk/src/jtag/jtag_driver.c
trunk/src/jtag/minidriver.h
trunk/src/jtag/parport.c
trunk/src/jtag/presto.c
trunk/src/jtag/rlink/rlink.c
trunk/src/jtag/usbprog.c
trunk/src/jtag/vsllink.c
trunk/src/jtag/zy1000.c
Log:
Finish JTAG header file modularization; command factoring follows.
Modified: trunk/src/jtag/amt_jtagaccel.c
===================================================================
--- trunk/src/jtag/amt_jtagaccel.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/amt_jtagaccel.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -21,8 +21,8 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
+#include "commands.h"
#if PARPORT_USE_PPDEV == 1
Modified: trunk/src/jtag/arm-jtag-ew.c
===================================================================
--- trunk/src/jtag/arm-jtag-ew.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/arm-jtag-ew.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -24,8 +24,8 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
+#include "commands.h"
#include <usb.h>
Modified: trunk/src/jtag/at91rm9200.c
===================================================================
--- trunk/src/jtag/at91rm9200.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/at91rm9200.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -21,7 +21,6 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
#include "bitbang.h"
Modified: trunk/src/jtag/bitbang.c
===================================================================
--- trunk/src/jtag/bitbang.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/bitbang.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -25,9 +25,8 @@
#endif
#include "bitbang.h"
-#define INCLUDE_JTAG_INTERFACE_H
-#include "jtag.h"
#include "interface.h"
+#include "commands.h"
/**
* Function bitbang_stableclocks
Modified: trunk/src/jtag/bitq.c
===================================================================
--- trunk/src/jtag/bitq.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/bitq.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -21,7 +21,6 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "bitq.h"
#include "interface.h"
Modified: trunk/src/jtag/bitq.h
===================================================================
--- trunk/src/jtag/bitq.h 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/bitq.h 2009-06-03 06:29:09 UTC (rev 2029)
@@ -20,7 +20,7 @@
#ifndef BITQ_H
#define BITQ_H
-#include "jtag.h"
+#include "commands.h"
typedef struct bitq_interface_s
{
Modified: trunk/src/jtag/dummy.c
===================================================================
--- trunk/src/jtag/dummy.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/dummy.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -21,7 +21,6 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
#include "bitbang.h"
Modified: trunk/src/jtag/ep93xx.c
===================================================================
--- trunk/src/jtag/ep93xx.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/ep93xx.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -21,7 +21,6 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
#include "bitbang.h"
Modified: trunk/src/jtag/ft2232.c
===================================================================
--- trunk/src/jtag/ft2232.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/ft2232.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -40,8 +40,8 @@
#endif
/* project specific includes */
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
+#include "commands.h"
#include "time_support.h"
#if IS_CYGWIN == 1
Modified: trunk/src/jtag/gw16012.c
===================================================================
--- trunk/src/jtag/gw16012.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/gw16012.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -21,8 +21,8 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
+#include "commands.h"
#if 1
Modified: trunk/src/jtag/jlink.c
===================================================================
--- trunk/src/jtag/jlink.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/jlink.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -25,8 +25,8 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
+#include "commands.h"
#include <usb.h>
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/jtag.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -28,7 +28,6 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "jtag.h"
#include "minidriver.h"
#include "interface.h"
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/jtag.h 2009-06-03 06:29:09 UTC (rev 2029)
@@ -552,10 +552,6 @@
*/
extern void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask);
-#ifdef INCLUDE_JTAG_INTERFACE_H
-#include "commands.h"
-#endif // INCLUDE_JTAG_INTERFACE_H
-
extern void jtag_sleep(u32 us);
extern int jtag_call_event_callbacks(enum jtag_event event);
extern int jtag_register_event_callback(int (* callback)(enum jtag_event event, void* priv), void* priv);
Modified: trunk/src/jtag/jtag_driver.c
===================================================================
--- trunk/src/jtag/jtag_driver.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/jtag_driver.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -31,7 +31,6 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
#include "minidriver.h"
#include "command.h"
Modified: trunk/src/jtag/minidriver.h
===================================================================
--- trunk/src/jtag/minidriver.h 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/minidriver.h 2009-06-03 06:29:09 UTC (rev 2029)
@@ -68,6 +68,8 @@
#else
+#include "commands.h"
+
static inline void interface_jtag_alloc_in_value32(scan_field_t *field)
{
field->in_value = (u8 *)cmd_queue_alloc(4);
Modified: trunk/src/jtag/parport.c
===================================================================
--- trunk/src/jtag/parport.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/parport.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -24,7 +24,6 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
#include "bitbang.h"
Modified: trunk/src/jtag/presto.c
===================================================================
--- trunk/src/jtag/presto.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/presto.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -25,7 +25,6 @@
#include "windows.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
#include "time_support.h"
#include "bitq.h"
Modified: trunk/src/jtag/rlink/rlink.c
===================================================================
--- trunk/src/jtag/rlink/rlink.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/rlink/rlink.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -28,8 +28,8 @@
#endif
/* project specific includes */
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
+#include "commands.h"
#include "rlink.h"
#include "st7.h"
#include "ep1_cmd.h"
Modified: trunk/src/jtag/usbprog.c
===================================================================
--- trunk/src/jtag/usbprog.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/usbprog.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -34,8 +34,8 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
+#include "commands.h"
#include <usb.h>
Modified: trunk/src/jtag/vsllink.c
===================================================================
--- trunk/src/jtag/vsllink.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/vsllink.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -26,8 +26,8 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "interface.h"
+#include "commands.h"
#include <usb.h>
Modified: trunk/src/jtag/zy1000.c
===================================================================
--- trunk/src/jtag/zy1000.c 2009-06-03 06:27:57 UTC (rev 2028)
+++ trunk/src/jtag/zy1000.c 2009-06-03 06:29:09 UTC (rev 2029)
@@ -20,7 +20,6 @@
#include "config.h"
#endif
-#define INCLUDE_JTAG_INTERFACE_H
#include "embeddedice.h"
#include "minidriver.h"
#include "interface.h"
|
|
From: oharboe at B. <oh...@ma...> - 2009-06-03 08:28:00
|
Author: oharboe Date: 2009-06-03 08:27:57 +0200 (Wed, 03 Jun 2009) New Revision: 2028 Modified: trunk/src/jtag/commands.h Log: added missing extern to jtag_command_queue definition. Modified: trunk/src/jtag/commands.h =================================================================== --- trunk/src/jtag/commands.h 2009-06-03 06:08:07 UTC (rev 2027) +++ trunk/src/jtag/commands.h 2009-06-03 06:27:57 UTC (rev 2028) @@ -146,7 +146,7 @@ } jtag_command_t; /// The current queue of jtag_command_s structures. -jtag_command_t* jtag_command_queue; +extern jtag_command_t* jtag_command_queue; void* cmd_queue_alloc(size_t size); void cmd_queue_free(void); |
|
From: <zw...@ma...> - 2009-06-03 08:08:22
|
Author: zwelch
Date: 2009-06-03 08:08:07 +0200 (Wed, 03 Jun 2009)
New Revision: 2027
Added:
trunk/src/jtag/commands.h
Modified:
trunk/src/jtag/Makefile.am
trunk/src/jtag/jtag.h
Log:
Move JTAG command APIs into new jtag/commands.h header file.
Modified: trunk/src/jtag/Makefile.am
===================================================================
--- trunk/src/jtag/Makefile.am 2009-06-03 04:44:38 UTC (rev 2026)
+++ trunk/src/jtag/Makefile.am 2009-06-03 06:08:07 UTC (rev 2027)
@@ -138,6 +138,7 @@
noinst_HEADERS = \
interface.h \
+ commands.h \
minidriver.h \
bitbang.h \
jtag.h \
Added: trunk/src/jtag/commands.h
===================================================================
--- trunk/src/jtag/commands.h 2009-06-03 04:44:38 UTC (rev 2026)
+++ trunk/src/jtag/commands.h 2009-06-03 06:08:07 UTC (rev 2027)
@@ -0,0 +1,162 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Dominic Rath *
+ * Dom...@gm... *
+ * *
+ * Copyright (C) 2007,2008 Øyvind Harboe *
+ * oyv...@zy... *
+ * *
+ * Copyright (C) 2009 Zachary T Welch *
+ * zw...@su... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef JTAG_COMMANDS_H
+#define JTAG_COMMANDS_H
+
+#include "jtag.h"
+
+/**
+ * The inferred type of a scan_command_s structure, indicating whether
+ * the command has the host scan in from the device, the host scan out
+ * to the device, or both.
+ */
+enum scan_type {
+ /// From device to host,
+ SCAN_IN = 1,
+ /// From host to device,
+ SCAN_OUT = 2,
+ /// Full-duplex scan.
+ SCAN_IO = 3
+};
+
+/**
+ * The scan_command provide a means of encapsulating a set of scan_field_s
+ * structures that should be scanned in/out to the device.
+ */
+typedef struct scan_command_s
+{
+ /// instruction/not data scan
+ bool ir_scan;
+ /// number of fields in *fields array
+ int num_fields;
+ /// pointer to an array of data scan fields
+ scan_field_t* fields;
+ /// state in which JTAG commands should finish
+ tap_state_t end_state;
+} scan_command_t;
+
+typedef struct statemove_command_s
+{
+ /// state in which JTAG commands should finish
+ tap_state_t end_state;
+} statemove_command_t;
+
+typedef struct pathmove_command_s
+{
+ /// number of states in *path
+ int num_states;
+ /// states that have to be passed
+ tap_state_t* path;
+} pathmove_command_t;
+
+typedef struct runtest_command_s
+{
+ /// number of cycles to spend in Run-Test/Idle state
+ int num_cycles;
+ /// state in which JTAG commands should finish
+ tap_state_t end_state;
+} runtest_command_t;
+
+
+typedef struct stableclocks_command_s
+{
+ /// number of clock cycles that should be sent
+ int num_cycles;
+} stableclocks_command_t;
+
+
+typedef struct reset_command_s
+{
+ /// Set TRST output: 0=deassert, 1=assert, -1=no change
+ int trst;
+ /// Set SRST output: 0=deassert, 1=assert, -1=no change
+ int srst;
+} reset_command_t;
+
+typedef struct end_state_command_s
+{
+ /// state in which JTAG commands should finish
+ tap_state_t end_state;
+} end_state_command_t;
+
+typedef struct sleep_command_s
+{
+ /// number of microseconds to sleep
+ u32 us;
+} sleep_command_t;
+
+/**
+ * Defines a container type that hold a pointer to a JTAG command
+ * structure of any defined type.
+ */
+typedef union jtag_command_container_u
+{
+ scan_command_t* scan;
+ statemove_command_t* statemove;
+ pathmove_command_t* pathmove;
+ runtest_command_t* runtest;
+ stableclocks_command_t* stableclocks;
+ reset_command_t* reset;
+ end_state_command_t* end_state;
+ sleep_command_t* sleep;
+} jtag_command_container_t;
+
+/**
+ * The type of the @c jtag_command_container_u contained by a
+ * @c jtag_command_s structure.
+ */
+enum jtag_command_type {
+ JTAG_SCAN = 1,
+ JTAG_STATEMOVE = 2,
+ JTAG_RUNTEST = 3,
+ JTAG_RESET = 4,
+ JTAG_PATHMOVE = 6,
+ JTAG_SLEEP = 7,
+ JTAG_STABLECLOCKS = 8
+};
+
+typedef struct jtag_command_s
+{
+ jtag_command_container_t cmd;
+ enum jtag_command_type type;
+ struct jtag_command_s* next;
+} jtag_command_t;
+
+/// The current queue of jtag_command_s structures.
+jtag_command_t* jtag_command_queue;
+
+void* cmd_queue_alloc(size_t size);
+void cmd_queue_free(void);
+
+void jtag_queue_command(jtag_command_t *cmd);
+void jtag_command_queue_reset(void);
+
+enum scan_type jtag_scan_type(const scan_command_t* cmd);
+int jtag_scan_size(const scan_command_t* cmd);
+int jtag_read_buffer(u8* buffer, const scan_command_t* cmd);
+int jtag_build_buffer(const scan_command_t* cmd, u8** buffer);
+
+#endif // JTAG_COMMANDS_H
Property changes on: trunk/src/jtag/commands.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-03 04:44:38 UTC (rev 2026)
+++ trunk/src/jtag/jtag.h 2009-06-03 06:08:07 UTC (rev 2027)
@@ -142,136 +142,6 @@
u8 intmp[4];
} scan_field_t;
-#ifdef INCLUDE_JTAG_INTERFACE_H
-
-/**
- * The inferred type of a scan_command_s structure, indicating whether
- * the command has the host scan in from the device, the host scan out
- * to the device, or both.
- */
-enum scan_type {
- /// From device to host,
- SCAN_IN = 1,
- /// From host to device,
- SCAN_OUT = 2,
- /// Full-duplex scan.
- SCAN_IO = 3
-};
-
-/**
- * The scan_command provide a means of encapsulating a set of scan_field_s
- * structures that should be scanned in/out to the device.
- */
-typedef struct scan_command_s
-{
- /// instruction/not data scan
- bool ir_scan;
- /// number of fields in *fields array
- int num_fields;
- /// pointer to an array of data scan fields
- scan_field_t* fields;
- /// state in which JTAG commands should finish
- tap_state_t end_state;
-} scan_command_t;
-
-typedef struct statemove_command_s
-{
- /// state in which JTAG commands should finish
- tap_state_t end_state;
-} statemove_command_t;
-
-typedef struct pathmove_command_s
-{
- /// number of states in *path
- int num_states;
- /// states that have to be passed
- tap_state_t* path;
-} pathmove_command_t;
-
-typedef struct runtest_command_s
-{
- /// number of cycles to spend in Run-Test/Idle state
- int num_cycles;
- /// state in which JTAG commands should finish
- tap_state_t end_state;
-} runtest_command_t;
-
-
-typedef struct stableclocks_command_s
-{
- /// number of clock cycles that should be sent
- int num_cycles;
-} stableclocks_command_t;
-
-
-typedef struct reset_command_s
-{
- /// Set TRST output: 0=deassert, 1=assert, -1=no change
- int trst;
- /// Set SRST output: 0=deassert, 1=assert, -1=no change
- int srst;
-} reset_command_t;
-
-typedef struct end_state_command_s
-{
- /// state in which JTAG commands should finish
- tap_state_t end_state;
-} end_state_command_t;
-
-typedef struct sleep_command_s
-{
- /// number of microseconds to sleep
- u32 us;
-} sleep_command_t;
-
-/**
- * Defines a container type that hold a pointer to a JTAG command
- * structure of any defined type.
- */
-typedef union jtag_command_container_u
-{
- scan_command_t* scan;
- statemove_command_t* statemove;
- pathmove_command_t* pathmove;
- runtest_command_t* runtest;
- stableclocks_command_t* stableclocks;
- reset_command_t* reset;
- end_state_command_t* end_state;
- sleep_command_t* sleep;
-} jtag_command_container_t;
-
-/**
- * The type of the @c jtag_command_container_u contained by a
- * @c jtag_command_s structure.
- */
-enum jtag_command_type {
- JTAG_SCAN = 1,
- JTAG_STATEMOVE = 2,
- JTAG_RUNTEST = 3,
- JTAG_RESET = 4,
- JTAG_PATHMOVE = 6,
- JTAG_SLEEP = 7,
- JTAG_STABLECLOCKS = 8
-};
-
-typedef struct jtag_command_s
-{
- jtag_command_container_t cmd;
- enum jtag_command_type type;
- struct jtag_command_s* next;
-} jtag_command_t;
-
-/// The current queue of jtag_command_s structures.
-extern jtag_command_t* jtag_command_queue;
-
-extern void* cmd_queue_alloc(size_t size);
-extern void cmd_queue_free(void);
-
-extern void jtag_queue_command(jtag_command_t *cmd);
-extern void jtag_command_queue_reset(void);
-
-#endif // INCLUDE_JTAG_INTERFACE_H
-
typedef struct jtag_tap_event_action_s jtag_tap_event_action_t;
/* this is really: typedef jtag_tap_t */
@@ -683,10 +553,7 @@
extern void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask);
#ifdef INCLUDE_JTAG_INTERFACE_H
-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);
+#include "commands.h"
#endif // INCLUDE_JTAG_INTERFACE_H
extern void jtag_sleep(u32 us);
|
|
From: <zw...@ma...> - 2009-06-03 06:44:49
|
Author: zwelch
Date: 2009-06-03 06:44:38 +0200 (Wed, 03 Jun 2009)
New Revision: 2026
Modified:
trunk/TODO
trunk/doc/manual/primer/patches.txt
trunk/doc/manual/scripting.txt
Log:
Improve remaining documentation that was causing Doxygen warnings.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2009-06-03 04:37:51 UTC (rev 2025)
+++ trunk/TODO 2009-06-03 04:44:38 UTC (rev 2026)
@@ -44,10 +44,14 @@
- use tap_set_state everywhere to allow logging TAP state transitions
- rename other tap_states to use standard JTAG names (suggested by ML)
+
- retire jtag_add_end_state() and replace w/global variable:
- removes TAP_INVALID as an argument to jtag_add_xxxx().
- - global variable as argument to jtag_add_xxxx() should be phased out, but
- it is useful while we need to bug-by-bug compatible while testing changes.
+
+ - global variable as argument to jtag_add_xxxx() should be phased out,
+ but it is useful while we need to bug-by-bug compatible while
+ testing changes.
+
- Suggested by . Michael Bruck also interested in this.
- Encapsulate cmd_queue_cur_state and related varaible handling.
@@ -223,7 +227,7 @@
- investigate fixes to permit the use of -Wshadow
- eliminate sources of confusion in @c boostrap script:
- -# Make @c bootstrap call 'configure --enable-maintainer-mode <opts>'?
+ -# Make @c bootstrap call 'configure --enable-maintainer-mode \<opts\>'?
-# Add @c buildstrap script to assist with boostrap and configure steps.
- automatically build tool-chains required for cross-compiling
- produce mingw32, arm-elf, others using in-tree scripts
Modified: trunk/doc/manual/primer/patches.txt
===================================================================
--- trunk/doc/manual/primer/patches.txt 2009-06-03 04:37:51 UTC (rev 2025)
+++ trunk/doc/manual/primer/patches.txt 2009-06-03 04:44:38 UTC (rev 2026)
@@ -206,5 +206,5 @@
*/
/** @file
-This file contains the @ref patchprimer page.
+This file contains the @ref primerpatches page.
*/
Modified: trunk/doc/manual/scripting.txt
===================================================================
--- trunk/doc/manual/scripting.txt 2009-06-03 04:37:51 UTC (rev 2025)
+++ trunk/doc/manual/scripting.txt 2009-06-03 04:44:38 UTC (rev 2026)
@@ -25,7 +25,7 @@
- Polymorphic commands for target scripts.
- there will be added some commands in Tcl that the target
scripts can replace.
- - produce <productionfile> <serialnumber>. Default implementation
+ - 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
|
|
From: <zw...@ma...> - 2009-06-03 06:38:06
|
Author: zwelch
Date: 2009-06-03 06:37:51 +0200 (Wed, 03 Jun 2009)
New Revision: 2025
Modified:
trunk/src/helper/jim.h
trunk/src/jtag/ft2232.c
trunk/src/jtag/jtag.h
trunk/src/target/target.h
Log:
Improve in-source documentation that was causing Doxygen warnings.
Modified: trunk/src/helper/jim.h
===================================================================
--- trunk/src/helper/jim.h 2009-06-03 02:57:55 UTC (rev 2024)
+++ trunk/src/helper/jim.h 2009-06-03 04:37:51 UTC (rev 2025)
@@ -1058,6 +1058,7 @@
*
* \param goi - get opt info
* \param puthere - where param is put
+ * \param len - return its length
*/
JIM_STATIC int JIM_API( Jim_GetOpt_String )( Jim_GetOptInfo *goi, char **puthere, int *len );
Modified: trunk/src/jtag/ft2232.c
===================================================================
--- trunk/src/jtag/ft2232.c 2009-06-03 02:57:55 UTC (rev 2024)
+++ trunk/src/jtag/ft2232.c 2009-06-03 04:37:51 UTC (rev 2025)
@@ -83,12 +83,14 @@
/**
- * Function ft2232_stableclocks
- * will send out \a num_cycles on the TCK line while the TAP(s)
- * are in a stable state. Calling code must ensure that current state is
- * stable, that verification is not done in here.
- * @param num_cycles is the count of clocks cycles to send.
- * @return int - ERROR_OK or ERROR_JTAG_QUEUE_FAILED
+ * Send out \a num_cycles on the TCK line while the TAP(s) are in a
+ * stable state. Calling code must ensure that current state is stable,
+ * that verification is not done in here.
+ *
+ * @param num_cycles The number of clocks cycles to send.
+ * @param cmd The command to send.
+ *
+ * @returns ERROR_OK on success, or ERROR_JTAG_QUEUE_FAILED on failure.
*/
static int ft2232_stableclocks(int num_cycles, jtag_command_t* cmd);
@@ -231,19 +233,21 @@
/**
- * Function clock_tms
- * clocks out \a bit_count bits on the TMS line, starting with the least
+ * Clocks out \a bit_count bits on the TMS line, starting with the least
* significant bit of tms_bits and progressing to more significant bits.
* Rigorous state transition logging is done here via tap_set_state().
*
- * @param pmsse_cmd is one of the MPSSE TMS oriented commands such as 0x4b or 0x6b. See
- * the MPSSE spec referenced above for their functionality. The MPSSE command
- * "Clock Data to TMS/CS Pin (no Read)" is often used for this, 0x4b.
+ * @param mpsse_cmd One of the MPSSE TMS oriented commands such as
+ * 0x4b or 0x6b. See the MPSSE spec referenced above for their
+ * functionality. The MPSSE command "Clock Data to TMS/CS Pin (no Read)"
+ * is often used for this, 0x4b.
*
- * @param tms_bits holds the sequence of bits to send.
- * @param tms_count tells how many bits in the sequence.
- * @param tdi_bit is a single bit which is passed on to TDI before the first TCK cycle
- * and is held static for the duration of TMS clocking. See the MPSSE spec referenced above.
+ * @param tms_bits Holds the sequence of bits to send.
+ * @param tms_count Tells how many bits in the sequence.
+ * @param tdi_bit A single bit to pass on to TDI before the first TCK
+ * cycle and held static for the duration of TMS clocking.
+ *
+ * See the MPSSE spec referenced above.
*/
static void clock_tms( u8 mpsse_cmd, int tms_bits, int tms_count, bool tdi_bit )
{
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-03 02:57:55 UTC (rev 2024)
+++ trunk/src/jtag/jtag.h 2009-06-03 04:37:51 UTC (rev 2025)
@@ -515,7 +515,7 @@
* @param data3 An integer big enough to use as an @c int or a pointer.
*
*/
-extern void jtag_add_callback4(jtag_callback_t, u8 *in,
+extern void jtag_add_callback4(jtag_callback_t f, u8 *in,
jtag_callback_data_t data1, jtag_callback_data_t data2,
jtag_callback_data_t data3);
Modified: trunk/src/target/target.h
===================================================================
--- trunk/src/target/target.h 2009-06-03 02:57:55 UTC (rev 2024)
+++ trunk/src/target/target.h 2009-06-03 04:37:51 UTC (rev 2025)
@@ -325,7 +325,7 @@
int timeout_ms, void *arch_info);
/**
- * Read @count items of @a size bytes from the memory of @a target at
+ * Read @a count items of @a size bytes from the memory of @a target at
* the @a address given.
*
* This routine is a wrapper for target->type->read_memory.
@@ -333,7 +333,7 @@
extern int target_read_memory(struct target_s *target,
u32 address, u32 size, u32 count, u8 *buffer);
/**
- * Write @count items of @a size bytes to the memory of @a target at
+ * Write @a count items of @a size bytes to the memory of @a target at
* the @a address given.
*
* This routine is wrapper for target->type->write_memory.
@@ -342,7 +342,7 @@
u32 address, u32 size, u32 count, u8 *buffer);
/**
- * Write @count items of 4 bytes to the memory of @a target at
+ * Write @a count items of 4 bytes to the memory of @a target at
* the @a address given. Because it operates only on whole words,
* this should be faster than target_write_memory().
*
|
|
From: <zw...@ma...> - 2009-06-03 04:57:59
|
Author: zwelch Date: 2009-06-03 04:57:55 +0200 (Wed, 03 Jun 2009) New Revision: 2024 Modified: trunk/doc/manual/jtag.txt trunk/doc/manual/main.txt Log: Add architectural introduction to the JTAG module in The Manual. Modified: trunk/doc/manual/jtag.txt =================================================================== --- trunk/doc/manual/jtag.txt 2009-06-03 02:56:20 UTC (rev 2023) +++ trunk/doc/manual/jtag.txt 2009-06-03 02:57:55 UTC (rev 2024) @@ -1,38 +1,61 @@ -/** @page jtagdocs OpenOCD JTAG APIs +/** @page jtagdocs JTAG APIs For new developers unfamiliar with the technology, @ref primerjtag provides a brief introduction to the IEEE JTAG interface. -The OpenOCD JTAG library API covers several functional areas: +The OpenOCD JTAG library API covers several functional areas. The jtag +@b core communicates through the @b minidriver API with either its full +@a driver implementation (src/jtag/jtag_driver.c) or a @a minidriver . +Internally, the @b command API is used by the JTAG driver for managing +asynchronous transactions. - - @subpage jtagcable - - @subpage jtagtap - - @subpage jtagmdriver - - @subpage jtagdriver +- @subpage jtagcore + - @b public API routines + - declared in @c src/jtag/jtag.h + - used by other modules -This section needs to be expanded. +- @subpage jtagcmd + - @b private command queue API + - declared in @c src/jtag/commands.h + - provides routines used internally by the full JTAG drivers. +- @subpage jtagiface + - @b private interface driver API + - declared in @c src/jtag/interface.h + - used by the core, minidrivers, and the full interface device drivers. + - allows implementing new interface device drivers. + - includes the Cable/TAP API (commands starting with @c tap_) + +- @subpage jtagdriver + - @b private minidriver API + - declared in @c src/jtag/minidriver.h + - used @a only by the core and minidriver implementations: + - @c jtag_driver.c (in-tree OpenOCD drivers) + - @c zy1000/build/include/jtag_minidriver.h (ZY1000 minidriver) + - future implementations (on other embedded hosts) + - interface device drivers do @b not need this API. + */ -/** @page jtagcable OpenOCD JTAG Cable API +/** @page jtagcore JTAG Core API This section needs to be expanded. */ -/** @page jtagtap OpenOCD JTAG TAP API +/** @page jtagcmd JTAG Command API This section needs to be expanded. */ -/** @page jtagmdriver OpenOCD JTAG Interface API +/** @page jtagiface JTAG Interface API This section needs to be expanded. */ -/** @page jtagdriver OpenOCD JTAG Driver API +/** @page jtagdriver JTAG Minidriver API This section needs to be expanded. Modified: trunk/doc/manual/main.txt =================================================================== --- trunk/doc/manual/main.txt 2009-06-03 02:56:20 UTC (rev 2023) +++ trunk/doc/manual/main.txt 2009-06-03 02:57:55 UTC (rev 2024) @@ -68,9 +68,9 @@ - @ref helpercommand - @ref helperlogging - @subpage jtagdocs - - @ref jtagcable - - @ref jtagtap - - @ref jtagmdriver + - @ref jtagcore + - @ref jtagcmd + - @ref jtagiface - @ref jtagdriver - @subpage targetdocs - @ref targetarm |
|
From: <zw...@ma...> - 2009-06-03 04:56:25
|
Author: zwelch
Date: 2009-06-03 04:56:20 +0200 (Wed, 03 Jun 2009)
New Revision: 2023
Modified:
trunk/tools/logger.pl
Log:
Improve logger script to expose warnings and errors in the output.
Modified: trunk/tools/logger.pl
===================================================================
--- trunk/tools/logger.pl 2009-06-03 02:17:26 UTC (rev 2022)
+++ trunk/tools/logger.pl 2009-06-03 02:56:20 UTC (rev 2023)
@@ -24,8 +24,14 @@
{
# echo line to output
print STDOUT $_;
+ # echo line to console if it is important
+ if (/(Warning|Error)/) {
+ print STDERR "\n" if $c;
+ print STDERR $_;
+ $c = 0;
+ }
# only display progress every Nth step
- next unless ++$n % $N;
+ next if ++$n % $N;
print STDERR ".";
# wrap at column C to provide fixed-width rows of dots
print STDERR "\n" unless ++$c % $C;
|
|
From: <zw...@ma...> - 2009-06-03 04:17:34
|
Author: zwelch Date: 2009-06-03 04:17:26 +0200 (Wed, 03 Jun 2009) New Revision: 2022 Modified: trunk/PATCHES Log: Improve doxygen markup of PATCHES file, link to new primer. Modified: trunk/PATCHES =================================================================== --- trunk/PATCHES 2009-06-03 02:12:44 UTC (rev 2021) +++ trunk/PATCHES 2009-06-03 02:17:26 UTC (rev 2022) @@ -1,4 +1,4 @@ -/** @page patchguide Patch Policies +/** @page patchguide Patch Guidelines Please mail patches to: @@ -7,6 +7,8 @@ Note that you can't send patches to that list unless you're a member, despite what the list info page says. +@section Patch Guidelines in a Nutshell + The patch should be against svn trunk using an SVN diff. If you use git-svn, a git diff or patch is OK too; likewise a quilt patch, if you use quilt. @@ -31,20 +33,24 @@ Add yourself to the GPL copyright for non-trivial changes. To create a patch from the command line: - +@code svn diff >mypatch.txt +@endcode -See: - +See: @par http://svnbook.red-bean.com/en/1.0/re09.html -NB! remember to use "svn add" on new files first! - +Remember to use "svn add" on new files first: @par http://svnbook.red-bean.com/en/1.0/re01.html If you have a decent SVN GUI, then that should be able to create and apply patches as well... +@section More Information on Patching + +The @ref primerpatches provides a more complete guide to creating, +managing, and contributing patches to the OpenOCD project. + */ /** @file This file contains the @ref patchguide page. |
|
From: <zw...@ma...> - 2009-06-03 04:12:50
|
Author: zwelch
Date: 2009-06-03 04:12:44 +0200 (Wed, 03 Jun 2009)
New Revision: 2021
Added:
trunk/doc/manual/primer/patches.txt
Modified:
trunk/doc/manual/main.txt
Log:
Add draft of Patching Primer in The Manual; update primer page.
Modified: trunk/doc/manual/main.txt
===================================================================
--- trunk/doc/manual/main.txt 2009-06-03 02:11:09 UTC (rev 2020)
+++ trunk/doc/manual/main.txt 2009-06-03 02:12:44 UTC (rev 2021)
@@ -35,11 +35,23 @@
They seek to provide information to pull novices up the learning curves
associated with the fundamental technologies used by OpenOCD.
+- @subpage primerpatches
- @subpage primerdocs
- @subpage primerautotools
- @subpage primertcl
- @subpage primerjtag
+These documents should bridge any "ancillary" gaps in contributor
+knowledge, without having to learn the complete languages or technology.
+They should provide enough information for experienced developers to
+learn how to make "correct" changes when creating patches.
+
+In all cases, these Primers should use idiomatic conventions that the
+community has agreed are the "right way of doing things". In this
+respect, these documents typically assume some familiarity with the
+information contained in one or more @ref styleguide, or they will
+directly refer to specific style guides as supplemental reading.
+
Contributions or suggestions for new Technical Primers are welcome.
*/
Added: trunk/doc/manual/primer/patches.txt
===================================================================
--- trunk/doc/manual/primer/patches.txt 2009-06-03 02:11:09 UTC (rev 2020)
+++ trunk/doc/manual/primer/patches.txt 2009-06-03 02:12:44 UTC (rev 2021)
@@ -0,0 +1,210 @@
+/** @page primerpatches Patch Primer
+
+This page provides an introduction to patching that may be useful
+for OpenOCD contributors who are unfamiliar with the process.
+
+@section primerpatchintro Introduction to Patching
+
+The standard method for creating patches requires developers to:
+- checkout the Subversion repository (or bring a copy up-to-date),
+- make the necessary modifications to a working copy,
+- check with 'svn status' to see which files will be modified/added, and
+- use 'svn diff' to review the changes and produce a patch.
+
+It is important to minimize the changes to only those lines that contain
+important differences; do not allow stray whitespace changes into your
+patches, and keep the focus to a single logical change.
+
+@section primerpatchcreate Creating Patches
+
+You can create a patch (from the root of your working copy) with a
+command like the following example: @par
+@verbatim
+svn diff > patch-name.patch
+@endverbatim
+
+where @a patch-name should be something that is descriptive and unique.
+
+The above command will create a patch containing all of the changes in
+the working copy; if you want to obtain a subset, simply provide the
+list of files to the command: @par
+@verbatim
+svn diff doc > <patch-name>-doc.patch
+svn diff src > <patch-name>-src.patch
+@endverbatim
+
+This will create two patches, each containing only those changes present
+in the subdirectory specified.
+
+@subsection primerpatchcreate Naming Patches
+
+One developer has evolved an informal standard for naming his patches: @par
+@verbatim
+<project>-<lod>-<action>-<task>.patch
+@endverbatim
+
+where @a project is @c openocd, @a lod (line-of-development) could be a
+subsystem (e.g. @c jtag, @c jlink, etc.) or other group identifier,
+@a action is @c add, @c change, @c fix, @c update, etc., and @a task is
+whatever the patch will accomplish (in 2-4 words).
+
+This scheme does not need to be followed, but it is helpful for
+maintainers that receive many patches. You do not want your own
+@c openocd.patch file to be accidentally overwritten by another
+submission, sending your patch to the bit bucket on accident.
+
+@section primerpatchpreflight Developer Review
+
+Before sending in patches, please make sure you have updated to the
+latest version of the trunk (using <code>svn up</code>) before creating
+your patch. This helps to increase the chances that it will apply
+cleanly to the trunk. However, the content matters most.
+
+When creating a patch using "<code>svn diff</code>", Subversion will
+produce a patch that contains all of the changes in your working copy.
+To manage multiple changes at once, you either need one working copy per
+patch, or you can specified specific files and directories when using
+<code>svn diff</code>. Overlapping patches will be discussed in the
+next section.
+
+The remainder of this section provides
+
+@subsection primerpatchprops Subversion Properties
+
+The Subversion attributes of files can be examined with commands like the
+following: @par
+@verbatim
+$ svn pl README
+Properties on 'README':
+ svn:eol-style
+$ svn pl tools/rlink_make_speed_table/rlink_make_speed_table.pl
+Properties on 'tools/rlink_make_speed_table/rlink_make_speed_table.pl':
+ svn:executable
+ svn:eol-style
+$
+@endverbatim
+
+@subsection primerpatchpropcrlf Native Line-endings
+
+Subversion checks out files marked with the attribute @c svn:eol-style
+set to @c native such that these files contain the default line ending
+style of the current host ('\\n' or '\\r\\n'). By using the proper line
+endings for different platforms, two different byte streams for the same
+file will be produced.
+
+@subsection primerpatchwincrlf Windows Patching Problems
+
+Because of the line-ending functionality, it may be correct when a fresh
+patch does not apply cleanly on the Windows platform. This is because
+patches are created by SVN with UNIX line endings, so the context and
+changes will not appear to match the files with Windows line endings.
+
+In other words, the following command may @b not succeed because @c foo
+has its @c svn:eol-style property set to @c native: @par
+@code
+svn diff foo | patch -R
+@endcode
+
+The following series of commands will work: @par
+@code
+svn diff foo | unix2dos | patch -R
+@endcode
+
+This is not a bug.
+
+@todo Does Subversion's treatment of line-endings for files marked with
+svn:eol-style=native continue to pose the problems described here, or
+has this been magically solved?
+
+@section primerpatchseries Patch Series
+
+As was mentioned above, each patch should contain one logical @c task,
+and multiple logical tasks should be split into a series of patches.
+There are no hard guidelines for how that is to be done; it's an art
+form. Many simple changes should not have to worry about being split,
+as they will naturally represent a single task.
+
+When working on several different non-intersecting lines of development,
+a combination of multiple working copies and patch series management
+techniques can become critical to efficiently managing change. This
+again is an area where developers have favorite methodologies that are
+simply a matter of taste or familiarity; your mileage may vary.
+
+Packages such as @c patchutils, @c diffutils, and @c quilt are among
+those that have proved themselves invaluable for these type of tasks.
+Others take their patch management a step further, tracking the
+Subversion repository with git-svn and employing GIT conventions and
+methodologies for development.
+
+@subsection primerpatchseriesinterdiff Using @c interdiff
+
+The @c patchutils package includes the @c interdiff command, which
+produces a patch that contains the changes made between two other
+patches. This command can be used to manage the creation of trivial
+patch series. For example, the following sequence of commands will
+produce three patches: @par
+@verbatim
+$ cd openocd-head/
+$ svn up && svn st
+At revision NNNN.
+$ <<<start changes for patch #1>>>
+...
+$ <<<finish changes for patch #1>>>
+$ svn diff > series-1.patch # patch #1 is easy
+$ <<<start changes for patch #2>>>
+...
+$ <<<finish changes for patch #2>>>
+$ svn diff > series-1+2.patch # create patch 1+2
+$ interdiff series-1{,+2}.patch > series-2.patch # 1 ~ 1+2 => #2
+$ <<<start changes for patch #3>>>
+...
+$ <<<finish changes for patch #3>>>
+$ svn diff > series-1+2+3.patch # create patch 1+2+3
+$ interdiff series-1+2{,+3}.patch > series-3.patch # 1+2 ~ 1+2+3 => 3
+@endverbatim
+
+This technique falls apart when the repository changes, but this may be
+suitable for small series of patches.
+
+@subsection primerpatchseriesquilt Using @c quilt
+
+The @c quilt package provides scripts to manage series of patches more
+efficiently than can be managed by hand. For out-of-tree work projects
+that require such patch management, @c quilt provides an indispensable
+tool for solving the problem.
+
+@subsection primerpatchseriesgit Using @c git
+
+The @c git revision control system provides a tool for tracking
+Subversion repositories.
+
+@section primerpatchsubmit Submitting Patches
+
+Write access to the OpenOCD Subversion repository is limited to
+contributors that have demonstrated the ability to produce clear,
+consistent, and frequent patches. These individuals are responsible
+for maintaining the integrity of the repository for the community.
+
+Thus, commits to the Subversion repository must be handled by one of
+these maintainers.
+
+Patches must be sent to the OpenOCD developer mailing list:
+@par
+ ope...@li...
+
+They will be reviewed and committed if the changes are found to be
+acceptable. If there are problems, you will receive feedback via the
+mailing list; in general, the maintainers prefer all communication to go
+through the list, as the entire community needs to judge contributions
+for possible merits and mistakes.
+
+Contributors may be asked to address certain issues and submit a new
+patch. In the event that it gets overlooked, you may need to resubmit
+it or prompt for feedback. Please have patience, as many maintainers
+work on the project voluntarily and without compensation for the time
+that they spend doing these tasks.
+
+ */
+/** @file
+This file contains the @ref patchprimer page.
+*/
Property changes on: trunk/doc/manual/primer/patches.txt
___________________________________________________________________
Name: svn:eol-style
+ native
|
|
From: <zw...@ma...> - 2009-06-03 04:11:13
|
Author: zwelch Date: 2009-06-03 04:11:09 +0200 (Wed, 03 Jun 2009) New Revision: 2020 Modified: trunk/TODO Log: Update TODO file with more content and better style. Modified: trunk/TODO =================================================================== --- trunk/TODO 2009-06-03 01:51:04 UTC (rev 2019) +++ trunk/TODO 2009-06-03 02:11:09 UTC (rev 2020) @@ -1,8 +1,9 @@ -/** @page thelist Pending and Open Tasks +/** @page tasks Pending and Open Tasks This page lists pending and open tasks being considered or worked upon by the OpenOCD community. +@section thelist The List Items with a current patch available should include a link to its posting on the openocd-developer mailing list archives. @@ -17,136 +18,242 @@ Feel free to send patches to add or clarify items on this list, too. -@verbatim -================================================================== - The List ------------------------------------------------------------------- -@endverbatim +@section thelisttcl TCL -- JTAG/TAP changes: - - update all drivers to use tap_get_tms_path_len API. - - use tap_set_state everywhere to allow logging TAP state transitions - - rename other tap_states to use standard JTAG names (suggested by ML) - - retire jtag_add_end_state() and replace w/global variable. This also - removes TAP_INVALID as an argument to jtag_add_xxxx(). The global variable - as argument to jtag_add_xxxx() should eventually be phased out, but - the global variable is useful in an interim phase where one needs to - be bug by bug compatible before each change can be tested. Suggested - by . Michael Bruck also interested in this. - -- JTAG Interfaces: - - autodetect devices present on the scan chain - - implement 'discover_taps' command - - FT2232 driver: (DH) - - integrate FTD2XX High-Speed Device support - - PATCH: https://lists.berlios.de/pipermail/openocd-development/2009-April/005479.html - - massive set of changes (DH): - - fixes non-recoverability of cable connect/reconnect - - https://lists.berlios.de/pipermail/openocd-development/2009-May/006011.html - - further cleanup (DH): - - PATCH: https://lists.berlios.de/pipermail/openocd-development/2009-May/006112.html - - fix outstanding bugs - - J-Link driver: (ZW) - - fix outstanding bugs - - test with known targets (i.e. working with other interfaces) - - test compatibility between v6.0 (yellow) and older units (e.g. v5.2) - - TCP driver: - - add TCP/IP client and server for remote JTAG interface control - - Do others need some help? Probably.... +This section provides possible things to improve with OpenOCD's TCL support. -- Other Interfaces - - SVF/XSVF: - - pending tasks?? - - SPI/UART emulation: - - (ab)use bit-banging JTAG interfaces to emulate SPI/UART - - allow SPI to program flash, MCUs, etc. - - SWD +- organize the TCL configurations: + - provide more directory structure for boards/targets? + - factor configurations into layers (encapsulation and re-use) -- Target Support: - - general layer cleanup: - - https://lists.berlios.de/pipermail/openocd-development/2009-May/006590.html - - ARM11 improvements (MB?) - - fix single stepping (reported by ) - - implement missing functionality (grep FNC_INFO_NOTIMPLEMENTED ...) - - Cortex A8 support (ML) - - add target implementation (ML) - - what else remains to be done? - - MC1322x support (JW/DE?) - - integrate and test support from JW (and DE?) - - get working with a known good interface (i.e. not today's jlink) - - AT91SAM92xx: - - improvements for unknown-board-atmel-at91sam9260.cfg (RD) - - STR9x: (ZW) - - improvements to str912.cfg to be more general purpose - - AVR: (SQ) - - independently verify implementation - - incrementally improve working prototype in trunk. (SQ) - - work out how to debug this target - - AVR debugging protocol. - - FPGA: - - improve things (??) - - Coldfire (suggested by NC) - - can we draw from the BDM project? @par - http://bdm.sourceforge.net/ +- Isolate all TCL command support: + - Pure C CLI implementations using --disable-builtin-tcl. + - Allow developers to build new dongles using OpenOCD's JTAG core. + - At first, provide only low-level JTAG support; target layer and + above rely heavily on scripting event mechanisms. + - Allow full TCL support? add --with-tcl=/path/to/installed/tcl + - Move TCL support out of foo.[ch] and into foo_tcl.[ch] (other ideas?) - - other targets? (suggestions always welcome) +@section thelistjtag JTAG -- CFI: - - finish implementing bus width/chip width handling (suggested by NC) - - factor vendor-specific code into separate source files +This section list issues that need to be resolved in the JTAG layer. + +@subsection thelistjtagcore JTAG Core + +The following tasks have been suggeted for cleaning up the JTAG layer: + +- use tap_set_state everywhere to allow logging TAP state transitions +- rename other tap_states to use standard JTAG names (suggested by ML) +- retire jtag_add_end_state() and replace w/global variable: + - removes TAP_INVALID as an argument to jtag_add_xxxx(). + - global variable as argument to jtag_add_xxxx() should be phased out, but + it is useful while we need to bug-by-bug compatible while testing changes. + - Suggested by . Michael Bruck also interested in this. +- Encapsulate cmd_queue_cur_state and related varaible handling. + +The following tasks have been suggested for adding new core JTAG support: + +- autodetect devices present on the scan chain + - implement 'discover_taps' command +- SPI/UART emulation: + - (ab)use bit-banging JTAG interfaces to emulate SPI/UART + - allow SPI to program flash, MCUs, etc. + +@subsection thelistjtaginterfaces JTAG Interfaces + +The following tasks have been suggeted for improving OpenOCD's JTAG +interface support: + +- rework USB communication to be more robust. Two possible options are: + -# use libusb-1.0.1 with libusb-compat-0.1.1 (non-blocking I/O wrapper) + -# rewrite implementation to use non-blocking I/O +- FT2232 driver: + - integrate FTD2XX High-Speed Device support @par + PATCH: https://lists.berlios.de/pipermail/openocd-development/2009-April/005479.html + - fix outstanding bugs +- J-Link driver: + - fix to work with long scan chains, such as R.Doss's svf test. + - fix other outstanding bugs + +The following tasks have been suggested for adding new JTAG interfaces: + +- TCP driver: allow client/server for remote JTAG interface control. + +@section thelistswd Serial Wire Debug + +- implement Serial Wire Debug interface + +@section thelistbs Boundary Scan Support + +- add STAPL support? +- add BSDL support? + +A few possible options for the above: + -# Fake a TCL equivalent? + -# Integrate an existing library? + -# Write a new C implementation a la Jim? + +Once the above are completed: +- add support for programming flash using boundary scan techniques +- add integration with a modified gerber view program: + - provide means to view the PCB and select pins and traces + - allow use-cases such as the following: + - @b Stimulus + -# Double-click on a pin (or trace) with the mouse. + - @b Effects + -# The trace starts blinking, and + -# OpenOCD toggles the pin(s) 0/1. + +@section thelisttargets Target Support + +- general layer cleanup: + - https://lists.berlios.de/pipermail/openocd-development/2009-May/006590.html +- ARM11 improvements (MB?) + - fix single stepping (reported by ) + - implement missing functionality (grep FNC_INFO_NOTIMPLEMENTED ...) +- Cortex A8 support (ML) + - add target implementation (ML) +- MC1322x support (JW/DE?) + - integrate and test support from JW (and DE?) + - get working with a known good interface (i.e. not today's jlink) +- AT91SAM92xx: + - improvements for unknown-board-atmel-at91sam9260.cfg (RD) +- STR9x: (ZW) + - improvements to str912.cfg to be more general purpose +- AVR: (SQ) + - independently verify implementation + - incrementally improve working prototype in trunk. (SQ) + - work out how to debug this target + - AVR debugging protocol. +- FPGA: + - improve things (??) +- Coldfire (suggested by NC) + - can we draw from the BDM project? @par + http://bdm.sourceforge.net/ + + or the OSBDM package @par + http://forums.freescale.com/freescale/board/message?board.id=OSBDM08&thread.id=422 + +@section thelistsvf SVF/XSVF + +- factor and clean-up code +- review The Guide for OpenOCD Users for documentation errors or omissions +- update The Manual for OpenOCD Developerrs: + - add documentation describing the architecture of each module + - provide Technical Primers to bootstrap contributor knowledge +- develop SVF unit tests +- develop XSVF unit tests + +@section thelistflash Flash Support + +- finish documentation for the following flash drivers: + - avr + - ecosflash + - pic32mx + - ocl + - str9xpec + +@subsection thelistflashcfi CFI + +- finish implementing bus width/chip width handling (suggested by NC) +- factor vendor-specific code into separate source files - add new callback interface for vendor-specific code - - investigate/implement "thin wrapper" to use eCos CFI drivers () +- investigate/implement "thin wrapper" to use eCos CFI drivers () -- TCL - - Isolate all TCL command support: - - Allow pure C CLI implementations using --disable-builtin-tcl. - Ref? How could this be made to work given targets extensive need - for events, etc.? What about the target library? - - Allow full TCL support? add --with-tcl=/path/to/installed/tcl - - Move TCL support in foo.* to foo_tcl.* (other ideas?) +@section thelistdebug Debugger Support -- Debugger Support - - Keil AGDI interface to OpenOCD (submitted by Dario Vecchio) +- integrate Keil AGDI interface to OpenOCD? (submitted by Dario Vecchio) -- Architectural Upgrades - - Allow N:M:P mapping of servers, targets, and interfaces - - loadable module support for interface/target/flash drivers - - libopenocd support: @par - https://lists.berlios.de/pipermail/openocd-development/2009-May/006405.html +@section thelisttesting Testing Suite -- Test Suite: - - implement server unit tests - - implement JTAG core unit tests - - implement JTAG interface unit tests - - implement flash unit tests - - implement target unit tests +This section includes several related groups of ideas: +- @ref thelistunittests +- @ref thelistsmoketests +- @ref thelisttestreports +- @ref thelisttestgenerichw -- Test Feedback Tools: @par - https://lists.berlios.de/pipermail/openocd-development/2009-May/006358.html +@subsection thelistunittests Unit Tests - - extend target test script to produce helpful pass/fail output - - provide results submission script +- add testing skeleton to provide frameworks for adding tests +- implement server unit tests +- implement JTAG core unit tests +- implement JTAG interface unit tests +- implement flash unit tests +- implement target unit tests +@subsection thelistsmoketests Smoke Test Tools -- Generic Hardware Tester: - - implement VHDL to use for FPGA-based JTAG TAP testing device - - develop test suite that utilizes this testing device +-# extend 'make check' with a smoketest app + - checks for OOCD_TEST_CONFIG, etc. in environment (or config file) + - if properly set, runs the smoke test with specified parameters + - openocd -f ${OOCD_TEST_CONFIG} + - implies a modular test suite (see below) + - should be able to run some minimal tests with dummy interface: + - compare results of baseline sanity checks with expected results -- Build Systems (Autotools, CMake, etc.) - - investigate fixes to permit the use of -Wshadow - - change bootstrap to call 'configure --enable-maintainer-mode <opts>'? +-# builds a more complete test suite: + - existing testing/examples/ look like a great start + - all targets should be tested fully and for all capabilities + - we do NOT want a "lowest common denominator" test suite + - ... but can we start with one to get going? + - probably requires one test configuration file per board/target + - modularization can occur here, just like with targets/boards/chips + - coverage can increase over time, building up bundles of tests -- Miscellaneous: - - make JTAG and USB debug output a run-time configuration option - - review and clean up interface/target/flash APIs - - factor code to eliminate duplicated functionality - - overhaul use of types to improve 32/64-bit portability +-# add new 'smoketest' Makefile target: + - calls 'make check' (and the smoketest app) + - gather inputs and output into a report file -- Berlios Admin: - - use patch tracker? @par - https://developer.berlios.de/patch/?group_id=4148 - - use bug tracking? we need something! +@subsection thelisttestreports Test Feedback Tools +These ideas were first introduced here: + https://lists.berlios.de/pipermail/openocd-development/2009-May/006358.html + +- provide report submission scripts for e-mail and web forms +- add new Makefile targets to post the report: + - 'checkreportsend' -- send to list via e-mail (via sendmail) + - 'checkreportpost' -- send web form (via curl or other script) + +@subsection thelisttestgenerichw Generic Hardware Tester + +- implement VHDL to use for FPGA-based JTAG TAP testing device +- develop test suite that utilizes this testing device + +@section thelistautotools Autotools Build System + +- investigate fixes to permit the use of -Wshadow +- eliminate sources of confusion in @c boostrap script: + -# Make @c bootstrap call 'configure --enable-maintainer-mode <opts>'? + -# Add @c buildstrap script to assist with boostrap and configure steps. +- automatically build tool-chains required for cross-compiling + - produce mingw32, arm-elf, others using in-tree scripts + - build all required target code from sources +- make JTAG and USB debug output a run-time configuration option + +@section thelistarchitecture Architectural Tasks + +The following architectural tasks need to be accomplished and should be +fairly easy to complete: + +- factor code to eliminate duplicated functionality +- overhaul use of types to improve 32/64-bit portability +- rewrite code that uses casts to access 16-bit and larger types + from unaligned memory addresses +- libopenocd support: @par + https://lists.berlios.de/pipermail/openocd-development/2009-May/006405.html +- review and clean up interface/target/flash APIs + +The following strategic tasks will require ambition, knowledge, and time +to complete: + +- Allow N:M:P mapping of servers, targets, and interfaces +- loadable module support for interface/target/flash drivers + +@section thelistadmin Administrative Tasks + +- Develop "style" guidelines for committing to Subversion +- Develop milestone and release guidelines. + */ /** @file This file contains the @ref thelist page. |
|
From: <zw...@ma...> - 2009-06-03 03:51:07
|
Author: zwelch
Date: 2009-06-03 03:51:04 +0200 (Wed, 03 Jun 2009)
New Revision: 2019
Modified:
trunk/src/jtag/jtag.h
Log:
Enable or add doxygen comments to the public JTAG API.
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-03 01:39:04 UTC (rev 2018)
+++ trunk/src/jtag/jtag.h 2009-06-03 01:51:04 UTC (rev 2019)
@@ -39,7 +39,10 @@
/*-----<Macros>--------------------------------------------------*/
-/** When given an array, compute its DIMension, i.e. number of elements in the array */
+/**
+ * When given an array, compute its DIMension; in other words, the
+ * number of elements in the array
+ */
#define DIM(x) (sizeof(x)/sizeof((x)[0]))
/** Calculate the number of bytes required to hold @a n TAP scan bits */
@@ -47,23 +50,20 @@
/*-----</Macros>-------------------------------------------------*/
-
-
-/*
- * Tap states from ARM7TDMI-S Technical reference manual.
- * Also, validated against several other ARM core technical manuals.
+/**
+ * Defines JTAG Test Access Port states.
*
- * N.B. tap_get_tms_path() was changed to reflect this corrected
- * numbering and ordering of the TAP states.
- *
- * DANGER!!!! some interfaces care about the actual numbers used
- * as they are handed off directly to hardware implementations.
+ * These definitions were gleaned from the ARM7TDMI-S Technical
+ * Reference Manual and validated against several other ARM core
+ * technical manuals. tap_get_tms_path() is sensitive to this numbering
+ * and ordering of the TAP states; furthermore, some interfaces require
+ * specific numbers be used, as they are handed-off directly to their
+ * hardware implementations.
*/
-
typedef enum tap_state
{
#if BUILD_ECOSBOARD
-/* These are the old numbers. Leave as-is for now... */
+ /* These are the old numbers. Leave as-is for now... */
TAP_RESET = 0, TAP_IDLE = 8,
TAP_DRSELECT = 1, TAP_DRCAPTURE = 2, TAP_DRSHIFT = 3, TAP_DREXIT1 = 4,
TAP_DRPAUSE = 5, TAP_DREXIT2 = 6, TAP_DRUPDATE = 7,
@@ -102,82 +102,132 @@
*/
const char* tap_state_name(tap_state_t state);
+/// The current TAP state of the pending JTAG command queue.
+extern tap_state_t cmd_queue_cur_state;
+/// The TAP state in which DR scans should end.
+extern tap_state_t cmd_queue_end_state;
-extern tap_state_t cmd_queue_end_state; /* finish DR scans in dr_end_state */
-extern tap_state_t cmd_queue_cur_state; /* current TAP state */
-
+/**
+ * This structure defines a single scan field in the scan. It provides
+ * fields for the field's width and pointers to scan input and output
+ * values.
+ *
+ * In addition, this structure includes a value and mask that is used by
+ * jtag_add_dr_scan_check() to validate the value that was scanned out.
+ *
+ * The allocated, modified, and intmp fields are internal work space.
+ */
typedef struct scan_field_s
{
- jtag_tap_t* tap; /* tap pointer this instruction refers to */
- int num_bits; /* number of bits this field specifies (up to 32) */
- u8* out_value; /* value to be scanned into the device */
- u8* in_value; /* pointer to a 32-bit memory location to take data scanned out */
+ /// A pointer to the tap structure to which this field refers.
+ jtag_tap_t* tap;
- u8* check_value; /* Used together with jtag_add_dr_scan_check() to check data clocked
- in */
- u8* check_mask; /* mask to go with check_value */
+ /// The number of bits this field specifies (up to 32)
+ int num_bits;
+ /// A pointer to value to be scanned into the device
+ u8* out_value;
+ /// A pointer to a 32-bit memory location for data scanned out
+ u8* in_value;
- /* internal work space */
- int allocated; /* in_value has been allocated for the queue */
- int modified; /* did we modify the in_value? */
- u8 intmp[4]; /* temporary storage for checking synchronously */
+ /// The value used to check the data scanned out.
+ u8* check_value;
+ /// The mask to go with check_value
+ u8* check_mask;
+
+ /// in_value has been allocated for the queue
+ int allocated;
+ /// Indicates we modified the in_value.
+ int modified;
+ /// temporary storage for performing value checks synchronously
+ u8 intmp[4];
} scan_field_t;
#ifdef INCLUDE_JTAG_INTERFACE_H
+/**
+ * The inferred type of a scan_command_s structure, indicating whether
+ * the command has the host scan in from the device, the host scan out
+ * to the device, or both.
+ */
enum scan_type {
- /* IN: from device to host, OUT: from host to device */
- SCAN_IN = 1, SCAN_OUT = 2, SCAN_IO = 3
+ /// From device to host,
+ SCAN_IN = 1,
+ /// From host to device,
+ SCAN_OUT = 2,
+ /// Full-duplex scan.
+ SCAN_IO = 3
};
+/**
+ * The scan_command provide a means of encapsulating a set of scan_field_s
+ * structures that should be scanned in/out to the device.
+ */
typedef struct scan_command_s
{
- bool ir_scan; /* instruction/not data scan */
- int num_fields; /* number of fields in *fields array */
- scan_field_t* fields; /* pointer to an array of data scan fields */
- tap_state_t end_state; /* TAP state in which JTAG commands should finish */
+ /// instruction/not data scan
+ bool ir_scan;
+ /// number of fields in *fields array
+ int num_fields;
+ /// pointer to an array of data scan fields
+ scan_field_t* fields;
+ /// state in which JTAG commands should finish
+ tap_state_t end_state;
} scan_command_t;
typedef struct statemove_command_s
{
- tap_state_t end_state; /* TAP state in which JTAG commands should finish */
+ /// state in which JTAG commands should finish
+ tap_state_t end_state;
} statemove_command_t;
typedef struct pathmove_command_s
{
- int num_states; /* number of states in *path */
- tap_state_t* path; /* states that have to be passed */
+ /// number of states in *path
+ int num_states;
+ /// states that have to be passed
+ tap_state_t* path;
} pathmove_command_t;
typedef struct runtest_command_s
{
- int num_cycles; /* number of cycles that should be spent in Run-Test/Idle */
- tap_state_t end_state; /* TAP state in which JTAG commands should finish */
+ /// number of cycles to spend in Run-Test/Idle state
+ int num_cycles;
+ /// state in which JTAG commands should finish
+ tap_state_t end_state;
} runtest_command_t;
typedef struct stableclocks_command_s
{
- int num_cycles; /* number of clock cycles that should be sent */
+ /// number of clock cycles that should be sent
+ int num_cycles;
} stableclocks_command_t;
typedef struct reset_command_s
{
- int trst; /* trst/srst 0: deassert, 1: assert, -1: don't change */
+ /// Set TRST output: 0=deassert, 1=assert, -1=no change
+ int trst;
+ /// Set SRST output: 0=deassert, 1=assert, -1=no change
int srst;
} reset_command_t;
typedef struct end_state_command_s
{
- tap_state_t end_state; /* TAP state in which JTAG commands should finish */
+ /// state in which JTAG commands should finish
+ tap_state_t end_state;
} end_state_command_t;
typedef struct sleep_command_s
{
- u32 us; /* number of microseconds to sleep */
+ /// number of microseconds to sleep
+ u32 us;
} sleep_command_t;
+/**
+ * Defines a container type that hold a pointer to a JTAG command
+ * structure of any defined type.
+ */
typedef union jtag_command_container_u
{
scan_command_t* scan;
@@ -190,6 +240,10 @@
sleep_command_t* sleep;
} jtag_command_container_t;
+/**
+ * The type of the @c jtag_command_container_u contained by a
+ * @c jtag_command_s structure.
+ */
enum jtag_command_type {
JTAG_SCAN = 1,
JTAG_STATEMOVE = 2,
@@ -207,6 +261,7 @@
struct jtag_command_s* next;
} jtag_command_t;
+/// The current queue of jtag_command_s structures.
extern jtag_command_t* jtag_command_queue;
extern void* cmd_queue_alloc(size_t size);
@@ -217,7 +272,6 @@
#endif // INCLUDE_JTAG_INTERFACE_H
-/* forward declaration */
typedef struct jtag_tap_event_action_s jtag_tap_event_action_t;
/* this is really: typedef jtag_tap_t */
@@ -228,21 +282,29 @@
const char* chip;
const char* tapname;
const char* dotted_name;
- int abs_chain_position;
- int enabled;
- int ir_length; /* size of instruction register */
- u32 ir_capture_value;
- u8* expected; /* Capture-IR expected value */
- u32 ir_capture_mask;
- u8* expected_mask; /* Capture-IR expected mask */
- u32 idcode; /* device identification code */
- u32* expected_ids; /* Array of expected identification codes */
- u8 expected_ids_cnt; /* Number of expected identification codes */
- u8* cur_instr; /* current instruction */
- int bypass; /* bypass register selected */
+ int abs_chain_position;
+ /// Is this TAP enabled?
+ int enabled;
+ int ir_length; /**< size of instruction register */
+ u32 ir_capture_value;
+ u8* expected; /**< Capture-IR expected value */
+ u32 ir_capture_mask;
+ u8* expected_mask; /**< Capture-IR expected mask */
+ u32 idcode;
+ /**< device identification code */
- jtag_tap_event_action_t* event_action;
+ /// Array of expected identification codes */
+ u32* expected_ids;
+ /// Number of expected identification codes
+ u8 expected_ids_cnt;
+ /// current instruction
+ u8* cur_instr;
+ /// Bypass register selected
+ int bypass;
+
+ jtag_tap_event_action_t *event_action;
+
jtag_tap_t* next_tap;
};
extern jtag_tap_t* jtag_AllTaps(void);
@@ -250,8 +312,8 @@
extern jtag_tap_t* jtag_TapByString(const char* dotted_name);
extern jtag_tap_t* jtag_TapByJimObj(Jim_Interp* interp, Jim_Obj* obj);
extern jtag_tap_t* jtag_TapByAbsPosition(int abs_position);
-extern int jtag_NumEnabledTaps(void);
-extern int jtag_NumTotalTaps(void);
+extern int jtag_NumEnabledTaps(void);
+extern int jtag_NumTotalTaps(void);
static __inline__ jtag_tap_t* jtag_NextEnabledTap(jtag_tap_t* p)
{
@@ -334,120 +396,138 @@
extern enum reset_types jtag_reset_config;
-/* initialize interface upon startup. A successful no-op
- * upon subsequent invocations
+/**
+ * Initialize interface upon startup. Return a successful no-op upon
+ * subsequent invocations.
*/
extern int jtag_interface_init(struct command_context_s* cmd_ctx);
/// Shutdown the JTAG interface upon program exit.
extern int jtag_interface_quit(void);
-/* initialize JTAG chain using only a RESET reset. If init fails,
+/**
+ * Initialize JTAG chain using only a RESET reset. If init fails,
* try reset + init.
*/
extern int jtag_init(struct command_context_s* cmd_ctx);
-/* reset, then initialize JTAG chain */
+/// reset, then initialize JTAG chain
extern int jtag_init_reset(struct command_context_s* cmd_ctx);
extern int jtag_register_commands(struct command_context_s* cmd_ctx);
-/* JTAG interface, can be implemented with a software or hardware fifo
+/**
+ * @file
+ * The JTAG interface can be implemented with a software or hardware fifo.
*
- * TAP_DRSHIFT and TAP_IRSHIFT are illegal end states. TAP_DRSHIFT/IRSHIFT as end states
- * can be emulated by using a larger scan.
+ * TAP_DRSHIFT and TAP_IRSHIFT are illegal end states; however,
+ * TAP_DRSHIFT/IRSHIFT can be emulated as end states, by using longer
+ * scans.
*
- * Code that is relatively insensitive to the path(as long
- * as it is JTAG compliant) taken through state machine can use
- * endstate for jtag_add_xxx_scan(). Otherwise the pause state must be
- * specified as end state and a subsequent jtag_add_pathmove() must
- * be issued.
- *
+ * Code that is relatively insensitive to the path taken through state
+ * machine (as long as it is JTAG compliant) can use @a endstate for
+ * jtag_add_xxx_scan(). Otherwise, the pause state must be specified as
+ * end state and a subsequent jtag_add_pathmove() must be issued.
*/
+
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 */
+/**
+ * The same as jtag_add_ir_scan except no verification is performed out
+ * the output values.
+ */
extern void jtag_add_ir_scan_noverify(int num_fields, const scan_field_t *fields, tap_state_t state);
-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
+
+/**
+ * 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
* JTAG queues.
*
* In the event of an asynchronous queue execution the queue buffer
- * allocation method is used, for the synchronous case the temporary 32 bits come
- * from the input field itself.
+ * allocation method is used, for the synchronous case the temporary 32
+ * bits come from the input field itself.
*/
extern void jtag_alloc_in_value32(scan_field_t *field);
-/* This version of jtag_add_dr_scan() uses the check_value/mask fields */
+extern void jtag_add_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+/// A version of jtag_add_dr_scan() that 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 void 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);
-/* Simplest/typical callback - do some conversion on the data clocked in.
- * This callback is for such conversion that can not fail.
- * For conversion types or checks that can
- * fail, use the jtag_callback_t variant */
+/**
+ * Defines a simple JTAG callback that can allow conversions on data
+ * scanned in from an interface.
+ *
+ * This callback should only be used for conversion that cannot fail.
+ * For conversion types or checks that can fail, use the more complete
+ * variant: jtag_callback_t.
+ */
typedef void (*jtag_callback1_t)(u8 *in);
-/* A simpler version of jtag_add_callback4 */
+/// A simpler version of jtag_add_callback4().
extern void jtag_add_callback(jtag_callback1_t, u8 *in);
-/* This type can store an integer safely by a normal cast on 64 and
- * 32 bit systems. */
+/**
+ * Defines the type of data passed to the jtag_callback_t interface.
+ * The underlying type must allow storing an @c int or pointer type.
+ */
typedef intptr_t jtag_callback_data_t;
-/* The generic callback mechanism.
+/**
+ * Defines the interface of the JTAG callback mechanism.
*
- * The callback is invoked with three arguments. The first argument is
- * the pointer to the data clocked in.
+ * @param in the pointer to the data clocked in
+ * @param data1 An integer big enough to use as an @c int or a pointer.
+ * @param data2 An integer big enough to use as an @c int or a pointer.
+ * @param data3 An integer big enough to use as an @c int or a pointer.
+ * @returns an error code
*/
typedef int (*jtag_callback_t)(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3);
-/* This callback can be executed immediately the queue has been flushed. Note that
- * the JTAG queue can either be executed synchronously or asynchronously. Typically
- * for USB the queue is executed asynchronously. For low latency interfaces, the
- * queue may be executed synchronously.
+/**
+ * This callback can be executed immediately the queue has been flushed.
*
- * These callbacks are typically executed *after* the *entire* JTAG queue has been
- * executed for e.g. USB interfaces.
+ * The JTAG queue can be executed synchronously or asynchronously.
+ * Typically for USB, the queue is executed asynchronously. For
+ * low-latency interfaces, the queue may be executed synchronously.
*
- * The callbacks are guaranteeed to be invoked in the order that they were queued.
+ * The callback mechanism is very general and does not make many
+ * assumptions about what the callback does or what its arguments are.
+ * These callbacks are typically executed *after* the *entire* JTAG
+ * queue has been executed for e.g. USB interfaces, and they are
+ * guaranteeed to be invoked in the order that they were queued.
*
- * The strange name is due to C's lack of overloading using function arguments
+ * If the execution of the queue fails before the callbacks, then --
+ * depending on driver implementation -- the callbacks may or may not be
+ * invoked. @todo Can we make this behavior consistent?
*
- * The callback mechansim is very general and does not really make any assumptions
- * about what the callback does and what the arguments are.
+ * The strange name is due to C's lack of overloading using function
+ * arguments.
*
- * in - typically used to point to the data to operate on. More often than not
- * this will be the data clocked in during a shift operation
+ * @param f The callback function to add.
+ * @param in Typically used to point to the data to operate on.
+ * Frequently this will be the data clocked in during a shift operation.
+ * @param data1 An integer big enough to use as an @c int or a pointer.
+ * @param data2 An integer big enough to use as an @c int or a pointer.
+ * @param data3 An integer big enough to use as an @c int or a pointer.
*
- * data1 - an integer that is big enough to be used either as an 'int' or
- * cast to/from a pointer
- *
- * data2 - an integer that is big enough to be used either as an 'int' or
- * cast to/from a pointer
- *
- * Why stop at 'data2' for arguments? Somewhat historical reasons. This is
- * sufficient to implement the jtag_check_value_mask(), besides the
- * line is best drawn somewhere...
- *
- * If the execution of the queue fails before the callbacks, then the
- * callbacks may or may not be invoked depending on driver implementation.
*/
extern void jtag_add_callback4(jtag_callback_t, u8 *in,
jtag_callback_data_t data1, jtag_callback_data_t data2,
jtag_callback_data_t data3);
-/* run a TAP_RESET reset. End state is TAP_RESET, regardless
- * of start state.
+/**
+ * Run a TAP_RESET reset where the end state is TAP_RESET,
+ * regardless of the start state.
*/
extern void jtag_add_tlr(void);
-/* Application code *must* assume that interfaces will
+/**
+ * Application code *must* assume that interfaces will
* implement transitions between states with different
* paths and path lengths through the state diagram. The
* path will vary across interface and also across versions
@@ -490,16 +570,20 @@
*/
extern void 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
- * to the end state, if it is != TAP_IDLE
+/**
+ * Goes to TAP_IDLE (if we're not already there), cycle
+ * precisely num_cycles in the TAP_IDLE state, after which move
+ * to @a endstate (unless it is also TAP_IDLE).
*
- * nb! num_cycles can be 0, in which case the fn will navigate
- * to endstate via TAP_IDLE
+ * @param num_cycles Number of cycles in TAP_IDLE state. This argument
+ * may be 0, in which case this routine will navigate to @a endstate
+ * via TAP_IDLE.
+ * @param endstate The final state.
*/
extern void jtag_add_runtest(int num_cycles, tap_state_t endstate);
-/* A reset of the TAP state machine can be requested.
+/**
+ * A reset of the TAP state machine can be requested.
*
* Whether tms or trst reset is used depends on the capabilities of
* the target and jtag interface(reset_config command configures this).
@@ -535,7 +619,7 @@
void jtag_add_clocks(int num_cycles);
-/*
+/**
* For software FIFO implementations, the queued commands can be executed
* during this call or earlier. A sw queue might decide to push out
* some of the jtag_add_xxx() operations once the queue is "big enough".
@@ -555,16 +639,19 @@
* jtag_add_xxx() commands can either be executed immediately or
* at some time between the jtag_add_xxx() fn call and jtag_execute_queue().
*/
-extern int jtag_execute_queue(void);
+extern int jtag_execute_queue(void);
/* same as jtag_execute_queue() but does not clear the error flag */
extern void jtag_execute_queue_noclear(void);
-/* this flag is set when an error occurs while executing the queue. cleared
- * by jtag_execute_queue()
+/**
+ * The jtag_error variable is set when an error occurs while executing
+ * the queue.
*
- * this flag can also be set from application code if some error happens
+ * This flag can also be set from application code, if an error happens
* during processing that should be reported during jtag_execute_queue().
+ *
+ * It is cleared by jtag_execute_queue().
*/
extern int jtag_error;
@@ -581,33 +668,39 @@
/* can be implemented by hw+sw */
-extern int jtag_power_dropout(int* dropout);
-extern int jtag_srst_asserted(int* srst_asserted);
+extern int jtag_power_dropout(int* dropout);
+extern int jtag_srst_asserted(int* srst_asserted);
/* JTAG support functions */
-/* execute jtag queue and check value and use mask if mask is != NULL. invokes
- * jtag_set_error() with any error. */
+/**
+ * Execute jtag queue and check value with an optional mask.
+ * @param field Pointer to scan field.
+ * @param value Pointer to scan value.
+ * @param mask Pointer to scan mask; may be NULL.
+ * @returns Nothing, but calls jtag_set_error() on any error.
+ */
extern void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask);
#ifdef INCLUDE_JTAG_INTERFACE_H
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 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);
#endif // INCLUDE_JTAG_INTERFACE_H
-extern void jtag_sleep(u32 us);
-extern int jtag_call_event_callbacks(enum jtag_event event);
-extern int jtag_register_event_callback(int (* callback)(enum jtag_event event, void* priv), void* priv);
+extern void jtag_sleep(u32 us);
+extern int jtag_call_event_callbacks(enum jtag_event event);
+extern int jtag_register_event_callback(int (* callback)(enum jtag_event event, void* priv), void* priv);
extern int jtag_verify_capture_ir;
void jtag_tap_handle_event(jtag_tap_t* tap, enum jtag_tap_event e);
-/* error codes
- * JTAG subsystem uses codes between -100 and -199 */
-
+/*
+ * The JTAG subsystem defines a number of error codes,
+ * using codes between -100 and -199.
+ */
#define ERROR_JTAG_INIT_FAILED (-100)
#define ERROR_JTAG_INVALID_INTERFACE (-101)
#define ERROR_JTAG_NOT_IMPLEMENTED (-102)
@@ -616,7 +709,8 @@
#define ERROR_JTAG_NOT_STABLE_STATE (-105)
#define ERROR_JTAG_DEVICE_ERROR (-107)
-/* jtag_add_dr_out() is a version of jtag_add_dr_scan() which
+/**
+ * jtag_add_dr_out() is a version of jtag_add_dr_scan() which
* only scans data out. It operates on 32 bit integers instead
* of 8 bit, which makes it a better impedance match with
* the calling code which often operate on 32 bit integers.
@@ -626,9 +720,9 @@
* num_bits[i] is the number of bits to clock out from value[i] LSB first.
*
* If the device is in bypass, then that is an error condition in
- * the caller code that is not detected by this fn, whereas jtag_add_dr_scan()
- * does detect it. Similarly if the device is not in bypass, data must
- * be passed to it.
+ * the caller code that is not detected by this fn, whereas
+ * jtag_add_dr_scan() does detect it. Similarly if the device is not in
+ * bypass, data must be passed to it.
*
* If anything fails, then jtag_error will be set and jtag_execute() will
* return an error. There is no way to determine if there was a failure
@@ -647,10 +741,13 @@
/**
- * Function jtag_add_statemove
- * moves from the current state to the goal \a state. This needs
- * to be handled according to the xsvf spec, see the XSTATE command
- * description.
+ * jtag_add_statemove() moves from the current state to @a goal_state.
+ *
+ * This function was originally designed to handle the XSTATE command
+ * from the XSVF specification.
+ *
+ * @param goal_state The final TAP state.
+ * @return ERROR_OK on success, or an error code on failure.
*/
extern int jtag_add_statemove(tap_state_t goal_state);
|
|
From: <zw...@ma...> - 2009-06-03 03:39:08
|
Author: zwelch
Date: 2009-06-03 03:39:04 +0200 (Wed, 03 Jun 2009)
New Revision: 2018
Modified:
trunk/src/jtag/interface.h
Log:
Update documentationf or jtag_interface structure members.
Modified: trunk/src/jtag/interface.h
===================================================================
--- trunk/src/jtag/interface.h 2009-06-03 01:29:01 UTC (rev 2017)
+++ trunk/src/jtag/interface.h 2009-06-03 01:39:04 UTC (rev 2018)
@@ -189,49 +189,89 @@
typedef struct jtag_interface_s
{
+ /// The name of the JTAG interface driver.
char* name;
- /* queued command execution
+ /**
+ * Execute queued commands.
+ * @returns ERROR_OK on success, or an error code on failure.
*/
int (*execute_queue)(void);
- /* interface initalization
+ /**
+ * Set the interface speed.
+ * @param speed The new interface speed setting.
+ * @returns ERROR_OK on success, or an error code on failure.
*/
int (*speed)(int speed);
+
+ /**
+ * The interface driver may register additional commands to expose
+ * additional features not covered by the standard command set.
+ * @param cmd_ctx The context in which commands should be registered.
+ * @returns ERROR_OK on success, or an error code on failure.
+ */
int (*register_commands)(struct command_context_s* cmd_ctx);
+
+ /**
+ * Interface driver must initalize any resources and connect to a
+ * JTAG device.
+ * @returns ERROR_OK on success, or an error code on failure.
+ */
int (*init)(void);
+
+ /**
+ * Interface driver must tear down all resources and disconnect from
+ * the JTAG device.
+ * @returns ERROR_OK on success, or an error code on failure.
+ */
int (*quit)(void);
- /* returns JTAG maxium speed for KHz. 0=RTCK. The function returns
+ /**
+ * Returns JTAG maxium speed for KHz. 0=RTCK. The function returns
* a failure if it can't support the KHz/RTCK.
*
* WARNING!!!! if RTCK is *slow* then think carefully about
* whether you actually want to support this in the driver.
* Many target scripts are written to handle the absence of RTCK
* and use a fallback kHz TCK.
+ * @returns ERROR_OK on success, or an error code on failure.
*/
int (*khz)(int khz, int* jtag_speed);
- /* returns the KHz for the provided JTAG speed. 0=RTCK. The function returns
- * a failure if it can't support the KHz/RTCK. */
+ /**
+ * Calculate the clock frequency (in KHz) for the given @a speed.
+ * @param speed The desired interface speed setting.
+ * @param khz On return, contains the speed in KHz (0 for RTCK).
+ * @returns ERROR_OK on success, or an error code if the
+ * interface cannot support the specified speed (KHz or RTCK).
+ */
int (*speed_div)(int speed, int* khz);
- /* Read and clear the power dropout flag. Note that a power dropout
- * can be transitionary, easily much less than a ms.
+ /**
+ * Read and clear the power dropout flag. Note that a power dropout
+ * can be transitionary, easily much less than a ms.
*
- * So to find out if the power is *currently* on, you must invoke
- * this method twice. Once to clear the power dropout flag and a
- * second time to read the current state.
+ * To find out if the power is *currently* on, one must invoke this
+ * method twice. Once to clear the power dropout flag and a second
+ * time to read the current state. The default implementation
+ * never reports power dropouts.
*
- * Currently the default implementation is never to detect power dropout.
+ * @returns ERROR_OK on success, or an error code on failure.
*/
int (*power_dropout)(int* power_dropout);
- /* Read and clear the srst asserted detection flag.
+ /**
+ * Read and clear the srst asserted detection flag.
*
- * NB!!!! like power_dropout this does *not* read the current
- * state. srst assertion is transitionary and *can* be much
- * less than 1ms.
+ * Like power_dropout this does *not* read the current
+ * state. SRST assertion is transitionary and may be much
+ * less than 1ms, so the interface driver must watch for these
+ * events until this routine is called.
+ *
+ * @param srst_asserted On return, indicates whether SRST has
+ * been asserted.
+ * @returns ERROR_OK on success, or an error code on failure.
*/
int (*srst_asserted)(int* srst_asserted);
} jtag_interface_t;
|