build: cleanup src/jtag/drivers directory
[openocd.git] / src / jtag / drivers / versaloon / usbtoxxx / usbtoswd.c
index 93333f088b144151bebc4f9ab48b639a97384c53..1b0733e92443fe484ee714db9140678e5aad756e 100644 (file)
@@ -16,6 +16,7 @@
  *   Free Software Foundation, Inc.,                                       *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 RESULT usbtoswd_callback(void *p, uint8_t *src, uint8_t *processed)
 {
        struct versaloon_pending_t *pending = (struct versaloon_pending_t *)p;
-       
+
        processed = processed;
-       
+
        if (pending->extra_data != NULL)
-       {
                *((uint8_t *)pending->extra_data) = src[0];
-       }
-       
+
        return ERROR_OK;
 }
 
@@ -54,77 +53,73 @@ RESULT usbtoswd_fini(uint8_t interface_index)
 }
 
 RESULT usbtoswd_config(uint8_t interface_index, uint8_t trn, uint16_t retry,
-                                          uint16_t dly)
+       uint16_t dly)
 {
        uint8_t cfg_buf[5];
-       
+
 #if PARAM_CHECK
-       if (interface_index > 7)
-       {
+       if (interface_index > 7) {
                LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
                return ERROR_FAIL;
        }
 #endif
-       
+
        cfg_buf[0] = trn;
        SET_LE_U16(&cfg_buf[1], retry);
        SET_LE_U16(&cfg_buf[3], dly);
-       
+
        return usbtoxxx_conf_command(USB_TO_SWD, interface_index, cfg_buf, 5);
 }
 
 RESULT usbtoswd_seqout(uint8_t interface_index, uint8_t *data, uint16_t bitlen)
 {
        uint16_t bytelen = (bitlen + 7) >> 3;
-       
+
 #if PARAM_CHECK
-       if (interface_index > 7)
-       {
+       if (interface_index > 7) {
                LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
                return ERROR_FAIL;
        }
 #endif
-       
+
        SET_LE_U16(&versaloon_cmd_buf[0], bitlen);
        memcpy(versaloon_cmd_buf + 2, data, bytelen);
-       
+
        return usbtoxxx_out_command(USB_TO_SWD, interface_index,
-                                                               versaloon_cmd_buf, bytelen + 2, 0);
+               versaloon_cmd_buf, bytelen + 2, 0);
 }
 
 RESULT usbtoswd_seqin(uint8_t interface_index, uint8_t *data, uint16_t bitlen)
 {
        uint16_t bytelen = (bitlen + 7) >> 3;
        uint8_t buff[2];
-       
+
 #if PARAM_CHECK
-       if (interface_index > 7)
-       {
+       if (interface_index > 7) {
                LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
                return ERROR_FAIL;
        }
 #endif
-       
+
        SET_LE_U16(&buff[0], bitlen);
-       
+
        return usbtoxxx_in_command(USB_TO_SWD, interface_index, buff, 2, bytelen,
-                                                               data, 0, bytelen, 0);
+               data, 0, bytelen, 0);
 }
 
 RESULT usbtoswd_transact(uint8_t interface_index, uint8_t request,
-                                                       uint32_t *data, uint8_t *ack)
+       uint32_t *data, uint8_t *ack)
 {
        uint8_t parity;
        uint8_t buff[5];
-       
+
 #if PARAM_CHECK
-       if (interface_index > 7)
-       {
+       if (interface_index > 7) {
                LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
                return ERROR_FAIL;
        }
 #endif
-       
+
        parity = (request >> 1) & 1;
        parity += (request >> 2) & 1;
        parity += (request >> 3) & 1;
@@ -132,27 +127,19 @@ RESULT usbtoswd_transact(uint8_t interface_index, uint8_t request,
        parity &= 1;
        buff[0] = (request | 0x81 | (parity << 5)) & ~0x40;
        if (data != NULL)
-       {
                SET_LE_U32(&buff[1], *data);
-       }
        else
-       {
                memset(buff + 1, 0, 4);
-       }
-       
+
        versaloon_set_extra_data(ack);
        versaloon_set_callback(usbtoswd_callback);
-       if (request & 0x04)
-       {
-               // read
+       if (request & 0x04) {
+               /* read */
                return usbtoxxx_inout_command(USB_TO_SWD, interface_index, buff, 5, 5,
-                                                                               (uint8_t *)data, 1, 4, 0);
-       }
-       else
-       {
-               // write
+                       (uint8_t *)data, 1, 4, 0);
+       } else {
+               /* write */
                return usbtoxxx_inout_command(USB_TO_SWD, interface_index, buff, 5, 5,
-                                                                               NULL, 0, 0, 0);
+                       NULL, 0, 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)