int ft2232_handle_serial_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int ft2232_handle_layout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int ft2232_handle_vid_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+int ft2232_handle_latency_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
char *ft2232_device_desc = NULL;
char *ft2232_serial = NULL;
char *ft2232_layout = NULL;
+unsigned char ft2232_latency = 2;
#define MAX_USB_IDS 8
/* vid = pid = 0 marks the end of the list */
int usbjtag_init(void);
int jtagkey_init(void);
int olimex_jtag_init(void);
-int m5960_init(void);
+int flyswatter_init(void);
int turtle_init(void);
int comstick_init(void);
void usbjtag_reset(int trst, int srst);
void jtagkey_reset(int trst, int srst);
void olimex_jtag_reset(int trst, int srst);
-void m5960_reset(int trst, int srst);
+void flyswatter_reset(int trst, int srst);
void turtle_reset(int trst, int srst);
void comstick_reset(int trst, int srst);
{"signalyzer", usbjtag_init, usbjtag_reset, NULL},
{"evb_lm3s811", usbjtag_init, usbjtag_reset, NULL},
{"olimex-jtag", olimex_jtag_init, olimex_jtag_reset, olimex_jtag_blink},
- {"m5960", m5960_init, m5960_reset, NULL},
+ {"flyswatter", flyswatter_init, flyswatter_reset, NULL},
{"turtelizer2", turtle_init, turtle_reset, turtle_jtag_blink},
{"comstick", comstick_init, comstick_reset, NULL},
{NULL, NULL, NULL},
while ((*bytes_read < size) && timeout--)
{
- if ((status = FT_Read(ftdih, buf, size, &dw_bytes_read)) != FT_OK)
+ if ((status = FT_Read(ftdih, buf + *bytes_read, size -
+ *bytes_read, &dw_bytes_read)) != FT_OK)
{
*bytes_read = 0;
ERROR("FT_Read returned: %lu", status);
ERROR("couldn't set FT2232 TCK speed");
return retval;
}
+
+ jtag_speed = speed;
return ERROR_OK;
}
COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "ft2232_vid_pid", ft2232_handle_vid_pid_command,
COMMAND_CONFIG, NULL);
+ register_command(cmd_ctx, NULL, "ft2232_latency", ft2232_handle_latency_command,
+ COMMAND_CONFIG, NULL);
return ERROR_OK;
}
DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction);
}
-void m5960_reset(int trst, int srst)
+void flyswatter_reset(int trst, int srst)
{
if (trst == 1)
{
return ERROR_JTAG_INIT_FAILED;
}
- if ((status = FT_SetLatencyTimer(ftdih, 2)) != FT_OK)
+ if ((status = FT_SetLatencyTimer(ftdih, ft2232_latency)) != FT_OK)
{
ERROR("unable to set latency timer: %lu", status);
return ERROR_JTAG_INIT_FAILED;
return ERROR_JTAG_INIT_FAILED;
}
- if (ftdi_set_latency_timer(&ftdic, 2) < 0)
+ if (ftdi_set_latency_timer(&ftdic, ft2232_latency) < 0)
{
ERROR("unable to set latency timer");
return ERROR_JTAG_INIT_FAILED;
return ERROR_OK;
}
-int m5960_init(void)
+int flyswatter_init(void)
{
u8 buf[3];
u32 bytes_written;
if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
- ERROR("couldn't initialize FT2232 with 'm5960' layout");
+ ERROR("couldn't initialize FT2232 with 'flyswatter' layout");
return ERROR_JTAG_INIT_FAILED;
}
if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{
- ERROR("couldn't initialize FT2232 with 'm5960' layout");
+ ERROR("couldn't initialize FT2232 with 'flyswatter' layout");
return ERROR_JTAG_INIT_FAILED;
}
return ERROR_OK;
}
+
+int ft2232_handle_latency_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc == 1)
+ {
+ ft2232_latency = atoi(args[0]);
+ }
+ else
+ {
+ ERROR("expected exactly one argument to ft2232_latency <ms>");
+ }
+
+ return ERROR_OK;
+}
+