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);
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);
{"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},
};
int ft2232_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "ft2232_device_desc", ft2232_handle_device_desc_command,
- COMMAND_CONFIG, NULL);
+ COMMAND_CONFIG, "the USB device description of the FTDI FT2232 device");
register_command(cmd_ctx, NULL, "ft2232_serial", ft2232_handle_serial_command,
- COMMAND_CONFIG, NULL);
+ COMMAND_CONFIG, "the serial number of the FTDI FT2232 device");
register_command(cmd_ctx, NULL, "ft2232_layout", ft2232_handle_layout_command,
- COMMAND_CONFIG, NULL);
+ COMMAND_CONFIG, "the layout of the FT2232 GPIO signals used to control output-enables and reset signals");
register_command(cmd_ctx, NULL, "ft2232_vid_pid", ft2232_handle_vid_pid_command,
- COMMAND_CONFIG, NULL);
+ COMMAND_CONFIG, "the vendor ID and product ID of the FTDI FT2232 device");
register_command(cmd_ctx, NULL, "ft2232_latency", ft2232_handle_latency_command,
- COMMAND_CONFIG, NULL);
+ COMMAND_CONFIG, "set the FT2232 latency timer to a new value");
return ERROR_OK;
}
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_TLR;
+ 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)
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
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;
}
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];
}
nSRST = 0x40;
-
+
high_output = 0x00;
high_direction = 0x0C;
nTRSTnOE = 0x00; /* no output enable for nTRST */
nSRST = 0x02;
nSRSTnOE = 0x00; /* no output enable for nSRST */
-
+
high_output = 0x03;
high_direction = 0x03;
nTRSTnOE = 0x00; /* no output enable for nTRST */
nSRST = 0x80;
nSRSTnOE = 0x00; /* no output enable for nSRST */
-
+
high_output = 0x01;
high_direction = 0x03;