target/xtensa: avoid IHI for writes to non-executable memory
[openocd.git] / src / jtag / drivers / versaloon / usbtoxxx / usbtogpio.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2
3 /***************************************************************************
4 * Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com> *
5 ***************************************************************************/
6
7 #ifdef HAVE_CONFIG_H
8 #include "config.h"
9 #endif
10
11 #include <string.h>
12
13 #include "../versaloon_include.h"
14 #include "../versaloon.h"
15 #include "../versaloon_internal.h"
16 #include "usbtoxxx.h"
17 #include "usbtoxxx_internal.h"
18
19 RESULT usbtogpio_init(uint8_t interface_index)
20 {
21 return usbtoxxx_init_command(USB_TO_GPIO, interface_index);
22 }
23
24 RESULT usbtogpio_fini(uint8_t interface_index)
25 {
26 return usbtoxxx_fini_command(USB_TO_GPIO, interface_index);
27 }
28
29 RESULT usbtogpio_config(uint8_t interface_index, uint32_t mask,
30 uint32_t dir_mask, uint32_t pull_en_mask,
31 uint32_t input_pull_mask)
32 {
33 uint8_t conf[8];
34
35 #if PARAM_CHECK
36 if (interface_index > 7) {
37 LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
38 return ERROR_FAIL;
39 }
40 #endif
41
42 dir_mask &= mask;
43 SET_LE_U16(&conf[0], mask);
44 SET_LE_U16(&conf[2], dir_mask);
45 SET_LE_U16(&conf[4], pull_en_mask);
46 SET_LE_U16(&conf[6], input_pull_mask);
47
48 return usbtoxxx_conf_command(USB_TO_GPIO, interface_index, conf,
49 sizeof(conf));
50 }
51
52 RESULT usbtogpio_in(uint8_t interface_index, uint32_t mask, uint32_t *value)
53 {
54 uint8_t buf[2];
55
56 #if PARAM_CHECK
57 if (interface_index > 7) {
58 LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
59 return ERROR_FAIL;
60 }
61 #endif
62
63 SET_LE_U16(&buf[0], mask);
64
65 return usbtoxxx_in_command(USB_TO_GPIO, interface_index, buf, 2, 2,
66 (uint8_t *)value, 0, 2, 0);
67 }
68
69 RESULT usbtogpio_out(uint8_t interface_index, uint32_t mask, uint32_t value)
70 {
71 uint8_t buf[4];
72
73 #if PARAM_CHECK
74 if (interface_index > 7) {
75 LOG_BUG(ERRMSG_INVALID_INTERFACE_NUM, interface_index);
76 return ERROR_FAIL;
77 }
78 #endif
79
80 SET_LE_U16(&buf[0], mask);
81 SET_LE_U16(&buf[2], value);
82
83 return usbtoxxx_out_command(USB_TO_GPIO, interface_index, buf, 4, 0);
84 }

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)