jtag: linuxgpiod: drop extra parenthesis
[openocd.git] / src / jtag / drivers / versaloon / versaloon_include.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /***************************************************************************
4 * Copyright (C) 2009 by Simon Qian <SimonQian@SimonQian.com> *
5 ***************************************************************************/
6
7 #ifndef OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INCLUDE_H
8 #define OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INCLUDE_H
9
10 #include "helper/system.h"
11 /* This file is used to include different header and macros */
12 /* according to different platform */
13 #include <jtag/interface.h>
14 #include <jtag/commands.h>
15
16 #define PARAM_CHECK 1
17
18 #define sleep_ms(ms) jtag_sleep((ms) * 1000)
19 #define TO_STR(name) #name
20
21 #define RESULT int
22 #define LOG_BUG LOG_ERROR
23
24 /* Common error messages */
25 #define ERRMSG_NOT_ENOUGH_MEMORY "Lack of memory."
26 #define ERRCODE_NOT_ENOUGH_MEMORY ERROR_FAIL
27
28 #define ERRMSG_INVALID_VALUE "%d is invalid for %s."
29 #define ERRMSG_INVALID_INDEX "Index %d is invalid for %s."
30 #define ERRMSG_INVALID_USAGE "Invalid usage of %s"
31 #define ERRMSG_INVALID_TARGET "Invalid %s"
32 #define ERRMSG_INVALID_PARAMETER "Invalid parameter of %s."
33 #define ERRMSG_INVALID_INTERFACE_NUM "invalid interface %d"
34 #define ERRMSG_INVALID_BUFFER "Buffer %s is not valid."
35 #define ERRCODE_INVALID_BUFFER ERROR_FAIL
36 #define ERRCODE_INVALID_PARAMETER ERROR_FAIL
37
38 #define ERRMSG_NOT_SUPPORT_BY "%s is not supported by %s."
39
40 #define ERRMSG_FAILURE_OPERATION "Fail to %s."
41 #define ERRMSG_FAILURE_OPERATION_MESSAGE "Fail to %s, %s"
42 #define ERRCODE_FAILURE_OPERATION ERROR_FAIL
43
44 #define GET_U16_MSBFIRST(p) (((*((uint8_t *)(p) + 0)) << 8) | \
45 ((*((uint8_t *)(p) + 1)) << 0))
46 #define GET_U32_MSBFIRST(p) (((*((uint8_t *)(p) + 0)) << 24) | \
47 ((*((uint8_t *)(p) + 1)) << 16) | \
48 ((*((uint8_t *)(p) + 2)) << 8) | \
49 ((*((uint8_t *)(p) + 3)) << 0))
50 #define GET_U16_LSBFIRST(p) (((*((uint8_t *)(p) + 0)) << 0) | \
51 ((*((uint8_t *)(p) + 1)) << 8))
52 #define GET_U32_LSBFIRST(p) (((*((uint8_t *)(p) + 0)) << 0) | \
53 ((*((uint8_t *)(p) + 1)) << 8) | \
54 ((*((uint8_t *)(p) + 2)) << 16) | \
55 ((*((uint8_t *)(p) + 3)) << 24))
56
57 #define SET_U16_MSBFIRST(p, v) \
58 do {\
59 *((uint8_t *)(p) + 0) = (((uint16_t)(v)) >> 8) & 0xFF;\
60 *((uint8_t *)(p) + 1) = (((uint16_t)(v)) >> 0) & 0xFF;\
61 } while (0)
62 #define SET_U32_MSBFIRST(p, v) \
63 do {\
64 *((uint8_t *)(p) + 0) = (((uint32_t)(v)) >> 24) & 0xFF;\
65 *((uint8_t *)(p) + 1) = (((uint32_t)(v)) >> 16) & 0xFF;\
66 *((uint8_t *)(p) + 2) = (((uint32_t)(v)) >> 8) & 0xFF;\
67 *((uint8_t *)(p) + 3) = (((uint32_t)(v)) >> 0) & 0xFF;\
68 } while (0)
69 #define SET_U16_LSBFIRST(p, v) \
70 do {\
71 *((uint8_t *)(p) + 0) = (((uint16_t)(v)) >> 0) & 0xFF;\
72 *((uint8_t *)(p) + 1) = (((uint16_t)(v)) >> 8) & 0xFF;\
73 } while (0)
74 #define SET_U32_LSBFIRST(p, v) \
75 do {\
76 *((uint8_t *)(p) + 0) = (((uint32_t)(v)) >> 0) & 0xFF;\
77 *((uint8_t *)(p) + 1) = (((uint32_t)(v)) >> 8) & 0xFF;\
78 *((uint8_t *)(p) + 2) = (((uint32_t)(v)) >> 16) & 0xFF;\
79 *((uint8_t *)(p) + 3) = (((uint32_t)(v)) >> 24) & 0xFF;\
80 } while (0)
81
82 #define GET_LE_U16(p) GET_U16_LSBFIRST(p)
83 #define GET_LE_U32(p) GET_U32_LSBFIRST(p)
84 #define GET_BE_U16(p) GET_U16_MSBFIRST(p)
85 #define GET_BE_U32(p) GET_U32_MSBFIRST(p)
86 #define SET_LE_U16(p, v) SET_U16_LSBFIRST(p, v)
87 #define SET_LE_U32(p, v) SET_U32_LSBFIRST(p, v)
88 #define SET_BE_U16(p, v) SET_U16_MSBFIRST(p, v)
89 #define SET_BE_U32(p, v) SET_U32_MSBFIRST(p, v)
90
91 #endif /* OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INCLUDE_H */

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)