c8684a77a16728212ea470a1755723270b3ab646
[openocd.git] / src / jtag / drivers / versaloon / usbtoxxx / usbtojtagraw.c
1 /***************************************************************************
2 * Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
18 ***************************************************************************/
19
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23
24 #include <string.h>
25
26 #include "../versaloon_include.h"
27 #include "../versaloon.h"
28 #include "../versaloon_internal.h"
29 #include "usbtoxxx.h"
30 #include "usbtoxxx_internal.h"
31
32 RESULT usbtojtagraw_init(uint8_t interface_index)
33 {
34 return usbtoxxx_init_command(USB_TO_JTAG_RAW, interface_index);
35 }
36
37 RESULT usbtojtagraw_fini(uint8_t interface_index)
38 {
39 return usbtoxxx_fini_command(USB_TO_JTAG_RAW, interface_index);
40 }
41
42 RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t kHz)
43 {
44 uint8_t cfg_buf[4];
45
46 #if PARAM_CHECK
47 if (interface_index > 7) {
48 LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
49 return ERROR_FAIL;
50 }
51 #endif
52
53 SET_LE_U32(&cfg_buf[0], kHz);
54
55 return usbtoxxx_conf_command(USB_TO_JTAG_RAW, interface_index, cfg_buf, 4);
56 }
57
58 RESULT usbtojtagraw_execute(uint8_t interface_index, uint8_t *tdi,
59 uint8_t *tms, uint8_t *tdo, uint32_t bitlen)
60 {
61 uint16_t bytelen;
62
63 #if PARAM_CHECK
64 if (interface_index > 7) {
65 LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
66 return ERROR_FAIL;
67 }
68 #endif
69
70 if (bitlen > 8 * 0xFFFF)
71 return ERROR_FAIL;
72 bytelen = (uint16_t)((bitlen + 7) >> 3);
73
74 SET_LE_U32(&versaloon_cmd_buf[0], bitlen);
75 memcpy(versaloon_cmd_buf + 4, tdi, bytelen);
76 memcpy(versaloon_cmd_buf + 4 + bytelen, tms, bytelen);
77
78 return usbtoxxx_inout_command(USB_TO_JTAG_RAW, interface_index,
79 versaloon_cmd_buf, 4 + bytelen * 2, bytelen, tdo, 0, bytelen, 0);
80 }

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)