Remove '_s' suffix from structs

Change-Id: I956acce316e60252b317daa41274403d87f704b8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8340
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Marc Schink 2024-06-14 18:12:03 +02:00 committed by Antonio Borneo
parent 92e8823ebd
commit 6b984a54c9
9 changed files with 186 additions and 186 deletions

View File

@ -34,7 +34,7 @@
#define NULINK2_USB_PID1 (0x5200) #define NULINK2_USB_PID1 (0x5200)
#define NULINK2_USB_PID2 (0x5201) #define NULINK2_USB_PID2 (0x5201)
struct nulink_usb_handle_s { struct nulink_usb_handle {
hid_device *dev_handle; hid_device *dev_handle;
uint16_t max_packet_size; uint16_t max_packet_size;
uint8_t usbcmdidx; uint8_t usbcmdidx;
@ -87,7 +87,7 @@ enum nulink_connect {
static int nulink_usb_xfer_rw(void *handle, uint8_t *buf) static int nulink_usb_xfer_rw(void *handle, uint8_t *buf)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -107,7 +107,7 @@ static int nulink_usb_xfer_rw(void *handle, uint8_t *buf)
static int nulink1_usb_xfer(void *handle, uint8_t *buf, int size) static int nulink1_usb_xfer(void *handle, uint8_t *buf, int size)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -120,7 +120,7 @@ static int nulink1_usb_xfer(void *handle, uint8_t *buf, int size)
static int nulink2_usb_xfer(void *handle, uint8_t *buf, int size) static int nulink2_usb_xfer(void *handle, uint8_t *buf, int size)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -133,7 +133,7 @@ static int nulink2_usb_xfer(void *handle, uint8_t *buf, int size)
static void nulink1_usb_init_buffer(void *handle, uint32_t size) static void nulink1_usb_init_buffer(void *handle, uint32_t size)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
h->cmdidx = 0; h->cmdidx = 0;
@ -149,7 +149,7 @@ static void nulink1_usb_init_buffer(void *handle, uint32_t size)
static void nulink2_usb_init_buffer(void *handle, uint32_t size) static void nulink2_usb_init_buffer(void *handle, uint32_t size)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
h->cmdidx = 0; h->cmdidx = 0;
@ -165,7 +165,7 @@ static void nulink2_usb_init_buffer(void *handle, uint32_t size)
static inline int nulink_usb_xfer(void *handle, uint8_t *buf, int size) static inline int nulink_usb_xfer(void *handle, uint8_t *buf, int size)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -174,7 +174,7 @@ static inline int nulink_usb_xfer(void *handle, uint8_t *buf, int size)
static inline void nulink_usb_init_buffer(void *handle, uint32_t size) static inline void nulink_usb_init_buffer(void *handle, uint32_t size)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -183,7 +183,7 @@ static inline void nulink_usb_init_buffer(void *handle, uint32_t size)
static int nulink_usb_version(void *handle) static int nulink_usb_version(void *handle)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_version"); LOG_DEBUG("nulink_usb_version");
@ -219,7 +219,7 @@ static int nulink_usb_version(void *handle)
static int nulink_usb_idcode(void *handle, uint32_t *idcode) static int nulink_usb_idcode(void *handle, uint32_t *idcode)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_idcode"); LOG_DEBUG("nulink_usb_idcode");
@ -243,7 +243,7 @@ static int nulink_usb_idcode(void *handle, uint32_t *idcode)
static int nulink_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val) static int nulink_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_write_debug_reg 0x%08" PRIX32 " 0x%08" PRIX32, addr, val); LOG_DEBUG("nulink_usb_write_debug_reg 0x%08" PRIX32 " 0x%08" PRIX32, addr, val);
@ -278,7 +278,7 @@ static int nulink_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val)
static enum target_state nulink_usb_state(void *handle) static enum target_state nulink_usb_state(void *handle)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -299,7 +299,7 @@ static enum target_state nulink_usb_state(void *handle)
static int nulink_usb_assert_srst(void *handle, int srst) static int nulink_usb_assert_srst(void *handle, int srst)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_assert_srst"); LOG_DEBUG("nulink_usb_assert_srst");
@ -324,7 +324,7 @@ static int nulink_usb_assert_srst(void *handle, int srst)
static int nulink_usb_reset(void *handle) static int nulink_usb_reset(void *handle)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_reset"); LOG_DEBUG("nulink_usb_reset");
@ -349,7 +349,7 @@ static int nulink_usb_reset(void *handle)
static int nulink_usb_run(void *handle) static int nulink_usb_run(void *handle)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_run"); LOG_DEBUG("nulink_usb_run");
@ -365,7 +365,7 @@ static int nulink_usb_run(void *handle)
static int nulink_usb_halt(void *handle) static int nulink_usb_halt(void *handle)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_halt"); LOG_DEBUG("nulink_usb_halt");
@ -385,7 +385,7 @@ static int nulink_usb_halt(void *handle)
static int nulink_usb_step(void *handle) static int nulink_usb_step(void *handle)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_step"); LOG_DEBUG("nulink_usb_step");
@ -405,7 +405,7 @@ static int nulink_usb_step(void *handle)
static int nulink_usb_read_reg(void *handle, unsigned int regsel, uint32_t *val) static int nulink_usb_read_reg(void *handle, unsigned int regsel, uint32_t *val)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -444,7 +444,7 @@ static int nulink_usb_read_reg(void *handle, unsigned int regsel, uint32_t *val)
static int nulink_usb_write_reg(void *handle, unsigned int regsel, uint32_t val) static int nulink_usb_write_reg(void *handle, unsigned int regsel, uint32_t val)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -483,7 +483,7 @@ static int nulink_usb_read_mem8(void *handle, uint32_t addr, uint16_t len,
int res = ERROR_OK; int res = ERROR_OK;
uint32_t offset = 0; uint32_t offset = 0;
uint32_t bytes_remaining = 12; uint32_t bytes_remaining = 12;
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_read_mem8: addr 0x%08" PRIx32 ", len %" PRId16, addr, len); LOG_DEBUG("nulink_usb_read_mem8: addr 0x%08" PRIx32 ", len %" PRId16, addr, len);
@ -568,7 +568,7 @@ static int nulink_usb_write_mem8(void *handle, uint32_t addr, uint16_t len,
int res = ERROR_OK; int res = ERROR_OK;
uint32_t offset = 0; uint32_t offset = 0;
uint32_t bytes_remaining = 12; uint32_t bytes_remaining = 12;
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_write_mem8: addr 0x%08" PRIx32 ", len %" PRIu16, addr, len); LOG_DEBUG("nulink_usb_write_mem8: addr 0x%08" PRIx32 ", len %" PRIu16, addr, len);
@ -675,7 +675,7 @@ static int nulink_usb_read_mem32(void *handle, uint32_t addr, uint16_t len,
{ {
int res = ERROR_OK; int res = ERROR_OK;
uint32_t bytes_remaining = 12; uint32_t bytes_remaining = 12;
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -744,7 +744,7 @@ static int nulink_usb_write_mem32(void *handle, uint32_t addr, uint16_t len,
{ {
int res = ERROR_OK; int res = ERROR_OK;
uint32_t bytes_remaining = 12; uint32_t bytes_remaining = 12;
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -819,7 +819,7 @@ static int nulink_usb_read_mem(void *handle, uint32_t addr, uint32_t size,
uint32_t count, uint8_t *buffer) uint32_t count, uint8_t *buffer)
{ {
int retval = ERROR_OK; int retval = ERROR_OK;
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
/* calculate byte count */ /* calculate byte count */
count *= size; count *= size;
@ -879,7 +879,7 @@ static int nulink_usb_write_mem(void *handle, uint32_t addr, uint32_t size,
uint32_t count, const uint8_t *buffer) uint32_t count, const uint8_t *buffer)
{ {
int retval = ERROR_OK; int retval = ERROR_OK;
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
if (addr < ARM_SRAM_BASE) { if (addr < ARM_SRAM_BASE) {
LOG_DEBUG("nulink_usb_write_mem: address below ARM_SRAM_BASE, not supported.\n"); LOG_DEBUG("nulink_usb_write_mem: address below ARM_SRAM_BASE, not supported.\n");
@ -950,7 +950,7 @@ static int nulink_usb_override_target(const char *targetname)
static int nulink_speed(void *handle, int khz, bool query) static int nulink_speed(void *handle, int khz, bool query)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
unsigned long max_ice_clock = khz; unsigned long max_ice_clock = khz;
LOG_DEBUG("nulink_speed: query %s", query ? "yes" : "no"); LOG_DEBUG("nulink_speed: query %s", query ? "yes" : "no");
@ -1004,7 +1004,7 @@ static int nulink_speed(void *handle, int khz, bool query)
static int nulink_usb_close(void *handle) static int nulink_usb_close(void *handle)
{ {
struct nulink_usb_handle_s *h = handle; struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_close"); LOG_DEBUG("nulink_usb_close");
@ -1018,7 +1018,7 @@ static int nulink_usb_close(void *handle)
return ERROR_OK; return ERROR_OK;
} }
static int nulink_usb_open(struct hl_interface_param_s *param, void **fd) static int nulink_usb_open(struct hl_interface_param *param, void **fd)
{ {
struct hid_device_info *devs, *cur_dev; struct hid_device_info *devs, *cur_dev;
uint16_t target_vid = 0; uint16_t target_vid = 0;
@ -1040,7 +1040,7 @@ static int nulink_usb_open(struct hl_interface_param_s *param, void **fd)
return ERROR_FAIL; return ERROR_FAIL;
} }
struct nulink_usb_handle_s *h = calloc(1, sizeof(*h)); struct nulink_usb_handle *h = calloc(1, sizeof(*h));
if (!h) { if (!h) {
LOG_ERROR("Out of memory"); LOG_ERROR("Out of memory");
goto error_open; goto error_open;
@ -1154,7 +1154,7 @@ error_open:
return ERROR_FAIL; return ERROR_FAIL;
} }
struct hl_layout_api_s nulink_usb_layout_api = { struct hl_layout_api nulink_usb_layout_api = {
.open = nulink_usb_open, .open = nulink_usb_open,
.close = nulink_usb_close, .close = nulink_usb_close,
.idcode = nulink_usb_idcode, .idcode = nulink_usb_idcode,

View File

@ -286,13 +286,13 @@ static uint8_t dtc_entry_download;
static int dtc_load_from_buffer(struct libusb_device_handle *hdev_param, const uint8_t *buffer, static int dtc_load_from_buffer(struct libusb_device_handle *hdev_param, const uint8_t *buffer,
size_t length) size_t length)
{ {
struct header_s { struct header {
uint8_t type; uint8_t type;
uint8_t length; uint8_t length;
}; };
int usb_err; int usb_err;
struct header_s *header; struct header *header;
uint8_t lut_start = 0xc0; uint8_t lut_start = 0xc0;
dtc_entry_download = 0; dtc_entry_download = 0;
@ -311,7 +311,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *hdev_param, const u
exit(1); exit(1);
} }
header = (struct header_s *)buffer; header = (struct header *)buffer;
buffer += sizeof(*header); buffer += sizeof(*header);
length -= sizeof(*header); length -= sizeof(*header);

View File

@ -140,7 +140,7 @@ struct stlink_usb_version {
uint32_t flags; uint32_t flags;
}; };
struct stlink_usb_priv_s { struct stlink_usb_priv {
/** */ /** */
struct libusb_device_handle *fd; struct libusb_device_handle *fd;
/** */ /** */
@ -154,7 +154,7 @@ struct stlink_tcp_version {
uint32_t build; uint32_t build;
}; };
struct stlink_tcp_priv_s { struct stlink_tcp_priv {
/** */ /** */
int fd; int fd;
/** */ /** */
@ -171,9 +171,9 @@ struct stlink_tcp_priv_s {
struct stlink_tcp_version version; struct stlink_tcp_version version;
}; };
struct stlink_backend_s { struct stlink_backend {
/** */ /** */
int (*open)(void *handle, struct hl_interface_param_s *param); int (*open)(void *handle, struct hl_interface_param *param);
/** */ /** */
int (*close)(void *handle); int (*close)(void *handle);
/** */ /** */
@ -245,13 +245,13 @@ struct dap_queue {
}; };
/** */ /** */
struct stlink_usb_handle_s { struct stlink_usb_handle {
/** */ /** */
struct stlink_backend_s *backend; struct stlink_backend *backend;
/** */ /** */
union { union {
struct stlink_usb_priv_s usb_backend_priv; struct stlink_usb_priv usb_backend_priv;
struct stlink_tcp_priv_s tcp_backend_priv; struct stlink_tcp_priv tcp_backend_priv;
}; };
/** */ /** */
uint8_t rx_ep; uint8_t rx_ep;
@ -294,22 +294,22 @@ struct stlink_usb_handle_s {
}; };
/** */ /** */
static inline int stlink_usb_open(void *handle, struct hl_interface_param_s *param) static inline int stlink_usb_open(void *handle, struct hl_interface_param *param)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
return h->backend->open(handle, param); return h->backend->open(handle, param);
} }
/** */ /** */
static inline int stlink_usb_close(void *handle) static inline int stlink_usb_close(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
return h->backend->close(handle); return h->backend->close(handle);
} }
/** */ /** */
static inline int stlink_usb_xfer_noerrcheck(void *handle, const uint8_t *buf, int size) static inline int stlink_usb_xfer_noerrcheck(void *handle, const uint8_t *buf, int size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
return h->backend->xfer_noerrcheck(handle, buf, size); return h->backend->xfer_noerrcheck(handle, buf, size);
} }
@ -567,7 +567,7 @@ static int stlink_usb_open_ap(void *handle, unsigned short apsel);
/** */ /** */
static unsigned int stlink_usb_block(void *handle) static unsigned int stlink_usb_block(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -727,7 +727,7 @@ static int jtag_libusb_bulk_transfer_n(
/** */ /** */
static int stlink_usb_xfer_v1_get_status(void *handle) static int stlink_usb_xfer_v1_get_status(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int tr, ret; int tr, ret;
assert(handle); assert(handle);
@ -762,7 +762,7 @@ static int stlink_usb_xfer_v1_get_status(void *handle)
#ifdef USE_LIBUSB_ASYNCIO #ifdef USE_LIBUSB_ASYNCIO
static int stlink_usb_xfer_rw(void *handle, int cmdsize, const uint8_t *buf, int size) static int stlink_usb_xfer_rw(void *handle, int cmdsize, const uint8_t *buf, int size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -800,7 +800,7 @@ static int stlink_usb_xfer_rw(void *handle, int cmdsize, const uint8_t *buf, int
#else #else
static int stlink_usb_xfer_rw(void *handle, int cmdsize, const uint8_t *buf, int size) static int stlink_usb_xfer_rw(void *handle, int cmdsize, const uint8_t *buf, int size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int tr, ret; int tr, ret;
assert(handle); assert(handle);
@ -834,7 +834,7 @@ static int stlink_usb_xfer_rw(void *handle, int cmdsize, const uint8_t *buf, int
static int stlink_usb_xfer_v1_get_sense(void *handle) static int stlink_usb_xfer_v1_get_sense(void *handle)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -860,7 +860,7 @@ static int stlink_usb_xfer_v1_get_sense(void *handle)
/** */ /** */
static int stlink_usb_usb_read_trace(void *handle, const uint8_t *buf, int size) static int stlink_usb_usb_read_trace(void *handle, const uint8_t *buf, int size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int tr, ret; int tr, ret;
ret = jtag_libusb_bulk_read(h->usb_backend_priv.fd, h->trace_ep, (char *)buf, size, ret = jtag_libusb_bulk_read(h->usb_backend_priv.fd, h->trace_ep, (char *)buf, size,
@ -882,7 +882,7 @@ static int stlink_usb_usb_read_trace(void *handle, const uint8_t *buf, int size)
static int stlink_usb_usb_xfer_noerrcheck(void *handle, const uint8_t *buf, int size) static int stlink_usb_usb_xfer_noerrcheck(void *handle, const uint8_t *buf, int size)
{ {
int err, cmdsize = STLINK_CMD_SIZE_V2; int err, cmdsize = STLINK_CMD_SIZE_V2;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -915,7 +915,7 @@ static int stlink_usb_usb_xfer_noerrcheck(void *handle, const uint8_t *buf, int
static int stlink_tcp_send_cmd(void *handle, int send_size, int recv_size, bool check_tcp_status) static int stlink_tcp_send_cmd(void *handle, int send_size, int recv_size, bool check_tcp_status)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -980,7 +980,7 @@ static int stlink_tcp_send_cmd(void *handle, int send_size, int recv_size, bool
/** */ /** */
static int stlink_tcp_xfer_noerrcheck(void *handle, const uint8_t *buf, int size) static int stlink_tcp_xfer_noerrcheck(void *handle, const uint8_t *buf, int size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int send_size = STLINK_TCP_USB_CMD_SIZE; int send_size = STLINK_TCP_USB_CMD_SIZE;
int recv_size = STLINK_TCP_SS_SIZE; int recv_size = STLINK_TCP_SS_SIZE;
@ -1040,7 +1040,7 @@ static int stlink_tcp_xfer_noerrcheck(void *handle, const uint8_t *buf, int size
/** */ /** */
static int stlink_tcp_read_trace(void *handle, const uint8_t *buf, int size) static int stlink_tcp_read_trace(void *handle, const uint8_t *buf, int size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
stlink_usb_init_buffer(h, h->trace_ep, 0); stlink_usb_init_buffer(h, h->trace_ep, 0);
return stlink_tcp_xfer_noerrcheck(handle, buf, size); return stlink_tcp_xfer_noerrcheck(handle, buf, size);
@ -1052,7 +1052,7 @@ static int stlink_tcp_read_trace(void *handle, const uint8_t *buf, int size)
*/ */
static int stlink_usb_error_check(void *handle) static int stlink_usb_error_check(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -1162,7 +1162,7 @@ static int stlink_cmd_allow_retry(void *handle, const uint8_t *buf, int size)
{ {
int retries = 0; int retries = 0;
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
while (1) { while (1) {
if ((h->st_mode != STLINK_MODE_DEBUG_SWIM) || !retries) { if ((h->st_mode != STLINK_MODE_DEBUG_SWIM) || !retries) {
@ -1191,7 +1191,7 @@ static int stlink_cmd_allow_retry(void *handle, const uint8_t *buf, int size)
/** */ /** */
static int stlink_usb_read_trace(void *handle, const uint8_t *buf, int size) static int stlink_usb_read_trace(void *handle, const uint8_t *buf, int size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -1206,14 +1206,14 @@ static int stlink_usb_read_trace(void *handle, const uint8_t *buf, int size)
*/ */
static void stlink_usb_set_cbw_transfer_datalength(void *handle, uint32_t size) static void stlink_usb_set_cbw_transfer_datalength(void *handle, uint32_t size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
buf_set_u32(h->cmdbuf+8, 0, 32, size); buf_set_u32(h->cmdbuf+8, 0, 32, size);
} }
static void stlink_usb_xfer_v1_create_cmd(void *handle, uint8_t direction, uint32_t size) static void stlink_usb_xfer_v1_create_cmd(void *handle, uint8_t direction, uint32_t size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
/* fill the send buffer */ /* fill the send buffer */
strcpy((char *)h->cmdbuf, "USBC"); strcpy((char *)h->cmdbuf, "USBC");
@ -1234,7 +1234,7 @@ static void stlink_usb_xfer_v1_create_cmd(void *handle, uint8_t direction, uint3
/** */ /** */
static void stlink_usb_init_buffer(void *handle, uint8_t direction, uint32_t size) static void stlink_usb_init_buffer(void *handle, uint8_t direction, uint32_t size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
h->direction = direction; h->direction = direction;
@ -1256,7 +1256,7 @@ static int stlink_usb_version(void *handle)
uint8_t v, x, y, jtag, swim, msd, bridge = 0; uint8_t v, x, y, jtag, swim, msd, bridge = 0;
char v_str[5 * (1 + 3) + 1]; /* VvJjMmBbSs */ char v_str[5 * (1 + 3) + 1]; /* VvJjMmBbSs */
char *p; char *p;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -1479,7 +1479,7 @@ static int stlink_usb_version(void *handle)
static int stlink_usb_check_voltage(void *handle, float *target_voltage) static int stlink_usb_check_voltage(void *handle, float *target_voltage)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
uint32_t adc_results[2]; uint32_t adc_results[2];
/* no error message, simply quit with error */ /* no error message, simply quit with error */
@ -1511,7 +1511,7 @@ static int stlink_usb_check_voltage(void *handle, float *target_voltage)
static int stlink_usb_set_swdclk(void *handle, uint16_t clk_divisor) static int stlink_usb_set_swdclk(void *handle, uint16_t clk_divisor)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -1535,7 +1535,7 @@ static int stlink_usb_set_swdclk(void *handle, uint16_t clk_divisor)
static int stlink_usb_set_jtagclk(void *handle, uint16_t clk_divisor) static int stlink_usb_set_jtagclk(void *handle, uint16_t clk_divisor)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -1561,7 +1561,7 @@ static int stlink_usb_set_jtagclk(void *handle, uint16_t clk_divisor)
static int stlink_usb_current_mode(void *handle, uint8_t *mode) static int stlink_usb_current_mode(void *handle, uint8_t *mode)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -1583,7 +1583,7 @@ static int stlink_usb_current_mode(void *handle, uint8_t *mode)
static int stlink_usb_mode_enter(void *handle, enum stlink_mode type) static int stlink_usb_mode_enter(void *handle, enum stlink_mode type)
{ {
int rx_size = 0; int rx_size = 0;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -1631,7 +1631,7 @@ static int stlink_usb_mode_enter(void *handle, enum stlink_mode type)
static int stlink_usb_mode_leave(void *handle, enum stlink_mode type) static int stlink_usb_mode_leave(void *handle, enum stlink_mode type)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -1725,7 +1725,7 @@ static int stlink_usb_init_mode(void *handle, bool connect_under_reset, int init
int res; int res;
uint8_t mode; uint8_t mode;
enum stlink_mode emode; enum stlink_mode emode;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -1829,7 +1829,7 @@ static int stlink_usb_init_mode(void *handle, bool connect_under_reset, int init
/* request status from last swim request */ /* request status from last swim request */
static int stlink_swim_status(void *handle) static int stlink_swim_status(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
stlink_usb_init_buffer(handle, h->rx_ep, 4); stlink_usb_init_buffer(handle, h->rx_ep, 4);
@ -1849,7 +1849,7 @@ static int stlink_swim_status(void *handle)
__attribute__((unused)) __attribute__((unused))
static int stlink_swim_cap(void *handle, uint8_t *cap) static int stlink_swim_cap(void *handle, uint8_t *cap)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
stlink_usb_init_buffer(handle, h->rx_ep, 8); stlink_usb_init_buffer(handle, h->rx_ep, 8);
@ -1866,7 +1866,7 @@ static int stlink_swim_cap(void *handle, uint8_t *cap)
/* debug dongle assert/deassert sreset line */ /* debug dongle assert/deassert sreset line */
static int stlink_swim_assert_reset(void *handle, int reset) static int stlink_swim_assert_reset(void *handle, int reset)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
stlink_usb_init_buffer(handle, h->rx_ep, 0); stlink_usb_init_buffer(handle, h->rx_ep, 0);
@ -1887,7 +1887,7 @@ static int stlink_swim_assert_reset(void *handle, int reset)
*/ */
static int stlink_swim_enter(void *handle) static int stlink_swim_enter(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
stlink_usb_init_buffer(handle, h->rx_ep, 0); stlink_usb_init_buffer(handle, h->rx_ep, 0);
@ -1902,7 +1902,7 @@ static int stlink_swim_enter(void *handle)
/* switch high/low speed swim */ /* switch high/low speed swim */
static int stlink_swim_speed(void *handle, int speed) static int stlink_swim_speed(void *handle, int speed)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
stlink_usb_init_buffer(handle, h->rx_ep, 0); stlink_usb_init_buffer(handle, h->rx_ep, 0);
@ -1924,7 +1924,7 @@ static int stlink_swim_speed(void *handle, int speed)
*/ */
static int stlink_swim_generate_rst(void *handle) static int stlink_swim_generate_rst(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
stlink_usb_init_buffer(handle, h->rx_ep, 0); stlink_usb_init_buffer(handle, h->rx_ep, 0);
@ -1943,7 +1943,7 @@ static int stlink_swim_generate_rst(void *handle)
*/ */
static int stlink_swim_resync(void *handle) static int stlink_swim_resync(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
stlink_usb_init_buffer(handle, h->rx_ep, 0); stlink_usb_init_buffer(handle, h->rx_ep, 0);
@ -1957,7 +1957,7 @@ static int stlink_swim_resync(void *handle)
static int stlink_swim_writebytes(void *handle, uint32_t addr, uint32_t len, const uint8_t *data) static int stlink_swim_writebytes(void *handle, uint32_t addr, uint32_t len, const uint8_t *data)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
unsigned int i; unsigned int i;
unsigned int datalen = 0; unsigned int datalen = 0;
@ -1993,7 +1993,7 @@ static int stlink_swim_writebytes(void *handle, uint32_t addr, uint32_t len, con
static int stlink_swim_readbytes(void *handle, uint32_t addr, uint32_t len, uint8_t *data) static int stlink_swim_readbytes(void *handle, uint32_t addr, uint32_t len, uint8_t *data)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
if (len > STLINK_SWIM_DATA_SIZE) if (len > STLINK_SWIM_DATA_SIZE)
@ -2024,7 +2024,7 @@ static int stlink_swim_readbytes(void *handle, uint32_t addr, uint32_t len, uint
static int stlink_usb_idcode(void *handle, uint32_t *idcode) static int stlink_usb_idcode(void *handle, uint32_t *idcode)
{ {
int res, offset; int res, offset;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2061,7 +2061,7 @@ static int stlink_usb_idcode(void *handle, uint32_t *idcode)
static int stlink_usb_v2_read_debug_reg(void *handle, uint32_t addr, uint32_t *val) static int stlink_usb_v2_read_debug_reg(void *handle, uint32_t addr, uint32_t *val)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int res; int res;
assert(handle); assert(handle);
@ -2083,7 +2083,7 @@ static int stlink_usb_v2_read_debug_reg(void *handle, uint32_t addr, uint32_t *v
static int stlink_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val) static int stlink_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2105,7 +2105,7 @@ static int stlink_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val)
/** */ /** */
static int stlink_usb_trace_read(void *handle, uint8_t *buf, size_t *size) static int stlink_usb_trace_read(void *handle, uint8_t *buf, size_t *size)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2156,7 +2156,7 @@ static enum target_state stlink_usb_v2_get_status(void *handle)
static enum target_state stlink_usb_state(void *handle) static enum target_state stlink_usb_state(void *handle)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2198,7 +2198,7 @@ static enum target_state stlink_usb_state(void *handle)
static int stlink_usb_assert_srst(void *handle, int srst) static int stlink_usb_assert_srst(void *handle, int srst)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2221,7 +2221,7 @@ static int stlink_usb_assert_srst(void *handle, int srst)
static void stlink_usb_trace_disable(void *handle) static void stlink_usb_trace_disable(void *handle)
{ {
int res = ERROR_OK; int res = ERROR_OK;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2243,7 +2243,7 @@ static void stlink_usb_trace_disable(void *handle)
static int stlink_usb_trace_enable(void *handle) static int stlink_usb_trace_enable(void *handle)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2274,7 +2274,7 @@ static int stlink_usb_trace_enable(void *handle)
/** */ /** */
static int stlink_usb_reset(void *handle) static int stlink_usb_reset(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int retval; int retval;
assert(handle); assert(handle);
@ -2304,7 +2304,7 @@ static int stlink_usb_reset(void *handle)
static int stlink_usb_run(void *handle) static int stlink_usb_run(void *handle)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2326,7 +2326,7 @@ static int stlink_usb_run(void *handle)
static int stlink_usb_halt(void *handle) static int stlink_usb_halt(void *handle)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2347,7 +2347,7 @@ static int stlink_usb_halt(void *handle)
/** */ /** */
static int stlink_usb_step(void *handle) static int stlink_usb_step(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2371,7 +2371,7 @@ static int stlink_usb_step(void *handle)
static int stlink_usb_read_regs(void *handle) static int stlink_usb_read_regs(void *handle)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2396,7 +2396,7 @@ static int stlink_usb_read_regs(void *handle)
static int stlink_usb_read_reg(void *handle, unsigned int regsel, uint32_t *val) static int stlink_usb_read_reg(void *handle, unsigned int regsel, uint32_t *val)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2436,7 +2436,7 @@ static int stlink_usb_read_reg(void *handle, unsigned int regsel, uint32_t *val)
/** */ /** */
static int stlink_usb_write_reg(void *handle, unsigned int regsel, uint32_t val) static int stlink_usb_write_reg(void *handle, unsigned int regsel, uint32_t val)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2465,7 +2465,7 @@ static int stlink_usb_write_reg(void *handle, unsigned int regsel, uint32_t val)
static int stlink_usb_get_rw_status(void *handle) static int stlink_usb_get_rw_status(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2490,7 +2490,7 @@ static int stlink_usb_read_mem8(void *handle, uint8_t ap_num, uint32_t csw,
{ {
int res; int res;
uint16_t read_len = len; uint16_t read_len = len;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2534,7 +2534,7 @@ static int stlink_usb_write_mem8(void *handle, uint8_t ap_num, uint32_t csw,
uint32_t addr, uint16_t len, const uint8_t *buffer) uint32_t addr, uint16_t len, const uint8_t *buffer)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2572,7 +2572,7 @@ static int stlink_usb_read_mem16(void *handle, uint8_t ap_num, uint32_t csw,
uint32_t addr, uint16_t len, uint8_t *buffer) uint32_t addr, uint16_t len, uint8_t *buffer)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2620,7 +2620,7 @@ static int stlink_usb_write_mem16(void *handle, uint8_t ap_num, uint32_t csw,
uint32_t addr, uint16_t len, const uint8_t *buffer) uint32_t addr, uint16_t len, const uint8_t *buffer)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2666,7 +2666,7 @@ static int stlink_usb_read_mem32(void *handle, uint8_t ap_num, uint32_t csw,
uint32_t addr, uint16_t len, uint8_t *buffer) uint32_t addr, uint16_t len, uint8_t *buffer)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2711,7 +2711,7 @@ static int stlink_usb_write_mem32(void *handle, uint8_t ap_num, uint32_t csw,
uint32_t addr, uint16_t len, const uint8_t *buffer) uint32_t addr, uint16_t len, const uint8_t *buffer)
{ {
int res; int res;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -2752,7 +2752,7 @@ static int stlink_usb_write_mem32(void *handle, uint8_t ap_num, uint32_t csw,
static int stlink_usb_read_mem32_noaddrinc(void *handle, uint8_t ap_num, uint32_t csw, static int stlink_usb_read_mem32_noaddrinc(void *handle, uint8_t ap_num, uint32_t csw,
uint32_t addr, uint16_t len, uint8_t *buffer) uint32_t addr, uint16_t len, uint8_t *buffer)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle != NULL); assert(handle != NULL);
@ -2794,7 +2794,7 @@ static int stlink_usb_read_mem32_noaddrinc(void *handle, uint8_t ap_num, uint32_
static int stlink_usb_write_mem32_noaddrinc(void *handle, uint8_t ap_num, uint32_t csw, static int stlink_usb_write_mem32_noaddrinc(void *handle, uint8_t ap_num, uint32_t csw,
uint32_t addr, uint16_t len, const uint8_t *buffer) uint32_t addr, uint16_t len, const uint8_t *buffer)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle != NULL); assert(handle != NULL);
@ -2845,7 +2845,7 @@ static int stlink_usb_read_ap_mem(void *handle, uint8_t ap_num, uint32_t csw,
int retval = ERROR_OK; int retval = ERROR_OK;
uint32_t bytes_remaining; uint32_t bytes_remaining;
int retries = 0; int retries = 0;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
/* calculate byte count */ /* calculate byte count */
count *= size; count *= size;
@ -2930,7 +2930,7 @@ static int stlink_usb_write_ap_mem(void *handle, uint8_t ap_num, uint32_t csw,
int retval = ERROR_OK; int retval = ERROR_OK;
uint32_t bytes_remaining; uint32_t bytes_remaining;
int retries = 0; int retries = 0;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
/* calculate byte count */ /* calculate byte count */
count *= size; count *= size;
@ -3080,7 +3080,7 @@ static int stlink_match_speed_map(const struct speed_map *map, unsigned int map_
static int stlink_speed_swd(void *handle, int khz, bool query) static int stlink_speed_swd(void *handle, int khz, bool query)
{ {
int speed_index; int speed_index;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
/* old firmware cannot change it */ /* old firmware cannot change it */
if (!(h->version.flags & STLINK_F_HAS_SWD_SET_FREQ)) if (!(h->version.flags & STLINK_F_HAS_SWD_SET_FREQ))
@ -3103,7 +3103,7 @@ static int stlink_speed_swd(void *handle, int khz, bool query)
static int stlink_speed_jtag(void *handle, int khz, bool query) static int stlink_speed_jtag(void *handle, int khz, bool query)
{ {
int speed_index; int speed_index;
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
/* old firmware cannot change it */ /* old firmware cannot change it */
if (!(h->version.flags & STLINK_F_HAS_JTAG_SET_FREQ)) if (!(h->version.flags & STLINK_F_HAS_JTAG_SET_FREQ))
@ -3135,7 +3135,7 @@ static void stlink_dump_speed_map(const struct speed_map *map, unsigned int map_
static int stlink_get_com_freq(void *handle, bool is_jtag, struct speed_map *map) static int stlink_get_com_freq(void *handle, bool is_jtag, struct speed_map *map)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int i; int i;
if (h->version.jtag_api != STLINK_JTAG_API_V3) { if (h->version.jtag_api != STLINK_JTAG_API_V3) {
@ -3170,7 +3170,7 @@ static int stlink_get_com_freq(void *handle, bool is_jtag, struct speed_map *map
static int stlink_set_com_freq(void *handle, bool is_jtag, unsigned int frequency) static int stlink_set_com_freq(void *handle, bool is_jtag, unsigned int frequency)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
if (h->version.jtag_api != STLINK_JTAG_API_V3) { if (h->version.jtag_api != STLINK_JTAG_API_V3) {
LOG_ERROR("Unknown command"); LOG_ERROR("Unknown command");
@ -3191,7 +3191,7 @@ static int stlink_set_com_freq(void *handle, bool is_jtag, unsigned int frequenc
static int stlink_speed_v3(void *handle, bool is_jtag, int khz, bool query) static int stlink_speed_v3(void *handle, bool is_jtag, int khz, bool query)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int speed_index; int speed_index;
struct speed_map map[STLINK_V3_MAX_FREQ_NB]; struct speed_map map[STLINK_V3_MAX_FREQ_NB];
@ -3211,7 +3211,7 @@ static int stlink_speed_v3(void *handle, bool is_jtag, int khz, bool query)
static int stlink_speed(void *handle, int khz, bool query) static int stlink_speed(void *handle, int khz, bool query)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
if (!handle) if (!handle)
return khz; return khz;
@ -3241,7 +3241,7 @@ static int stlink_speed(void *handle, int khz, bool query)
/** */ /** */
static int stlink_usb_usb_close(void *handle) static int stlink_usb_usb_close(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
if (!h) if (!h)
return ERROR_OK; return ERROR_OK;
@ -3262,7 +3262,7 @@ static int stlink_usb_usb_close(void *handle)
/** */ /** */
static int stlink_tcp_close(void *handle) static int stlink_tcp_close(void *handle)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
if (!h) if (!h)
return ERROR_OK; return ERROR_OK;
@ -3295,7 +3295,7 @@ static int stlink_tcp_close(void *handle)
static int stlink_close(void *handle) static int stlink_close(void *handle)
{ {
if (handle) { if (handle) {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
stlink_usb_close(handle); stlink_usb_close(handle);
@ -3385,9 +3385,9 @@ static char *stlink_usb_get_alternate_serial(struct libusb_device_handle *device
} }
/** */ /** */
static int stlink_usb_usb_open(void *handle, struct hl_interface_param_s *param) static int stlink_usb_usb_open(void *handle, struct hl_interface_param *param)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int err, retry_count = 1; int err, retry_count = 1;
h->cmdbuf = malloc(STLINK_SG_SIZE); h->cmdbuf = malloc(STLINK_SG_SIZE);
@ -3496,9 +3496,9 @@ static int stlink_usb_usb_open(void *handle, struct hl_interface_param_s *param)
} }
/** */ /** */
static int stlink_tcp_open(void *handle, struct hl_interface_param_s *param) static int stlink_tcp_open(void *handle, struct hl_interface_param *param)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int ret; int ret;
/* SWIM is not supported using stlink-server */ /* SWIM is not supported using stlink-server */
@ -3711,27 +3711,27 @@ static int stlink_tcp_open(void *handle, struct hl_interface_param_s *param)
return stlink_usb_version(h); return stlink_usb_version(h);
} }
static struct stlink_backend_s stlink_usb_backend = { static struct stlink_backend stlink_usb_backend = {
.open = stlink_usb_usb_open, .open = stlink_usb_usb_open,
.close = stlink_usb_usb_close, .close = stlink_usb_usb_close,
.xfer_noerrcheck = stlink_usb_usb_xfer_noerrcheck, .xfer_noerrcheck = stlink_usb_usb_xfer_noerrcheck,
.read_trace = stlink_usb_usb_read_trace, .read_trace = stlink_usb_usb_read_trace,
}; };
static struct stlink_backend_s stlink_tcp_backend = { static struct stlink_backend stlink_tcp_backend = {
.open = stlink_tcp_open, .open = stlink_tcp_open,
.close = stlink_tcp_close, .close = stlink_tcp_close,
.xfer_noerrcheck = stlink_tcp_xfer_noerrcheck, .xfer_noerrcheck = stlink_tcp_xfer_noerrcheck,
.read_trace = stlink_tcp_read_trace, .read_trace = stlink_tcp_read_trace,
}; };
static int stlink_open(struct hl_interface_param_s *param, enum stlink_mode mode, void **fd) static int stlink_open(struct hl_interface_param *param, enum stlink_mode mode, void **fd)
{ {
struct stlink_usb_handle_s *h; struct stlink_usb_handle *h;
LOG_DEBUG("stlink_open"); LOG_DEBUG("stlink_open");
h = calloc(1, sizeof(struct stlink_usb_handle_s)); h = calloc(1, sizeof(struct stlink_usb_handle));
if (!h) { if (!h) {
LOG_DEBUG("malloc failed"); LOG_DEBUG("malloc failed");
@ -3829,7 +3829,7 @@ error_open:
return ERROR_FAIL; return ERROR_FAIL;
} }
static int stlink_usb_hl_open(struct hl_interface_param_s *param, void **fd) static int stlink_usb_hl_open(struct hl_interface_param *param, void **fd)
{ {
return stlink_open(param, stlink_get_mode(param->transport), fd); return stlink_open(param, stlink_get_mode(param->transport), fd);
} }
@ -3839,7 +3839,7 @@ static int stlink_config_trace(void *handle, bool enabled,
unsigned int *trace_freq, unsigned int traceclkin_freq, unsigned int *trace_freq, unsigned int traceclkin_freq,
uint16_t *prescaler) uint16_t *prescaler)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
if (!(h->version.flags & STLINK_F_HAS_TRACE)) { if (!(h->version.flags & STLINK_F_HAS_TRACE)) {
LOG_ERROR("The attached ST-LINK version doesn't support trace"); LOG_ERROR("The attached ST-LINK version doesn't support trace");
@ -3900,7 +3900,7 @@ static int stlink_config_trace(void *handle, bool enabled,
/** */ /** */
static int stlink_usb_init_access_port(void *handle, unsigned char ap_num) static int stlink_usb_init_access_port(void *handle, unsigned char ap_num)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -3919,7 +3919,7 @@ static int stlink_usb_init_access_port(void *handle, unsigned char ap_num)
/** */ /** */
static int stlink_usb_close_access_port(void *handle, unsigned char ap_num) static int stlink_usb_close_access_port(void *handle, unsigned char ap_num)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -3942,7 +3942,7 @@ static int stlink_usb_close_access_port(void *handle, unsigned char ap_num)
static int stlink_usb_rw_misc_out(void *handle, uint32_t items, const uint8_t *buffer) static int stlink_usb_rw_misc_out(void *handle, uint32_t items, const uint8_t *buffer)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
unsigned int buflen = ALIGN_UP(items, 4) + 4 * items; unsigned int buflen = ALIGN_UP(items, 4) + 4 * items;
LOG_DEBUG_IO("%s(%" PRIu32 ")", __func__, items); LOG_DEBUG_IO("%s(%" PRIu32 ")", __func__, items);
@ -3963,7 +3963,7 @@ static int stlink_usb_rw_misc_out(void *handle, uint32_t items, const uint8_t *b
static int stlink_usb_rw_misc_in(void *handle, uint32_t items, uint8_t *buffer) static int stlink_usb_rw_misc_in(void *handle, uint32_t items, uint8_t *buffer)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
unsigned int buflen = 2 * 4 * items; unsigned int buflen = 2 * 4 * items;
LOG_DEBUG_IO("%s(%" PRIu32 ")", __func__, items); LOG_DEBUG_IO("%s(%" PRIu32 ")", __func__, items);
@ -3991,7 +3991,7 @@ static int stlink_usb_rw_misc_in(void *handle, uint32_t items, uint8_t *buffer)
static int stlink_read_dap_register(void *handle, unsigned short dap_port, static int stlink_read_dap_register(void *handle, unsigned short dap_port,
unsigned short addr, uint32_t *val) unsigned short addr, uint32_t *val)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int retval; int retval;
assert(handle); assert(handle);
@ -4015,7 +4015,7 @@ static int stlink_read_dap_register(void *handle, unsigned short dap_port,
static int stlink_write_dap_register(void *handle, unsigned short dap_port, static int stlink_write_dap_register(void *handle, unsigned short dap_port,
unsigned short addr, uint32_t val) unsigned short addr, uint32_t val)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
assert(handle); assert(handle);
@ -4033,7 +4033,7 @@ static int stlink_write_dap_register(void *handle, unsigned short dap_port,
} }
/** */ /** */
struct hl_layout_api_s stlink_usb_layout_api = { struct hl_layout_api stlink_usb_layout_api = {
/** */ /** */
.open = stlink_usb_hl_open, .open = stlink_usb_hl_open,
/** */ /** */
@ -4078,8 +4078,8 @@ struct hl_layout_api_s stlink_usb_layout_api = {
* DAP direct interface * DAP direct interface
*/ */
static struct stlink_usb_handle_s *stlink_dap_handle; static struct stlink_usb_handle *stlink_dap_handle;
static struct hl_interface_param_s stlink_dap_param; static struct hl_interface_param stlink_dap_param;
static DECLARE_BITMAP(opened_ap, DP_APSEL_MAX + 1); static DECLARE_BITMAP(opened_ap, DP_APSEL_MAX + 1);
static uint32_t last_csw_default[DP_APSEL_MAX + 1]; static uint32_t last_csw_default[DP_APSEL_MAX + 1];
static int stlink_dap_error = ERROR_OK; static int stlink_dap_error = ERROR_OK;
@ -4107,7 +4107,7 @@ static int stlink_dap_get_error(void)
static int stlink_usb_open_ap(void *handle, unsigned short apsel) static int stlink_usb_open_ap(void *handle, unsigned short apsel)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
int retval; int retval;
/* nothing to do on old versions */ /* nothing to do on old versions */
@ -4523,7 +4523,7 @@ static int stlink_usb_buf_rw_segment(void *handle, const struct dap_queue *q, un
static int stlink_usb_count_misc_rw_queue(void *handle, const struct dap_queue *q, unsigned int len, static int stlink_usb_count_misc_rw_queue(void *handle, const struct dap_queue *q, unsigned int len,
unsigned int *pkt_items) unsigned int *pkt_items)
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle *h = handle;
unsigned int i, items = 0; unsigned int i, items = 0;
uint32_t ap_num = DP_APSEL_INVALID; uint32_t ap_num = DP_APSEL_INVALID;
unsigned int misc_max_items = (h->version.stlink == 2) ? STLINK_V2_RW_MISC_SIZE : STLINK_V3_RW_MISC_SIZE; unsigned int misc_max_items = (h->version.stlink == 2) ? STLINK_V2_RW_MISC_SIZE : STLINK_V3_RW_MISC_SIZE;
@ -5039,7 +5039,7 @@ COMMAND_HANDLER(stlink_dap_backend_command)
COMMAND_HANDLER(stlink_dap_cmd_command) COMMAND_HANDLER(stlink_dap_cmd_command)
{ {
unsigned int rx_n, tx_n; unsigned int rx_n, tx_n;
struct stlink_usb_handle_s *h = stlink_dap_handle; struct stlink_usb_handle *h = stlink_dap_handle;
if (CMD_ARGC < 2) if (CMD_ARGC < 2)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;

View File

@ -33,7 +33,7 @@
#define PACKET_START "$" #define PACKET_START "$"
#define PACKET_END "#" #define PACKET_END "#"
struct icdi_usb_handle_s { struct icdi_usb_handle {
struct libusb_device_handle *usb_dev; struct libusb_device_handle *usb_dev;
char *read_buffer; char *read_buffer;
@ -108,7 +108,7 @@ static int remote_unescape_input(const char *buffer, int len, char *out_buf, int
static int icdi_send_packet(void *handle, int len) static int icdi_send_packet(void *handle, int len)
{ {
unsigned char cksum = 0; unsigned char cksum = 0;
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
int result, retry = 0; int result, retry = 0;
int transferred = 0; int transferred = 0;
@ -220,7 +220,7 @@ static int icdi_send_packet(void *handle, int len)
static int icdi_send_cmd(void *handle, const char *cmd) static int icdi_send_cmd(void *handle, const char *cmd)
{ {
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
int cmd_len = snprintf(h->write_buffer, h->max_packet, PACKET_START "%s", cmd); int cmd_len = snprintf(h->write_buffer, h->max_packet, PACKET_START "%s", cmd);
return icdi_send_packet(handle, cmd_len); return icdi_send_packet(handle, cmd_len);
@ -228,7 +228,7 @@ static int icdi_send_cmd(void *handle, const char *cmd)
static int icdi_send_remote_cmd(void *handle, const char *data) static int icdi_send_remote_cmd(void *handle, const char *data)
{ {
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
size_t cmd_len = sprintf(h->write_buffer, PACKET_START "qRcmd,"); size_t cmd_len = sprintf(h->write_buffer, PACKET_START "qRcmd,");
cmd_len += hexify(h->write_buffer + cmd_len, (const uint8_t *)data, cmd_len += hexify(h->write_buffer + cmd_len, (const uint8_t *)data,
@ -239,7 +239,7 @@ static int icdi_send_remote_cmd(void *handle, const char *data)
static int icdi_get_cmd_result(void *handle) static int icdi_get_cmd_result(void *handle)
{ {
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
int offset = 0; int offset = 0;
char ch; char ch;
@ -284,7 +284,7 @@ static int icdi_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val)
static enum target_state icdi_usb_state(void *handle) static enum target_state icdi_usb_state(void *handle)
{ {
int result; int result;
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
uint32_t dhcsr; uint32_t dhcsr;
uint8_t buf[4]; uint8_t buf[4];
@ -303,7 +303,7 @@ static enum target_state icdi_usb_state(void *handle)
static int icdi_usb_version(void *handle) static int icdi_usb_version(void *handle)
{ {
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
char version[20]; char version[20];
@ -335,7 +335,7 @@ static int icdi_usb_query(void *handle)
{ {
int result; int result;
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
result = icdi_send_cmd(handle, "qSupported"); result = icdi_send_cmd(handle, "qSupported");
if (result != ERROR_OK) if (result != ERROR_OK)
@ -468,7 +468,7 @@ static int icdi_usb_read_regs(void *handle)
static int icdi_usb_read_reg(void *handle, unsigned int regsel, uint32_t *val) static int icdi_usb_read_reg(void *handle, unsigned int regsel, uint32_t *val)
{ {
int result; int result;
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
char cmd[10]; char cmd[10];
snprintf(cmd, sizeof(cmd), "p%x", regsel); snprintf(cmd, sizeof(cmd), "p%x", regsel);
@ -521,7 +521,7 @@ static int icdi_usb_write_reg(void *handle, unsigned int regsel, uint32_t val)
static int icdi_usb_read_mem_int(void *handle, uint32_t addr, uint32_t len, uint8_t *buffer) static int icdi_usb_read_mem_int(void *handle, uint32_t addr, uint32_t len, uint8_t *buffer)
{ {
int result; int result;
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
char cmd[20]; char cmd[20];
snprintf(cmd, sizeof(cmd), "x%" PRIx32 ",%" PRIx32, addr, len); snprintf(cmd, sizeof(cmd), "x%" PRIx32 ",%" PRIx32, addr, len);
@ -549,7 +549,7 @@ static int icdi_usb_read_mem_int(void *handle, uint32_t addr, uint32_t len, uint
static int icdi_usb_write_mem_int(void *handle, uint32_t addr, uint32_t len, const uint8_t *buffer) static int icdi_usb_write_mem_int(void *handle, uint32_t addr, uint32_t len, const uint8_t *buffer)
{ {
int result; int result;
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
size_t cmd_len = snprintf(h->write_buffer, h->max_packet, PACKET_START "X%" PRIx32 ",%" PRIx32 ":", addr, len); size_t cmd_len = snprintf(h->write_buffer, h->max_packet, PACKET_START "X%" PRIx32 ",%" PRIx32 ":", addr, len);
@ -581,7 +581,7 @@ static int icdi_usb_read_mem(void *handle, uint32_t addr, uint32_t size,
uint32_t count, uint8_t *buffer) uint32_t count, uint8_t *buffer)
{ {
int retval = ERROR_OK; int retval = ERROR_OK;
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
uint32_t bytes_remaining; uint32_t bytes_remaining;
/* calculate byte count */ /* calculate byte count */
@ -609,7 +609,7 @@ static int icdi_usb_write_mem(void *handle, uint32_t addr, uint32_t size,
uint32_t count, const uint8_t *buffer) uint32_t count, const uint8_t *buffer)
{ {
int retval = ERROR_OK; int retval = ERROR_OK;
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
uint32_t bytes_remaining; uint32_t bytes_remaining;
/* calculate byte count */ /* calculate byte count */
@ -640,7 +640,7 @@ static int icdi_usb_override_target(const char *targetname)
static int icdi_usb_close(void *handle) static int icdi_usb_close(void *handle)
{ {
struct icdi_usb_handle_s *h = handle; struct icdi_usb_handle *h = handle;
if (!h) if (!h)
return ERROR_OK; return ERROR_OK;
@ -654,15 +654,15 @@ static int icdi_usb_close(void *handle)
return ERROR_OK; return ERROR_OK;
} }
static int icdi_usb_open(struct hl_interface_param_s *param, void **fd) static int icdi_usb_open(struct hl_interface_param *param, void **fd)
{ {
/* TODO: Convert remaining libusb_ calls to jtag_libusb_ */ /* TODO: Convert remaining libusb_ calls to jtag_libusb_ */
int retval; int retval;
struct icdi_usb_handle_s *h; struct icdi_usb_handle *h;
LOG_DEBUG("icdi_usb_open"); LOG_DEBUG("icdi_usb_open");
h = calloc(1, sizeof(struct icdi_usb_handle_s)); h = calloc(1, sizeof(struct icdi_usb_handle));
if (!h) { if (!h) {
LOG_ERROR("unable to allocate memory"); LOG_ERROR("unable to allocate memory");
@ -743,7 +743,7 @@ error_open:
return ERROR_FAIL; return ERROR_FAIL;
} }
struct hl_layout_api_s icdi_usb_layout_api = { struct hl_layout_api icdi_usb_layout_api = {
.open = icdi_usb_open, .open = icdi_usb_open,
.close = icdi_usb_close, .close = icdi_usb_close,
.idcode = icdi_usb_idcode, .idcode = icdi_usb_idcode,

View File

@ -23,7 +23,7 @@
#include <target/target.h> #include <target/target.h>
static struct hl_interface_s hl_if = { static struct hl_interface hl_if = {
.param = { .param = {
.device_desc = NULL, .device_desc = NULL,
.vid = { 0 }, .vid = { 0 },

View File

@ -20,7 +20,7 @@ extern const char *hl_transports[];
#define HLA_MAX_USB_IDS 16 #define HLA_MAX_USB_IDS 16
struct hl_interface_param_s { struct hl_interface_param {
/** */ /** */
const char *device_desc; const char *device_desc;
/** List of recognised VIDs */ /** List of recognised VIDs */
@ -39,9 +39,9 @@ struct hl_interface_param_s {
uint16_t stlink_tcp_port; uint16_t stlink_tcp_port;
}; };
struct hl_interface_s { struct hl_interface {
/** */ /** */
struct hl_interface_param_s param; struct hl_interface_param param;
/** */ /** */
const struct hl_layout *layout; const struct hl_layout *layout;
/** */ /** */

View File

@ -21,7 +21,7 @@
#include <jtag/hla/hla_transport.h> #include <jtag/hla/hla_transport.h>
#include <jtag/hla/hla_interface.h> #include <jtag/hla/hla_interface.h>
static int hl_layout_open(struct hl_interface_s *adapter) static int hl_layout_open(struct hl_interface *adapter)
{ {
int res; int res;
@ -39,7 +39,7 @@ static int hl_layout_open(struct hl_interface_s *adapter)
return ERROR_OK; return ERROR_OK;
} }
static int hl_layout_close(struct hl_interface_s *adapter) static int hl_layout_close(struct hl_interface *adapter)
{ {
return ERROR_OK; return ERROR_OK;
} }
@ -78,7 +78,7 @@ const struct hl_layout *hl_layout_get_list(void)
return hl_layouts; return hl_layouts;
} }
int hl_layout_init(struct hl_interface_s *adapter) int hl_layout_init(struct hl_interface *adapter)
{ {
LOG_DEBUG("hl_layout_init"); LOG_DEBUG("hl_layout_init");

View File

@ -15,18 +15,18 @@
#include <target/arm_tpiu_swo.h> #include <target/arm_tpiu_swo.h>
/** */ /** */
struct hl_interface_s; struct hl_interface;
struct hl_interface_param_s; struct hl_interface_param;
/** */ /** */
extern struct hl_layout_api_s stlink_usb_layout_api; extern struct hl_layout_api stlink_usb_layout_api;
extern struct hl_layout_api_s icdi_usb_layout_api; extern struct hl_layout_api icdi_usb_layout_api;
extern struct hl_layout_api_s nulink_usb_layout_api; extern struct hl_layout_api nulink_usb_layout_api;
/** */ /** */
struct hl_layout_api_s { struct hl_layout_api {
/** */ /** */
int (*open)(struct hl_interface_param_s *param, void **handle); int (*open)(struct hl_interface_param *param, void **handle);
/** */ /** */
int (*close)(void *handle); int (*close)(void *handle);
/** */ /** */
@ -121,16 +121,16 @@ struct hl_layout {
/** */ /** */
char *name; char *name;
/** */ /** */
int (*open)(struct hl_interface_s *adapter); int (*open)(struct hl_interface *adapter);
/** */ /** */
int (*close)(struct hl_interface_s *adapter); int (*close)(struct hl_interface *adapter);
/** */ /** */
struct hl_layout_api_s *api; struct hl_layout_api *api;
}; };
/** */ /** */
const struct hl_layout *hl_layout_get_list(void); const struct hl_layout *hl_layout_get_list(void);
/** */ /** */
int hl_layout_init(struct hl_interface_s *adapter); int hl_layout_init(struct hl_interface *adapter);
#endif /* OPENOCD_JTAG_HLA_HLA_LAYOUT_H */ #endif /* OPENOCD_JTAG_HLA_HLA_LAYOUT_H */

View File

@ -36,7 +36,7 @@
#define ARMV7M_SCS_DCRSR DCB_DCRSR #define ARMV7M_SCS_DCRSR DCB_DCRSR
#define ARMV7M_SCS_DCRDR DCB_DCRDR #define ARMV7M_SCS_DCRDR DCB_DCRDR
static inline struct hl_interface_s *target_to_adapter(struct target *target) static inline struct hl_interface *target_to_adapter(struct target *target)
{ {
return target->tap->priv; return target->tap->priv;
} }
@ -44,14 +44,14 @@ static inline struct hl_interface_s *target_to_adapter(struct target *target)
static int adapter_load_core_reg_u32(struct target *target, static int adapter_load_core_reg_u32(struct target *target,
uint32_t regsel, uint32_t *value) uint32_t regsel, uint32_t *value)
{ {
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
return adapter->layout->api->read_reg(adapter->handle, regsel, value); return adapter->layout->api->read_reg(adapter->handle, regsel, value);
} }
static int adapter_store_core_reg_u32(struct target *target, static int adapter_store_core_reg_u32(struct target *target,
uint32_t regsel, uint32_t value) uint32_t regsel, uint32_t value)
{ {
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
return adapter->layout->api->write_reg(adapter->handle, regsel, value); return adapter->layout->api->write_reg(adapter->handle, regsel, value);
} }
@ -65,7 +65,7 @@ static int adapter_examine_debug_reason(struct target *target)
return ERROR_OK; return ERROR_OK;
} }
static int hl_dcc_read(struct hl_interface_s *hl_if, uint8_t *value, uint8_t *ctrl) static int hl_dcc_read(struct hl_interface *hl_if, uint8_t *value, uint8_t *ctrl)
{ {
uint16_t dcrdr; uint16_t dcrdr;
int retval = hl_if->layout->api->read_mem(hl_if->handle, int retval = hl_if->layout->api->read_mem(hl_if->handle,
@ -90,7 +90,7 @@ static int hl_dcc_read(struct hl_interface_s *hl_if, uint8_t *value, uint8_t *ct
static int hl_target_request_data(struct target *target, static int hl_target_request_data(struct target *target,
uint32_t size, uint8_t *buffer) uint32_t size, uint8_t *buffer)
{ {
struct hl_interface_s *hl_if = target_to_adapter(target); struct hl_interface *hl_if = target_to_adapter(target);
uint8_t data; uint8_t data;
uint8_t ctrl; uint8_t ctrl;
uint32_t i; uint32_t i;
@ -113,7 +113,7 @@ static int hl_handle_target_request(void *priv)
if (!target_was_examined(target)) if (!target_was_examined(target))
return ERROR_OK; return ERROR_OK;
struct hl_interface_s *hl_if = target_to_adapter(target); struct hl_interface *hl_if = target_to_adapter(target);
if (!target->dbg_msg_enabled) if (!target->dbg_msg_enabled)
return ERROR_OK; return ERROR_OK;
@ -227,7 +227,7 @@ static int adapter_load_context(struct target *target)
static int adapter_debug_entry(struct target *target) static int adapter_debug_entry(struct target *target)
{ {
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
struct armv7m_common *armv7m = target_to_armv7m(target); struct armv7m_common *armv7m = target_to_armv7m(target);
struct arm *arm = &armv7m->arm; struct arm *arm = &armv7m->arm;
struct reg *r; struct reg *r;
@ -286,7 +286,7 @@ static int adapter_debug_entry(struct target *target)
static int adapter_poll(struct target *target) static int adapter_poll(struct target *target)
{ {
enum target_state state; enum target_state state;
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
struct armv7m_common *armv7m = target_to_armv7m(target); struct armv7m_common *armv7m = target_to_armv7m(target);
enum target_state prev_target_state = target->state; enum target_state prev_target_state = target->state;
@ -329,7 +329,7 @@ static int adapter_poll(struct target *target)
static int hl_assert_reset(struct target *target) static int hl_assert_reset(struct target *target)
{ {
int res = ERROR_OK; int res = ERROR_OK;
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
struct armv7m_common *armv7m = target_to_armv7m(target); struct armv7m_common *armv7m = target_to_armv7m(target);
bool use_srst_fallback = true; bool use_srst_fallback = true;
@ -412,7 +412,7 @@ static int hl_deassert_reset(struct target *target)
static int adapter_halt(struct target *target) static int adapter_halt(struct target *target)
{ {
int res; int res;
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
LOG_DEBUG("%s", __func__); LOG_DEBUG("%s", __func__);
@ -439,7 +439,7 @@ static int adapter_resume(struct target *target, int current,
int debug_execution) int debug_execution)
{ {
int res; int res;
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
struct armv7m_common *armv7m = target_to_armv7m(target); struct armv7m_common *armv7m = target_to_armv7m(target);
uint32_t resume_pc; uint32_t resume_pc;
struct breakpoint *breakpoint = NULL; struct breakpoint *breakpoint = NULL;
@ -529,7 +529,7 @@ static int adapter_step(struct target *target, int current,
target_addr_t address, int handle_breakpoints) target_addr_t address, int handle_breakpoints)
{ {
int res; int res;
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
struct armv7m_common *armv7m = target_to_armv7m(target); struct armv7m_common *armv7m = target_to_armv7m(target);
struct breakpoint *breakpoint = NULL; struct breakpoint *breakpoint = NULL;
struct reg *pc = armv7m->arm.pc; struct reg *pc = armv7m->arm.pc;
@ -593,7 +593,7 @@ static int adapter_read_memory(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, uint32_t size, uint32_t count,
uint8_t *buffer) uint8_t *buffer)
{ {
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
if (!count || !buffer) if (!count || !buffer)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -608,7 +608,7 @@ static int adapter_write_memory(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, uint32_t size, uint32_t count,
const uint8_t *buffer) const uint8_t *buffer)
{ {
struct hl_interface_s *adapter = target_to_adapter(target); struct hl_interface *adapter = target_to_adapter(target);
if (!count || !buffer) if (!count || !buffer)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;