jtag: linuxgpiod: drop extra parenthesis
[openocd.git] / src / target / riscv / batch.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 #ifndef TARGET__RISCV__SCANS_H
4 #define TARGET__RISCV__SCANS_H
5
6 #include "target/target.h"
7 #include "jtag/jtag.h"
8 #include "riscv.h"
9
10 enum riscv_scan_type {
11 RISCV_SCAN_TYPE_INVALID,
12 RISCV_SCAN_TYPE_NOP,
13 RISCV_SCAN_TYPE_READ,
14 RISCV_SCAN_TYPE_WRITE,
15 };
16
17 /* A batch of multiple JTAG scans, which are grouped together to avoid the
18 * overhead of some JTAG adapters when sending single commands. This is
19 * designed to support block copies, as that's what we actually need to go
20 * fast. */
21 struct riscv_batch {
22 struct target *target;
23
24 size_t allocated_scans;
25 size_t used_scans;
26
27 size_t idle_count;
28
29 uint8_t *data_out;
30 uint8_t *data_in;
31 struct scan_field *fields;
32
33 /* If in BSCAN mode, this field will be allocated (one per scan),
34 and utilized to tunnel all the scans in the batch. If not in
35 BSCAN mode, this field is unallocated and stays NULL */
36 riscv_bscan_tunneled_scan_context_t *bscan_ctxt;
37
38 /* In JTAG we scan out the previous value's output when performing a
39 * scan. This is a pain for users, so we just provide them the
40 * illusion of not having to do this by eliding all but the last NOP.
41 * */
42 enum riscv_scan_type last_scan;
43
44 /* The read keys. */
45 size_t *read_keys;
46 size_t read_keys_used;
47 };
48
49 /* Allocates (or frees) a new scan set. "scans" is the maximum number of JTAG
50 * scans that can be issued to this object, and idle is the number of JTAG idle
51 * cycles between every real scan. */
52 struct riscv_batch *riscv_batch_alloc(struct target *target, size_t scans, size_t idle);
53 void riscv_batch_free(struct riscv_batch *batch);
54
55 /* Checks to see if this batch is full. */
56 bool riscv_batch_full(struct riscv_batch *batch);
57
58 /* Executes this scan batch. */
59 int riscv_batch_run(struct riscv_batch *batch);
60
61 /* Adds a DMI write to this batch. */
62 void riscv_batch_add_dmi_write(struct riscv_batch *batch, unsigned address, uint64_t data);
63
64 /* DMI reads must be handled in two parts: the first one schedules a read and
65 * provides a key, the second one actually obtains the result of the read -
66 * status (op) and the actual data. */
67 size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, unsigned address);
68 unsigned riscv_batch_get_dmi_read_op(struct riscv_batch *batch, size_t key);
69 uint32_t riscv_batch_get_dmi_read_data(struct riscv_batch *batch, size_t key);
70
71 /* Scans in a NOP. */
72 void riscv_batch_add_nop(struct riscv_batch *batch);
73
74 /* Returns the number of available scans. */
75 size_t riscv_batch_available_scans(struct riscv_batch *batch);
76
77 #endif

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)