rlink: remove redundant text from log messages
[openocd.git] / src / jtag / drivers / rlink.c
index ae3431bee55e092a5ee388f7c9c71c8bbccb971b..7bc23ba0b618c4668edec02a8ba7e6547e637a16 100644 (file)
@@ -504,7 +504,7 @@ dtc_run_download(
        int     usb_err;
        int     i;
 
-       LOG_DEBUG("%d/%d", command_buffer_size, reply_buffer_size);
+       LOG_DEBUG("%d/%d", command_buffer_size, reply_buffer_size);
 
        usb_err = usb_bulk_write(
                        pHDev_param,
@@ -538,9 +538,7 @@ dtc_run_download(
                if (ep2_buffer[0] & 0x01) break;
 
                if (!--i) {
-                       LOG_ERROR("%s, %d: too many retries waiting for DTC status",
-                                       __FILE__, __LINE__
-                       );
+                       LOG_ERROR("too many retries waiting for DTC status");
                        return(-ETIMEDOUT);
                }
        }
@@ -556,8 +554,8 @@ dtc_run_download(
                );
 
                if (usb_err < (int)sizeof(ep2_buffer)) {
-                       LOG_ERROR("%s, %d: Read of endpoint 2 returned %d",
-                                       __FILE__, __LINE__, usb_err
+                       LOG_ERROR("Read of endpoint 2 returned %d, expected %d",
+                                       usb_err, reply_buffer_size
                        );
                        return(usb_err);
                }
@@ -678,32 +676,26 @@ dtc_queue_run(void) {
        uint8_t                 dtc_mask, tdo_mask;
        uint8_t                 reply_buffer[USB_EP2IN_SIZE];
 
+       assert((dtc_queue.rq_head != 0) == (dtc_queue.reply_index > 0));
+       assert(dtc_queue.cmd_index < USB_EP2BANK_SIZE);
+       assert(dtc_queue.reply_index <= USB_EP2IN_SIZE);
+
        retval = ERROR_OK;
 
        if (dtc_queue.cmd_index < 1) return(retval);
 
        dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = DTC_CMD_STOP;
 
-       /* run the cmd */
-       if (dtc_queue.rq_head == NULL) {
-               usb_err = dtc_run_download(pHDev,
-                               dtc_queue.cmd_buffer, dtc_queue.cmd_index,
-                               NULL, 0
-               );
-               if (usb_err < 0) {
-                       LOG_ERROR("dtc_run_download: %s", usb_strerror());
-                       exit(1);
-               }
-       } else {
-               usb_err = dtc_run_download(pHDev,
-                               dtc_queue.cmd_buffer, dtc_queue.cmd_index,
-                               reply_buffer, dtc_queue.reply_index
-               );
-               if (usb_err < 0) {
-                       LOG_ERROR("dtc_run_download: %s", usb_strerror());
-                       exit(1);
-               }
+       usb_err = dtc_run_download(pHDev,
+                       dtc_queue.cmd_buffer, dtc_queue.cmd_index,
+                       reply_buffer, dtc_queue.reply_index
+       );
+       if (usb_err < 0) {
+               LOG_ERROR("dtc_run_download: %s", usb_strerror());
+               exit(1);
+       }
 
+       if (dtc_queue.rq_head != NULL) {
                /* process the reply, which empties the reply queue and frees its entries */
                dtc_p = reply_buffer;
 
@@ -807,8 +799,6 @@ dtc_queue_run(void) {
        return(retval);
 }
 
-
-
 static
 int
 tap_state_queue_init(void) {
@@ -1232,6 +1222,7 @@ rlink_scan(
                                LOG_ERROR("enqueuing DTC reply entry: %s", strerror(errno));
                                exit(1);
                        }
+                       dtc_queue.reply_index += (chunk_bits + 7) / 8;
 
                        tdi_bit_offset += chunk_bits;
                }
@@ -1264,7 +1255,6 @@ rlink_scan(
                                dtc_mask >>= 1;
                                if (dtc_mask == 0) {
                                        dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = x;
-                                       dtc_queue.reply_index++;
                                        x = 0;
                                        dtc_mask = 1 << (8 - 1);
                                }
@@ -1298,6 +1288,8 @@ rlink_scan(
                        exit(1);
                }
 
+               dtc_queue.reply_index++;
+
                tdi_bit_offset += extra_bits;
 
                if (type == SCAN_IN) {
@@ -1327,8 +1319,6 @@ rlink_scan(
 
                        dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = x;
                }
-
-               dtc_queue.reply_index++;
        }
 
        /* Schedule the last bit into the DTC command buffer */
@@ -1355,10 +1345,10 @@ rlink_scan(
                        exit(1);
                }
 
+               dtc_queue.reply_index++;
+
                dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
                                DTC_CMD_SHIFT_TMS_TDI_BIT_PAIR(1, (*tdi_p & tdi_mask), 1);
-
-               dtc_queue.reply_index++;
        }
 
        /* Move to pause state */
@@ -1505,10 +1495,7 @@ int rlink_speed(int speed)
                        }
 
                        if (dtc_start_download() < 0) {
-                               LOG_ERROR("%s, %d: starting DTC: %s",
-                                               __FILE__, __LINE__,
-                                               usb_strerror()
-                               );
+                               LOG_ERROR("starting DTC: %s", usb_strerror());
                                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)