|
From: <kc...@ma...> - 2008-12-13 08:04:06
|
Author: kc8apf
Date: 2008-12-13 08:02:56 +0100 (Sat, 13 Dec 2008)
New Revision: 1236
Added:
branches/openocd_1_0_branch/src/target/target/samsung_s3c2410.cfg
Removed:
branches/openocd_1_0_branch/src/target/target/samsung_s2c2410.cfg
Modified:
branches/openocd_1_0_branch/README
branches/openocd_1_0_branch/doc/openocd.texi
branches/openocd_1_0_branch/src/flash/flash.c
branches/openocd_1_0_branch/src/flash/str9xpec.c
branches/openocd_1_0_branch/src/helper/command.c
branches/openocd_1_0_branch/src/jtag/amt_jtagaccel.c
branches/openocd_1_0_branch/src/jtag/bitbang.c
branches/openocd_1_0_branch/src/jtag/bitq.c
branches/openocd_1_0_branch/src/jtag/ft2232.c
branches/openocd_1_0_branch/src/jtag/gw16012.c
branches/openocd_1_0_branch/src/jtag/jlink.c
branches/openocd_1_0_branch/src/jtag/jtag.c
branches/openocd_1_0_branch/src/jtag/jtag.h
branches/openocd_1_0_branch/src/jtag/usbprog.c
branches/openocd_1_0_branch/src/jtag/zy1000.c
branches/openocd_1_0_branch/src/pld/virtex2.c
branches/openocd_1_0_branch/src/target/arm11.c
branches/openocd_1_0_branch/src/target/arm11_dbgtap.c
branches/openocd_1_0_branch/src/target/arm720t.c
branches/openocd_1_0_branch/src/target/arm7_9_common.c
branches/openocd_1_0_branch/src/target/arm7tdmi.c
branches/openocd_1_0_branch/src/target/arm920t.c
branches/openocd_1_0_branch/src/target/arm926ejs.c
branches/openocd_1_0_branch/src/target/arm966e.c
branches/openocd_1_0_branch/src/target/arm9tdmi.c
branches/openocd_1_0_branch/src/target/board/hammer.cfg
branches/openocd_1_0_branch/src/target/cortex_m3.c
branches/openocd_1_0_branch/src/target/cortex_m3.h
branches/openocd_1_0_branch/src/target/cortex_swjdp.c
branches/openocd_1_0_branch/src/target/embeddedice.c
branches/openocd_1_0_branch/src/target/etb.c
branches/openocd_1_0_branch/src/target/etm.c
branches/openocd_1_0_branch/src/target/feroceon.c
branches/openocd_1_0_branch/src/target/mips_ejtag.c
branches/openocd_1_0_branch/src/target/mips_m4k.c
branches/openocd_1_0_branch/src/target/target/at91r40008.cfg
branches/openocd_1_0_branch/src/target/target/at91sam9260.cfg
branches/openocd_1_0_branch/src/target/target/at91sam9260minimal.cfg
branches/openocd_1_0_branch/src/target/target/imote2.cfg
branches/openocd_1_0_branch/src/target/target/is5114.cfg
branches/openocd_1_0_branch/src/target/target/samsung_s3c6410.cfg
branches/openocd_1_0_branch/src/target/xscale.c
branches/openocd_1_0_branch/src/xsvf/xsvf.c
Log:
Merge r1217-r1235
Modified: branches/openocd_1_0_branch/README
===================================================================
--- branches/openocd_1_0_branch/README 2008-12-13 06:59:24 UTC (rev 1235)
+++ branches/openocd_1_0_branch/README 2008-12-13 07:02:56 UTC (rev 1236)
@@ -1 +1,2 @@
openocd.texi is the authoritative source of OpenOCD documentation
+
Modified: branches/openocd_1_0_branch/doc/openocd.texi
===================================================================
--- branches/openocd_1_0_branch/doc/openocd.texi 2008-12-13 06:59:24 UTC (rev 1235)
+++ branches/openocd_1_0_branch/doc/openocd.texi 2008-12-13 07:02:56 UTC (rev 1236)
@@ -286,7 +286,7 @@
@itemize @bullet
@item @b{usbjtag}
-@* Link Unknown [not easily verified]
+@* Link @url{http://www.hs-augsburg.de/~hhoegl/proj/usbjtag/usbjtag.html}
@item @b{jtagkey}
@* See: @url{http://www.amontec.com/jtagkey.shtml}
@item @b{oocdlink}
@@ -304,7 +304,9 @@
@item @b{comstick}
@* Link: @url{http://www.hitex.com/index.php?id=383}
@item @b{stm32stick}
-@* Link Unknown [not easily verified]
+@* Link @url{http://www.hitex.com/stm32-stick}
+@item @b{axm0432_jtag}
+@* Axiom AXM-0432 Link @url{http://www.axman.com}
@end itemize
@section USB JLINK based
@@ -370,7 +372,7 @@
@* Unknown.
@item @b{Lattice}
-@* From Lattice Semiconductor [link unknown]
+@* ispDownload from Lattice Semiconductor @url{http://www.latticesemi.com/lit/docs/devtools/dlcable.pdf}
@item @b{flashlink}
@* From ST Microsystems, link:
@@ -1177,6 +1179,8 @@
egnite Software turtelizer2
@item @b{oocdlink}
OOCDLink
+@item @b{axm0432_jtag}
+Axiom AXM-0432
@end itemize
@item @b{ft2232_vid_pid} <@var{vid}> <@var{pid}>
@@ -1950,7 +1954,7 @@
@cindex flash protect_check
@*Check protection state of sectors in flash bank <num>.
@option{flash erase_sector} using the same syntax.
-@subsection fash erase_sector
+@subsection flash erase_sector
@b{flash erase_sector} <@var{num}> <@var{first}> <@var{last}>
@cindex flash erase_sector
@anchor{flash erase_sector}
@@ -2080,7 +2084,7 @@
@option{enable_turbo} <@var{num>.}
Only use this driver for locking/unlocking the device or configuring the option bytes.
-Use the standard str9 driver for programming.
+Use the standard str9 driver for programming. @xref{STR9 specific commands}.
@subsubsection stellaris (LM3Sxxx) options
@cindex stellaris (LM3Sxxx) options
@@ -2140,6 +2144,7 @@
@subsection STR9 specific commands
@cindex STR9 specific commands
+@anchor{STR9 specific commands}
These are flash specific commands when using the str9xpec driver.
@itemize @bullet
@item @b{str9xpec enable_turbo} <@var{num}>
@@ -2164,6 +2169,43 @@
@*write str9 option bytes.
@end itemize
+Note: Before using the str9xpec driver here is some background info to help
+you better understand how the drivers works. Openocd has two flash drivers for
+the str9.
+@enumerate
+@item
+Standard driver @option{str9x} programmed via the str9 core. Normally used for
+flash programming as it is faster than the @option{str9xpec} driver.
+@item
+Direct programming @option{str9xpec} using the flash controller, this is
+ISC compilant (IEEE 1532) tap connected in series with the str9 core. The str9
+core does not need to be running to program using this flash driver. Typical use
+for this driver is locking/unlocking the target and programming the option bytes.
+@end enumerate
+
+Before we run any cmds using the @option{str9xpec} driver we must first disable
+the str9 core. This example assumes the @option{str9xpec} driver has been
+configured for flash bank 0.
+@example
+# assert srst, we do not want core running
+# while accessing str9xpec flash driver
+jtag_reset 0 1
+# turn off target polling
+poll off
+# disable str9 core
+str9xpec enable_turbo 0
+# read option bytes
+str9xpec options_read 0
+# re-enable str9 core
+str9xpec disable_turbo 0
+poll on
+reset halt
+@end example
+The above example will read the str9 option bytes.
+When performing a unlock remember that you will not be able to halt the str9 - it
+has been locked. Halting the core is not required for the @option{str9xpec} driver
+as mentioned above, just issue the cmds above manually or from a telnet prompt.
+
@subsection STR9 configuration
@cindex STR9 configuration
@itemize @bullet
Modified: branches/openocd_1_0_branch/src/flash/flash.c
===================================================================
--- branches/openocd_1_0_branch/src/flash/flash.c 2008-12-13 06:59:24 UTC (rev 1235)
+++ branches/openocd_1_0_branch/src/flash/flash.c 2008-12-13 07:02:56 UTC (rev 1236)
@@ -144,7 +144,7 @@
{
flash_cmd = register_command(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL);
- register_command(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, "flash_bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]");
+ register_command(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, "flash bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]");
return ERROR_OK;
}
Modified: branches/openocd_1_0_branch/src/flash/str9xpec.c
===================================================================
--- branches/openocd_1_0_branch/src/flash/str9xpec.c 2008-12-13 06:59:24 UTC (rev 1235)
+++ branches/openocd_1_0_branch/src/flash/str9xpec.c 2008-12-13 07:02:56 UTC (rev 1236)
@@ -145,7 +145,7 @@
scan_field_t field;
u8 status;
- if (str9xpec_set_instr(tap, ISC_NOOP, TAP_PI) != ERROR_OK)
+ if (str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE) != ERROR_OK)
return ISC_STATUS_ERROR;
field.tap = tap;
@@ -158,7 +158,7 @@
field.in_handler = NULL;
field.in_handler_priv = NULL;
- jtag_add_dr_scan(1, &field, TAP_RTI);
+ jtag_add_dr_scan(1, &field, TAP_IDLE);
jtag_execute_queue();
LOG_DEBUG("status: 0x%2.2x", status);
@@ -181,7 +181,7 @@
return ERROR_OK;
/* enter isc mode */
- if (str9xpec_set_instr(tap, ISC_ENABLE, TAP_RTI) != ERROR_OK)
+ if (str9xpec_set_instr(tap, ISC_ENABLE, TAP_IDLE) != ERROR_OK)
return ERROR_TARGET_INVALID;
/* check ISC status */
@@ -207,7 +207,7 @@
if (!str9xpec_info->isc_enable)
return ERROR_OK;
- if (str9xpec_set_instr(tap, ISC_DISABLE, TAP_RTI) != ERROR_OK)
+ if (str9xpec_set_instr(tap, ISC_DISABLE, TAP_IDLE) != ERROR_OK)
return ERROR_TARGET_INVALID;
/* delay to handle aborts */
@@ -238,7 +238,7 @@
LOG_DEBUG("ISC_CONFIGURATION");
/* execute ISC_CONFIGURATION command */
- str9xpec_set_instr(tap, ISC_CONFIGURATION, TAP_PI);
+ str9xpec_set_instr(tap, ISC_CONFIGURATION, TAP_IRPAUSE);
field.tap = tap;
field.num_bits = 64;
@@ -250,7 +250,7 @@
field.in_handler = NULL;
field.in_handler_priv = NULL;
- jtag_add_dr_scan(1, &field, TAP_RTI);
+ jtag_add_dr_scan(1, &field, TAP_IDLE);
jtag_execute_queue();
status = str9xpec_isc_status(tap);
@@ -349,10 +349,10 @@
armv4_5 = bank->target->arch_info;
arm7_9 = armv4_5->arch_info;
jtag_info = &arm7_9->jtag_info;
-
+
str9xpec_info->tap = jtag_TapByAbsPosition( jtag_info->tap->abs_chain_position - 1);
str9xpec_info->isc_enable = 0;
-
+
str9xpec_build_block_list(bank);
/* clear option byte register */
@@ -390,7 +390,7 @@
}
/* execute ISC_BLANK_CHECK command */
- str9xpec_set_instr(tap, ISC_BLANK_CHECK, TAP_PI);
+ str9xpec_set_instr(tap, ISC_BLANK_CHECK, TAP_IRPAUSE);
field.tap = tap;
field.num_bits = 64;
@@ -402,7 +402,7 @@
field.in_handler = NULL;
field.in_handler_priv = NULL;
- jtag_add_dr_scan(1, &field, TAP_RTI);
+ jtag_add_dr_scan(1, &field, TAP_IDLE);
jtag_add_sleep(40000);
/* read blank check result */
@@ -416,7 +416,7 @@
field.in_handler = NULL;
field.in_handler_priv = NULL;
- jtag_add_dr_scan(1, &field, TAP_PI);
+ jtag_add_dr_scan(1, &field, TAP_IRPAUSE);
jtag_execute_queue();
status = str9xpec_isc_status(tap);
@@ -506,7 +506,7 @@
LOG_DEBUG("ISC_ERASE");
/* execute ISC_ERASE command */
- str9xpec_set_instr(tap, ISC_ERASE, TAP_PI);
+ str9xpec_set_instr(tap, ISC_ERASE, TAP_IRPAUSE);
field.tap = tap;
field.num_bits = 64;
@@ -518,7 +518,7 @@
field.in_handler = NULL;
field.in_handler_priv = NULL;
- jtag_add_dr_scan(1, &field, TAP_RTI);
+ jtag_add_dr_scan(1, &field, TAP_IDLE);
jtag_execute_queue();
jtag_add_sleep(10);
@@ -569,9 +569,9 @@
str9xpec_set_address(bank, 0x80);
/* execute ISC_PROGRAM command */
- str9xpec_set_instr(tap, ISC_PROGRAM_SECURITY, TAP_RTI);
+ str9xpec_set_instr(tap, ISC_PROGRAM_SECURITY, TAP_IDLE);
- str9xpec_set_instr(tap, ISC_NOOP, TAP_PI);
+ str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE);
do {
field.tap = tap;
@@ -658,7 +658,7 @@
tap = str9xpec_info->tap;
/* set flash controller address */
- str9xpec_set_instr(tap, ISC_ADDRESS_SHIFT, TAP_PI);
+ str9xpec_set_instr(tap, ISC_ADDRESS_SHIFT, TAP_IRPAUSE);
field.tap = tap;
field.num_bits = 8;
@@ -747,7 +747,7 @@
while (dwords_remaining > 0)
{
- str9xpec_set_instr(tap, ISC_PROGRAM, TAP_PI);
+ str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE);
field.tap = tap;
field.num_bits = 64;
@@ -759,12 +759,12 @@
field.in_handler = NULL;
field.in_handler_priv = NULL;
- jtag_add_dr_scan(1, &field, TAP_RTI);
+ jtag_add_dr_scan(1, &field, TAP_IDLE);
/* small delay before polling */
jtag_add_sleep(50);
- str9xpec_set_instr(tap, ISC_NOOP, TAP_PI);
+ str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE);
do {
field.tap = tap;
@@ -807,7 +807,7 @@
bytes_written++;
}
- str9xpec_set_instr(tap, ISC_PROGRAM, TAP_PI);
+ str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE);
field.tap = tap;
field.num_bits = 64;
@@ -819,12 +819,12 @@
field.in_handler = NULL;
field.in_handler_priv = NULL;
- jtag_add_dr_scan(1, &field, TAP_RTI);
+ jtag_add_dr_scan(1, &field, TAP_IDLE);
/* small delay before polling */
jtag_add_sleep(50);
- str9xpec_set_instr(tap, ISC_NOOP, TAP_PI);
+ str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE);
do {
field.tap = tap;
@@ -889,7 +889,7 @@
buffer = calloc(CEIL(32, 8), 1);
- str9xpec_set_instr(tap, ISC_IDCODE, TAP_PI);
+ str9xpec_set_instr(tap, ISC_IDCODE, TAP_IRPAUSE);
field.tap = tap;
field.num_bits = 32;
@@ -901,7 +901,7 @@
field.in_handler = NULL;
field.in_handler_priv = NULL;
- jtag_add_dr_scan(1, &field, TAP_RTI);
+ jtag_add_dr_scan(1, &field, TAP_IDLE);
jtag_execute_queue();
idcode = buf_get_u32(buffer, 0, 32);
@@ -1014,7 +1014,7 @@
str9xpec_set_address(bank, 0x50);
/* execute ISC_PROGRAM command */
- str9xpec_set_instr(tap, ISC_PROGRAM, TAP_PI);
+ str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE);
field.tap = tap;
field.num_bits = 64;
@@ -1026,12 +1026,12 @@
field.in_handler = NULL;
field.in_handler_priv = NULL;
- jtag_add_dr_scan(1, &field, TAP_RTI);
+ jtag_add_dr_scan(1, &field, TAP_IDLE);
/* small delay before polling */
jtag_add_sleep(50);
- str9xpec_set_instr(tap, ISC_NOOP, TAP_PI);
+ str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE);
do {
field.tap = tap;
@@ -1303,13 +1303,13 @@
}
/* enable turbo mode - TURBO-PROG-ENABLE */
- str9xpec_set_instr(tap2, 0xD, TAP_RTI);
+ str9xpec_set_instr(tap2, 0xD, TAP_IDLE);
if ((retval = jtag_execute_queue()) != ERROR_OK)
return retval;
/* modify scan chain - str9 core has been removed */
tap1->enabled = 0;
-
+
return ERROR_OK;
}
@@ -1337,11 +1337,11 @@
if (tap == NULL)
return ERROR_FAIL;
-
- /* exit turbo mode via TLR */
- str9xpec_set_instr(tap, ISC_NOOP, TAP_TLR);
+
+ /* exit turbo mode via RESET */
+ str9xpec_set_instr(tap, ISC_NOOP, TAP_RESET);
jtag_execute_queue();
-
+
/* restore previous scan chain */
if (tap->next_tap) {
tap->next_tap->enabled = 1;
Modified: branches/openocd_1_0_branch/src/helper/command.c
===================================================================
--- branches/openocd_1_0_branch/src/helper/command.c 2008-12-13 06:59:24 UTC (rev 1235)
+++ branches/openocd_1_0_branch/src/helper/command.c 2008-12-13 07:02:56 UTC (rev 1236)
@@ -289,8 +289,10 @@
return ERROR_INVALID_ARGUMENTS;
/* find command */
- for (c = context->commands; c; c = c->next)
- {
+ c = context->commands;
+
+ while(NULL != c)
+ {
if (strcmp(name, c->name) == 0)
{
/* unlink command */
@@ -300,26 +302,32 @@
}
else
{
+ /* first element in command list */
context->commands = c->next;
}
-
+
/* unregister children */
- if (c->children)
+ while(NULL != c->children)
{
- for (c2 = c->children; c2; c2 = c2->next)
- {
- free(c2->name);
- free(c2);
- }
+ c2 = c->children;
+ c->children = c->children->next;
+ free(c2->name);
+ c2->name = NULL;
+ free(c2);
+ c2 = NULL;
}
-
+
/* delete command */
free(c->name);
+ c->name = NULL;
free(c);
+ c = NULL;
+ return ERROR_OK;
}
-
+
/* remember the last command for unlinking */
p = c;
+ c = c->next;
}
return ERROR_OK;
Modified: branches/openocd_1_0_branch/src/jtag/amt_jtagaccel.c
===================================================================
--- branches/openocd_1_0_branch/src/jtag/amt_jtagaccel.c 2008-12-13 06:59:24 UTC (rev 1235)
+++ branches/openocd_1_0_branch/src/jtag/amt_jtagaccel.c 2008-12-13 07:02:56 UTC (rev 1236)
@@ -100,22 +100,22 @@
*/
u8 amt_jtagaccel_tap_move[6][6][2] =
{
- /* TLR RTI SD PD SI PI */
- {{0x1f, 0x00}, {0x0f, 0x00}, {0x8a, 0x04}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* TLR */
- {{0x1f, 0x00}, {0x00, 0x00}, {0x85, 0x08}, {0x05, 0x00}, {0x8b, 0x08}, {0x0b, 0x00}}, /* RTI */
- {{0x1f, 0x00}, {0x0d, 0x00}, {0x00, 0x00}, {0x01, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* SD */
- {{0x1f, 0x00}, {0x0c, 0x00}, {0x08, 0x00}, {0x00, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* PD */
- {{0x1f, 0x00}, {0x0d, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x00, 0x00}, {0x01, 0x00}}, /* SI */
- {{0x1f, 0x00}, {0x0c, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x08, 0x00}, {0x00, 0x00}}, /* PI */
+ /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */
+ {{0x1f, 0x00}, {0x0f, 0x00}, {0x8a, 0x04}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* RESET */
+ {{0x1f, 0x00}, {0x00, 0x00}, {0x85, 0x08}, {0x05, 0x00}, {0x8b, 0x08}, {0x0b, 0x00}}, /* IDLE */
+ {{0x1f, 0x00}, {0x0d, 0x00}, {0x00, 0x00}, {0x01, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* DRSHIFT */
+ {{0x1f, 0x00}, {0x0c, 0x00}, {0x08, 0x00}, {0x00, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* DRPAUSE */
+ {{0x1f, 0x00}, {0x0d, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x00, 0x00}, {0x01, 0x00}}, /* IRSHIFT */
+ {{0x1f, 0x00}, {0x0c, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x08, 0x00}, {0x00, 0x00}}, /* IRPAUSE */
};
-jtag_interface_t amt_jtagaccel_interface =
+jtag_interface_t amt_jtagaccel_interface =
{
.name = "amt_jtagaccel",
-
+
.execute_queue = amt_jtagaccel_execute_queue,
- .speed = amt_jtagaccel_speed,
+ .speed = amt_jtagaccel_speed,
.register_commands = amt_jtagaccel_register_commands,
.init = amt_jtagaccel_init,
.quit = amt_jtagaccel_quit,
@@ -127,7 +127,7 @@
COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "rtck", amt_jtagaccel_handle_rtck_command,
COMMAND_CONFIG, NULL);
-
+
return ERROR_OK;
}
@@ -142,7 +142,7 @@
aw_control_rst |= 0x1;
else if (srst == 0)
aw_control_rst &= ~0x1;
-
+
AMT_AW(aw_control_rst);
}
@@ -151,7 +151,7 @@
aw_control_baudrate &= 0xf0;
aw_control_baudrate |= speed & 0x0f;
AMT_AW(aw_control_baudrate);
-
+
return ERROR_OK;
}
@@ -170,11 +170,11 @@
{
int timeout = 4096;
u8 ar_status;
-
+
AMT_AR(ar_status);
while (((ar_status) & 0x80) && (timeout-- > 0))
AMT_AR(ar_status);
-
+
if (ar_status & 0x80)
{
LOG_ERROR("amt_jtagaccel timed out while waiting for end of scan, rtck was %s, last AR_STATUS: 0x%2.2x", (rtck_enabled) ? "enabled" : "disabled", ar_status);
@@ -186,15 +186,15 @@
{
u8 aw_scan_tms_5;
u8 tms_scan[2];
-
+
tms_scan[0] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][0];
tms_scan[1] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][1];
-
+
aw_scan_tms_5 = 0x40 | (tms_scan[0] & 0x1f);
AMT_AW(aw_scan_tms_5);
if (jtag_speed > 3 || rtck_enabled)
amt_wait_scan_busy();
-
+
if (tms_scan[0] & 0x80)
{
aw_scan_tms_5 = 0x40 | (tms_scan[1] & 0x1f);
@@ -202,7 +202,7 @@
if (jtag_speed > 3 || rtck_enabled)
amt_wait_scan_busy();
}
-
+
cur_state = end_state;
}
@@ -213,27 +213,27 @@
u8 aw_scan_tms_1to4;
enum tap_state saved_end_state = end_state;
-
- /* only do a state_move when we're not already in RTI */
- if (cur_state != TAP_RTI)
+
+ /* only do a state_move when we're not already in IDLE */
+ if (cur_state != TAP_IDLE)
{
- amt_jtagaccel_end_state(TAP_RTI);
+ amt_jtagaccel_end_state(TAP_IDLE);
amt_jtagaccel_state_move();
}
-
+
while (num_cycles - i >= 5)
{
aw_scan_tms_5 = 0x40;
AMT_AW(aw_scan_tms_5);
i += 5;
}
-
+
if (num_cycles - i > 0)
{
aw_scan_tms_1to4 = 0x80 | ((num_cycles - i - 1) & 0x3) << 4;
AMT_AW(aw_scan_tms_1to4);
}
-
+
amt_jtagaccel_end_state(saved_end_state);
if (cur_state != end_state)
amt_jtagaccel_state_move();
@@ -251,9 +251,9 @@
u8 tms_scan[2];
if (ir_scan)
- amt_jtagaccel_end_state(TAP_SI);
+ amt_jtagaccel_end_state(TAP_IRSHIFT);
else
- amt_jtagaccel_end_state(TAP_SD);
+ amt_jtagaccel_end_state(TAP_DRSHIFT);
amt_jtagaccel_state_move();
amt_jtagaccel_end_state(saved_end_state);
@@ -263,7 +263,7 @@
{
aw_tdi_option = 0x30 | (((scan_size - 1) % 8) - 1);
AMT_AW(aw_tdi_option);
-
+
dw_tdi_scan = buf_get_u32(buffer, bit_count, (scan_size - 1) % 8) & 0xff;
AMT_DW(dw_tdi_scan);
if (jtag_speed > 3 || rtck_enabled)
@@ -275,11 +275,11 @@
dr_tdo = dr_tdo >> (8 - ((scan_size - 1) % 8));
buf_set_u32(buffer, bit_count, (scan_size - 1) % 8, dr_tdo);
}
-
+
bit_count += (scan_size - 1) % 8;
bits_left -= (scan_size - 1) % 8;
}
-
+
while (bits_left - 1 >= 8)
{
dw_tdi_scan = buf_get_u32(buffer, bit_count, 8) & 0xff;
@@ -292,11 +292,11 @@
AMT_DR(dr_tdo);
buf_set_u32(buffer, bit_count, 8, dr_tdo);
}
-
+
bit_count += 8;
bits_left -= 8;
}
-
+
tms_scan[0] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][0];
tms_scan[1] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][1];
aw_tms_scan = 0x40 | (tms_scan[0] & 0x1f) | (buf_get_u32(buffer, bit_count, 1) << 5);
@@ -310,7 +310,7 @@
dr_tdo = dr_tdo >> 7;
buf_set_u32(buffer, bit_count, 1, dr_tdo);
}
-
+
if (tms_scan[0] & 0x80)
{
aw_tms_scan = 0x40 | (tms_scan[1] & 0x1f);
@@ -328,12 +328,12 @@
enum scan_type type;
u8 *buffer;
int retval;
-
+
/* return ERROR_OK, unless a jtag_read_buffer returns a failed check
* that wasn't handled by a caller-provided error handler
- */
+ */
retval = ERROR_OK;
-
+
while (cmd)
{
switch (cmd->type)
@@ -351,7 +351,7 @@
#endif
if (cmd->cmd.reset->trst == 1)
{
- cur_state = TAP_TLR;
+ cur_state = TAP_RESET;
}
amt_jtagaccel_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
break;
@@ -397,7 +397,7 @@
}
cmd = cmd->next;
}
-
+
return retval;
}
@@ -409,16 +409,16 @@
version.dwOSVersionInfoSize = sizeof version;
if (!GetVersionEx( &version )) {
- errno = EINVAL;
- return -1;
+ errno = EINVAL;
+ return -1;
}
if (version.dwPlatformId != VER_PLATFORM_WIN32_NT)
- return 0;
+ return 0;
h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if (h == INVALID_HANDLE_VALUE) {
- errno = ENODEV;
- return -1;
+ errno = ENODEV;
+ return -1;
}
CloseHandle( h );
@@ -437,7 +437,7 @@
u8 status_port;
#endif
u8 ar_status;
-
+
#if PARPORT_USE_PPDEV == 1
if (device_handle > 0)
{
@@ -447,7 +447,7 @@
snprintf(buffer, 256, "/dev/parport%d", amt_jtagaccel_port);
device_handle = open(buffer, O_RDWR);
-
+
if (device_handle < 0)
{
LOG_ERROR("cannot open device. check it exists and that user read and write rights are set");
@@ -468,7 +468,7 @@
LOG_ERROR(" cannot set compatible mode to device");
return ERROR_JTAG_INIT_FAILED;
}
-
+
control_port = 0x00;
i = ioctl(device_handle, PPWCONTROL, &control_port);
@@ -484,57 +484,57 @@
#if PARPORT_USE_GIVEIO == 1
if (amt_jtagaccel_get_giveio_access() != 0) {
-#else /* PARPORT_USE_GIVEIO */
+#else /* PARPORT_USE_GIVEIO */
if (ioperm(amt_jtagaccel_port, 5, 1) != 0) {
#endif /* PARPORT_USE_GIVEIO */
LOG_ERROR("missing privileges for direct i/o");
return ERROR_JTAG_INIT_FAILED;
}
-
+
/* prepare epp port */
/* clear timeout */
status_port = inb(amt_jtagaccel_port + 1);
outb(status_port | 0x1, amt_jtagaccel_port + 1);
-
+
/* reset epp port */
outb(0x00, amt_jtagaccel_port + 2);
outb(0x04, amt_jtagaccel_port + 2);
#endif
-
+
if (rtck_enabled)
- {
+ {
/* set RTCK enable bit */
aw_control_fsm |= 0x02;
}
-
+
/* enable JTAG port */
aw_control_fsm |= 0x04;
AMT_AW(aw_control_fsm);
-
+
amt_jtagaccel_speed(jtag_speed);
-
+
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
aw_control_rst &= ~0x8;
else
aw_control_rst |= 0x8;
-
+
if (jtag_reset_config & RESET_SRST_PUSH_PULL)
aw_control_rst &= ~0x2;
else
aw_control_rst |= 0x2;
-
+
amt_jtagaccel_reset(0, 0);
-
+
/* read status register */
AMT_AR(ar_status);
LOG_DEBUG("AR_STATUS: 0x%2.2x", ar_status);
-
+
return ERROR_OK;
}
int amt_jtagaccel_quit(void)
{
-
+
return ERROR_OK;
}
@@ -568,6 +568,6 @@
rtck_enabled = 0;
}
}
-
+
return ERROR_OK;
}
Modified: branches/openocd_1_0_branch/src/jtag/bitbang.c
===================================================================
--- branches/openocd_1_0_branch/src/jtag/bitbang.c 2008-12-13 06:59:24 UTC (rev 1235)
+++ branches/openocd_1_0_branch/src/jtag/bitbang.c 2008-12-13 07:02:56 UTC (rev 1236)
@@ -41,24 +41,24 @@
/* DANGER!!!! clock absolutely *MUST* be 0 in idle or reset won't work!
- *
+ *
* Set this to 1 and str912 reset halt will fail.
- *
+ *
* If someone can submit a patch with an explanation it will be greatly
* appreciated, but as far as I can tell () DCLK is generated upon
- * clk=0 in TAP_RTI. Good luck deducing that from the ARM documentation!
- * The ARM documentation uses the term "DCLK is asserted while in the TAP_RTI
+ * clk=0 in TAP_IDLE. Good luck deducing that from the ARM documentation!
+ * The ARM documentation uses the term "DCLK is asserted while in the TAP_IDLE
* state". With hardware there is no such thing as *while* in a state. There
* are only edges. So clk => 0 is in fact a very subtle state transition that
- * happens *while* in the TAP_RTI state. "#&"#&"#&"#&
- *
+ * happens *while* in the TAP_IDLE state. "#&"#&"#&"#&
+ *
* For "reset halt" the last thing that happens before srst is asserted
* is that the breakpoint is set up. If DCLK is not wiggled one last
* time before the reset, then the breakpoint is not set up and
* "reset halt" will fail to halt.
- *
+ *
*/
-#define CLOCK_IDLE() 0
+#define CLOCK_IDLE() 0
int bitbang_execute_queue(void);
@@ -76,10 +76,10 @@
}
void bitbang_state_move(void) {
-
+
int i=0, tms=0;
u8 tms_scan = TAP_MOVE(cur_state, end_state);
-
+
for (i = 0; i < 7; i++)
{
tms = (tms_scan >> i) & 1;
@@ -87,7 +87,7 @@
bitbang_interface->write(1, tms, 0);
}
bitbang_interface->write(CLOCK_IDLE(), tms, 0);
-
+
cur_state = end_state;
}
@@ -113,7 +113,7 @@
LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
exit(-1);
}
-
+
bitbang_interface->write(0, tms, 0);
bitbang_interface->write(1, tms, 0);
@@ -121,7 +121,7 @@
state_count++;
num_states--;
}
-
+
bitbang_interface->write(CLOCK_IDLE(), tms, 0);
end_state = cur_state;
@@ -130,16 +130,16 @@
void bitbang_runtest(int num_cycles)
{
int i;
-
+
enum tap_state saved_end_state = end_state;
-
- /* only do a state_move when we're not already in RTI */
- if (cur_state != TAP_RTI)
+
+ /* only do a state_move when we're not already in IDLE */
+ if (cur_state != TAP_IDLE)
{
- bitbang_end_state(TAP_RTI);
+ bitbang_end_state(TAP_IDLE);
bitbang_state_move();
}
-
+
/* execute num_cycles */
for (i = 0; i < num_cycles; i++)
{
@@ -147,7 +147,7 @@
bitbang_interface->write(1, 0, 0);
}
bitbang_interface->write(CLOCK_IDLE(), 0, 0);
-
+
/* finish in end_state */
bitbang_end_state(saved_end_state);
if (cur_state != end_state)
@@ -158,13 +158,13 @@
{
enum tap_state saved_end_state = end_state;
int bit_cnt;
-
- if (!((!ir_scan && (cur_state == TAP_SD)) || (ir_scan && (cur_state == TAP_SI))))
+
+ if (!((!ir_scan && (cur_state == TAP_DRSHIFT)) || (ir_scan && (cur_state == TAP_IRSHIFT))))
{
if (ir_scan)
- bitbang_end_state(TAP_SI);
+ bitbang_end_state(TAP_IRSHIFT);
else
- bitbang_end_state(TAP_SD);
+ bitbang_end_state(TAP_DRSHIFT);
bitbang_state_move();
bitbang_end_state(saved_end_state);
@@ -181,7 +181,7 @@
/* if we're just reading the scan, but don't care about the output
* default to outputting 'low', this also makes valgrind traces more readable,
* as it removes the dependency on an uninitialised value
- */
+ */
tdi=0;
if ((type != SCAN_IN) && (buffer[bytec] & bcval))
tdi=1;
@@ -192,7 +192,7 @@
val=bitbang_interface->read();
bitbang_interface->write(1, tms, tdi);
-
+
if (type != SCAN_OUT)
{
if (val)
@@ -201,21 +201,21 @@
buffer[bytec] &= ~bcval;
}
}
-
- /* TAP_SD & TAP_SI are illegal end states, so we always transition to the pause
+
+ /* TAP_DRSHIFT & TAP_IRSHIFT are illegal end states, so we always transition to the pause
* state which is a legal stable state from which statemove will work.
- *
- * Exit1 -> Pause
+ *
+ * Exit1 -> Pause
*/
bitbang_interface->write(0, 0, 0);
bitbang_interface->write(1, 0, 0);
bitbang_interface->write(CLOCK_IDLE(), 0, 0);
-
+
if (ir_scan)
- cur_state = TAP_PI;
+ cur_state = TAP_IRPAUSE;
else
- cur_state = TAP_PD;
-
+ cur_state = TAP_DRPAUSE;
+
if (cur_state != end_state)
bitbang_state_move();
}
@@ -227,18 +227,18 @@
enum scan_type type;
u8 *buffer;
int retval;
-
+
if (!bitbang_interface)
{
LOG_ERROR("BUG: Bitbang interface called, but not yet initialized");
exit(-1);
}
-
+
/* return ERROR_OK, unless a jtag_read_buffer returns a failed check
* that wasn't handled by a caller-provided error handler
- */
+ */
retval = ERROR_OK;
-
+
if(bitbang_interface->blink)
bitbang_interface->blink(1);
@@ -259,7 +259,7 @@
#endif
if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
{
- cur_state = TAP_TLR;
+ cur_state = TAP_RESET;
}
bitbang_interface->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
break;
@@ -313,7 +313,7 @@
}
if(bitbang_interface->blink)
bitbang_interface->blink(0);
-
+
return retval;
}
Modified: branches/openocd_1_0_branch/src/jtag/bitq.c
===================================================================
--- branches/openocd_1_0_branch/src/jtag/bitq.c 2008-12-13 06:59:24 UTC (rev 1235)
+++ branches/openocd_1_0_branch/src/jtag/bitq.c 2008-12-13 07:02:56 UTC (rev 1236)
@@ -194,8 +194,8 @@
{
int i;
- /* only do a state_move when we're not already in RTI */
- if (cur_state != TAP_RTI) bitq_state_move(TAP_RTI);
+ /* only do a state_move when we're not already in IDLE */
+ if (cur_state != TAP_IDLE) bitq_state_move(TAP_IDLE);
/* execute num_cycles */
for (i = 0; i < num_cycles; i++)
@@ -240,8 +240,8 @@
if (pause) {
bitq_io(0,0,0);
- if (cur_state==TAP_SI) cur_state=TAP_PI;
- else if (cur_state==TAP_SD) cur_state=TAP_PD;
+ if (cur_state==TAP_IRSHIFT) cur_state=TAP_IRPAUSE;
+ else if (cur_state==TAP_DRSHIFT) cur_state=TAP_DRPAUSE;
}
}
@@ -250,8 +250,8 @@
{
int i;
- if (cmd->ir_scan) bitq_state_move(TAP_SI);
- else bitq_state_move(TAP_SD);
+ if (cmd->ir_scan) bitq_state_move(TAP_IRSHIFT);
+ else bitq_state_move(TAP_DRSHIFT);
for (i=0; i < cmd->num_fields-1; i++)
bitq_scan_field(&cmd->fields[i], 0);
@@ -285,7 +285,7 @@
#endif
if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
{
- cur_state = TAP_TLR;
+ cur_state = TAP_RESET;
}
bitq_interface->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
if (bitq_interface->in_rdy()) bitq_in_proc();
Modified: branches/openocd_1_0_branch/src/jtag/ft2232.c
===================================================================
--- branches/openocd_1_0_branch/src/jtag/ft2232.c 2008-12-13 06:59:24 UTC (rev 1235)
+++ branches/openocd_1_0_branch/src/jtag/ft2232.c 2008-12-13 07:02:56 UTC (rev 1236)
@@ -102,6 +102,7 @@
int turtle_init(void);
int comstick_init(void);
int stm32stick_init(void);
+int axm0432_jtag_init(void);
/* reset procedures for supported layouts */
void usbjtag_reset(int trst, int srst);
@@ -111,6 +112,7 @@
void turtle_reset(int trst, int srst);
void comstick_reset(int trst, int srst);
void stm32stick_reset(int trst, int srst);
+void axm0432_jtag_reset(int trst, int srst);
/* blink procedures for layouts that support a blinking led */
void olimex_jtag_blink(void);
@@ -129,6 +131,7 @@
{"turtelizer2", turtle_init, turtle_reset, turtle_jtag_blink},
{"comstick", comstick_init, comstick_reset, NULL},
{"stm32stick", stm32stick_init, stm32stick_reset, NULL},
+ {"axm0432_jtag", axm0432_jtag_init, axm0432_jtag_reset, NULL},
{NULL, NULL, NULL},
};
@@ -154,13 +157,13 @@
#define BUFFER_ADD ft2232_buffer[ft2232_buffer_size++]
#define BUFFER_READ ft2232_buffer[ft2232_read_pointer++]
-jtag_interface_t ft2232_interface =
+jtag_interface_t ft2232_interface =
{
.name = "ft2232",
.execute_queue = ft2232_execute_queue,
.speed = ft2232_speed,
.speed_div = ft2232_speed_div,
- .khz = ft2232_khz,
+ .khz = ft2232_khz,
.register_commands = ft2232_register_commands,
.init = ft2232_init,
.quit = ft2232_quit,
@@ -180,7 +183,7 @@
else
{
*bytes_written = dw_bytes_written;
- return ERROR_OK;
+ return ERROR_OK;
}
#elif BUILD_FT2232_LIBFTDI == 1
int retval;
@@ -193,7 +196,7 @@
else
{
*bytes_written = retval;
- return ERROR_OK;
+ return ERROR_OK;
}
#endif
}
@@ -208,20 +211,20 @@
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;
+ *bytes_read = 0;
LOG_ERROR("FT_Read returned: %lu", status);
return ERROR_JTAG_DEVICE_ERROR;
}
- *bytes_read += dw_bytes_read;
+ *bytes_read += dw_bytes_read;
}
#elif BUILD_FT2232_LIBFTDI == 1
int retval;
int timeout = 100;
*bytes_read = 0;
-
+
while ((*bytes_read < size) && timeout--)
{
if ((retval = ftdi_read_data(&ftdic, buf + *bytes_read, size - *bytes_read)) < 0)
@@ -239,7 +242,7 @@
LOG_ERROR("couldn't read the requested number of bytes from FT2232 device (%i < %i)", *bytes_read, size);
return ERROR_JTAG_DEVICE_ERROR;
}
-
+
return ERROR_OK;
}
@@ -252,7 +255,7 @@
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))
{
@@ -265,12 +268,12 @@
int ft2232_speed_div(int speed, int *khz)
{
- /* Take a look in the FT2232 manual,
+ /* Take a look in the FT2232 manual,
* AN2232C-01 Command Processor for
* MPSSE and MCU Host Bus. Chapter 3.8 */
-
+
*khz = 6000 / (1+speed);
-
+
return ERROR_OK;
}
@@ -281,35 +284,35 @@
LOG_ERROR("RCLK not supported");
return ERROR_FAIL;
}
- /* Take a look in the FT2232 manual,
+ /* Take a look in the FT2232 manual,
* AN2232C-01 Command Processor for
* MPSSE and MCU Host Bus. Chapter 3.8
- *
+ *
* We will calc here with a multiplier
* of 10 for better rounding later. */
-
+
/* Calc speed, (6000 / khz) - 1 */
/* Use 65000 for better rounding */
*jtag_speed = (60000 / khz) - 10;
-
+
/* Add 0.9 for rounding */
*jtag_speed += 9;
-
+
/* Calc real speed */
*jtag_speed = *jtag_speed / 10;
-
+
/* Check if speed is greater than 0 */
if (*jtag_speed < 0)
{
*jtag_speed = 0;
}
-
+
/* Check max value */
if (*jtag_speed > 0xFFFF)
{
*jtag_speed = 0xFFFF;
}
-
+
return ERROR_OK;
}
@@ -368,7 +371,7 @@
int i;
char line[256];
char *line_p = line;
-
+
for (i = 0; i < ft2232_buffer_size; i++)
{
line_p += snprintf(line_p, 256 - (line_p - line), "%2.2x ", ft2232_buffer[i]);
@@ -378,7 +381,7 @@
line_p = line;
}
}
-
+
if (line_p != line)
LOG_DEBUG("%s", line);
}
@@ -392,7 +395,7 @@
int retval;
u32 bytes_written;
u32 bytes_read;
-
+
#ifdef _DEBUG_USB_IO_
struct timeval start, inter, inter2, end;
struct timeval d_inter, d_inter2, d_end;
@@ -404,7 +407,7 @@
#endif
#ifdef _DEBUG_USB_IO_
- gettimeofday(&start, NULL);
+ gettimeofday(&start, NULL);
#endif
if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK)
@@ -412,28 +415,28 @@
LOG_ERROR("couldn't write MPSSE commands to FT2232");
return retval;
}
-
+
#ifdef _DEBUG_USB_IO_
- gettimeofday(&inter, NULL);
+ gettimeofday(&inter, NULL);
#endif
-
+
if (ft2232_expect_read)
{
int timeout = 100;
ft2232_buffer_size = 0;
-
+
#ifdef _DEBUG_USB_IO_
- gettimeofday(&inter2, NULL);
+ gettimeofday(&inter2, NULL);
#endif
-
+
if ((retval = ft2232_read(ft2232_buffer, ft2232_expect_read, &bytes_read)) != ERROR_OK)
{
LOG_ERROR("couldn't read from FT2232");
return retval;
}
-
+
#ifdef _DEBUG_USB_IO_
- gettimeofday(&end, NULL);
+ gettimeofday(&end, NULL);
timeval_subtract(&d_inter, &inter, &start);
timeval_subtract(&d_inter2, &inter2, &start);
@@ -441,14 +444,14 @@
LOG_INFO("inter: %i.%i, inter2: %i.%i end: %i.%i", d_inter.tv_sec, d_inter.tv_usec, d_inter2.tv_sec, d_inter2.tv_usec, d_end.tv_sec, d_end.tv_usec);
#endif
-
-
+
+
ft2232_buffer_size = bytes_read;
-
+
if (ft2232_expect_read != ft2232_buffer_size)
{
LOG_ERROR("ft2232_expect_read (%i) != ft2232_buffer_size (%i) (%i retries)", ft2232_expect_read, ft2232_buffer_size, 100 - timeout);
- ft2232_debug_dump_buffer();
+ ft2232_debug_dump_buffer();
exit(-1);
}
@@ -461,12 +464,12 @@
ft2232_expect_read = 0;
ft2232_read_pointer = 0;
-
+
/* return ERROR_OK, unless a jtag_read_buffer returns a failed check
* that wasn't handled by a caller-provided error handler
- */
+ */
retval = ERROR_OK;
-
+
cmd = first;
while (cmd != last)
{
@@ -489,7 +492,7 @@
}
cmd = cmd->next;
}
-
+
ft2232_buffer_size = 0;
return retval;
@@ -505,7 +508,7 @@
while (num_states)
{
int bit_count = 0;
-
+
int num_states_batch = num_states > 7 ? 7 : num_states;
tms_byte = 0x0;
@@ -513,7 +516,7 @@
BUFFER_ADD = 0x4b;
/* number of states remaining */
BUFFER_ADD = num_states_batch - 1;
-
+
while (num_states_batch--)
{
if (tap_transitions[cur_state].low == cmd->path[state_count])
@@ -530,10 +533,10 @@
state_count++;
num_states--;
}
-
+
BUFFER_ADD = tms_byte;
}
-
+
end_state = cur_state;
}
@@ -544,7 +547,7 @@
int cur_byte = 0;
int last_bit;
- if (!((!ir_scan && (cur_state == TAP_SD)) || (ir_scan && (cur_state == TAP_SI))))
+ if (!((!ir_scan && (cur_state == TAP_DRSHIFT)) || (ir_scan && (cur_state == TAP_IRSHIFT))))
{
/* command "Clock Data to TMS/CS Pin (no Read)" */
BUFFER_ADD = 0x4b;
@@ -553,17 +556,17 @@
/* TMS data bits */
if (ir_scan)
{
- BUFFER_ADD = TAP_MOVE(cur_state, TAP_SI);
- cur_state = TAP_SI;
+ BUFFER_ADD = TAP_MOVE(cur_state, TAP_IRSHIFT);
+ cur_state = TAP_IRSHIFT;
}
else
{
- BUFFER_ADD = TAP_MOVE(cur_state, TAP_SD);
- cur_state = TAP_SD;
+ BUFFER_ADD = TAP_MOVE(cur_state, TAP_DRSHIFT);
+ cur_state = TAP_DRSHIFT;
}
/* LOG_DEBUG("added TMS scan (no read)"); */
}
-
+
/* add command for complete bytes */
while (num_bytes > 1)
{
@@ -605,7 +608,7 @@
bits_left -= 8 * (thisrun_bytes);
}
}
-
+
/* the most signifcant bit is scanned during TAP movement */
if (type != SCAN_IN)
last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1;
@@ -638,8 +641,8 @@
BUFFER_ADD = buffer[cur_byte];
}
- if ((ir_scan && (end_state == TAP_SI)) ||
- (!ir_scan && (end_state == TAP_SD)))
+ if ((ir_scan && (end_state == TAP_IRSHIFT)) ||
+ (!ir_scan && (end_state == TAP_DRSHIFT)))
{
if (type == SCAN_IO)
{
@@ -695,24 +698,24 @@
u32 bytes_read;
int retval;
int thisrun_read = 0;
-
+
if (cmd->ir_scan)
{
LOG_ERROR("BUG: large IR scans are not supported");
exit(-1);
}
- if (cur_state != TAP_SD)
+ if (cur_state != TAP_DRSHIFT)
{
/* command "Clock Data to TMS/CS Pin (no Read)" */
BUFFER_ADD = 0x4b;
/* scan 7 bit */
BUFFER_ADD = 0x6;
/* TMS data bits */
- BUFFER_ADD = TAP_MOVE(cur_state, TAP_SD);
- cur_state = TAP_SD;
+ BUFFER_ADD = TAP_MOVE(cur_state, TAP_DRSHIFT);
+ cur_state = TAP_DRSHIFT;
}
-
+
if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK)
{
LOG_ERROR("couldn't write MPSSE commands to FT2232");
@@ -720,12 +723,12 @@
}
LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i", ft2232_buffer_size, bytes_written);
ft2232_buffer_size = 0;
-
+
/* add command for complete bytes */
while (num_bytes > 1)
{
int thisrun_bytes;
-
+
if (type == SCAN_IO)
{
/* Clock Data Bytes In and Out LSB First */
@@ -771,7 +774,7 @@
}
LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i", ft2232_buffer_size, bytes_written);
ft2232_buffer_size = 0;
-
+
if (type != SCAN_OUT)
{
if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK)
@@ -783,9 +786,9 @@
receive_pointer += bytes_read;
}
}
-
+
thisrun_read = 0;
-
+
/* the most signifcant bit is scanned during TAP movement */
if (type != SCAN_IN)
last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1;
@@ -816,12 +819,12 @@
BUFFER_ADD = bits_left - 2;
if (type != SCAN_IN)
BUFFER_ADD = buffer[cur_byte];
-
+
if (type != SCAN_OUT)
thisrun_read += 2;
}
- if (end_state == TAP_SD)
+ if (end_state == TAP_DRSHIFT)
{
if (type == SCAN_IO)
{
@@ -863,10 +866,10 @@
BUFFER_ADD = TAP_MOVE(cur_state, end_state) | (last_bit << 7);
cur_state = end_state;
}
-
+
if (type != SCAN_OUT)
thisrun_read += 1;
-
+
if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK)
{
LOG_ERROR("couldn't write MPSSE commands to FT2232");
@@ -874,7 +877,7 @@
}
LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i", ft2232_buffer_size, bytes_written);
ft2232_buffer_size = 0;
-
+
if (type != SCAN_OUT)
{
if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK)
@@ -885,7 +888,7 @@
LOG_DEBUG("thisrun_read: %i, bytes_read: %i", thisrun_read, bytes_read);
receive_pointer += bytes_read;
}
-
+
return ERROR_OK;
}
@@ -893,10 +896,10 @@
{
int predicted_size = 3;
int num_bytes = (scan_size - 1) / 8;
-
- if (cur_state != TAP_SD)
+
+ if (cur_state != TAP_DRSHIFT)
predicted_size += 3;
-
+
if (type == SCAN_IN) /* only from device to host */
{
/* complete bytes */
@@ -918,7 +921,7 @@
int ft2232_predict_scan_in(int scan_size, enum scan_type type)
{
int predicted_size = 0;
-
+
if (type != SCAN_OUT)
{
/* complete bytes */
@@ -928,7 +931,7 @@
/* last bit (from TMS scan) */
predicted_size += 1;
}
-
+
/* LOG_DEBUG("scan_size: %i, predicted_size: %i", scan_size, predicted_size); */
return predicted_size;
@@ -965,7 +968,7 @@
else
low_direction &= ~nSRSTnOE; /* switch to input pin (high-Z) */
}
-
+
/* command "set data bits low byte" */
BUFFER_ADD = 0x80;
BUFFER_ADD = low_output;
@@ -1004,7 +1007,7 @@
else
high_output |= nSRSTnOE;
}
-
+
/* command "set data bits high byte" */
BUFFER_ADD = 0x82;
BUFFER_ADD = high_output;
@@ -1045,6 +1048,34 @@
LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction);
}
+void axm0432_jtag_reset(int trst, int srst)
+{
+ if (trst == 1)
+ {
+ cur_state = TAP_RESET;
+ high_output &= ~nTRST;
+ }
+ else if (trst == 0)
+ {
+ high_output |= nTRST;
+ }
+
+ if (srst == 1)
+ {
+ high_output &= ~nSRST;
+ }
+ else if (srst == 0)
+ {
+ high_output |= nSRST;
+ }
+
+ /* command "set data bits low byte" */
+ BUFFER_ADD = 0x82;
+ BUFFER_ADD = high_output;
+ BUFFER_ADD = high_direction;
+ LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction);
+}
+
void flyswatter_reset(int trst, int srst)
{
if (trst == 1)
@@ -1075,7 +1106,7 @@
void turtle_reset(int trst, int srst)
{
trst = trst;
-
+
if (srst == 1)
{
low_output |= nSRST;
@@ -1084,7 +1115,7 @@
{
low_output &= ~nSRST;
}
-
+
/* command "set data bits low byte" */
BUFFER_ADD = 0x80;
BUFFER_ADD = low_output;
@@ -1111,7 +1142,7 @@
{
high_output |= nSRST;
}
-
+
/* command "set data bits high byte" */
BUFFER_ADD = 0x82;
BUFFER_ADD = high_output;
@@ -1138,12 +1169,12 @@
{
low_output |= nSRST;
}
-
+
/* command "set data bits low byte" */
BUFFER_ADD = 0x80;
BUFFER_ADD = low_output;
BUFFER_ADD = low_direction;
-
+
/* command "set data bits high byte" */
BUFFER_ADD = 0x82;
BUFFER_ADD = high_output;
@@ -1162,15 +1193,15 @@
int predicted_size = 0;
int require_send = 0;
int retval;
-
+
/* return ERROR_OK, unless ft2232_send_and_recv reports a failed check
* that wasn't handled by a caller-provided error handler
- */
+ */
retval = ERROR_OK;
ft2232_buffer_size = 0;
ft2232_expect_read = 0;
-
+
/* blink, if the current layout has that feature */
if (layout->blink)
layout->blink();
@@ -1196,24 +1227,24 @@
if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
{
- cur_state = TAP_TLR;
+ cur_state = TAP_RESET;
}
layout->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
require_send = 1;
-
-#ifdef _DEBUG_JTAG_IO_
+
+#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("trst: %i, srst: %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
#endif
break;
case JTAG_RUNTEST:
/* only send the maximum buffer size that FT2232C can handle */
predicted_size = 0;
- if (cur_state != TAP_RTI)
+ if (cur_state != TAP_IDLE)
predicted_size += 3;
predicted_size += 3 * CEIL(cmd->cmd.runtest->num_cycles, 7);
- if ((cmd->cmd.runtest->end_state != -1) && (cmd->cmd.runtest->end_state != TAP_RTI))
+ if ((cmd->cmd.runtest->end_state != -1) && (cmd->cmd.runtest->end_state != TAP_IDLE))
predicted_size += 3;
- if ((cmd->cmd.runtest->end_state == -1) && (end_state != TAP_RTI))
+ if ((cmd->cmd.runtest->end_state == -1) && (end_state != TAP_IDLE))
predicted_size += 3;
if (ft2232_buffer_size + predicted_size + 1 > FT2232_BUFFER_SIZE)
{
@@ -1222,15 +1253,15 @@
require_send = 0;
first_unsent = cmd;
}
- if (cur_state != TAP_RTI)
+ if (cur_state != TAP_IDLE)
{
/* command "Clock Data to TMS/CS Pin (no Read)" */
BUFFER_ADD = 0x4b;
/* scan 7 bit */
BUFFER_ADD = 0x6;
/* TMS data bits */
- BUFFER_ADD = TAP_MOVE(cur_state, TAP_RTI);
- cur_state = TAP_RTI;
+ BUFFER_ADD = TAP_MOVE(cur_state, TAP_IDLE);
+ cur_state = TAP_IDLE;
require_send = 1;
}
i = cmd->cmd.runtest->num_cycles;
@@ -1242,7 +1273,7 @@
BUFFER_ADD = (i > 7) ? 6 : (i - 1);
/* TMS data bits */
BUFFER_ADD = 0x0;
- cur_state = TAP_RTI;
+ cur_state = TAP_IDLE;
i -= (i > 7) ? 7 : i;
/* LOG_DEBUG("added TMS scan (no read)"); */
}
@@ -1260,7 +1291,7 @@
/* LOG_DEBUG("added TMS scan (no read)"); */
}
require_send = 1;
-#ifdef _DEBUG_JTAG_IO_
+#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("runtest: %i, end in %i", cmd->cmd.runtest->num_cycles, end_state);
#endif
break;
@@ -1285,7 +1316,7 @@
/* LOG_DEBUG("added TMS scan (no read)"); */
cur_state = end_state;
require_send = 1;
-#ifdef _DEBUG_JTAG_IO_
+#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("statemove: %i", end_state);
#endif
break;
@@ -1301,7 +1332,7 @@
}
ft2232_add_pathmove(cmd->cmd.pathmove);
require_send = 1;
-#ifdef _DEBUG_JTAG_IO_
+#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
#endif
break;
@@ -1316,7 +1347,7 @@
if (first_unsent != cmd)
if (ft2232_send_and_recv(first_unsent, cmd) != ERROR_OK)
retval = ERROR_JTAG_QUEUE_FAILED;
-
+
/* current command */
if (cmd->cmd.scan->end_state != -1)
ft2232_end_state(cmd->cmd.scan->end_state);
@@ -1343,7 +1374,7 @@
require_send = 1;
if (buffer)
free(buffer);
-#ifdef _DEBUG_JTAG_IO_
+#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("%s scan, %i bit, end in %i", (cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size, end_state);
#endif
break;
@@ -1352,7 +1383,7 @@
retval = ERROR_JTAG_QUEUE_FAILED;
first_unsent = cmd->next;
jtag_sleep(cmd->cmd.sleep->us);
-#ifdef _DEBUG_JTAG_IO_
+#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("sleep %i usec", cmd->cmd.sleep->us);
#endif
break;
@@ -1378,15 +1409,13 @@
char *openex_string = NULL;
u8 latency_timer;
- LOG_DEBUG("'ft2232' interface using FTD2XX with '%s' layout (%4.4x:%4.4x)",
- ft2232_layout, vid, pid);
+ 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)
{
- LOG_WARNING("couldn't add %4.4x:%4.4x",
- vid, pid);
+ LOG_WARNING("couldn't add %4.4x:%4.4x", vid, pid);
}
#endif
@@ -1395,7 +1424,7 @@
LOG_WARNING("can't open by device description and serial number, giving precedence to serial");
ft2232_device_desc = NULL;
}
-
+
if (ft2232_device_desc)
{
openex_string = ft2232_device_desc;
@@ -1410,17 +1439,16 @@
{
LOG_ERROR("neither device description nor serial number specified");
LOG_ERROR("please add \"ft2232_device_desc <string>\" or \"ft2232_serial <string>\" to your .cfg file");
-
- return ERROR_JTAG_INIT_FAILED;
+
+ return ERROR_JTAG_INIT_FAILED;
}
if ((status = FT_OpenEx(openex_string, openex_flags, &ftdih)) != FT_OK)
{
DWORD num_devices;
-
+
if (more) {
- LOG_WARNING("unable to open ftdi device (trying more): %lu",
- status);
+ LOG_WARNING("unable to open ftdi device (trying more): %lu", status);
*try_more = 1;
return ERROR_JTAG_INIT_FAILED;
}
@@ -1443,7 +1471,7 @@
for (i = 0; i < num_devices; i++)
LOG_ERROR("%i: %s", i, desc_array[i]);
}
-
+
for (i = 0; i < num_devices; i++)
free(desc_array[i]);
free(desc_array);
@@ -1460,7 +1488,7 @@
LOG_ERROR("unable to set latency timer: %lu", status);
return ERROR_JTAG_INIT_FAILED;
}
-
+
if ((status = FT_GetLatencyTimer(ftdih, &latency_timer)) != FT_OK)
{
LOG_ERROR("unable to get latency timer: %lu", status);
@@ -1470,7 +1498,7 @@
{
LOG_DEBUG("current latency timer: %i", latency_timer);
}
-
+
if ((status = FT_SetTimeouts(ftdih, 5000, 5000)) != FT_OK)
{
LOG_ERROR("unable to set timeouts: %lu", status);
@@ -1540,7 +1568,7 @@
LOG_ERROR("unable to set latency timer");
return ERROR_JTAG_INIT_FAILED;
}
-
+
if (ftdi_get_latency_timer(&ftdic, &latency_timer) < 0)
{
LOG_ERROR("unable to get latency timer");
@@ -1575,13 +1603,13 @@
u32 bytes_written;
ft2232_layout_t *cur_layout = ft2232_layouts;
int i;
-
+
if ((ft2232_layout == NULL) || (ft2232_layout[0] == 0))
{
ft2232_layout = "usbjtag";
LOG_WARNING("No ft2232 layout specified, using default 'usbjtag'");
}
-
+
while (cur_layout->name)
{
if (strcmp(cur_layout->name, ft2232_layout) == 0)
@@ -1597,7 +1625,7 @@
LOG_ERROR("No matching layout found for %s", ft2232_layout);
return ERROR_JTAG_INIT_FAILED;
}
-
+
for (i = 0; 1; i++) {
/*
* "more indicates that there are more IDs to try, so we should
@@ -1617,7 +1645,7 @@
#elif BUILD_FT2232_LIBFTDI == 1
retval = ft2232_init_libftdi(ft2232_vid[i], ft2232_pid[i],
more, &try_more);
-#endif
+#endif
if (retval >= 0)
break;
if (!more || !try_more)
@@ -1643,7 +1671,7 @@
return ft2232_purge_ftd2xx();
#elif BUILD_FT2232_LIBFTDI == 1
return ft2232_purge_libftdi();
-#endif
+#endif
return ERROR_OK;
}
@@ -1652,10 +1680,10 @@
{
u8 buf[3];
u32 bytes_written;
-
+
low_output = 0x08;
low_direction = 0x0b;
-
+
if (strcmp(ft2232_layout, "usbjtag") == 0)
{
nTRST = 0x10;
@@ -1682,9 +1710,9 @@
else
{
LOG_ERROR("BUG: usbjtag_init called for unknown layout '%s'", ft2232_layout);
- return ERROR_JTAG_INIT_FAILED;
+ return ERROR_JTAG_INIT_FAILED;
}
-
+
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
low_direction &= ~nTRSTnOE; /* nTRST input */
@@ -1695,7 +1723,7 @@
low_direction |= nTRSTnOE; /* nTRST output */
low_output |= nTRST; /* nTRST = 1 */
}
-
+
if (jtag_reset_config & RESET_SRST_PUSH_PULL)
{
low_direction |= nSRSTnOE; /* nSRST output */
@@ -1706,42 +1734,111 @@
low_direction &= ~nSRSTnOE; /* nSRST input */
low_output &= ~nSRST; /* nSRST = 0 */
}
-
+
/* initialize low byte for jtag */
buf[0] = 0x80; /* command "set data bits low byte" */
buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, xRST high) */
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))
{
- LOG_ERROR("couldn't initialize FT2232 with 'USBJTAG' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'USBJTAG' layout");
return ERROR_JTAG_INIT_FAILED;
}
return ERROR_OK;
}
+int axm0432_jtag_init(void)
+{
+ u8 buf[3];
+ u32 bytes_written;
+
+ low_output = 0x08;
+ low_direction = 0x2b;
+
+ /* initialize low byte for jtag */
+ buf[0] = 0x80; /* command "set data bits low byte" */
+ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
+ 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))
+ {
+ LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ if (strcmp(layout->name, "axm0432_jtag") == 0)
+ {
+ nTRST = 0x08;
+ nTRSTnOE = 0x0; /* No output enable for TRST*/
+ nSRST = 0x04;
+ nSRSTnOE = 0x0; /* No output enable for SRST*/
+ }
+ else
+ {
+ LOG_ERROR("BUG: axm0432_jtag_init called for non axm0432 layout");
+ exit(-1);
+ }
+
+ high_output = 0x0;
+ high_direction = 0x0c;
+
+ if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
+ {
+ LOG_ERROR("can't set nTRSTOE to push-pull on the Dicarlo jtag");
+ }
+ else
+ {
+ high_output |= nTRST;
+ }
+
+ if (jtag_reset_config & RESET_SRST_PUSH_PULL)
+ {
+ LOG_ERROR("can't set nSRST to push-pull on the Dicarlo jtag");
+ }
+ else
+ {
+ high_output |= nSRST;
+ }
+
+ /* initialize high port */
+ buf[0] = 0x82; /* command "set data bits high byte" */
+ buf[1] = high_output; /* value */
+ 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))
+ {
+ LOG_ERROR("couldn't initialize FT2232 with 'Dicarlo' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ return ERROR_OK;
+}
+
int jtagkey_init(void)
{
u8 buf[3];
u32 bytes_written;
-
+
low_output = 0x08;
low_direction = 0x1b;
-
+
/* initialize low byte for jtag */
buf[0] = 0x80; /* command "set data bits low byte" */
buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
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))
{
- LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
return ERROR_JTAG_INIT_FAILED;
}
-
+
if (strcmp(layout->name, "jtagkey") == 0)
{
nTRST = 0x01;
@@ -1762,7 +1859,7 @@
LOG_ERROR("BUG: jtagkey_init called for non jtagkey layout");
exit(-1);
}
-
+
high_output = 0x0;
high_direction = 0x0f;
@@ -1776,7 +1873,7 @@
high_output &= ~nTRSTnOE;
high_output |= nTRST;
}
-
+
if (jtag_reset_config & RESET_SRST_PUSH_PULL)
{
high_output &= ~nSRSTnOE;
@@ -1787,19 +1884,19 @@
high_output |= nSRSTnOE;
high_output &= ~nSRST;
}
-
+
/* initialize high port */
buf[0] = 0x82; /* command "set data bits high byte" */
buf[1] = high_output; /* value */
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))
{
- LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
return ERROR_JTAG_INIT_FAILED;
}
-
+
return ERROR_OK;
}
@@ -1807,22 +1904,22 @@
{
u8 buf[3];
u32 bytes_written;
-
+
low_output = 0x08;
low_direction = 0x1b;
-
+
/* initialize low byte for jtag */
buf[0] = 0x80; /* command "set data bits low byte" */
buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
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))
{
- LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
return ERROR_JTAG_INIT_FAILED;
}
-
+
nTRST = 0x01;
nTRSTnOE = 0x4;
nSRST = 0x02;
@@ -1841,7 +1938,7 @@
high_output &= ~nTRSTnOE;
high_output |= nTRST;
}
-
+
if (jtag_reset_config & RESET_SRST_PUSH_PULL)
{
LOG_ERROR("can't set nSRST to push-pull on the Olimex ARM-USB-OCD");
@@ -1850,22 +1947,22 @@
{
high_output &= ~nSRST;
}
-
+
/* turn red LED on */
high_output |= 0x08;
-
+
/* initialize high port */
buf[0] = 0x82; /* command "set data bits high byte" */
buf[1] = high_output; /* value */
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))
{
- LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
return ERROR_JTAG_INIT_FAILED;
}
-
+
return ERROR_OK;
}
@@ -1873,22 +1970,22 @@
{
u8 buf[3];
u32 bytes_written;
-
+
low_output = 0x18;
low_direction = 0xfb;
-
+
/* initialize low byte for jtag */
buf[0] = 0x80; /* command "set data bits low byte" */
buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
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))
{
- LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout");
return ERROR_JTAG_INIT_FAILED;
}
-
+
nTRST = 0x10;
nTRSTnOE = 0x0; /* not output enable for nTRST */
nSRST = 0x20;
@@ -1899,19 +1996,19 @@
/* turn red LED1 on, LED2 off */
high_output |= 0x08;
-
+
/* initialize high port */
buf[0] = 0x82; /* command "set data bits high byte" */
buf[1] = high_output; /* value */
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))
{
- LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout");
return ERROR_JTAG_INIT_FAILED;
}
-
+
return ERROR_OK;
}
@@ -1919,39 +2016,39 @@
{
u8 buf[3];
u32 bytes_written;
-
+
low_output = 0x08;
low_direction = 0x5b;
-
+
/* initialize low byte for jtag */
buf[0] = 0x80; /* command "set data bits low byte" */
buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
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))
{
- LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout");
+ LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout");
return ERROR_JTAG_INIT_FAILED;
}
-
+
nSRST = 0x40;
-
+
high_output = 0x00;
high_direction = 0x0C;
-
+
/* initialize high port */
buf[0] = 0x82; /* command "set data bits high byte" */
buf[1] = high_output;
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) || (by...
[truncated message content] |