From 20ee64ae4bc70b836664465daebe828caca7ccbc Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 25 Apr 2021 23:41:15 +0200 Subject: [PATCH] jtag: rename CamelCase symbols No major cross dependency, just changes internal to each file or function. Change-Id: Ie6258a090ce53de5db65df6a77d57ac6bb899488 Signed-off-by: Antonio Borneo Reviewed-on: http://openocd.zylin.com/6301 Tested-by: jenkins --- src/jtag/aice/aice_transport.c | 46 ++++---- src/jtag/drivers/libusb_helper.c | 32 +++--- src/jtag/drivers/libusb_helper.h | 4 +- src/jtag/drivers/rlink.c | 108 +++++++++--------- .../drivers/versaloon/usbtoxxx/usbtojtagraw.c | 4 +- .../drivers/versaloon/usbtoxxx/usbtopwr.c | 4 +- .../drivers/versaloon/usbtoxxx/usbtoxxx.h | 22 ++-- src/jtag/drivers/versaloon/versaloon.h | 2 +- src/jtag/drivers/xlnx-pcie-xvc.c | 6 +- src/jtag/hla/hla_tcl.c | 40 +++---- src/jtag/tcl.c | 100 ++++++++-------- 11 files changed, 184 insertions(+), 184 deletions(-) diff --git a/src/jtag/aice/aice_transport.c b/src/jtag/aice/aice_transport.c index 322d8ae5cd..7e06760fb4 100644 --- a/src/jtag/aice/aice_transport.c +++ b/src/jtag/aice/aice_transport.c @@ -31,7 +31,7 @@ /* */ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi, - struct jtag_tap *pTap) + struct jtag_tap *tap) { jim_wide w; int e = jim_getopt_wide(goi, &w); @@ -41,21 +41,21 @@ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi return e; } - unsigned expected_len = sizeof(uint32_t) * pTap->expected_ids_cnt; + unsigned expected_len = sizeof(uint32_t) * tap->expected_ids_cnt; uint32_t *new_expected_ids = malloc(expected_len + sizeof(uint32_t)); if (new_expected_ids == NULL) { Jim_SetResultFormatted(goi->interp, "no memory"); return JIM_ERR; } - assert(pTap->expected_ids); - memcpy(new_expected_ids, pTap->expected_ids, expected_len); + assert(tap->expected_ids); + memcpy(new_expected_ids, tap->expected_ids, expected_len); - new_expected_ids[pTap->expected_ids_cnt] = w; + new_expected_ids[tap->expected_ids_cnt] = w; - free(pTap->expected_ids); - pTap->expected_ids = new_expected_ids; - pTap->expected_ids_cnt++; + free(tap->expected_ids); + tap->expected_ids = new_expected_ids; + tap->expected_ids_cnt++; return JIM_OK; } @@ -65,7 +65,7 @@ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi /* */ static int jim_aice_newtap_cmd(struct jim_getopt_info *goi) { - struct jtag_tap *pTap; + struct jtag_tap *tap; int x; int e; struct jim_nvp *n; @@ -75,8 +75,8 @@ static int jim_aice_newtap_cmd(struct jim_getopt_info *goi) {.name = NULL, .value = -1}, }; - pTap = calloc(1, sizeof(struct jtag_tap)); - if (!pTap) { + tap = calloc(1, sizeof(struct jtag_tap)); + if (!tap) { Jim_SetResultFormatted(goi->interp, "no memory"); return JIM_ERR; } @@ -87,41 +87,41 @@ static int jim_aice_newtap_cmd(struct jim_getopt_info *goi) if (goi->argc < 3) { Jim_SetResultFormatted(goi->interp, "Missing CHIP TAP OPTIONS ...."); - free(pTap); + free(tap); return JIM_ERR; } const char *tmp; jim_getopt_string(goi, &tmp, NULL); - pTap->chip = strdup(tmp); + tap->chip = strdup(tmp); jim_getopt_string(goi, &tmp, NULL); - pTap->tapname = strdup(tmp); + tap->tapname = strdup(tmp); /* name + dot + name + null */ - x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1; + x = strlen(tap->chip) + 1 + strlen(tap->tapname) + 1; cp = malloc(x); - sprintf(cp, "%s.%s", pTap->chip, pTap->tapname); - pTap->dotted_name = cp; + sprintf(cp, "%s.%s", tap->chip, tap->tapname); + tap->dotted_name = cp; LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params", - pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc); + tap->chip, tap->tapname, tap->dotted_name, goi->argc); while (goi->argc) { e = jim_getopt_nvp(goi, opts, &n); if (e != JIM_OK) { jim_getopt_nvp_unknown(goi, opts, 0); free(cp); - free(pTap); + free(tap); return e; } LOG_DEBUG("Processing option: %s", n->name); switch (n->value) { case NTAP_OPT_EXPECTED_ID: - e = jim_newtap_expected_id(n, goi, pTap); + e = jim_newtap_expected_id(n, goi, tap); if (JIM_OK != e) { free(cp); - free(pTap); + free(tap); return e; } break; @@ -129,9 +129,9 @@ static int jim_aice_newtap_cmd(struct jim_getopt_info *goi) } /* while (goi->argc) */ /* default is enabled-after-reset */ - pTap->enabled = !pTap->disabled_after_reset; + tap->enabled = !tap->disabled_after_reset; - jtag_tap_init(pTap); + jtag_tap_init(tap); return JIM_OK; } diff --git a/src/jtag/drivers/libusb_helper.c b/src/jtag/drivers/libusb_helper.c index 18fe4bad4c..e214eb7012 100644 --- a/src/jtag/drivers/libusb_helper.c +++ b/src/jtag/drivers/libusb_helper.c @@ -158,7 +158,7 @@ int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], struct libusb_device_handle **out, adapter_get_alternate_serial_fn adapter_get_alternate_serial) { - int cnt, idx, errCode; + int cnt, idx, err_code; int retval = ERROR_FAIL; bool serial_mismatch = false; struct libusb_device_handle *libusb_handle = NULL; @@ -180,11 +180,11 @@ int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], if (jtag_usb_get_location() && !jtag_libusb_location_equal(devs[idx])) continue; - errCode = libusb_open(devs[idx], &libusb_handle); + err_code = libusb_open(devs[idx], &libusb_handle); - if (errCode) { + if (err_code) { LOG_ERROR("libusb_open() failed with %s", - libusb_error_name(errCode)); + libusb_error_name(err_code)); continue; } @@ -222,13 +222,13 @@ void jtag_libusb_close(struct libusb_device_handle *dev) libusb_exit(jtag_libusb_context); } -int jtag_libusb_control_transfer(struct libusb_device_handle *dev, uint8_t requestType, - uint8_t request, uint16_t wValue, uint16_t wIndex, char *bytes, +int jtag_libusb_control_transfer(struct libusb_device_handle *dev, uint8_t request_type, + uint8_t request, uint16_t value, uint16_t index, char *bytes, uint16_t size, unsigned int timeout) { int transferred = 0; - transferred = libusb_control_transfer(dev, requestType, request, wValue, wIndex, + transferred = libusb_control_transfer(dev, request_type, request, value, index, (unsigned char *)bytes, size, timeout); if (transferred < 0) @@ -275,28 +275,28 @@ int jtag_libusb_set_configuration(struct libusb_device_handle *devh, int configuration) { struct libusb_device *udev = libusb_get_device(devh); - int retCode = -99; + int retval = -99; struct libusb_config_descriptor *config = NULL; int current_config = -1; - retCode = libusb_get_configuration(devh, ¤t_config); - if (retCode != 0) - return retCode; + retval = libusb_get_configuration(devh, ¤t_config); + if (retval != 0) + return retval; - retCode = libusb_get_config_descriptor(udev, configuration, &config); - if (retCode != 0 || config == NULL) - return retCode; + retval = libusb_get_config_descriptor(udev, configuration, &config); + if (retval != 0 || config == NULL) + return retval; /* Only change the configuration if it is not already set to the same one. Otherwise this issues a lightweight reset and hangs LPC-Link2 with JLink firmware. */ if (current_config != config->bConfigurationValue) - retCode = libusb_set_configuration(devh, config->bConfigurationValue); + retval = libusb_set_configuration(devh, config->bConfigurationValue); libusb_free_config_descriptor(config); - return retCode; + return retval; } int jtag_libusb_choose_interface(struct libusb_device_handle *devh, diff --git a/src/jtag/drivers/libusb_helper.h b/src/jtag/drivers/libusb_helper.h index 3e77865d61..6087128d24 100644 --- a/src/jtag/drivers/libusb_helper.h +++ b/src/jtag/drivers/libusb_helper.h @@ -33,8 +33,8 @@ int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], adapter_get_alternate_serial_fn adapter_get_alternate_serial); void jtag_libusb_close(struct libusb_device_handle *dev); int jtag_libusb_control_transfer(struct libusb_device_handle *dev, - uint8_t requestType, uint8_t request, uint16_t wValue, - uint16_t wIndex, char *bytes, uint16_t size, unsigned int timeout); + uint8_t request_type, uint8_t request, uint16_t value, + uint16_t index, char *bytes, uint16_t size, unsigned int timeout); int jtag_libusb_bulk_write(struct libusb_device_handle *dev, int ep, char *bytes, int size, int timeout, int *transferred); int jtag_libusb_bulk_read(struct libusb_device_handle *dev, int ep, diff --git a/src/jtag/drivers/rlink.c b/src/jtag/drivers/rlink.c index a88731f4ab..07e22ffb79 100644 --- a/src/jtag/drivers/rlink.c +++ b/src/jtag/drivers/rlink.c @@ -97,14 +97,14 @@ #define ST7_PC_TDO ST7_PC_IO9 #define ST7_PA_DBGACK ST7_PA_IO10 -static struct libusb_device_handle *pHDev; +static struct libusb_device_handle *hdev; /* * ep1 commands are up to USB_EP1OUT_SIZE bytes in length. * This function takes care of zeroing the unused bytes before sending the packet. * Any reply packet is not handled by this function. */ -static int ep1_generic_commandl(struct libusb_device_handle *pHDev_param, size_t length, ...) +static int ep1_generic_commandl(struct libusb_device_handle *hdev_param, size_t length, ...) { uint8_t usb_buffer[USB_EP1OUT_SIZE]; uint8_t *usb_buffer_p; @@ -130,7 +130,7 @@ static int ep1_generic_commandl(struct libusb_device_handle *pHDev_param, size_t ); usb_ret = jtag_libusb_bulk_write( - pHDev_param, + hdev_param, USB_EP1OUT_ADDR, (char *)usb_buffer, sizeof(usb_buffer), USB_TIMEOUT_MS, @@ -144,7 +144,7 @@ static int ep1_generic_commandl(struct libusb_device_handle *pHDev_param, size_t #if 0 static ssize_t ep1_memory_read( - struct libusb_device_handle *pHDev_param, uint16_t addr, + struct libusb_device_handle *hdev_param, uint16_t addr, size_t length, uint8_t *buffer) { uint8_t usb_buffer[USB_EP1OUT_SIZE]; @@ -174,7 +174,7 @@ static ssize_t ep1_memory_read( usb_buffer[3] = length; usb_ret = jtag_libusb_bulk_write( - pHDev_param, USB_EP1OUT_ADDR, + hdev_param, USB_EP1OUT_ADDR, (char *)usb_buffer, sizeof(usb_buffer), USB_TIMEOUT_MS, &transferred @@ -184,7 +184,7 @@ static ssize_t ep1_memory_read( break; usb_ret = jtag_libusb_bulk_read( - pHDev_param, USB_EP1IN_ADDR, + hdev_param, USB_EP1IN_ADDR, (char *)buffer, length, USB_TIMEOUT_MS, &transferred @@ -203,7 +203,7 @@ static ssize_t ep1_memory_read( } #endif -static ssize_t ep1_memory_write(struct libusb_device_handle *pHDev_param, uint16_t addr, +static ssize_t ep1_memory_write(struct libusb_device_handle *hdev_param, uint16_t addr, size_t length, uint8_t const *buffer) { uint8_t usb_buffer[USB_EP1OUT_SIZE]; @@ -239,7 +239,7 @@ static ssize_t ep1_memory_write(struct libusb_device_handle *pHDev_param, uint16 int transferred; usb_ret = jtag_libusb_bulk_write( - pHDev_param, USB_EP1OUT_ADDR, + hdev_param, USB_EP1OUT_ADDR, (char *)usb_buffer, sizeof(usb_buffer), USB_TIMEOUT_MS, &transferred @@ -259,7 +259,7 @@ static ssize_t ep1_memory_write(struct libusb_device_handle *pHDev_param, uint16 #if 0 -static ssize_t ep1_memory_writel(struct libusb_device_handle *pHDev_param, uint16_t addr, +static ssize_t ep1_memory_writel(struct libusb_device_handle *hdev_param, uint16_t addr, size_t length, ...) { uint8_t buffer[USB_EP1OUT_SIZE - 4]; @@ -279,7 +279,7 @@ static ssize_t ep1_memory_writel(struct libusb_device_handle *pHDev_param, uint1 remain--; } - return ep1_memory_write(pHDev_param, addr, length, buffer); + return ep1_memory_write(hdev_param, addr, length, buffer); } #endif @@ -296,7 +296,7 @@ static ssize_t ep1_memory_writel(struct libusb_device_handle *pHDev_param, uint1 static uint8_t dtc_entry_download; /* The buffer is specially formatted to represent a valid image to load into the DTC. */ -static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const uint8_t *buffer, +static int dtc_load_from_buffer(struct libusb_device_handle *hdev_param, const uint8_t *buffer, size_t length) { struct header_s { @@ -312,7 +312,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const /* Stop the DTC before loading anything. */ usb_err = ep1_generic_commandl( - pHDev_param, 1, + hdev_param, 1, EP1_CMD_DTC_STOP ); if (usb_err < 0) @@ -346,7 +346,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const case DTCLOAD_LOAD: /* Send the DTC program to ST7 RAM. */ usb_err = ep1_memory_write( - pHDev_param, + hdev_param, DTC_LOAD_BUFFER, header->length + 1, buffer ); @@ -355,7 +355,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const /* Load it into the DTC. */ usb_err = ep1_generic_commandl( - pHDev_param, 3, + hdev_param, 3, EP1_CMD_DTC_LOAD, (DTC_LOAD_BUFFER >> 8), DTC_LOAD_BUFFER @@ -367,7 +367,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const case DTCLOAD_RUN: usb_err = ep1_generic_commandl( - pHDev_param, 3, + hdev_param, 3, EP1_CMD_DTC_CALL, buffer[0], EP1_CMD_DTC_WAIT @@ -383,7 +383,7 @@ static int dtc_load_from_buffer(struct libusb_device_handle *pHDev_param, const case DTCLOAD_LUT: usb_err = ep1_memory_write( - pHDev_param, + hdev_param, ST7_USB_BUF_EP0OUT + lut_start, header->length + 1, buffer ); @@ -415,7 +415,7 @@ static int dtc_start_download(void) /* set up for download mode and make sure EP2 is set up to transmit */ usb_err = ep1_generic_commandl( - pHDev, 7, + hdev, 7, EP1_CMD_DTC_STOP, EP1_CMD_SET_UPLOAD, @@ -430,7 +430,7 @@ static int dtc_start_download(void) /* read back ep2txr */ usb_err = jtag_libusb_bulk_read( - pHDev, USB_EP1IN_ADDR, + hdev, USB_EP1IN_ADDR, (char *)&ep2txr, 1, USB_TIMEOUT_MS, &transferred @@ -439,7 +439,7 @@ static int dtc_start_download(void) return usb_err; usb_err = ep1_generic_commandl( - pHDev, 13, + hdev, 13, EP1_CMD_MEMORY_WRITE, /* preinitialize poll byte */ DTC_STATUS_POLL_BYTE >> 8, @@ -460,7 +460,7 @@ static int dtc_start_download(void) /* wait for completion */ usb_err = jtag_libusb_bulk_read( - pHDev, USB_EP1IN_ADDR, + hdev, USB_EP1IN_ADDR, (char *)&ep2txr, 1, USB_TIMEOUT_MS, &transferred @@ -470,7 +470,7 @@ static int dtc_start_download(void) } static int dtc_run_download( - struct libusb_device_handle *pHDev_param, + struct libusb_device_handle *hdev_param, uint8_t *command_buffer, int command_buffer_size, uint8_t *reply_buffer, @@ -485,7 +485,7 @@ static int dtc_run_download( LOG_DEBUG("%d/%d", command_buffer_size, reply_buffer_size); usb_err = jtag_libusb_bulk_write( - pHDev_param, + hdev_param, USB_EP2OUT_ADDR, (char *)command_buffer, USB_EP2BANK_SIZE, USB_TIMEOUT_MS, @@ -498,7 +498,7 @@ static int dtc_run_download( /* Wait for DTC to finish running command buffer */ for (i = 50;; ) { usb_err = ep1_generic_commandl( - pHDev_param, 4, + hdev_param, 4, EP1_CMD_MEMORY_READ, DTC_STATUS_POLL_BYTE >> 8, @@ -509,7 +509,7 @@ static int dtc_run_download( return usb_err; usb_err = jtag_libusb_bulk_read( - pHDev_param, + hdev_param, USB_EP1IN_ADDR, &dtc_status, 1, USB_TIMEOUT_MS, @@ -530,7 +530,7 @@ static int dtc_run_download( if (reply_buffer && reply_buffer_size) { usb_err = jtag_libusb_bulk_read( - pHDev_param, + hdev_param, USB_EP2IN_ADDR, (char *)reply_buffer, reply_buffer_size, USB_TIMEOUT_MS, @@ -656,7 +656,7 @@ static int dtc_queue_run(void) dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = DTC_CMD_STOP; - usb_err = dtc_run_download(pHDev, + usb_err = dtc_run_download(hdev, dtc_queue.cmd_buffer, dtc_queue.cmd_index, reply_buffer, sizeof(reply_buffer) ); @@ -940,7 +940,7 @@ static void rlink_reset(int trst, int srst) /* Read port A for bit op */ usb_err = ep1_generic_commandl( - pHDev, 4, + hdev, 4, EP1_CMD_MEMORY_READ, ST7_PADR >> 8, ST7_PADR, @@ -952,7 +952,7 @@ static void rlink_reset(int trst, int srst) } usb_err = jtag_libusb_bulk_read( - pHDev, USB_EP1IN_ADDR, + hdev, USB_EP1IN_ADDR, (char *)&bitmap, 1, USB_TIMEOUT_MS, &transferred @@ -971,7 +971,7 @@ static void rlink_reset(int trst, int srst) * port B has no OR, and we want to emulate open drain on NSRST, so we initialize DR to 0 *and assert NSRST by setting DDR to 1. */ usb_err = ep1_generic_commandl( - pHDev, 9, + hdev, 9, EP1_CMD_MEMORY_WRITE, ST7_PADR >> 8, ST7_PADR, @@ -988,7 +988,7 @@ static void rlink_reset(int trst, int srst) } usb_err = jtag_libusb_bulk_read( - pHDev, USB_EP1IN_ADDR, + hdev, USB_EP1IN_ADDR, (char *)&bitmap, 1, USB_TIMEOUT_MS, &transferred @@ -1005,7 +1005,7 @@ static void rlink_reset(int trst, int srst) /* write port B and read dummy to ensure completion before returning */ usb_err = ep1_generic_commandl( - pHDev, 6, + hdev, 6, EP1_CMD_MEMORY_WRITE, ST7_PBDDR >> 8, ST7_PBDDR, @@ -1019,7 +1019,7 @@ static void rlink_reset(int trst, int srst) } usb_err = jtag_libusb_bulk_read( - pHDev, USB_EP1IN_ADDR, + hdev, USB_EP1IN_ADDR, (char *)&bitmap, 1, USB_TIMEOUT_MS, &transferred @@ -1297,7 +1297,7 @@ static int rlink_execute_queue(void) #ifndef AUTOMATIC_BUSY_LED /* turn LED on */ - ep1_generic_commandl(pHDev, 2, + ep1_generic_commandl(hdev, 2, EP1_CMD_SET_PORTD_LEDS, ~(ST7_PD_NBUSY_LED) ); @@ -1381,7 +1381,7 @@ static int rlink_execute_queue(void) #ifndef AUTOMATIC_BUSY_LED /* turn LED off */ - ep1_generic_commandl(pHDev, 2, + ep1_generic_commandl(hdev, 2, EP1_CMD_SET_PORTD_LEDS, ~0 ); @@ -1404,7 +1404,7 @@ static int rlink_speed(int speed) for (i = rlink_speed_table_size; i--; ) { if (rlink_speed_table[i].prescaler == speed) { - if (dtc_load_from_buffer(pHDev, rlink_speed_table[i].dtc, + if (dtc_load_from_buffer(hdev, rlink_speed_table[i].dtc, rlink_speed_table[i].dtc_size) != 0) { LOG_ERROR( "An error occurred while trying to load DTC code for speed \"%d\".", @@ -1470,11 +1470,11 @@ static int rlink_init(void) const uint16_t vids[] = { USB_IDVENDOR, 0 }; const uint16_t pids[] = { USB_IDPRODUCT, 0 }; - if (jtag_libusb_open(vids, pids, NULL, &pHDev, NULL) != ERROR_OK) + if (jtag_libusb_open(vids, pids, NULL, &hdev, NULL) != ERROR_OK) return ERROR_FAIL; struct libusb_device_descriptor descriptor; - struct libusb_device *usb_dev = libusb_get_device(pHDev); + struct libusb_device *usb_dev = libusb_get_device(hdev); int r = libusb_get_device_descriptor(usb_dev, &descriptor); if (r < 0) { LOG_ERROR("error %d getting device descriptor", r); @@ -1492,17 +1492,17 @@ static int rlink_init(void) return ERROR_FAIL; } - LOG_DEBUG("Opened device, pHDev = %p", pHDev); + LOG_DEBUG("Opened device, hdev = %p", hdev); /* usb_set_configuration required under win32 */ - libusb_set_configuration(pHDev, config->bConfigurationValue); + libusb_set_configuration(hdev, config->bConfigurationValue); retries = 3; do { - i = libusb_claim_interface(pHDev, 0); + i = libusb_claim_interface(hdev, 0); if (i != LIBUSB_SUCCESS) { LOG_ERROR("usb_claim_interface: %s", libusb_error_name(i)); - j = libusb_detach_kernel_driver(pHDev, 0); + j = libusb_detach_kernel_driver(hdev, 0); if (j != LIBUSB_SUCCESS) LOG_ERROR("detach kernel driver: %s", libusb_error_name(j)); } else { @@ -1515,7 +1515,7 @@ static int rlink_init(void) LOG_ERROR("Initialisation failed."); return ERROR_FAIL; } - if (libusb_set_interface_alt_setting(pHDev, 0, 0) != LIBUSB_SUCCESS) { + if (libusb_set_interface_alt_setting(hdev, 0, 0) != LIBUSB_SUCCESS) { LOG_ERROR("Failed to set interface."); return ERROR_FAIL; } @@ -1531,7 +1531,7 @@ static int rlink_init(void) */ for (i = 0; i < 5; i++) { j = ep1_generic_commandl( - pHDev, 1, + hdev, 1, EP1_CMD_GET_FWREV ); if (j < USB_EP1OUT_SIZE) { @@ -1539,7 +1539,7 @@ static int rlink_init(void) return ERROR_FAIL; } j = jtag_libusb_bulk_read( - pHDev, USB_EP1IN_ADDR, + hdev, USB_EP1IN_ADDR, (char *)reply_buffer, sizeof(reply_buffer), 200, &transferred @@ -1563,7 +1563,7 @@ static int rlink_init(void) /* Probe port E for adapter presence */ ep1_generic_commandl( - pHDev, 16, + hdev, 16, EP1_CMD_MEMORY_WRITE, /* Drive sense pin with 0 */ ST7_PEDR >> 8, ST7_PEDR, @@ -1583,7 +1583,7 @@ static int rlink_init(void) ); jtag_libusb_bulk_read( - pHDev, USB_EP1IN_ADDR, + hdev, USB_EP1IN_ADDR, (char *)reply_buffer, 1, USB_TIMEOUT_MS, &transferred @@ -1593,7 +1593,7 @@ static int rlink_init(void) LOG_WARNING("target detection problem"); ep1_generic_commandl( - pHDev, 11, + hdev, 11, EP1_CMD_MEMORY_READ, /* Read back */ ST7_PEDR >> 8, ST7_PEDR, @@ -1608,7 +1608,7 @@ static int rlink_init(void) ); jtag_libusb_bulk_read( - pHDev, USB_EP1IN_ADDR, + hdev, USB_EP1IN_ADDR, (char *)reply_buffer, 1, USB_TIMEOUT_MS, &transferred @@ -1620,7 +1620,7 @@ static int rlink_init(void) /* float ports A and B */ ep1_generic_commandl( - pHDev, 11, + hdev, 11, EP1_CMD_MEMORY_WRITE, ST7_PADDR >> 8, ST7_PADDR, @@ -1636,7 +1636,7 @@ static int rlink_init(void) /* make sure DTC is stopped, set VPP control, set up ports A and B */ ep1_generic_commandl( - pHDev, 14, + hdev, 14, EP1_CMD_DTC_STOP, EP1_CMD_SET_PORTD_VPP, ~(ST7_PD_VPP_SHDN), @@ -1657,7 +1657,7 @@ static int rlink_init(void) /* set LED updating mode and make sure they're unlit */ ep1_generic_commandl( - pHDev, 3, + hdev, 3, #ifdef AUTOMATIC_BUSY_LED EP1_CMD_LEDUE_BUSY, #else @@ -1678,7 +1678,7 @@ static int rlink_quit(void) { /* stop DTC and make sure LEDs are off */ ep1_generic_commandl( - pHDev, 6, + hdev, 6, EP1_CMD_DTC_STOP, EP1_CMD_LEDUE_NONE, EP1_CMD_SET_PORTD_LEDS, @@ -1687,8 +1687,8 @@ static int rlink_quit(void) ~0 ); - libusb_release_interface(pHDev, 0); - libusb_close(pHDev); + libusb_release_interface(hdev, 0); + libusb_close(hdev); return ERROR_OK; } diff --git a/src/jtag/drivers/versaloon/usbtoxxx/usbtojtagraw.c b/src/jtag/drivers/versaloon/usbtoxxx/usbtojtagraw.c index f2ea175ad6..bd6104935c 100644 --- a/src/jtag/drivers/versaloon/usbtoxxx/usbtojtagraw.c +++ b/src/jtag/drivers/versaloon/usbtoxxx/usbtojtagraw.c @@ -37,7 +37,7 @@ RESULT usbtojtagraw_fini(uint8_t interface_index) return usbtoxxx_fini_command(USB_TO_JTAG_RAW, interface_index); } -RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t kHz) +RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t khz) { uint8_t cfg_buf[4]; @@ -48,7 +48,7 @@ RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t kHz) } #endif - SET_LE_U32(&cfg_buf[0], kHz); + SET_LE_U32(&cfg_buf[0], khz); return usbtoxxx_conf_command(USB_TO_JTAG_RAW, interface_index, cfg_buf, 4); } diff --git a/src/jtag/drivers/versaloon/usbtoxxx/usbtopwr.c b/src/jtag/drivers/versaloon/usbtoxxx/usbtopwr.c index 16433aff5c..e7568171c4 100644 --- a/src/jtag/drivers/versaloon/usbtoxxx/usbtopwr.c +++ b/src/jtag/drivers/versaloon/usbtoxxx/usbtopwr.c @@ -49,7 +49,7 @@ RESULT usbtopwr_config(uint8_t interface_index) return usbtoxxx_conf_command(USB_TO_POWER, interface_index, NULL, 0); } -RESULT usbtopwr_output(uint8_t interface_index, uint16_t mV) +RESULT usbtopwr_output(uint8_t interface_index, uint16_t millivolt) { #if PARAM_CHECK if (interface_index > 7) { @@ -58,6 +58,6 @@ RESULT usbtopwr_output(uint8_t interface_index, uint16_t mV) } #endif - return usbtoxxx_out_command(USB_TO_POWER, interface_index, (uint8_t *)&mV, + return usbtoxxx_out_command(USB_TO_POWER, interface_index, (uint8_t *)&millivolt, 2, 0); } diff --git a/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.h b/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.h index 98a056a8b8..0ae3c0353b 100644 --- a/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.h +++ b/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.h @@ -47,7 +47,7 @@ RESULT usbtousart_status(uint8_t interface_index, /* USB_TO_SPI */ RESULT usbtospi_init(uint8_t interface_index); RESULT usbtospi_fini(uint8_t interface_index); -RESULT usbtospi_config(uint8_t interface_index, uint32_t kHz, uint8_t mode); +RESULT usbtospi_config(uint8_t interface_index, uint32_t khz, uint8_t mode); RESULT usbtospi_io(uint8_t interface_index, uint8_t *out, uint8_t *in, uint16_t bytelen); @@ -82,7 +82,7 @@ RESULT usbtolpcicp_poll_ready(uint8_t interface_index, uint8_t data, /* USB_TO_JTAG_LL */ RESULT usbtojtagll_init(uint8_t interface_index); RESULT usbtojtagll_fini(uint8_t interface_index); -RESULT usbtojtagll_config(uint8_t interface_index, uint32_t kHz); +RESULT usbtojtagll_config(uint8_t interface_index, uint32_t khz); RESULT usbtojtagll_tms(uint8_t interface_index, uint8_t *tms, uint8_t bytelen); RESULT usbtojtagll_tms_clocks(uint8_t interface_index, uint32_t bytelen, uint8_t tms); @@ -94,7 +94,7 @@ RESULT usbtojtagll_scan(uint8_t interface_index, uint8_t *data, /* USB_TO_JTAG_HL */ RESULT usbtojtaghl_init(uint8_t interface_index); RESULT usbtojtaghl_fini(uint8_t interface_index); -RESULT usbtojtaghl_config(uint8_t interface_index, uint32_t kHz, uint8_t ub, +RESULT usbtojtaghl_config(uint8_t interface_index, uint32_t khz, uint8_t ub, uint8_t ua, uint16_t bb, uint16_t ba); RESULT usbtojtaghl_ir(uint8_t interface_index, uint8_t *ir, uint16_t bitlen, uint8_t idle, uint8_t want_ret); @@ -108,7 +108,7 @@ RESULT usbtojtaghl_register_callback(uint8_t index, jtag_callback_t send_callbac /* USB_TO_JTAG_RAW */ RESULT usbtojtagraw_init(uint8_t interface_index); RESULT usbtojtagraw_fini(uint8_t interface_index); -RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t kHz); +RESULT usbtojtagraw_config(uint8_t interface_index, uint32_t khz); RESULT usbtojtagraw_execute(uint8_t interface_index, uint8_t *tdi, uint8_t *tms, uint8_t *tdo, uint32_t bitlen); @@ -123,7 +123,7 @@ RESULT usbtoc2_readdata(uint8_t interface_index, uint8_t *buf, uint8_t len); /* USB_TO_I2C */ RESULT usbtoi2c_init(uint8_t interface_index); RESULT usbtoi2c_fini(uint8_t interface_index); -RESULT usbtoi2c_config(uint8_t interface_index, uint16_t kHz, +RESULT usbtoi2c_config(uint8_t interface_index, uint16_t khz, uint16_t byte_interval, uint16_t max_dly); RESULT usbtoi2c_read(uint8_t interface_index, uint16_t chip_addr, uint8_t *data, uint16_t data_len, uint8_t stop, @@ -165,7 +165,7 @@ RESULT usbtomsp430sbw_poll(uint8_t interface_index, uint32_t dr, uint32_t mask, RESULT usbtopwr_init(uint8_t interface_index); RESULT usbtopwr_fini(uint8_t interface_index); RESULT usbtopwr_config(uint8_t interface_index); -RESULT usbtopwr_output(uint8_t interface_index, uint16_t mV); +RESULT usbtopwr_output(uint8_t interface_index, uint16_t millivolt); /* USB_TO_POLL */ RESULT usbtopoll_start(uint16_t retry_cnt, uint16_t interval_us); @@ -190,14 +190,14 @@ RESULT usbtoswd_transact(uint8_t interface_index, uint8_t request, /* USB_TO_SWIM */ RESULT usbtoswim_init(uint8_t interface_index); RESULT usbtoswim_fini(uint8_t interface_index); -RESULT usbtoswim_config(uint8_t interface_index, uint8_t mHz, uint8_t cnt0, +RESULT usbtoswim_config(uint8_t interface_index, uint8_t mhz, uint8_t cnt0, uint8_t cnt1); RESULT usbtoswim_srst(uint8_t interface_index); RESULT usbtoswim_wotf(uint8_t interface_index, uint8_t *data, uint16_t bytelen, uint32_t addr); RESULT usbtoswim_rotf(uint8_t interface_index, uint8_t *data, uint16_t bytelen, uint32_t addr); -RESULT usbtoswim_sync(uint8_t interface_index, uint8_t mHz); +RESULT usbtoswim_sync(uint8_t interface_index, uint8_t mhz); RESULT usbtoswim_enable(uint8_t interface_index); /* USB_TO_BDM */ @@ -210,14 +210,14 @@ RESULT usbtobdm_transact(uint8_t interface_index, uint8_t *out, /* USB_TO_DUSI */ RESULT usbtodusi_init(uint8_t interface_index); RESULT usbtodusi_fini(uint8_t interface_index); -RESULT usbtodusi_config(uint8_t interface_index, uint32_t kHz, uint8_t mode); +RESULT usbtodusi_config(uint8_t interface_index, uint32_t khz, uint8_t mode); RESULT usbtodusi_io(uint8_t interface_index, uint8_t *mo, uint8_t *mi, uint8_t *so, uint8_t *si, uint32_t bitlen); /* USB_TO_MICROWIRE */ RESULT usbtomicrowire_init(uint8_t interface_index); RESULT usbtomicrowire_fini(uint8_t interface_index); -RESULT usbtomicrowire_config(uint8_t interface_index, uint16_t kHz, +RESULT usbtomicrowire_config(uint8_t interface_index, uint16_t khz, uint8_t sel_polarity); RESULT usbtomicrowire_transport(uint8_t interface_index, uint32_t opcode, uint8_t opcode_bitlen, @@ -230,7 +230,7 @@ RESULT usbtomicrowire_poll(uint8_t interface_index, uint16_t interval_us, /* USB_TO_PWM */ RESULT usbtopwm_init(uint8_t interface_index); RESULT usbtopwm_fini(uint8_t interface_index); -RESULT usbtopwm_config(uint8_t interface_index, uint16_t kHz, uint8_t mode); +RESULT usbtopwm_config(uint8_t interface_index, uint16_t khz, uint8_t mode); RESULT usbtopwm_out(uint8_t interface_index, uint16_t count, uint16_t *rate); RESULT usbtopwm_in(uint8_t interface_index, uint16_t count, uint16_t *rate); diff --git a/src/jtag/drivers/versaloon/versaloon.h b/src/jtag/drivers/versaloon/versaloon.h index fcf2235747..22e73fb35b 100644 --- a/src/jtag/drivers/versaloon/versaloon.h +++ b/src/jtag/drivers/versaloon/versaloon.h @@ -69,7 +69,7 @@ struct interface_swd_t { struct interface_jtag_raw_t { RESULT(*init)(uint8_t interface_index); RESULT(*fini)(uint8_t interface_index); - RESULT(*config)(uint8_t interface_index, uint32_t kHz); + RESULT(*config)(uint8_t interface_index, uint32_t khz); RESULT(*execute)(uint8_t interface_index, uint8_t *tdi, uint8_t *tms, uint8_t *tdo, uint32_t bitlen); }; diff --git a/src/jtag/drivers/xlnx-pcie-xvc.c b/src/jtag/drivers/xlnx-pcie-xvc.c index 22f256f355..7b82218d51 100644 --- a/src/jtag/drivers/xlnx-pcie-xvc.c +++ b/src/jtag/drivers/xlnx-pcie-xvc.c @@ -31,7 +31,7 @@ #define XLNX_XVC_VSEC_HDR 0x04 #define XLNX_XVC_LEN_REG 0x0C #define XLNX_XVC_TMS_REG 0x10 -#define XLNX_XVC_TDx_REG 0x14 +#define XLNX_XVC_TDX_REG 0x14 #define XLNX_XVC_CAP_SIZE 0x20 #define XLNX_XVC_VSEC_ID 0x8 @@ -103,11 +103,11 @@ static int xlnx_pcie_xvc_transact(size_t num_bits, uint32_t tms, uint32_t tdi, if (err != ERROR_OK) return err; - err = xlnx_pcie_xvc_write_reg(XLNX_XVC_TDx_REG, tdi); + err = xlnx_pcie_xvc_write_reg(XLNX_XVC_TDX_REG, tdi); if (err != ERROR_OK) return err; - err = xlnx_pcie_xvc_read_reg(XLNX_XVC_TDx_REG, tdo); + err = xlnx_pcie_xvc_read_reg(XLNX_XVC_TDX_REG, tdo); if (err != ERROR_OK) return err; diff --git a/src/jtag/hla/hla_tcl.c b/src/jtag/hla/hla_tcl.c index 2998498be8..bd26ec54ed 100644 --- a/src/jtag/hla/hla_tcl.c +++ b/src/jtag/hla/hla_tcl.c @@ -29,7 +29,7 @@ #include static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi, - struct jtag_tap *pTap) + struct jtag_tap *tap) { jim_wide w; int e = jim_getopt_wide(goi, &w); @@ -39,15 +39,15 @@ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi return e; } - uint32_t *p = realloc(pTap->expected_ids, - (pTap->expected_ids_cnt + 1) * sizeof(uint32_t)); + uint32_t *p = realloc(tap->expected_ids, + (tap->expected_ids_cnt + 1) * sizeof(uint32_t)); if (!p) { Jim_SetResultFormatted(goi->interp, "no memory"); return JIM_ERR; } - pTap->expected_ids = p; - pTap->expected_ids[pTap->expected_ids_cnt++] = w; + tap->expected_ids = p; + tap->expected_ids[tap->expected_ids_cnt++] = w; return JIM_OK; } @@ -62,7 +62,7 @@ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi static int jim_hl_newtap_cmd(struct jim_getopt_info *goi) { - struct jtag_tap *pTap; + struct jtag_tap *tap; int x; int e; struct jim_nvp *n; @@ -78,8 +78,8 @@ static int jim_hl_newtap_cmd(struct jim_getopt_info *goi) { .name = NULL, .value = -1}, }; - pTap = calloc(1, sizeof(struct jtag_tap)); - if (!pTap) { + tap = calloc(1, sizeof(struct jtag_tap)); + if (!tap) { Jim_SetResultFormatted(goi->interp, "no memory"); return JIM_ERR; } @@ -90,41 +90,41 @@ static int jim_hl_newtap_cmd(struct jim_getopt_info *goi) if (goi->argc < 3) { Jim_SetResultFormatted(goi->interp, "Missing CHIP TAP OPTIONS ...."); - free(pTap); + free(tap); return JIM_ERR; } const char *tmp; jim_getopt_string(goi, &tmp, NULL); - pTap->chip = strdup(tmp); + tap->chip = strdup(tmp); jim_getopt_string(goi, &tmp, NULL); - pTap->tapname = strdup(tmp); + tap->tapname = strdup(tmp); /* name + dot + name + null */ - x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1; + x = strlen(tap->chip) + 1 + strlen(tap->tapname) + 1; cp = malloc(x); - sprintf(cp, "%s.%s", pTap->chip, pTap->tapname); - pTap->dotted_name = cp; + sprintf(cp, "%s.%s", tap->chip, tap->tapname); + tap->dotted_name = cp; LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params", - pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc); + tap->chip, tap->tapname, tap->dotted_name, goi->argc); while (goi->argc) { e = jim_getopt_nvp(goi, opts, &n); if (e != JIM_OK) { jim_getopt_nvp_unknown(goi, opts, 0); free(cp); - free(pTap); + free(tap); return e; } LOG_DEBUG("Processing option: %s", n->name); switch (n->value) { case NTAP_OPT_EXPECTED_ID: - e = jim_newtap_expected_id(n, goi, pTap); + e = jim_newtap_expected_id(n, goi, tap); if (JIM_OK != e) { free(cp); - free(pTap); + free(tap); return e; } break; @@ -138,9 +138,9 @@ static int jim_hl_newtap_cmd(struct jim_getopt_info *goi) } /* while (goi->argc) */ /* default is enabled-after-reset */ - pTap->enabled = !pTap->disabled_after_reset; + tap->enabled = !tap->disabled_after_reset; - jtag_tap_init(pTap); + jtag_tap_init(tap); return JIM_OK; } diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 970bd37eca..b765305e52 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -82,7 +82,7 @@ static bool scan_is_safe(tap_state_t state) } } -static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args) +static int jim_command_drscan(Jim_Interp *interp, int argc, Jim_Obj * const *args) { int retval; struct scan_field *fields; @@ -223,7 +223,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args } -static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *args) +static int jim_command_pathmove(Jim_Interp *interp, int argc, Jim_Obj * const *args) { tap_state_t states[8]; @@ -260,7 +260,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar } -static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args) +static int jim_command_flush_count(Jim_Interp *interp, int argc, Jim_Obj * const *args) { Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_get_flush_queue_count())); @@ -281,7 +281,7 @@ static const struct command_registration jtag_command_handlers_to_move[] = { { .name = "drscan", .mode = COMMAND_EXEC, - .jim_handler = Jim_Command_drscan, + .jim_handler = jim_command_drscan, .help = "Execute Data Register (DR) scan for one TAP. " "Other TAPs must be in BYPASS mode.", .usage = "tap_name [num_bits value]* ['-endstate' state_name]", @@ -289,14 +289,14 @@ static const struct command_registration jtag_command_handlers_to_move[] = { { .name = "flush_count", .mode = COMMAND_EXEC, - .jim_handler = Jim_Command_flush_count, + .jim_handler = jim_command_flush_count, .help = "Returns the number of times the JTAG queue " "has been flushed.", }, { .name = "pathmove", .mode = COMMAND_EXEC, - .jim_handler = Jim_Command_pathmove, + .jim_handler = jim_command_pathmove, .usage = "start_state state1 [state2 [state3 ...]]", .help = "Move JTAG state machine from current state " "(start_state) to state1, then state2, state3, etc.", @@ -440,7 +440,7 @@ static int is_bad_irval(int ir_length, jim_wide w) } static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi, - struct jtag_tap *pTap) + struct jtag_tap *tap) { jim_wide w; int e = jim_getopt_wide(goi, &w); @@ -449,15 +449,15 @@ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi return e; } - uint32_t *p = realloc(pTap->expected_ids, - (pTap->expected_ids_cnt + 1) * sizeof(uint32_t)); + uint32_t *p = realloc(tap->expected_ids, + (tap->expected_ids_cnt + 1) * sizeof(uint32_t)); if (!p) { Jim_SetResultFormatted(goi->interp, "no memory"); return JIM_ERR; } - pTap->expected_ids = p; - pTap->expected_ids[pTap->expected_ids_cnt++] = w; + tap->expected_ids = p; + tap->expected_ids[tap->expected_ids_cnt++] = w; return JIM_OK; } @@ -471,7 +471,7 @@ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi #define NTAP_OPT_VERSION 6 static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi, - struct jtag_tap *pTap) + struct jtag_tap *tap) { jim_wide w; int e = jim_getopt_wide(goi, &w); @@ -482,33 +482,33 @@ static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi, } switch (n->value) { case NTAP_OPT_IRLEN: - if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value))) { + if (w > (jim_wide) (8 * sizeof(tap->ir_capture_value))) { LOG_WARNING("%s: huge IR length %d", - pTap->dotted_name, (int) w); + tap->dotted_name, (int) w); } - pTap->ir_length = w; + tap->ir_length = w; break; case NTAP_OPT_IRMASK: - if (is_bad_irval(pTap->ir_length, w)) { + if (is_bad_irval(tap->ir_length, w)) { LOG_ERROR("%s: IR mask %x too big", - pTap->dotted_name, + tap->dotted_name, (int) w); return JIM_ERR; } if ((w & 3) != 3) - LOG_WARNING("%s: nonstandard IR mask", pTap->dotted_name); - pTap->ir_capture_mask = w; + LOG_WARNING("%s: nonstandard IR mask", tap->dotted_name); + tap->ir_capture_mask = w; break; case NTAP_OPT_IRCAPTURE: - if (is_bad_irval(pTap->ir_length, w)) { + if (is_bad_irval(tap->ir_length, w)) { LOG_ERROR("%s: IR capture %x too big", - pTap->dotted_name, (int) w); + tap->dotted_name, (int) w); return JIM_ERR; } if ((w & 3) != 1) LOG_WARNING("%s: nonstandard IR value", - pTap->dotted_name); - pTap->ir_capture_value = w; + tap->dotted_name); + tap->ir_capture_value = w; break; default: return JIM_ERR; @@ -518,7 +518,7 @@ static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi, static int jim_newtap_cmd(struct jim_getopt_info *goi) { - struct jtag_tap *pTap; + struct jtag_tap *tap; int x; int e; struct jim_nvp *n; @@ -534,8 +534,8 @@ static int jim_newtap_cmd(struct jim_getopt_info *goi) { .name = NULL, .value = -1 }, }; - pTap = calloc(1, sizeof(struct jtag_tap)); - if (!pTap) { + tap = calloc(1, sizeof(struct jtag_tap)); + if (!tap) { Jim_SetResultFormatted(goi->interp, "no memory"); return JIM_ERR; } @@ -545,30 +545,30 @@ static int jim_newtap_cmd(struct jim_getopt_info *goi) * */ if (goi->argc < 3) { Jim_SetResultFormatted(goi->interp, "Missing CHIP TAP OPTIONS ...."); - free(pTap); + free(tap); return JIM_ERR; } const char *tmp; jim_getopt_string(goi, &tmp, NULL); - pTap->chip = strdup(tmp); + tap->chip = strdup(tmp); jim_getopt_string(goi, &tmp, NULL); - pTap->tapname = strdup(tmp); + tap->tapname = strdup(tmp); /* name + dot + name + null */ - x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1; + x = strlen(tap->chip) + 1 + strlen(tap->tapname) + 1; cp = malloc(x); - sprintf(cp, "%s.%s", pTap->chip, pTap->tapname); - pTap->dotted_name = cp; + sprintf(cp, "%s.%s", tap->chip, tap->tapname); + tap->dotted_name = cp; LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params", - pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc); + tap->chip, tap->tapname, tap->dotted_name, goi->argc); if (!transport_is_jtag()) { /* SWD doesn't require any JTAG tap parameters */ - pTap->enabled = true; - jtag_tap_init(pTap); + tap->enabled = true; + jtag_tap_init(tap); return JIM_OK; } @@ -576,62 +576,62 @@ static int jim_newtap_cmd(struct jim_getopt_info *goi) * that the default. The "-ircapture" and "-irmask" options are only * needed to cope with nonstandard TAPs, or to specify more bits. */ - pTap->ir_capture_mask = 0x03; - pTap->ir_capture_value = 0x01; + tap->ir_capture_mask = 0x03; + tap->ir_capture_value = 0x01; while (goi->argc) { e = jim_getopt_nvp(goi, opts, &n); if (e != JIM_OK) { jim_getopt_nvp_unknown(goi, opts, 0); free(cp); - free(pTap); + free(tap); return e; } LOG_DEBUG("Processing option: %s", n->name); switch (n->value) { case NTAP_OPT_ENABLED: - pTap->disabled_after_reset = false; + tap->disabled_after_reset = false; break; case NTAP_OPT_DISABLED: - pTap->disabled_after_reset = true; + tap->disabled_after_reset = true; break; case NTAP_OPT_EXPECTED_ID: - e = jim_newtap_expected_id(n, goi, pTap); + e = jim_newtap_expected_id(n, goi, tap); if (JIM_OK != e) { free(cp); - free(pTap); + free(tap); return e; } break; case NTAP_OPT_IRLEN: case NTAP_OPT_IRMASK: case NTAP_OPT_IRCAPTURE: - e = jim_newtap_ir_param(n, goi, pTap); + e = jim_newtap_ir_param(n, goi, tap); if (JIM_OK != e) { free(cp); - free(pTap); + free(tap); return e; } break; case NTAP_OPT_VERSION: - pTap->ignore_version = true; + tap->ignore_version = true; break; } /* switch (n->value) */ } /* while (goi->argc) */ /* default is enabled-after-reset */ - pTap->enabled = !pTap->disabled_after_reset; + tap->enabled = !tap->disabled_after_reset; /* Did all the required option bits get cleared? */ - if (pTap->ir_length != 0) { - jtag_tap_init(pTap); + if (tap->ir_length != 0) { + jtag_tap_init(tap); return JIM_OK; } Jim_SetResultFormatted(goi->interp, "newtap: %s missing IR length", - pTap->dotted_name); - jtag_tap_free(pTap); + tap->dotted_name); + jtag_tap_free(tap); return JIM_ERR; } -- 2.30.2