- allow FT2232 devices to be opened by serial number instead of device description ('ft2232_serial <serial>' command)

- redirect output from target event scripts (currently only reset) to the daemon output (INFO:)
- some minor fixes and enhancements


git-svn-id: svn://svn.berlios.de/openocd/trunk@103 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
drath 2006-10-12 16:20:47 +00:00
parent 94ffacdd93
commit 81294537cd
4 changed files with 67 additions and 18 deletions

View File

@ -181,7 +181,7 @@ void amt_wait_scan_busy()
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);
}
}
@ -434,7 +434,8 @@ int amt_jtagaccel_init(void)
#else
u8 status_port;
#endif
u8 ar_status;
#if PARPORT_USE_PPDEV == 1
if (device_handle > 0)
{
@ -498,6 +499,12 @@ int amt_jtagaccel_init(void)
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);
@ -516,6 +523,10 @@ int amt_jtagaccel_init(void)
amt_jtagaccel_reset(0, 0);
/* read status register */
AMT_AR(ar_status);
DEBUG("AR_STATUS: 0x%2.2x", ar_status);
return ERROR_OK;
}
@ -549,10 +560,10 @@ int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, char *c
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;
}
}

View File

@ -70,10 +70,12 @@ int ft2232_init(void);
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;
@ -238,6 +240,8 @@ 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);
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,
@ -942,6 +946,8 @@ int ft2232_init(void)
#if BUILD_FT2232_FTD2XX == 1
FT_STATUS status;
DWORD openex_flags = 0;
char *openex_string = NULL;
#endif
ft2232_layout_t *cur_layout = ft2232_layouts;
@ -975,13 +981,6 @@ int ft2232_init(void)
#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)
@ -990,7 +989,30 @@ int ft2232_init(void)
}
#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;
@ -1005,7 +1027,7 @@ int ft2232_init(void)
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)
{
@ -1435,6 +1457,20 @@ int ft2232_handle_device_desc_command(struct command_context_s *cmd_ctx, char *c
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)

View File

@ -18,7 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#define OPENOCD_VERSION "Open On-Chip Debugger (2006-09-07 20:00 CEST)"
#define OPENOCD_VERSION "Open On-Chip Debugger (2006-10-12 18:00 CEST)"
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -93,6 +93,8 @@ int main(int argc, char *argv[])
command_done(cfg_cmd_ctx);
command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);
if (jtag_init(cmd_ctx) != ERROR_OK)
return EXIT_FAILURE;
DEBUG("jtag init complete");

View File

@ -1768,7 +1768,7 @@ int arm7_9_read_memory(struct target_s *target, u32 address, u32 size, u32 count
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);
@ -1933,7 +1933,7 @@ int arm7_9_write_memory(struct target_s *target, u32 address, u32 size, u32 coun
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);