if (ar_status & 0x80)
{
- ERROR("amt_jtagaccel timed out while waiting for end of scan, rtck was %s", (rtck_enabled) ? "enabled" : "disabled");
+ 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);
exit(-1);
}
}
#else
u8 status_port;
#endif
-
+ u8 ar_status;
+
#if PARPORT_USE_PPDEV == 1
if (device_handle > 0)
{
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_reset(0, 0);
+ /* read status register */
+ AMT_AR(ar_status);
+ DEBUG("AR_STATUS: 0x%2.2x", ar_status);
+
return ERROR_OK;
}
if (strcmp(args[0], "enabled") == 0)
{
rtck_enabled = 1;
-
- /* set RTCK enable bit */
- aw_control_fsm |= 0x02;
- AMT_AW(aw_control_fsm);
+ }
+ else
+ {
+ rtck_enabled = 0;
}
}
int ft2232_quit(void);
int ft2232_handle_device_desc_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+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);
char *ft2232_device_desc = NULL;
+char *ft2232_serial = NULL;
char *ft2232_layout = NULL;
u16 ft2232_vid = 0x0403;
u16 ft2232_pid = 0x6010;
{
register_command(cmd_ctx, NULL, "ft2232_device_desc", ft2232_handle_device_desc_command,
COMMAND_CONFIG, NULL);
+ register_command(cmd_ctx, NULL, "ft2232_serial", ft2232_handle_serial_command,
+ COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "ft2232_layout", ft2232_handle_layout_command,
COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "ft2232_vid_pid", ft2232_handle_vid_pid_command,
#if BUILD_FT2232_FTD2XX == 1
FT_STATUS status;
+ DWORD openex_flags = 0;
+ char *openex_string = NULL;
#endif
ft2232_layout_t *cur_layout = ft2232_layouts;
#endif
#if BUILD_FT2232_FTD2XX == 1
- /* Open by device description */
- if (ft2232_device_desc == NULL)
- {
- WARNING("no ftd2xx device description specified, using default 'Dual RS232'");
- ft2232_device_desc = "Dual RS232";
- }
-
#if IS_WIN32 == 0
/* Add non-standard Vid/Pid to the linux driver */
if ((status = FT_SetVIDPID(ft2232_vid, ft2232_pid)) != FT_OK)
}
#endif
- if ((status = FT_OpenEx(ft2232_device_desc, FT_OPEN_BY_DESCRIPTION, &ftdih)) != FT_OK)
+ if (ft2232_device_desc && ft2232_serial)
+ {
+ WARNING("can't open by device description and serial number, giving precedence to serial");
+ ft2232_device_desc = NULL;
+ }
+ else if (ft2232_device_desc)
+ {
+ openex_string = ft2232_device_desc;
+ openex_flags = FT_OPEN_BY_DESCRIPTION;
+ }
+ else if (ft2232_serial)
+ {
+ openex_string = ft2232_serial;
+ openex_flags = FT_OPEN_BY_SERIAL_NUMBER;
+ }
+ else
+ {
+ ERROR("neither device description nor serial number specified");
+ ERROR("please add \"ft2232_device_desc <string>\" or \"ft2232_serial <string>\" to your .cfg file");
+
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ if ((status = FT_OpenEx(openex_string, openex_flags, &ftdih)) != FT_OK)
{
DWORD num_devices;
desc_array[i] = malloc(64);
desc_array[num_devices] = NULL;
- status = FT_ListDevices(desc_array, &num_devices, FT_LIST_ALL | FT_OPEN_BY_DESCRIPTION);
+ status = FT_ListDevices(desc_array, &num_devices, FT_LIST_ALL | openex_flags);
if (status == FT_OK)
{
return ERROR_OK;
}
+int ft2232_handle_serial_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc == 1)
+ {
+ ft2232_serial = strdup(args[0]);
+ }
+ else
+ {
+ ERROR("expected exactly one argument to ft2232_serial <serial-number>");
+ }
+
+ return ERROR_OK;
+}
+
int ft2232_handle_layout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 0)
if (((cpsr & 0x1f) == ARMV4_5_MODE_ABT) && (armv4_5->core_mode != ARMV4_5_MODE_ABT))
{
- ERROR("memory read caused data abort");
+ ERROR("memory read caused data abort (address: 0x%8.8x, size: 0x%x, count: 0x%x)", address, size, count);
arm7_9->write_xpsr_im8(target, buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 8) & ~0x20, 0, 0);
if (((cpsr & 0x1f) == ARMV4_5_MODE_ABT) && (armv4_5->core_mode != ARMV4_5_MODE_ABT))
{
- ERROR("memory write caused data abort");
+ ERROR("memory write caused data abort (address: 0x%8.8x, size: 0x%x, count: 0x%x)", address, size, count);
arm7_9->write_xpsr_im8(target, buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 8) & ~0x20, 0, 0);