aboutsummaryrefslogtreecommitdiff
path: root/src/jtag
diff options
context:
space:
mode:
Diffstat (limited to 'src/jtag')
-rw-r--r--src/jtag/commands.h6
-rw-r--r--src/jtag/drivers/angie.c2
-rw-r--r--src/jtag/drivers/ftdi.c4
-rw-r--r--src/jtag/drivers/nulink_usb.c60
-rw-r--r--src/jtag/drivers/remote_bitbang.c9
-rw-r--r--src/jtag/drivers/rlink.c6
-rw-r--r--src/jtag/drivers/stlink_usb.c206
-rw-r--r--src/jtag/drivers/ti_icdi_usb.c36
-rw-r--r--src/jtag/drivers/ulink.c2
-rw-r--r--src/jtag/hla/hla_interface.c2
-rw-r--r--src/jtag/hla/hla_interface.h6
-rw-r--r--src/jtag/hla/hla_layout.c6
-rw-r--r--src/jtag/hla/hla_layout.h22
-rw-r--r--src/jtag/tcl.c5
14 files changed, 190 insertions, 182 deletions
diff --git a/src/jtag/commands.h b/src/jtag/commands.h
index a1096da..8259077 100644
--- a/src/jtag/commands.h
+++ b/src/jtag/commands.h
@@ -15,7 +15,7 @@
#define OPENOCD_JTAG_COMMANDS_H
/**
- * The inferred type of a scan_command_s structure, indicating whether
+ * The inferred type of a scan_command structure, indicating whether
* the command has the host scan in from the device, the host scan out
* to the device, or both.
*/
@@ -29,7 +29,7 @@ enum scan_type {
};
/**
- * The scan_command provide a means of encapsulating a set of scan_field_s
+ * The scan_command provide a means of encapsulating a set of scan_field
* structures that should be scanned in/out to the device.
*/
struct scan_command {
@@ -123,7 +123,7 @@ union jtag_command_container {
/**
* The type of the @c jtag_command_container contained by a
- * @c jtag_command_s structure.
+ * @c jtag_command structure.
*/
enum jtag_command_type {
JTAG_SCAN = 1,
diff --git a/src/jtag/drivers/angie.c b/src/jtag/drivers/angie.c
index c024667..81dd1af 100644
--- a/src/jtag/drivers/angie.c
+++ b/src/jtag/drivers/angie.c
@@ -1597,7 +1597,7 @@ static int angie_queue_scan(struct angie *device, struct jtag_command *cmd)
/* Allocate TDO buffer if required */
if (type == SCAN_IN || type == SCAN_IO) {
- tdo_buffer_start = calloc(sizeof(uint8_t), scan_size_bytes);
+ tdo_buffer_start = calloc(scan_size_bytes, sizeof(uint8_t));
if (!tdo_buffer_start)
return ERROR_FAIL;
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index a0b120b..1793cbf 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -1228,7 +1228,7 @@ COMMAND_HANDLER(ftdi_handle_get_signal_command)
uint16_t sig_data = 0;
sig = find_signal_by_name(CMD_ARGV[0]);
if (!sig) {
- LOG_ERROR("interface configuration doesn't define signal '%s'", CMD_ARGV[0]);
+ command_print(CMD, "interface configuration doesn't define signal '%s'", CMD_ARGV[0]);
return ERROR_FAIL;
}
@@ -1236,7 +1236,7 @@ COMMAND_HANDLER(ftdi_handle_get_signal_command)
if (ret != ERROR_OK)
return ret;
- LOG_USER("Signal %s = %#06x", sig->name, sig_data);
+ command_print(CMD, "%#06x", sig_data);
return ERROR_OK;
}
diff --git a/src/jtag/drivers/nulink_usb.c b/src/jtag/drivers/nulink_usb.c
index 4fdb857..66cf25a 100644
--- a/src/jtag/drivers/nulink_usb.c
+++ b/src/jtag/drivers/nulink_usb.c
@@ -34,7 +34,7 @@
#define NULINK2_USB_PID1 (0x5200)
#define NULINK2_USB_PID2 (0x5201)
-struct nulink_usb_handle_s {
+struct nulink_usb_handle {
hid_device *dev_handle;
uint16_t max_packet_size;
uint8_t usbcmdidx;
@@ -87,7 +87,7 @@ enum nulink_connect {
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);
@@ -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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = 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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = 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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = 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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = 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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
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)
{
- 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);
@@ -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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = 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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_reset");
@@ -349,7 +349,7 @@ static int nulink_usb_reset(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");
@@ -365,7 +365,7 @@ static int nulink_usb_run(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");
@@ -385,7 +385,7 @@ static int nulink_usb_halt(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");
@@ -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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = 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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = 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;
uint32_t offset = 0;
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);
@@ -568,7 +568,7 @@ static int nulink_usb_write_mem8(void *handle, uint32_t addr, uint16_t len,
int res = ERROR_OK;
uint32_t offset = 0;
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);
@@ -675,7 +675,7 @@ static int nulink_usb_read_mem32(void *handle, uint32_t addr, uint16_t len,
{
int res = ERROR_OK;
uint32_t bytes_remaining = 12;
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = 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;
uint32_t bytes_remaining = 12;
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = 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)
{
int retval = ERROR_OK;
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
/* calculate byte count */
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)
{
int retval = ERROR_OK;
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
if (addr < ARM_SRAM_BASE) {
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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
unsigned long max_ice_clock = khz;
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)
{
- struct nulink_usb_handle_s *h = handle;
+ struct nulink_usb_handle *h = handle;
LOG_DEBUG("nulink_usb_close");
@@ -1018,7 +1018,7 @@ static int nulink_usb_close(void *handle)
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;
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;
}
- struct nulink_usb_handle_s *h = calloc(1, sizeof(*h));
+ struct nulink_usb_handle *h = calloc(1, sizeof(*h));
if (!h) {
LOG_ERROR("Out of memory");
goto error_open;
@@ -1154,7 +1154,7 @@ error_open:
return ERROR_FAIL;
}
-struct hl_layout_api_s nulink_usb_layout_api = {
+struct hl_layout_api nulink_usb_layout_api = {
.open = nulink_usb_open,
.close = nulink_usb_close,
.idcode = nulink_usb_idcode,
diff --git a/src/jtag/drivers/remote_bitbang.c b/src/jtag/drivers/remote_bitbang.c
index 53d2151..edd36f2 100644
--- a/src/jtag/drivers/remote_bitbang.c
+++ b/src/jtag/drivers/remote_bitbang.c
@@ -114,12 +114,18 @@ static int remote_bitbang_fill_buf(enum block_bool block)
contiguous_available_space);
if (first && block == BLOCK)
socket_nonblock(remote_bitbang_fd);
- first = false;
if (count > 0) {
remote_bitbang_recv_buf_end += count;
if (remote_bitbang_recv_buf_end == sizeof(remote_bitbang_recv_buf))
remote_bitbang_recv_buf_end = 0;
} else if (count == 0) {
+ /* When read_socket returns 0, socket reached EOF and there is
+ * no data to read. But if request was blocking, the caller
+ * expected some data. Such situations should be treated as ERROR. */
+ if (first && block == BLOCK) {
+ LOG_ERROR("remote_bitbang: socket closed by remote");
+ return ERROR_FAIL;
+ }
return ERROR_OK;
} else if (count < 0) {
#ifdef _WIN32
@@ -133,6 +139,7 @@ static int remote_bitbang_fill_buf(enum block_bool block)
return ERROR_FAIL;
}
}
+ first = false;
}
return ERROR_OK;
diff --git a/src/jtag/drivers/rlink.c b/src/jtag/drivers/rlink.c
index 1b1f2e4..afdf16e 100644
--- a/src/jtag/drivers/rlink.c
+++ b/src/jtag/drivers/rlink.c
@@ -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,
size_t length)
{
- struct header_s {
+ struct header {
uint8_t type;
uint8_t length;
};
int usb_err;
- struct header_s *header;
+ struct header *header;
uint8_t lut_start = 0xc0;
dtc_entry_download = 0;
@@ -311,7 +311,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *hdev_param, const u
exit(1);
}
- header = (struct header_s *)buffer;
+ header = (struct header *)buffer;
buffer += sizeof(*header);
length -= sizeof(*header);
diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index b14fbf1..8cf3b0c 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -140,7 +140,7 @@ struct stlink_usb_version {
uint32_t flags;
};
-struct stlink_usb_priv_s {
+struct stlink_usb_priv {
/** */
struct libusb_device_handle *fd;
/** */
@@ -154,7 +154,7 @@ struct stlink_tcp_version {
uint32_t build;
};
-struct stlink_tcp_priv_s {
+struct stlink_tcp_priv {
/** */
int fd;
/** */
@@ -171,9 +171,9 @@ struct stlink_tcp_priv_s {
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);
/** */
@@ -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 {
- struct stlink_usb_priv_s usb_backend_priv;
- struct stlink_tcp_priv_s tcp_backend_priv;
+ struct stlink_usb_priv usb_backend_priv;
+ struct stlink_tcp_priv tcp_backend_priv;
};
/** */
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);
}
/** */
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);
}
/** */
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);
}
@@ -567,7 +567,7 @@ static int stlink_usb_open_ap(void *handle, unsigned short apsel);
/** */
static unsigned int stlink_usb_block(void *handle)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
assert(handle);
@@ -727,7 +727,7 @@ static int jtag_libusb_bulk_transfer_n(
/** */
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;
assert(handle);
@@ -762,7 +762,7 @@ static int stlink_usb_xfer_v1_get_status(void *handle)
#ifdef USE_LIBUSB_ASYNCIO
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);
@@ -800,7 +800,7 @@ static int stlink_usb_xfer_rw(void *handle, int cmdsize, const uint8_t *buf, int
#else
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;
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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int tr, ret;
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)
{
int err, cmdsize = STLINK_CMD_SIZE_V2;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int send_size = STLINK_TCP_USB_CMD_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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
stlink_usb_init_buffer(h, h->trace_ep, 0);
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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 res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
while (1) {
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
/* fill the send buffer */
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
h->direction = direction;
@@ -1256,7 +1256,7 @@ static int stlink_usb_version(void *handle)
uint8_t v, x, y, jtag, swim, msd, bridge = 0;
char v_str[5 * (1 + 3) + 1]; /* VvJjMmBbSs */
char *p;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
uint32_t adc_results[2];
/* 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int rx_size = 0;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
assert(handle);
@@ -1725,7 +1725,7 @@ static int stlink_usb_init_mode(void *handle, bool connect_under_reset, int init
int res;
uint8_t mode;
enum stlink_mode emode;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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 */
static int stlink_swim_status(void *handle)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int res;
stlink_usb_init_buffer(handle, h->rx_ep, 4);
@@ -1849,7 +1849,7 @@ static int stlink_swim_status(void *handle)
__attribute__((unused))
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;
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 */
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;
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int res;
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 */
static int stlink_swim_speed(void *handle, int speed)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int res;
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int res;
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int res;
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int res;
unsigned int i;
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int res;
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)
{
int res, offset;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int res;
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res = ERROR_OK;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
assert(handle);
@@ -2243,7 +2243,7 @@ static void stlink_usb_trace_disable(void *handle)
static int stlink_usb_trace_enable(void *handle)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
assert(handle);
@@ -2274,7 +2274,7 @@ static int stlink_usb_trace_enable(void *handle)
/** */
static int stlink_usb_reset(void *handle)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int retval;
assert(handle);
@@ -2304,7 +2304,7 @@ static int stlink_usb_reset(void *handle)
static int stlink_usb_run(void *handle)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
assert(handle);
@@ -2326,7 +2326,7 @@ static int stlink_usb_run(void *handle)
static int stlink_usb_halt(void *handle)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
assert(handle);
@@ -2347,7 +2347,7 @@ static int stlink_usb_halt(void *handle)
/** */
static int stlink_usb_step(void *handle)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
assert(handle);
@@ -2371,7 +2371,7 @@ static int stlink_usb_step(void *handle)
static int stlink_usb_read_regs(void *handle)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
assert(handle);
@@ -2490,7 +2490,7 @@ static int stlink_usb_read_mem8(void *handle, uint8_t ap_num, uint32_t csw,
{
int res;
uint16_t read_len = len;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
int res;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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,
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);
@@ -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,
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);
@@ -2845,7 +2845,7 @@ static int stlink_usb_read_ap_mem(void *handle, uint8_t ap_num, uint32_t csw,
int retval = ERROR_OK;
uint32_t bytes_remaining;
int retries = 0;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
/* calculate byte count */
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;
uint32_t bytes_remaining;
int retries = 0;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
/* calculate byte count */
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)
{
int speed_index;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
/* old firmware cannot change it */
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)
{
int speed_index;
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
/* old firmware cannot change it */
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int i;
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
if (h->version.jtag_api != STLINK_JTAG_API_V3) {
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int speed_index;
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
if (!handle)
return khz;
@@ -3241,7 +3241,7 @@ static int stlink_speed(void *handle, int khz, bool query)
/** */
static int stlink_usb_usb_close(void *handle)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
if (!h)
return ERROR_OK;
@@ -3262,7 +3262,7 @@ static int stlink_usb_usb_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)
return ERROR_OK;
@@ -3295,7 +3295,7 @@ static int stlink_tcp_close(void *handle)
static int stlink_close(void *handle)
{
if (handle) {
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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;
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;
/* 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);
}
-static struct stlink_backend_s stlink_usb_backend = {
+static struct stlink_backend stlink_usb_backend = {
.open = stlink_usb_usb_open,
.close = stlink_usb_usb_close,
.xfer_noerrcheck = stlink_usb_usb_xfer_noerrcheck,
.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,
.close = stlink_tcp_close,
.xfer_noerrcheck = stlink_tcp_xfer_noerrcheck,
.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");
- h = calloc(1, sizeof(struct stlink_usb_handle_s));
+ h = calloc(1, sizeof(struct stlink_usb_handle));
if (!h) {
LOG_DEBUG("malloc failed");
@@ -3829,7 +3829,7 @@ error_open:
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);
}
@@ -3839,7 +3839,7 @@ static int stlink_config_trace(void *handle, bool enabled,
unsigned int *trace_freq, unsigned int traceclkin_freq,
uint16_t *prescaler)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
if (!(h->version.flags & STLINK_F_HAS_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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
unsigned int buflen = ALIGN_UP(items, 4) + 4 * 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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
unsigned int buflen = 2 * 4 * 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,
unsigned short addr, uint32_t *val)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int retval;
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,
unsigned short addr, uint32_t val)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = 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,
/** */
@@ -4078,8 +4078,8 @@ struct hl_layout_api_s stlink_usb_layout_api = {
* DAP direct interface
*/
-static struct stlink_usb_handle_s *stlink_dap_handle;
-static struct hl_interface_param_s stlink_dap_param;
+static struct stlink_usb_handle *stlink_dap_handle;
+static struct hl_interface_param stlink_dap_param;
static DECLARE_BITMAP(opened_ap, DP_APSEL_MAX + 1);
static uint32_t last_csw_default[DP_APSEL_MAX + 1];
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)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
int retval;
/* 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,
unsigned int *pkt_items)
{
- struct stlink_usb_handle_s *h = handle;
+ struct stlink_usb_handle *h = handle;
unsigned int i, items = 0;
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;
@@ -5039,7 +5039,7 @@ COMMAND_HANDLER(stlink_dap_backend_command)
COMMAND_HANDLER(stlink_dap_cmd_command)
{
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)
return ERROR_COMMAND_SYNTAX_ERROR;
diff --git a/src/jtag/drivers/ti_icdi_usb.c b/src/jtag/drivers/ti_icdi_usb.c
index 4260e2d..0e01171 100644
--- a/src/jtag/drivers/ti_icdi_usb.c
+++ b/src/jtag/drivers/ti_icdi_usb.c
@@ -33,7 +33,7 @@
#define PACKET_START "$"
#define PACKET_END "#"
-struct icdi_usb_handle_s {
+struct icdi_usb_handle {
struct libusb_device_handle *usb_dev;
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)
{
unsigned char cksum = 0;
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
int result, retry = 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)
{
- 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);
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)
{
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
size_t cmd_len = sprintf(h->write_buffer, PACKET_START "qRcmd,");
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)
{
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
int offset = 0;
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)
{
int result;
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
uint32_t dhcsr;
uint8_t buf[4];
@@ -303,7 +303,7 @@ static enum target_state icdi_usb_state(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];
@@ -335,7 +335,7 @@ static int icdi_usb_query(void *handle)
{
int result;
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
result = icdi_send_cmd(handle, "qSupported");
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)
{
int result;
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
char cmd[10];
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)
{
int result;
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
char cmd[20];
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)
{
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);
@@ -581,7 +581,7 @@ static int icdi_usb_read_mem(void *handle, uint32_t addr, uint32_t size,
uint32_t count, uint8_t *buffer)
{
int retval = ERROR_OK;
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
uint32_t bytes_remaining;
/* 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)
{
int retval = ERROR_OK;
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
uint32_t bytes_remaining;
/* calculate byte count */
@@ -640,7 +640,7 @@ static int icdi_usb_override_target(const char *targetname)
static int icdi_usb_close(void *handle)
{
- struct icdi_usb_handle_s *h = handle;
+ struct icdi_usb_handle *h = handle;
if (!h)
return ERROR_OK;
@@ -654,15 +654,15 @@ static int icdi_usb_close(void *handle)
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_ */
int retval;
- struct icdi_usb_handle_s *h;
+ struct icdi_usb_handle *h;
LOG_DEBUG("icdi_usb_open");
- h = calloc(1, sizeof(struct icdi_usb_handle_s));
+ h = calloc(1, sizeof(struct icdi_usb_handle));
if (!h) {
LOG_ERROR("unable to allocate memory");
@@ -743,7 +743,7 @@ error_open:
return ERROR_FAIL;
}
-struct hl_layout_api_s icdi_usb_layout_api = {
+struct hl_layout_api icdi_usb_layout_api = {
.open = icdi_usb_open,
.close = icdi_usb_close,
.idcode = icdi_usb_idcode,
diff --git a/src/jtag/drivers/ulink.c b/src/jtag/drivers/ulink.c
index 4f23c6c..0fe8989 100644
--- a/src/jtag/drivers/ulink.c
+++ b/src/jtag/drivers/ulink.c
@@ -1473,7 +1473,7 @@ static int ulink_queue_scan(struct ulink *device, struct jtag_command *cmd)
/* Allocate TDO buffer if required */
if ((type == SCAN_IN) || (type == SCAN_IO)) {
- tdo_buffer_start = calloc(sizeof(uint8_t), scan_size_bytes);
+ tdo_buffer_start = calloc(scan_size_bytes, sizeof(uint8_t));
if (!tdo_buffer_start)
return ERROR_FAIL;
diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c
index 9c8d0fa..6ac6801 100644
--- a/src/jtag/hla/hla_interface.c
+++ b/src/jtag/hla/hla_interface.c
@@ -23,7 +23,7 @@
#include <target/target.h>
-static struct hl_interface_s hl_if = {
+static struct hl_interface hl_if = {
.param = {
.device_desc = NULL,
.vid = { 0 },
diff --git a/src/jtag/hla/hla_interface.h b/src/jtag/hla/hla_interface.h
index fa49658..c95638b 100644
--- a/src/jtag/hla/hla_interface.h
+++ b/src/jtag/hla/hla_interface.h
@@ -20,7 +20,7 @@ extern const char *hl_transports[];
#define HLA_MAX_USB_IDS 16
-struct hl_interface_param_s {
+struct hl_interface_param {
/** */
const char *device_desc;
/** List of recognised VIDs */
@@ -39,9 +39,9 @@ struct hl_interface_param_s {
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;
/** */
diff --git a/src/jtag/hla/hla_layout.c b/src/jtag/hla/hla_layout.c
index 51671d6..04c963f 100644
--- a/src/jtag/hla/hla_layout.c
+++ b/src/jtag/hla/hla_layout.c
@@ -21,7 +21,7 @@
#include <jtag/hla/hla_transport.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;
@@ -39,7 +39,7 @@ static int hl_layout_open(struct hl_interface_s *adapter)
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;
}
@@ -78,7 +78,7 @@ const struct hl_layout *hl_layout_get_list(void)
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");
diff --git a/src/jtag/hla/hla_layout.h b/src/jtag/hla/hla_layout.h
index e13da65..71a7563 100644
--- a/src/jtag/hla/hla_layout.h
+++ b/src/jtag/hla/hla_layout.h
@@ -15,18 +15,18 @@
#include <target/arm_tpiu_swo.h>
/** */
-struct hl_interface_s;
-struct hl_interface_param_s;
+struct hl_interface;
+struct hl_interface_param;
/** */
-extern struct hl_layout_api_s stlink_usb_layout_api;
-extern struct hl_layout_api_s icdi_usb_layout_api;
-extern struct hl_layout_api_s nulink_usb_layout_api;
+extern struct hl_layout_api stlink_usb_layout_api;
+extern struct hl_layout_api icdi_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);
/** */
@@ -121,16 +121,16 @@ struct hl_layout {
/** */
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);
/** */
-int hl_layout_init(struct hl_interface_s *adapter);
+int hl_layout_init(struct hl_interface *adapter);
#endif /* OPENOCD_JTAG_HLA_HLA_LAYOUT_H */
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 7995529..1a4c4b7 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -760,8 +760,9 @@ static const struct command_registration jtag_subcommand_handlers[] = {
.mode = COMMAND_EXEC,
.handler = handle_jtag_configure,
.help = "Return any Tcl handler for the specified "
- "TAP event.",
- .usage = "tap_name '-event' event_name",
+ "TAP event or the value of the IDCODE found in hardware.",
+ .usage = "tap_name '-event' event_name | "
+ "tap_name '-idcode'",
},
{
.name = "names",