retire ERROR_INVALID_ARGUMENTS and replace with ERROR_COMMAND_SYNTAX_ERROR
[openocd.git] / src / jtag / zy1000 / zy1000.c
index ee61003971b464e9a37a8ffa9ec7e443f17e1ce1..22193abd2c74afe84890104e830f1eb27d860220 100644 (file)
@@ -283,7 +283,7 @@ int zy1000_speed(int speed)
                {
                        LOG_USER("valid ZY1000 jtag_speed=[8190,2]. With divisor is %dkHz / even values between 8190-2, i.e. min %dHz, max %dMHz",
                                        ZYLIN_KHZ, (ZYLIN_KHZ * 1000) / 8190, ZYLIN_KHZ / (2 * 1000));
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
 
                int khz;
@@ -325,7 +325,7 @@ COMMAND_HANDLER(handle_power_command)
                LOG_INFO("Target power %s", savePower ? "on" : "off");
                break;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        return ERROR_OK;
@@ -618,6 +618,11 @@ int interface_jtag_add_ir_scan(struct jtag_tap *active, const struct scan_field
                        assert(scan_size <= 32);
                        shiftValueInner(TAP_IRSHIFT, pause_state, scan_size, 0xffffffff);
 
+                       /* Optimization code will check what the cur_instr is set to, so
+                        * we must set it to bypass value.
+                        */
+                       buf_set_ones(tap->cur_instr, tap->ir_length);
+
                        tap->bypass = 1;
                }
        }
@@ -848,7 +853,7 @@ static void jtag_pre_post_bits(struct jtag_tap *tap, int *pre, int *post)
                        TAP_IDLE);
 */
 
-void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, uint8_t *buffer, int little, int count)
+void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, const uint8_t *buffer, int little, int count)
 {
 #if 0
        int i;
@@ -890,7 +895,7 @@ void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, uint8_t *buffer,
 
 
 
-int arm11_run_instr_data_to_core_noack_inner(struct jtag_tap * tap, uint32_t opcode, uint32_t * data, size_t count)
+int arm11_run_instr_data_to_core_noack_inner(struct jtag_tap * tap, uint32_t opcode, const uint32_t * data, size_t count)
 {
        /* bypass bits before and after */
        int pre_bits;
@@ -900,7 +905,7 @@ int arm11_run_instr_data_to_core_noack_inner(struct jtag_tap * tap, uint32_t opc
 
        if ((pre_bits > 32) || (post_bits > 32))
        {
-               int arm11_run_instr_data_to_core_noack_inner_default(struct jtag_tap *, uint32_t, uint32_t *, size_t);
+               int arm11_run_instr_data_to_core_noack_inner_default(struct jtag_tap *, uint32_t, const uint32_t *, size_t);
                return arm11_run_instr_data_to_core_noack_inner_default(tap, opcode, data, count);
        } else
        {
@@ -1291,6 +1296,15 @@ void zy1000_jtag_add_callback4(jtag_callback_t callback, jtag_callback_data_t da
        callbackqueue[callbackqueue_pos].data2 = data2;
        callbackqueue[callbackqueue_pos].data3 = data3;
        callbackqueue_pos++;
+
+       /* KLUDGE!
+        * make callbacks synchronous for now as minidriver requires callback
+        * to be synchronous.
+        *
+        * We can get away with making read and writes asynchronous so we
+        * don't completely kill performance.
+        */
+       zy1000_flush_callbackqueue();
 }
 
 static int zy1000_jtag_convert_to_callback4(jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
@@ -1337,6 +1351,9 @@ static void writeShiftValue(uint8_t *data, int bits)
        readqueue[readqueue_pos].dest = data;
        readqueue[readqueue_pos].bits = bits;
        readqueue_pos++;
+
+       /* KLUDGE!!! minidriver requires readqueue to be synchronous */
+       zy1000_flush_readqueue();
 }
 
 #else
@@ -1500,11 +1517,6 @@ int zy1000_init(void)
 
         /* deassert resets. Important to avoid infinite loop waiting for SRST to deassert */
        zy1000_reset(0, 0);
-       int jtag_speed_var;
-       int retval = jtag_get_speed(&jtag_speed_var);
-       if (retval != ERROR_OK)
-               return retval;
-       zy1000_speed(jtag_speed_var);
 
 #if BUILD_ZY1000_MASTER
 #if BUILD_ECOSBOARD

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)