- added support for Asix Presto JTAG interface (thanks to Pavel Chromy and Asix for...
[openocd.git] / src / jtag / jtag.c
index 7ea40edb0e190ff3c06c9dac849a9a1b8d0dfafa..1db8247eaab1a1bed23b8963f539876d2fa5ec6b 100644 (file)
@@ -58,6 +58,8 @@ static cmd_queue_page_t *cmd_queue_pages = NULL;
  * 3: Pause-DR
  * 4: Shift-IR
  * 5: Pause-IR
+ * 
+ * SD->SD and SI->SI have to be caught in interface specific code
  */
 u8 tap_move[6][6] =
 {
@@ -160,6 +162,14 @@ jtag_event_callback_t *jtag_event_callbacks;
        extern jtag_interface_t gw16012_interface;
 #endif
 
+#if BUILD_PRESTO == 1
+       extern jtag_interface_t presto_interface;
+#endif
+
+#if BUILD_USBPROG == 1
+       extern jtag_interface_t usbprog_interface;
+#endif
+
 jtag_interface_t *jtag_interfaces[] = {
 #if BUILD_PARPORT == 1
        &parport_interface,
@@ -181,6 +191,12 @@ jtag_interface_t *jtag_interfaces[] = {
 #endif
 #if BUILD_GW16012 == 1
        &gw16012_interface,
+#endif
+#if BUILD_PRESTO == 1
+       &presto_interface,
+#endif
+#if BUILD_USBPROG == 1
+       &usbprog_interface,
 #endif
        NULL,
 };
@@ -1039,6 +1055,7 @@ int jtag_read_buffer(u8 *buffer, scan_command_t *cmd)
                {
                        int num_bits = cmd->fields[i].num_bits;
                        u8 *captured = buf_set_buf(buffer, bit_count, malloc(CEIL(num_bits, 8)), 0, num_bits);
+                       
                        #ifdef _DEBUG_JTAG_IO_
                                char *char_buf;
 
@@ -1085,9 +1102,6 @@ int jtag_read_buffer(u8 *buffer, scan_command_t *cmd)
                                
                                if (compare_failed)
                                {
-                                       char *captured_char = buf_to_str(captured, (num_bits > 64) ? 64 : num_bits, 16);
-                                       char *in_check_value_char = buf_to_str(cmd->fields[i].in_check_value, (num_bits > 64) ? 64 : num_bits, 16);
-
                                        if (cmd->error_handler)
                                        {
                                                /* ask the error handler if once has been specified if this is a real problem */ 
@@ -1108,6 +1122,9 @@ int jtag_read_buffer(u8 *buffer, scan_command_t *cmd)
                                         */ 
                                        if (compare_failed)
                                        {
+                                               char *captured_char = buf_to_str(captured, (num_bits > 64) ? 64 : num_bits, 16);
+                                               char *in_check_value_char = buf_to_str(cmd->fields[i].in_check_value, (num_bits > 64) ? 64 : num_bits, 16);
+
                                                if (cmd->fields[i].in_check_mask)
                                                {
                                                        char *in_check_mask_char;
@@ -1119,10 +1136,11 @@ int jtag_read_buffer(u8 *buffer, scan_command_t *cmd)
                                                {
                                                        WARNING("value captured during scan didn't pass the requested check: captured: 0x%s check_value: 0x%s", captured_char, in_check_value_char);
                                                }
+
+                                               free(captured_char);
+                                               free(in_check_value_char);
                                        }
                                        
-                                       free(captured_char);
-                                       free(in_check_value_char);
                                }
                        }
                        free(captured);
@@ -1217,7 +1235,7 @@ int jtag_examine_chain()
        
        for (i = 0; i < JTAG_MAX_CHAIN_SIZE; i++)
        {
-               buf_set_u32(idcode_buffer, 0, 32, 0x000000FF);
+               buf_set_u32(idcode_buffer, i * 32, 32, 0x000000FF);
        }
        
        jtag_add_plain_dr_scan(1, &field, TAP_TLR, NULL);
@@ -1281,6 +1299,7 @@ int jtag_examine_chain()
        {
                ERROR("number of discovered devices in JTAG chain (%i) doesn't match configuration (%i)", 
                        device_count, jtag_num_devices);
+               ERROR("check the config file and ensure proper JTAG communication (connections, speed, ...)");
                exit(-1);
        }
        

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)