JTAG: jtag_tap_init() bugfixes
[openocd.git] / src / jtag / arm-jtag-ew.c
index b951f61bfcaabe681eeb91a3814416919aaad2bd..fa18ef0f59f8371eef027ce6113d3053b27ea152 100644 (file)
@@ -1,5 +1,3 @@
-// vim:ts=4 sw=4:
-
 /***************************************************************************
  *   Copyright (C) 2009 by Dimitar Dimitrov <dinuxbg@gmail.com>            *
  *   based on Dominic Rath's and Benedikt Sauter's usbprog.c               *
@@ -135,7 +133,7 @@ static int armjtagew_execute_queue(void)
                switch (cmd->type)
                {
                        case JTAG_RUNTEST:
-                               DEBUG_JTAG_IO( "runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, \
+                               DEBUG_JTAG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, \
                                        cmd->cmd.runtest->end_state);
 
                                armjtagew_end_state(cmd->cmd.runtest->end_state);
@@ -209,7 +207,7 @@ static int armjtagew_speed(int speed)
 
 
     usb_out_buffer[0] = CMD_SET_TCK_FREQUENCY;
-       buf_set_u32(usb_out_buffer+1, 0, 32, speed);
+       buf_set_u32(usb_out_buffer + 1, 0, 32, speed);
 
     result = armjtagew_usb_message(armjtagew_jtag_handle, 4, 4);
 
@@ -222,7 +220,7 @@ static int armjtagew_speed(int speed)
        usb_out_buffer[0] = CMD_GET_TCK_FREQUENCY;
     result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4);
        speed_real = (int)buf_get_u32(usb_in_buffer,0,32);
-       if(result < 0)
+       if (result < 0)
        {
         LOG_ERROR("ARM-JTAG-EW getting speed failed (%d)", result);
         return ERROR_JTAG_DEVICE_ERROR;
@@ -415,8 +413,8 @@ static void armjtagew_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, i
 
 static void armjtagew_reset(int trst, int srst)
 {
-       const uint8_t trst_mask = (1u<<5);
-       const uint8_t srst_mask = (1u<<6);
+       const uint8_t trst_mask = (1u << 5);
+       const uint8_t srst_mask = (1u << 6);
        uint8_t val = 0;
        uint8_t outp_en = 0;
        uint8_t change_mask = 0;
@@ -472,14 +470,14 @@ static int armjtagew_get_status(void)
        if (result == 0)
        {
                unsigned int u_tg = buf_get_u32(usb_in_buffer, 0, 16);
-               LOG_INFO("U_tg = %d mV, U_aux = %d mV, U_tgpwr = %d mV, I_tgpwr = %d mA, D1 = %d, Target power %s %s\n", \
-                       buf_get_u32(usb_in_buffer + 0, 0, 16), \
-                       buf_get_u32(usb_in_buffer + 2, 0, 16), \
-                       buf_get_u32(usb_in_buffer + 4, 0, 16), \
-                       buf_get_u32(usb_in_buffer + 6, 0, 16), \
-                       usb_in_buffer[9], \
-                       usb_in_buffer[11] ? "OVERCURRENT" : "OK", \
-                       usb_in_buffer[10] ? "enabled" : "disabled");
+               LOG_INFO("U_tg = %d mV, U_aux = %d mV, U_tgpwr = %d mV, I_tgpwr = %d mA, D1 = %d, Target power %s %s\n",
+                        (int)(buf_get_u32(usb_in_buffer + 0, 0, 16)),
+                        (int)(buf_get_u32(usb_in_buffer + 2, 0, 16)),
+                        (int)(buf_get_u32(usb_in_buffer + 4, 0, 16)),
+                        (int)(buf_get_u32(usb_in_buffer + 6, 0, 16)),
+                        usb_in_buffer[9],
+                        usb_in_buffer[11] ? "OVERCURRENT" : "OK",
+                        usb_in_buffer[10] ? "enabled" : "disabled");
 
                if (u_tg < 1500)
                {
@@ -502,7 +500,7 @@ static int armjtagew_get_version_info(void)
 
        /* query hardware version */
        usb_out_buffer[0] = CMD_GET_VERSION;
-       result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4+15+256);
+       result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4 + 15 + 256);
 
        if (result != 0)
        {
@@ -511,9 +509,9 @@ static int armjtagew_get_version_info(void)
        }
 
 
-       memcpy(sn, usb_in_buffer+4, 15);
+       memcpy(sn, usb_in_buffer + 4, 15);
        sn[15] = '\0';
-       memcpy(auxinfo, usb_in_buffer+4+15, 256);
+       memcpy(auxinfo, usb_in_buffer + 4+15, 256);
        auxinfo[256] = '\0';
 
        LOG_INFO("ARM-JTAG-EW firmware version %d.%d, hardware revision %c, SN=%s, Additional info: %s", \
@@ -653,7 +651,7 @@ static int armjtagew_tap_execute(void)
                byte_length = tap_length / 8;
 
                usb_out_buffer[0] = CMD_TAP_SHIFT;
-               buf_set_u32(usb_out_buffer+1, 0, 16, byte_length);
+               buf_set_u32(usb_out_buffer + 1, 0, 16, byte_length);
 
                tms_offset = 3;
                for (i = 0; i < byte_length; i++)
@@ -674,7 +672,7 @@ static int armjtagew_tap_execute(void)
                        int stat;
 
                        stat = (int)buf_get_u32(usb_in_buffer + byte_length, 0, 32);
-                       if(stat) {
+                       if (stat) {
                                LOG_ERROR("armjtagew_tap_execute, emulator returned error code %d for a CMD_TAP_SHIFT command", stat);
                                return ERROR_JTAG_QUEUE_FAILED;
                        }

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)