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