Add RISC-V support.
[openocd.git] / src / target / riscv / batch.h
1 #ifndef TARGET__RISCV__SCANS_H
2 #define TARGET__RISCV__SCANS_H
3
4 #include "target/target.h"
5 #include "jtag/jtag.h"
6
7 enum riscv_scan_type {
8 RISCV_SCAN_TYPE_INVALID,
9 RISCV_SCAN_TYPE_NOP,
10 RISCV_SCAN_TYPE_READ,
11 RISCV_SCAN_TYPE_WRITE,
12 };
13
14 /* A batch of multiple JTAG scans, which are grouped together to avoid the
15 * overhead of some JTAG adapters when sending single commands. This is
16 * designed to support block copies, as that's what we actually need to go
17 * fast. */
18 struct riscv_batch {
19 struct target *target;
20
21 size_t allocated_scans;
22 size_t used_scans;
23
24 size_t idle_count;
25
26 uint8_t *data_out;
27 uint8_t *data_in;
28 struct scan_field *fields;
29
30 /* In JTAG we scan out the previous value's output when performing a
31 * scan. This is a pain for users, so we just provide them the
32 * illusion of not having to do this by eliding all but the last NOP.
33 * */
34 enum riscv_scan_type last_scan;
35
36 /* The read keys. */
37 size_t *read_keys;
38 size_t read_keys_used;
39 };
40
41 /* Allocates (or frees) a new scan set. "scans" is the maximum number of JTAG
42 * scans that can be issued to this object, and idle is the number of JTAG idle
43 * cycles between every real scan. */
44 struct riscv_batch *riscv_batch_alloc(struct target *target, size_t scans, size_t idle);
45 void riscv_batch_free(struct riscv_batch *batch);
46
47 /* Checks to see if this batch is full. */
48 bool riscv_batch_full(struct riscv_batch *batch);
49
50 /* Executes this scan batch. */
51 int riscv_batch_run(struct riscv_batch *batch);
52
53 /* Adds a DMI write to this batch. */
54 void riscv_batch_add_dmi_write(struct riscv_batch *batch, unsigned address, uint64_t data);
55
56 /* DMI reads must be handled in two parts: the first one schedules a read and
57 * provides a key, the second one actually obtains the value of that read .*/
58 size_t riscv_batch_add_dmi_read(struct riscv_batch *batch, unsigned address);
59 uint64_t riscv_batch_get_dmi_read(struct riscv_batch *batch, size_t key);
60
61 /* Scans in a NOP. */
62 void riscv_batch_add_nop(struct riscv_batch *batch);
63
64 #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)