Change-Id: Ia97283707282ccccdc707c969f59337313b4e291
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1767
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
20 files changed:
static int nand_list_walker(struct nand_flash_controller *c, void *x)
{
static int nand_list_walker(struct nand_flash_controller *c, void *x)
{
- struct command_context *cmd_ctx = (struct command_context *)x;
+ struct command_context *cmd_ctx = x;
command_print(cmd_ctx, " %s", c->name);
return ERROR_OK;
}
command_print(cmd_ctx, " %s", c->name);
return ERROR_OK;
}
static struct sam3_bank_private *get_sam3_bank_private(struct flash_bank *bank)
{
static struct sam3_bank_private *get_sam3_bank_private(struct flash_bank *bank)
{
- return (struct sam3_bank_private *)(bank->driver_priv);
+ return bank->driver_priv;
static struct sam4_bank_private *get_sam4_bank_private(struct flash_bank *bank)
{
static struct sam4_bank_private *get_sam4_bank_private(struct flash_bank *bank)
{
- return (struct sam4_bank_private *)(bank->driver_priv);
+ return bank->driver_priv;
static void cfi_fixup_0002_polling_bits(struct flash_bank *bank, const void *param)
{
struct cfi_flash_bank *cfi_info = bank->driver_priv;
static void cfi_fixup_0002_polling_bits(struct flash_bank *bank, const void *param)
{
struct cfi_flash_bank *cfi_info = bank->driver_priv;
- const int status_poll_mask = *(const int *)param;
+ const int *status_poll_mask = param;
- cfi_info->status_poll_mask = status_poll_mask;
+ cfi_info->status_poll_mask = *status_poll_mask;
};
ret = target_write_buffer(target, write_algorithm->address,
};
ret = target_write_buffer(target, write_algorithm->address,
- sizeof(efm32x_flash_write_code),
- (uint8_t *)efm32x_flash_write_code);
+ sizeof(efm32x_flash_write_code), efm32x_flash_write_code);
if (ret != ERROR_OK)
return ret;
if (ret != ERROR_OK)
return ret;
;
retval = target_write_buffer(target, write_algorithm->address,
;
retval = target_write_buffer(target, write_algorithm->address,
- sizeof(em357_flash_write_code), (uint8_t *)em357_flash_write_code);
+ sizeof(em357_flash_write_code), em357_flash_write_code);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
};
retval = target_write_buffer(target, write_algorithm->address,
};
retval = target_write_buffer(target, write_algorithm->address,
- sizeof(mdr32fx_flash_write_code), (uint8_t *)mdr32fx_flash_write_code);
+ sizeof(mdr32fx_flash_write_code), mdr32fx_flash_write_code);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
target_write_buffer(target, write_algorithm->address,
sizeof(stellaris_write_code),
target_write_buffer(target, write_algorithm->address,
sizeof(stellaris_write_code),
- (uint8_t *) stellaris_write_code);
armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
armv7m_info.core_mode = ARM_MODE_THREAD;
armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
armv7m_info.core_mode = ARM_MODE_THREAD;
retval = target_write_buffer(target, write_algorithm->address,
sizeof(stm32x_flash_write_code),
retval = target_write_buffer(target, write_algorithm->address,
sizeof(stm32x_flash_write_code),
- (uint8_t *)stm32x_flash_write_code);
+ stm32x_flash_write_code);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
retval = target_write_buffer(target,
write_algorithm->address,
sizeof(stm32lx_flash_write_code),
retval = target_write_buffer(target,
write_algorithm->address,
sizeof(stm32lx_flash_write_code),
- (uint8_t *)stm32lx_flash_write_code);
+ stm32lx_flash_write_code);
if (retval != ERROR_OK) {
target_free_working_area(target, write_algorithm);
return retval;
if (retval != ERROR_OK) {
target_free_working_area(target, write_algorithm);
return retval;
static void tcl_output(void *privData, const char *file, unsigned line,
const char *function, const char *string)
{
static void tcl_output(void *privData, const char *file, unsigned line,
const char *function, const char *string)
{
- struct log_capture_state *state = (struct log_capture_state *)privData;
+ struct log_capture_state *state = privData;
Jim_AppendString(state->interp, state->output, string, strlen(string));
}
Jim_AppendString(state->interp, state->output, string, strlen(string));
}
void add_script_search_dir(const char *dir)
{
num_script_dirs++;
void add_script_search_dir(const char *dir)
{
num_script_dirs++;
- script_search_dirs =
- (char **)realloc(script_search_dirs, (num_script_dirs + 1) * sizeof(char *));
+ script_search_dirs = realloc(script_search_dirs, (num_script_dirs + 1) * sizeof(char *));
script_search_dirs[num_script_dirs-1] = strdup(dir);
script_search_dirs[num_script_dirs] = NULL;
script_search_dirs[num_script_dirs-1] = strdup(dir);
script_search_dirs[num_script_dirs] = NULL;
void add_config_command(const char *cfg)
{
num_config_files++;
void add_config_command(const char *cfg)
{
num_config_files++;
- config_file_names =
- (char **)realloc(config_file_names, (num_config_files + 1) * sizeof(char *));
+ config_file_names = realloc(config_file_names, (num_config_files + 1) * sizeof(char *));
config_file_names[num_config_files-1] = strdup(cfg);
config_file_names[num_config_files] = NULL;
config_file_names[num_config_files-1] = strdup(cfg);
config_file_names[num_config_files] = NULL;
offset = (*p_page)->used;
(*p_page)->used += size;
offset = (*p_page)->used;
(*p_page)->used += size;
- t = (uint8_t *)((*p_page)->address);
+ t = (*p_page)->address;
static inline void interface_jtag_add_scan_check_alloc(struct scan_field *field)
{
unsigned num_bytes = DIV_ROUND_UP(field->num_bits, 8);
static inline void interface_jtag_add_scan_check_alloc(struct scan_field *field)
{
unsigned num_bytes = DIV_ROUND_UP(field->num_bits, 8);
- field->in_value = (uint8_t *)cmd_queue_alloc(num_bytes);
+ field->in_value = cmd_queue_alloc(num_bytes);
}
void interface_jtag_add_dr_out(struct jtag_tap *tap,
}
void interface_jtag_add_dr_out(struct jtag_tap *tap,
static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer)
{
static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer)
{
- struct transfer_result *res = (struct transfer_result *)transfer->user_data;
+ struct transfer_result *res = transfer->user_data;
struct mpsse_ctx *ctx = res->ctx;
unsigned packet_size = ctx->max_packet_size;
struct mpsse_ctx *ctx = res->ctx;
unsigned packet_size = ctx->max_packet_size;
static LIBUSB_CALL void write_cb(struct libusb_transfer *transfer)
{
static LIBUSB_CALL void write_cb(struct libusb_transfer *transfer)
{
- struct transfer_result *res = (struct transfer_result *)transfer->user_data;
+ struct transfer_result *res = transfer->user_data;
struct mpsse_ctx *ctx = res->ctx;
res->transferred += transfer->actual_length;
struct mpsse_ctx *ctx = res->ctx;
res->transferred += transfer->actual_length;
usb_in_buffer = malloc(opendous_probe->BUFFERSIZE);
usb_out_buffer = malloc(opendous_probe->BUFFERSIZE);
usb_in_buffer = malloc(opendous_probe->BUFFERSIZE);
usb_out_buffer = malloc(opendous_probe->BUFFERSIZE);
- pending_scan_results_buffer = (struct pending_scan_result *)
- malloc(MAX_PENDING_SCAN_RESULTS * sizeof(struct pending_scan_result));
+ pending_scan_results_buffer = malloc(
+ MAX_PENDING_SCAN_RESULTS * sizeof(*pending_scan_results_buffer));
opendous_jtag_handle = opendous_usb_open();
opendous_jtag_handle = opendous_usb_open();
jtag_libusb_set_configuration(devh, 0);
jtag_libusb_claim_interface(devh, 0);
jtag_libusb_set_configuration(devh, 0);
jtag_libusb_claim_interface(devh, 0);
- result = (struct opendous_jtag *) malloc(sizeof(struct opendous_jtag));
+ result = malloc(sizeof(*result));
result->usb_handle = devh;
return result;
}
result->usb_handle = devh;
return result;
}
- next = (struct sequence *)malloc(sizeof(*next));
+ next = malloc(sizeof(*next));
if (next) {
next->tms = calloc(1, DIV_ROUND_UP(len, 8));
if (next->tms) {
if (next) {
next->tms = calloc(1, DIV_ROUND_UP(len, 8));
if (next->tms) {
static struct queue *queue_alloc(void)
{
static struct queue *queue_alloc(void)
{
- struct queue *queue = (struct queue *)malloc(sizeof(struct queue));
+ struct queue *queue = malloc(sizeof(*queue));
if (queue)
queue->head = NULL;
else
if (queue)
queue->head = NULL;
else
- uint8_t *buffer = (uint8_t *)osbdm->buffer + 4;
+ uint8_t *buffer = osbdm->buffer + 4;
for (int bit_idx = 0; bit_idx < length; ) {
int bit_count = length - bit_idx;
if (bit_count > 16)
for (int bit_idx = 0; bit_idx < length; ) {
int bit_count = length - bit_idx;
if (bit_count > 16)
/** */
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;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
/* read status */
memset(h->cmdbuf, 0, STLINK_SG_SIZE);
/* read status */
memset(h->cmdbuf, 0, STLINK_SG_SIZE);
/** */
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;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (jtag_libusb_bulk_write(h->fd, STLINK_TX_EP, (char *)h->cmdbuf, cmdsize,
STLINK_WRITE_TIMEOUT) != cmdsize) {
return ERROR_FAIL;
if (jtag_libusb_bulk_write(h->fd, STLINK_TX_EP, (char *)h->cmdbuf, cmdsize,
STLINK_WRITE_TIMEOUT) != cmdsize) {
return ERROR_FAIL;
static int stlink_usb_xfer_v1_get_sense(void *handle)
{
int res;
static int stlink_usb_xfer_v1_get_sense(void *handle)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, 16);
h->cmdbuf[h->cmdidx++] = REQUEST_SENSE;
stlink_usb_init_buffer(handle, STLINK_RX_EP, 16);
h->cmdbuf[h->cmdidx++] = REQUEST_SENSE;
static int stlink_usb_xfer(void *handle, const uint8_t *buf, int size)
{
int err, cmdsize = STLINK_CMD_SIZE_V2;
static int stlink_usb_xfer(void *handle, const uint8_t *buf, int size)
{
int err, cmdsize = STLINK_CMD_SIZE_V2;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (h->version.stlink == 1)
cmdsize = STLINK_SG_SIZE;
if (h->version.stlink == 1)
cmdsize = STLINK_SG_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;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
assert(h->version.stlink >= 2);
if (jtag_libusb_bulk_read(h->fd, STLINK_TRACE_EP, (char *)buf,
assert(h->version.stlink >= 2);
if (jtag_libusb_bulk_read(h->fd, STLINK_TRACE_EP, (char *)buf,
/** */
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;
-
- h = (struct stlink_usb_handle_s *)handle;
+ struct stlink_usb_handle_s *h = handle;
/* fill the send buffer */
strcpy((char *)h->cmdbuf, "USBC");
/* fill the send buffer */
strcpy((char *)h->cmdbuf, "USBC");
/** */
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;
-
- h = (struct stlink_usb_handle_s *)handle;
+ struct stlink_usb_handle_s *h = handle;
h->direction = direction;
h->direction = direction;
{
int res;
const char *err_msg = 0;
{
int res;
const char *err_msg = 0;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
/* TODO: no error checking yet on api V1 */
if (h->jtag_api == STLINK_JTAG_API_V1)
h->databuf[0] = STLINK_DEBUG_ERR_OK;
/* TODO: no error checking yet on api V1 */
if (h->jtag_api == STLINK_JTAG_API_V1)
h->databuf[0] = STLINK_DEBUG_ERR_OK;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, 6);
h->cmdbuf[h->cmdidx++] = STLINK_GET_VERSION;
stlink_usb_init_buffer(handle, STLINK_RX_EP, 6);
h->cmdbuf[h->cmdidx++] = STLINK_GET_VERSION;
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;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
/* only supported by stlink/v2 and for firmware >= 13 */
if (h->version.stlink == 1 || h->version.jtag < 13)
return ERROR_COMMAND_NOTFOUND;
/* only supported by stlink/v2 and for firmware >= 13 */
if (h->version.stlink == 1 || h->version.jtag < 13)
return ERROR_COMMAND_NOTFOUND;
static int stlink_usb_current_mode(void *handle, uint8_t *mode)
{
int res;
static int stlink_usb_current_mode(void *handle, uint8_t *mode)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, 2);
h->cmdbuf[h->cmdidx++] = STLINK_GET_CURRENT_MODE;
stlink_usb_init_buffer(handle, STLINK_RX_EP, 2);
h->cmdbuf[h->cmdidx++] = STLINK_GET_CURRENT_MODE;
{
int res;
int rx_size = 0;
{
int res;
int rx_size = 0;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
/* on api V2 we are able the read the latest command
* status
* TODO: we need the test on api V1 too
/* on api V2 we are able the read the latest command
* status
* TODO: we need the test on api V1 too
static int stlink_usb_mode_leave(void *handle, enum stlink_mode type)
{
int res;
static int stlink_usb_mode_leave(void *handle, enum stlink_mode type)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_NULL_EP, 0);
switch (type) {
stlink_usb_init_buffer(handle, STLINK_NULL_EP, 0);
switch (type) {
int res;
uint8_t mode;
enum stlink_mode emode;
int res;
uint8_t mode;
enum stlink_mode emode;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
res = stlink_usb_current_mode(handle, &mode);
if (res != ERROR_OK)
res = stlink_usb_current_mode(handle, &mode);
if (res != ERROR_OK)
static int stlink_usb_idcode(void *handle, uint32_t *idcode)
{
int res;
static int stlink_usb_idcode(void *handle, uint32_t *idcode)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, 4);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_RX_EP, 4);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
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;
+ struct stlink_usb_handle_s *h = handle;
int res;
assert(handle != NULL);
int res;
assert(handle != NULL);
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, 8);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_RX_EP, 8);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
static int stlink_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val)
{
int res;
static int stlink_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_RX_EP, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
/** */
static void stlink_usb_trace_read(void *handle)
{
/** */
static void stlink_usb_trace_read(void *handle)
{
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (h->trace.enabled && h->version.jtag >= STLINK_TRACE_MIN_VERSION) {
int res;
if (h->trace.enabled && h->version.jtag >= STLINK_TRACE_MIN_VERSION) {
int res;
static enum target_state stlink_usb_state(void *handle)
{
int res;
static enum target_state stlink_usb_state(void *handle)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (h->jtag_api == STLINK_JTAG_API_V2)
return stlink_usb_v2_get_status(handle);
if (h->jtag_api == STLINK_JTAG_API_V2)
return stlink_usb_v2_get_status(handle);
static int stlink_usb_reset(void *handle)
{
int res;
static int stlink_usb_reset(void *handle)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_RX_EP, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
static int stlink_usb_assert_srst(void *handle, int srst)
{
int res;
static int stlink_usb_assert_srst(void *handle, int srst)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (h->jtag_api == STLINK_JTAG_API_V1)
return ERROR_COMMAND_NOTFOUND;
if (h->jtag_api == STLINK_JTAG_API_V1)
return ERROR_COMMAND_NOTFOUND;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
/* configure the TPI */
/* enable the trace subsystem */
/* configure the TPI */
/* enable the trace subsystem */
static void stlink_usb_trace_disable(void *handle)
{
int res = ERROR_OK;
static void stlink_usb_trace_disable(void *handle)
{
int res = ERROR_OK;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
assert(h->version.jtag >= STLINK_TRACE_MIN_VERSION);
LOG_DEBUG("Tracing: disable\n");
assert(h->version.jtag >= STLINK_TRACE_MIN_VERSION);
LOG_DEBUG("Tracing: disable\n");
static int stlink_usb_trace_enable(void *handle)
{
int res;
static int stlink_usb_trace_enable(void *handle)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (h->version.jtag >= STLINK_TRACE_MIN_VERSION) {
uint32_t trace_hz;
if (h->version.jtag >= STLINK_TRACE_MIN_VERSION) {
uint32_t trace_hz;
static int stlink_usb_run(void *handle)
{
int res;
static int stlink_usb_run(void *handle)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (h->jtag_api == STLINK_JTAG_API_V2) {
res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_DEBUGEN);
if (h->jtag_api == STLINK_JTAG_API_V2) {
res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_DEBUGEN);
static int stlink_usb_halt(void *handle)
{
int res;
static int stlink_usb_halt(void *handle)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (h->jtag_api == STLINK_JTAG_API_V2) {
res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_HALT|C_DEBUGEN);
if (h->jtag_api == STLINK_JTAG_API_V2) {
res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_HALT|C_DEBUGEN);
static int stlink_usb_step(void *handle)
{
int res;
static int stlink_usb_step(void *handle)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (h->jtag_api == STLINK_JTAG_API_V2) {
/* TODO: this emulates the v1 api, it should really use a similar auto mask isr
* that the cortex-m3 currently does. */
if (h->jtag_api == STLINK_JTAG_API_V2) {
/* TODO: this emulates the v1 api, it should really use a similar auto mask isr
* that the cortex-m3 currently does. */
static int stlink_usb_read_regs(void *handle)
{
int res;
static int stlink_usb_read_regs(void *handle)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, 84);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_RX_EP, 84);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
static int stlink_usb_read_reg(void *handle, int num, uint32_t *val)
{
int res;
static int stlink_usb_read_reg(void *handle, int num, uint32_t *val)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, h->jtag_api == STLINK_JTAG_API_V1 ? 4 : 8);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_RX_EP, h->jtag_api == STLINK_JTAG_API_V1 ? 4 : 8);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
static int stlink_usb_write_reg(void *handle, int num, uint32_t val)
{
int res;
static int stlink_usb_write_reg(void *handle, int num, uint32_t val)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_RX_EP, 2);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
static int stlink_usb_get_rw_status(void *handle)
{
int res;
static int stlink_usb_get_rw_status(void *handle)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
if (h->jtag_api == STLINK_JTAG_API_V1)
return ERROR_OK;
if (h->jtag_api == STLINK_JTAG_API_V1)
return ERROR_OK;
{
int res;
uint16_t read_len = len;
{
int res;
uint16_t read_len = len;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, read_len);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_RX_EP, read_len);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
const uint8_t *buffer)
{
int res;
const uint8_t *buffer)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_TX_EP, len);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_TX_EP, len);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
uint8_t *buffer)
{
int res;
uint8_t *buffer)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
return ERROR_TARGET_UNALIGNED_ACCESS;
}
return ERROR_TARGET_UNALIGNED_ACCESS;
}
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_RX_EP, len);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_RX_EP, len);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
const uint8_t *buffer)
{
int res;
const uint8_t *buffer)
{
int res;
- struct stlink_usb_handle_s *h;
+ struct stlink_usb_handle_s *h = handle;
return ERROR_TARGET_UNALIGNED_ACCESS;
}
return ERROR_TARGET_UNALIGNED_ACCESS;
}
- h = (struct stlink_usb_handle_s *)handle;
-
stlink_usb_init_buffer(handle, STLINK_TX_EP, len);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
stlink_usb_init_buffer(handle, STLINK_TX_EP, len);
h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
{
int retval = ERROR_OK;
uint32_t bytes_remaining;
{
int retval = ERROR_OK;
uint32_t bytes_remaining;
- struct stlink_usb_handle_s *h = (struct stlink_usb_handle_s *)handle;
+ struct stlink_usb_handle_s *h = handle;
/* calculate byte count */
count *= size;
/* calculate byte count */
count *= size;
{
int retval = ERROR_OK;
uint32_t bytes_remaining;
{
int retval = ERROR_OK;
uint32_t bytes_remaining;
- struct stlink_usb_handle_s *h = (struct stlink_usb_handle_s *)handle;
+ struct stlink_usb_handle_s *h = handle;
/* calculate byte count */
count *= size;
/* calculate byte count */
count *= size;
/** */
static int stlink_usb_close(void *fd)
{
/** */
static int stlink_usb_close(void *fd)
{
- struct stlink_usb_handle_s *h;
-
- h = (struct stlink_usb_handle_s *)fd;
+ struct stlink_usb_handle_s *h = fd;
if (h->fd)
jtag_libusb_close(h->fd);
if (h->fd)
jtag_libusb_close(h->fd);
uint32_t timeout_tmp;
/* malloc temporary buffer */
uint32_t timeout_tmp;
/* malloc temporary buffer */
- versaloon_buf =
- (uint8_t *)malloc(versaloon_interface.usb_setting.buf_size);
+ versaloon_buf = malloc(versaloon_interface.usb_setting.buf_size);
if (NULL == versaloon_buf) {
LOG_ERROR(ERRMSG_NOT_ENOUGH_MEMORY);
return ERRCODE_NOT_ENOUGH_MEMORY;
if (NULL == versaloon_buf) {
LOG_ERROR(ERRMSG_NOT_ENOUGH_MEMORY);
return ERRCODE_NOT_ENOUGH_MEMORY;
free(versaloon_buf);
versaloon_buf = NULL;
free(versaloon_buf);
versaloon_buf = NULL;
- versaloon_buf =
- (uint8_t *)malloc(versaloon_interface.usb_setting.buf_size);
+ versaloon_buf = malloc(versaloon_interface.usb_setting.buf_size);
if (NULL == versaloon_buf) {
versaloon_fini();
LOG_ERROR(ERRMSG_NOT_ENOUGH_MEMORY);
return ERRCODE_NOT_ENOUGH_MEMORY;
}
if (NULL == versaloon_buf) {
versaloon_fini();
LOG_ERROR(ERRMSG_NOT_ENOUGH_MEMORY);
return ERRCODE_NOT_ENOUGH_MEMORY;
}
- versaloon_cmd_buf =
- (uint8_t *)malloc(versaloon_interface.usb_setting.buf_size - 3);
+ versaloon_cmd_buf = malloc(versaloon_interface.usb_setting.buf_size - 3);
if (NULL == versaloon_cmd_buf) {
versaloon_fini();
LOG_ERROR(ERRMSG_NOT_ENOUGH_MEMORY);
if (NULL == versaloon_cmd_buf) {
versaloon_fini();
LOG_ERROR(ERRMSG_NOT_ENOUGH_MEMORY);
/* malloc buffer size for tap */
tap_buffer_size = versaloon_interface.usb_setting.buf_size / 2 - 32;
vsllink_free_buffer();
/* malloc buffer size for tap */
tap_buffer_size = versaloon_interface.usb_setting.buf_size / 2 - 32;
vsllink_free_buffer();
- tdi_buffer = (uint8_t *)malloc(tap_buffer_size);
- tdo_buffer = (uint8_t *)malloc(tap_buffer_size);
- tms_buffer = (uint8_t *)malloc(tap_buffer_size);
+ tdi_buffer = malloc(tap_buffer_size);
+ tdo_buffer = malloc(tap_buffer_size);
+ tms_buffer = malloc(tap_buffer_size);
if ((NULL == tdi_buffer) || (NULL == tdo_buffer) || (NULL == tms_buffer)) {
vsllink_quit();
return ERROR_FAIL;
if ((NULL == tdi_buffer) || (NULL == tdo_buffer) || (NULL == tms_buffer)) {
vsllink_quit();
return ERROR_FAIL;
if (NULL == buff) {
buf_size = 256;
if (NULL == buff) {
buf_size = 256;
- buff = (char *)malloc(buf_size);
+ buff = malloc(buf_size);
if (NULL == buff) {
ret = 0;
goto free_and_return;
if (NULL == buff) {
ret = 0;
goto free_and_return;
- len = usb_get_string_simple(usb, stringidx, (char *)buff, buf_size);
- if ((len < 0) || (len != ((int)strlen((const char *)buff)))) {
+ len = usb_get_string_simple(usb, stringidx, buff, buf_size);
+ if ((len < 0) || ((size_t)len != strlen(buff))) {
ret = 0;
goto free_and_return;
}
buff[len] = '\0';
ret = 0;
goto free_and_return;
}
buff[len] = '\0';
- if ((string != NULL) && strcmp((const char *)buff, string)) {
+ if ((string != NULL) && strcmp(buff, string)) {
ret = 0;
goto free_and_return;
}
ret = 0;
goto free_and_return;
}
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)