- allow FT2232 devices to be opened by serial number instead of device description...
authordrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 12 Oct 2006 16:20:47 +0000 (16:20 +0000)
committerdrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 12 Oct 2006 16:20:47 +0000 (16:20 +0000)
- 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

src/jtag/amt_jtagaccel.c
src/jtag/ft2232.c
src/openocd.c
src/target/arm7_9_common.c

index dde09ff55d00a790120a1eb19a747beb2b772cee..dca5c334af60f1ff51c38940cab9213f5864f192 100644 (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;
                }
        }
        
index 6bb4be93f8a00874612c331407d0d5e1ff7ccd7c..e9fce54be4f6327dde1dfb24a334afb87230a27b 100644 (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)
index 39475b9307d051796131d560b2c216b5a40454ce..4df416e8f221ee4232fa3cda639efe83da9f0ae1 100644 (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");
index e587658776933fa179ae3e13fe84956312020d84..c1a39b6b5bcfe6fbb83e550fa137e43f0c54a426 100644 (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);
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)