flash/nor/at91samd: Use 32-bit register writes for ST-Link compat
[fw/openocd] / src / jtag / drivers / cmsis_dap.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 #ifndef OPENOCD_JTAG_DRIVERS_CMSIS_DAP_H
4 #define OPENOCD_JTAG_DRIVERS_CMSIS_DAP_H
5
6 #include <stdint.h>
7
8 struct cmsis_dap_backend;
9 struct cmsis_dap_backend_data;
10 struct command_registration;
11
12 struct cmsis_dap {
13         struct cmsis_dap_backend_data *bdata;
14         const struct cmsis_dap_backend *backend;
15         uint16_t packet_size;
16         int packet_count;
17         uint8_t *packet_buffer;
18         uint16_t packet_buffer_size;
19         uint8_t *command;
20         uint8_t *response;
21         uint16_t caps;
22         uint8_t mode;
23         uint32_t swo_buf_sz;
24         bool trace_enabled;
25 };
26
27 struct cmsis_dap_backend {
28         const char *name;
29         int (*open)(struct cmsis_dap *dap, uint16_t vids[], uint16_t pids[], const char *serial);
30         void (*close)(struct cmsis_dap *dap);
31         int (*read)(struct cmsis_dap *dap, int timeout_ms);
32         int (*write)(struct cmsis_dap *dap, int len, int timeout_ms);
33         int (*packet_buffer_alloc)(struct cmsis_dap *dap, unsigned int pkt_sz);
34 };
35
36 extern const struct cmsis_dap_backend cmsis_dap_hid_backend;
37 extern const struct cmsis_dap_backend cmsis_dap_usb_backend;
38 extern const struct command_registration cmsis_dap_usb_subcommand_handlers[];
39
40 #define REPORT_ID_SIZE   1
41
42 #endif