jtag: convert 'unsigned' to 'unsigned int'
Conversion done with checkpatch --fix-inplace -types UNSPECIFIED_INT Ignore the cast as they could be better addressed. Fix only minor additional checkpatch issue (spacing and line length). Change-Id: I2c1ef03bbc828112cc5bea89463cff9fc0c1e94f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8481 Reviewed-by: zapb <dev@zapb.de> Tested-by: jenkins
This commit is contained in:
parent
e72733d590
commit
a64dc23bf1
|
@ -401,7 +401,7 @@ COMMAND_HANDLER(adapter_transports_command)
|
|||
retval = allow_transports(CMD_CTX, (const char **)transports);
|
||||
|
||||
if (retval != ERROR_OK) {
|
||||
for (unsigned i = 0; transports[i]; i++)
|
||||
for (unsigned int i = 0; transports[i]; i++)
|
||||
free(transports[i]);
|
||||
free(transports);
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ COMMAND_HANDLER(handle_adapter_list_command)
|
|||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
command_print(CMD, "The following debug adapters are available:");
|
||||
for (unsigned i = 0; adapter_drivers[i]; i++) {
|
||||
for (unsigned int i = 0; adapter_drivers[i]; i++) {
|
||||
const char *name = adapter_drivers[i]->name;
|
||||
command_print(CMD, "%u: %s", i + 1, name);
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ COMMAND_HANDLER(handle_adapter_driver_command)
|
|||
if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0')
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
for (unsigned i = 0; adapter_drivers[i]; i++) {
|
||||
for (unsigned int i = 0; adapter_drivers[i]; i++) {
|
||||
if (strcmp(CMD_ARGV[0], adapter_drivers[i]->name) != 0)
|
||||
continue;
|
||||
|
||||
|
@ -684,7 +684,7 @@ COMMAND_HANDLER(handle_adapter_srst_delay_command)
|
|||
if (CMD_ARGC > 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
if (CMD_ARGC == 1) {
|
||||
unsigned delay;
|
||||
unsigned int delay;
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
|
||||
|
||||
jtag_set_nsrst_delay(delay);
|
||||
|
@ -698,7 +698,7 @@ COMMAND_HANDLER(handle_adapter_srst_pulse_width_command)
|
|||
if (CMD_ARGC > 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
if (CMD_ARGC == 1) {
|
||||
unsigned width;
|
||||
unsigned int width;
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], width);
|
||||
|
||||
jtag_set_nsrst_assert_width(width);
|
||||
|
@ -714,7 +714,7 @@ COMMAND_HANDLER(handle_adapter_speed_command)
|
|||
|
||||
int retval = ERROR_OK;
|
||||
if (CMD_ARGC == 1) {
|
||||
unsigned khz = 0;
|
||||
unsigned int khz = 0;
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
|
||||
|
||||
retval = adapter_config_khz(khz);
|
||||
|
|
|
@ -224,7 +224,7 @@ static void jtag_tap_add(struct jtag_tap *t)
|
|||
}
|
||||
|
||||
/* returns a pointer to the n-th device in the scan chain */
|
||||
struct jtag_tap *jtag_tap_by_position(unsigned n)
|
||||
struct jtag_tap *jtag_tap_by_position(unsigned int n)
|
||||
{
|
||||
struct jtag_tap *t = jtag_all_taps();
|
||||
|
||||
|
@ -246,7 +246,7 @@ struct jtag_tap *jtag_tap_by_string(const char *s)
|
|||
}
|
||||
|
||||
/* no tap found by name, so try to parse the name as a number */
|
||||
unsigned n;
|
||||
unsigned int n;
|
||||
if (parse_uint(s, &n) != ERROR_OK)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -92,13 +92,13 @@ static int bitbang_state_move(int skip)
|
|||
*/
|
||||
static int bitbang_execute_tms(struct jtag_command *cmd)
|
||||
{
|
||||
unsigned num_bits = cmd->cmd.tms->num_bits;
|
||||
unsigned int num_bits = cmd->cmd.tms->num_bits;
|
||||
const uint8_t *bits = cmd->cmd.tms->bits;
|
||||
|
||||
LOG_DEBUG_IO("TMS: %u bits", num_bits);
|
||||
|
||||
int tms = 0;
|
||||
for (unsigned i = 0; i < num_bits; i++) {
|
||||
for (unsigned int i = 0; i < num_bits; i++) {
|
||||
tms = ((bits[i/8] >> (i % 8)) & 1);
|
||||
if (bitbang_interface->write(0, tms, 0) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
|
@ -193,10 +193,10 @@ static int bitbang_stableclocks(unsigned int num_cycles)
|
|||
}
|
||||
|
||||
static int bitbang_scan(bool ir_scan, enum scan_type type, uint8_t *buffer,
|
||||
unsigned scan_size)
|
||||
unsigned int scan_size)
|
||||
{
|
||||
tap_state_t saved_end_state = tap_get_end_state();
|
||||
unsigned bit_cnt;
|
||||
unsigned int bit_cnt;
|
||||
|
||||
if (!((!ir_scan &&
|
||||
(tap_get_state() == TAP_DRSHIFT)) ||
|
||||
|
@ -254,7 +254,7 @@ static int bitbang_scan(bool ir_scan, enum scan_type type, uint8_t *buffer,
|
|||
if (type != SCAN_OUT && bitbang_interface->buf_size &&
|
||||
(buffered == bitbang_interface->buf_size ||
|
||||
bit_cnt == scan_size - 1)) {
|
||||
for (unsigned i = bit_cnt + 1 - buffered; i <= bit_cnt; i++) {
|
||||
for (unsigned int i = bit_cnt + 1 - buffered; i <= bit_cnt; i++) {
|
||||
switch (bitbang_interface->read_sample()) {
|
||||
case BB_LOW:
|
||||
buffer[i/8] &= ~(1 << (i % 8));
|
||||
|
|
|
@ -2153,7 +2153,7 @@ COMMAND_HANDLER(cmsis_dap_handle_cmd_command)
|
|||
{
|
||||
uint8_t *command = cmsis_dap_handle->command;
|
||||
|
||||
for (unsigned i = 0; i < CMD_ARGC; i++)
|
||||
for (unsigned int i = 0; i < CMD_ARGC; i++)
|
||||
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[i], command[i]);
|
||||
|
||||
int retval = cmsis_dap_xfer(cmsis_dap_handle, CMD_ARGC);
|
||||
|
@ -2185,7 +2185,7 @@ COMMAND_HANDLER(cmsis_dap_handle_vid_pid_command)
|
|||
CMD_ARGC -= 1;
|
||||
}
|
||||
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
for (i = 0; i < CMD_ARGC; i += 2) {
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], cmsis_dap_vid[i >> 1]);
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], cmsis_dap_pid[i >> 1]);
|
||||
|
|
|
@ -234,7 +234,7 @@ int interface_jtag_add_tlr(void)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int interface_add_tms_seq(unsigned num_bits, const uint8_t *seq, enum tap_state state)
|
||||
int interface_add_tms_seq(unsigned int num_bits, const uint8_t *seq, enum tap_state state)
|
||||
{
|
||||
struct jtag_command *cmd;
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ static void ft232r_increase_buf_size(size_t new_buf_size)
|
|||
*/
|
||||
static void ft232r_write(int tck, int tms, int tdi)
|
||||
{
|
||||
unsigned out_value = (1<<ntrst_gpio) | (1<<nsysrst_gpio);
|
||||
unsigned int out_value = (1 << ntrst_gpio) | (1 << nsysrst_gpio);
|
||||
if (tck)
|
||||
out_value |= (1<<tck_gpio);
|
||||
if (tms)
|
||||
|
@ -201,7 +201,7 @@ static void ft232r_write(int tck, int tms, int tdi)
|
|||
*/
|
||||
static void ft232r_reset(int trst, int srst)
|
||||
{
|
||||
unsigned out_value = (1<<ntrst_gpio) | (1<<nsysrst_gpio);
|
||||
unsigned int out_value = (1 << ntrst_gpio) | (1 << nsysrst_gpio);
|
||||
LOG_DEBUG("ft232r_reset(%d,%d)", trst, srst);
|
||||
|
||||
if (trst == 1)
|
||||
|
@ -281,7 +281,7 @@ static int ft232r_init(void)
|
|||
}
|
||||
|
||||
/* Exactly 500 nsec between updates. */
|
||||
unsigned divisor = 1;
|
||||
unsigned int divisor = 1;
|
||||
unsigned char latency_timer = 1;
|
||||
|
||||
/* Frequency divisor is 14-bit non-zero value. */
|
||||
|
@ -654,13 +654,13 @@ static void syncbb_state_move(int skip)
|
|||
*/
|
||||
static int syncbb_execute_tms(struct jtag_command *cmd)
|
||||
{
|
||||
unsigned num_bits = cmd->cmd.tms->num_bits;
|
||||
unsigned int num_bits = cmd->cmd.tms->num_bits;
|
||||
const uint8_t *bits = cmd->cmd.tms->bits;
|
||||
|
||||
LOG_DEBUG_IO("TMS: %u bits", num_bits);
|
||||
|
||||
int tms = 0;
|
||||
for (unsigned i = 0; i < num_bits; i++) {
|
||||
for (unsigned int i = 0; i < num_bits; i++) {
|
||||
tms = ((bits[i/8] >> (i % 8)) & 1);
|
||||
ft232r_write(0, tms, 0);
|
||||
ft232r_write(1, tms, 0);
|
||||
|
|
|
@ -324,7 +324,7 @@ static void ftdi_execute_runtest(struct jtag_command *cmd)
|
|||
unsigned int i = cmd->cmd.runtest->num_cycles;
|
||||
while (i > 0) {
|
||||
/* there are no state transitions in this code, so omit state tracking */
|
||||
unsigned this_len = i > 7 ? 7 : i;
|
||||
unsigned int this_len = i > 7 ? 7 : i;
|
||||
mpsse_clock_tms_cs_out(mpsse_ctx, &zero, 0, this_len, false, ftdi_jtag_mode);
|
||||
i -= this_len;
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ static void ftdi_execute_pathmove(struct jtag_command *cmd)
|
|||
tap_state_name(path[num_states-1]));
|
||||
|
||||
int state_count = 0;
|
||||
unsigned bit_count = 0;
|
||||
unsigned int bit_count = 0;
|
||||
uint8_t tms_byte = 0;
|
||||
|
||||
LOG_DEBUG_IO("-");
|
||||
|
@ -447,7 +447,7 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
|
|||
ftdi_end_state(cmd->cmd.scan->end_state);
|
||||
|
||||
struct scan_field *field = cmd->cmd.scan->fields;
|
||||
unsigned scan_size = 0;
|
||||
unsigned int scan_size = 0;
|
||||
|
||||
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
scan_size += field->num_bits;
|
||||
|
@ -584,7 +584,7 @@ static void ftdi_execute_stableclocks(struct jtag_command *cmd)
|
|||
* the correct level and remain there during the scan */
|
||||
while (num_cycles > 0) {
|
||||
/* there are no state transitions in this code, so omit state tracking */
|
||||
unsigned this_len = num_cycles > 7 ? 7 : num_cycles;
|
||||
unsigned int this_len = num_cycles > 7 ? 7 : num_cycles;
|
||||
mpsse_clock_tms_cs_out(mpsse_ctx, &tms, 0, this_len, false, ftdi_jtag_mode);
|
||||
num_cycles -= this_len;
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ COMMAND_HANDLER(ftdi_handle_layout_signal_command)
|
|||
uint16_t input_mask = 0;
|
||||
bool invert_oe = false;
|
||||
uint16_t oe_mask = 0;
|
||||
for (unsigned i = 1; i < CMD_ARGC; i += 2) {
|
||||
for (unsigned int i = 1; i < CMD_ARGC; i += 2) {
|
||||
if (strcmp("-data", CMD_ARGV[i]) == 0) {
|
||||
invert_data = false;
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], data_mask);
|
||||
|
@ -879,7 +879,7 @@ COMMAND_HANDLER(ftdi_handle_vid_pid_command)
|
|||
CMD_ARGC -= 1;
|
||||
}
|
||||
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
for (i = 0; i < CMD_ARGC; i += 2) {
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], ftdi_vid[i >> 1]);
|
||||
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], ftdi_pid[i >> 1]);
|
||||
|
|
|
@ -104,10 +104,10 @@ static int jlink_flush(void);
|
|||
* @param in_offset A bit offset for TDO data.
|
||||
* @param length Amount of bits to transfer out and in.
|
||||
*/
|
||||
static void jlink_clock_data(const uint8_t *out, unsigned out_offset,
|
||||
const uint8_t *tms_out, unsigned tms_offset,
|
||||
uint8_t *in, unsigned in_offset,
|
||||
unsigned length);
|
||||
static void jlink_clock_data(const uint8_t *out, unsigned int out_offset,
|
||||
const uint8_t *tms_out, unsigned int tms_offset,
|
||||
uint8_t *in, unsigned int in_offset,
|
||||
unsigned int length);
|
||||
|
||||
static enum tap_state jlink_last_state = TAP_RESET;
|
||||
static int queued_retval;
|
||||
|
@ -179,7 +179,7 @@ static void jlink_execute_scan(struct jtag_command *cmd)
|
|||
jlink_end_state(cmd->cmd.scan->end_state);
|
||||
|
||||
struct scan_field *field = cmd->cmd.scan->fields;
|
||||
unsigned scan_size = 0;
|
||||
unsigned int scan_size = 0;
|
||||
|
||||
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
scan_size += field->num_bits;
|
||||
|
@ -1962,7 +1962,7 @@ static void jlink_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_c
|
|||
/***************************************************************************/
|
||||
/* J-Link tap functions */
|
||||
|
||||
static unsigned tap_length;
|
||||
static unsigned int tap_length;
|
||||
/* In SWD mode use tms buffer for direction control */
|
||||
static uint8_t tms_buffer[JLINK_TAP_BUFFER_SIZE];
|
||||
static uint8_t tdi_buffer[JLINK_TAP_BUFFER_SIZE];
|
||||
|
@ -1970,13 +1970,13 @@ static uint8_t tdo_buffer[JLINK_TAP_BUFFER_SIZE];
|
|||
|
||||
struct pending_scan_result {
|
||||
/** First bit position in tdo_buffer to read. */
|
||||
unsigned first;
|
||||
unsigned int first;
|
||||
/** Number of bits to read. */
|
||||
unsigned length;
|
||||
unsigned int length;
|
||||
/** Location to store the result */
|
||||
void *buffer;
|
||||
/** Offset in the destination buffer */
|
||||
unsigned buffer_offset;
|
||||
unsigned int buffer_offset;
|
||||
/** SWD command */
|
||||
uint8_t swd_cmd;
|
||||
};
|
||||
|
@ -1994,13 +1994,13 @@ static void jlink_tap_init(void)
|
|||
memset(tdi_buffer, 0, sizeof(tdi_buffer));
|
||||
}
|
||||
|
||||
static void jlink_clock_data(const uint8_t *out, unsigned out_offset,
|
||||
const uint8_t *tms_out, unsigned tms_offset,
|
||||
uint8_t *in, unsigned in_offset,
|
||||
unsigned length)
|
||||
static void jlink_clock_data(const uint8_t *out, unsigned int out_offset,
|
||||
const uint8_t *tms_out, unsigned int tms_offset,
|
||||
uint8_t *in, unsigned int in_offset,
|
||||
unsigned int length)
|
||||
{
|
||||
do {
|
||||
unsigned available_length = JLINK_TAP_BUFFER_SIZE - tap_length / 8;
|
||||
unsigned int available_length = JLINK_TAP_BUFFER_SIZE - tap_length / 8;
|
||||
|
||||
if (!available_length ||
|
||||
(in && pending_scan_results_length == MAX_PENDING_SCAN_RESULTS)) {
|
||||
|
@ -2012,7 +2012,7 @@ static void jlink_clock_data(const uint8_t *out, unsigned out_offset,
|
|||
struct pending_scan_result *pending_scan_result =
|
||||
&pending_scan_results_buffer[pending_scan_results_length];
|
||||
|
||||
unsigned scan_length = length > available_length ?
|
||||
unsigned int scan_length = length > available_length ?
|
||||
available_length : length;
|
||||
|
||||
if (out)
|
||||
|
|
|
@ -158,7 +158,7 @@ retry_write:
|
|||
|
||||
static int jtag_vpi_receive_cmd(struct vpi_cmd *vpi)
|
||||
{
|
||||
unsigned bytes_buffered = 0;
|
||||
unsigned int bytes_buffered = 0;
|
||||
while (bytes_buffered < sizeof(struct vpi_cmd)) {
|
||||
int bytes_to_receive = sizeof(struct vpi_cmd) - bytes_buffered;
|
||||
int retval = read_socket(sockfd, ((char *)vpi) + bytes_buffered, bytes_to_receive);
|
||||
|
|
|
@ -53,7 +53,7 @@ static int jtag_libusb_error(int err)
|
|||
bool jtag_libusb_match_ids(struct libusb_device_descriptor *dev_desc,
|
||||
const uint16_t vids[], const uint16_t pids[])
|
||||
{
|
||||
for (unsigned i = 0; vids[i]; i++) {
|
||||
for (unsigned int i = 0; vids[i]; i++) {
|
||||
if (dev_desc->idVendor == vids[i] &&
|
||||
dev_desc->idProduct == pids[i]) {
|
||||
return true;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
static inline void interface_jtag_add_scan_check_alloc(struct scan_field *field)
|
||||
{
|
||||
unsigned num_bytes = DIV_ROUND_UP(field->num_bits, 8);
|
||||
unsigned int num_bytes = DIV_ROUND_UP(field->num_bits, 8);
|
||||
field->in_value = cmd_queue_alloc(num_bytes);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,13 +64,13 @@ struct mpsse_ctx {
|
|||
uint8_t interface;
|
||||
enum ftdi_chip_type type;
|
||||
uint8_t *write_buffer;
|
||||
unsigned write_size;
|
||||
unsigned write_count;
|
||||
unsigned int write_size;
|
||||
unsigned int write_count;
|
||||
uint8_t *read_buffer;
|
||||
unsigned read_size;
|
||||
unsigned read_count;
|
||||
unsigned int read_size;
|
||||
unsigned int read_count;
|
||||
uint8_t *read_chunk;
|
||||
unsigned read_chunk_size;
|
||||
unsigned int read_chunk_size;
|
||||
struct bit_copy_queue read_queue;
|
||||
int retval;
|
||||
};
|
||||
|
@ -444,13 +444,13 @@ void mpsse_purge(struct mpsse_ctx *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
static unsigned buffer_write_space(struct mpsse_ctx *ctx)
|
||||
static unsigned int buffer_write_space(struct mpsse_ctx *ctx)
|
||||
{
|
||||
/* Reserve one byte for SEND_IMMEDIATE */
|
||||
return ctx->write_size - ctx->write_count - 1;
|
||||
}
|
||||
|
||||
static unsigned buffer_read_space(struct mpsse_ctx *ctx)
|
||||
static unsigned int buffer_read_space(struct mpsse_ctx *ctx)
|
||||
{
|
||||
return ctx->read_size - ctx->read_count;
|
||||
}
|
||||
|
@ -462,8 +462,8 @@ static void buffer_write_byte(struct mpsse_ctx *ctx, uint8_t data)
|
|||
ctx->write_buffer[ctx->write_count++] = data;
|
||||
}
|
||||
|
||||
static unsigned buffer_write(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset,
|
||||
unsigned bit_count)
|
||||
static unsigned int buffer_write(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
|
||||
unsigned int bit_count)
|
||||
{
|
||||
LOG_DEBUG_IO("%d bits", bit_count);
|
||||
assert(ctx->write_count + DIV_ROUND_UP(bit_count, 8) <= ctx->write_size);
|
||||
|
@ -472,8 +472,8 @@ static unsigned buffer_write(struct mpsse_ctx *ctx, const uint8_t *out, unsigned
|
|||
return bit_count;
|
||||
}
|
||||
|
||||
static unsigned buffer_add_read(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_offset,
|
||||
unsigned bit_count, unsigned offset)
|
||||
static unsigned int buffer_add_read(struct mpsse_ctx *ctx, uint8_t *in, unsigned int in_offset,
|
||||
unsigned int bit_count, unsigned int offset)
|
||||
{
|
||||
LOG_DEBUG_IO("%d bits, offset %d", bit_count, offset);
|
||||
assert(ctx->read_count + DIV_ROUND_UP(bit_count, 8) <= ctx->read_size);
|
||||
|
@ -483,20 +483,20 @@ static unsigned buffer_add_read(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_
|
|||
return bit_count;
|
||||
}
|
||||
|
||||
void mpsse_clock_data_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset,
|
||||
unsigned length, uint8_t mode)
|
||||
void mpsse_clock_data_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
|
||||
unsigned int length, uint8_t mode)
|
||||
{
|
||||
mpsse_clock_data(ctx, out, out_offset, NULL, 0, length, mode);
|
||||
}
|
||||
|
||||
void mpsse_clock_data_in(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_offset, unsigned length,
|
||||
void mpsse_clock_data_in(struct mpsse_ctx *ctx, uint8_t *in, unsigned int in_offset, unsigned int length,
|
||||
uint8_t mode)
|
||||
{
|
||||
mpsse_clock_data(ctx, NULL, 0, in, in_offset, length, mode);
|
||||
}
|
||||
|
||||
void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in,
|
||||
unsigned in_offset, unsigned length, uint8_t mode)
|
||||
void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in,
|
||||
unsigned int in_offset, unsigned int length, uint8_t mode)
|
||||
{
|
||||
/* TODO: Fix MSB first modes */
|
||||
LOG_DEBUG_IO("%s%s %d bits", in ? "in" : "", out ? "out" : "", length);
|
||||
|
@ -531,7 +531,7 @@ void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_of
|
|||
length = 0;
|
||||
} else {
|
||||
/* Byte transfer */
|
||||
unsigned this_bytes = length / 8;
|
||||
unsigned int this_bytes = length / 8;
|
||||
/* MPSSE command limit */
|
||||
if (this_bytes > 65536)
|
||||
this_bytes = 65536;
|
||||
|
@ -558,7 +558,7 @@ void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_of
|
|||
this_bytes * 8,
|
||||
0);
|
||||
if (!out && !in)
|
||||
for (unsigned n = 0; n < this_bytes; n++)
|
||||
for (unsigned int n = 0; n < this_bytes; n++)
|
||||
buffer_write_byte(ctx, 0x00);
|
||||
length -= this_bytes * 8;
|
||||
}
|
||||
|
@ -566,14 +566,14 @@ void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_of
|
|||
}
|
||||
}
|
||||
|
||||
void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset,
|
||||
unsigned length, bool tdi, uint8_t mode)
|
||||
void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
|
||||
unsigned int length, bool tdi, uint8_t mode)
|
||||
{
|
||||
mpsse_clock_tms_cs(ctx, out, out_offset, NULL, 0, length, tdi, mode);
|
||||
}
|
||||
|
||||
void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in,
|
||||
unsigned in_offset, unsigned length, bool tdi, uint8_t mode)
|
||||
void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in,
|
||||
unsigned int in_offset, unsigned int length, bool tdi, uint8_t mode)
|
||||
{
|
||||
LOG_DEBUG_IO("%sout %d bits, tdi=%d", in ? "in" : "", length, tdi);
|
||||
assert(out);
|
||||
|
@ -593,7 +593,7 @@ void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_
|
|||
ctx->retval = mpsse_flush(ctx);
|
||||
|
||||
/* Byte transfer */
|
||||
unsigned this_bits = length;
|
||||
unsigned int this_bits = length;
|
||||
/* MPSSE command limit */
|
||||
/* NOTE: there's a report of an FT2232 bug in this area, where shifting
|
||||
* exactly 7 bits can make problems with TMS signaling for the last
|
||||
|
@ -783,7 +783,7 @@ int mpsse_set_frequency(struct mpsse_ctx *ctx, int frequency)
|
|||
struct transfer_result {
|
||||
struct mpsse_ctx *ctx;
|
||||
bool done;
|
||||
unsigned transferred;
|
||||
unsigned int transferred;
|
||||
};
|
||||
|
||||
static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer)
|
||||
|
@ -791,16 +791,16 @@ static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer)
|
|||
struct transfer_result *res = transfer->user_data;
|
||||
struct mpsse_ctx *ctx = res->ctx;
|
||||
|
||||
unsigned packet_size = ctx->max_packet_size;
|
||||
unsigned int packet_size = ctx->max_packet_size;
|
||||
|
||||
DEBUG_PRINT_BUF(transfer->buffer, transfer->actual_length);
|
||||
|
||||
/* Strip the two status bytes sent at the beginning of each USB packet
|
||||
* while copying the chunk buffer to the read buffer */
|
||||
unsigned num_packets = DIV_ROUND_UP(transfer->actual_length, packet_size);
|
||||
unsigned chunk_remains = transfer->actual_length;
|
||||
for (unsigned i = 0; i < num_packets && chunk_remains > 2; i++) {
|
||||
unsigned this_size = packet_size - 2;
|
||||
unsigned int num_packets = DIV_ROUND_UP(transfer->actual_length, packet_size);
|
||||
unsigned int chunk_remains = transfer->actual_length;
|
||||
for (unsigned int i = 0; i < num_packets && chunk_remains > 2; i++) {
|
||||
unsigned int this_size = packet_size - 2;
|
||||
if (this_size > chunk_remains - 2)
|
||||
this_size = chunk_remains - 2;
|
||||
if (this_size > ctx->read_count - res->transferred)
|
||||
|
|
|
@ -44,16 +44,16 @@ bool mpsse_is_high_speed(struct mpsse_ctx *ctx);
|
|||
/* Command queuing. These correspond to the MPSSE commands with the same names, but no need to care
|
||||
* about bit/byte transfer or data length limitation. Read data is guaranteed to be available only
|
||||
* after the following mpsse_flush(). */
|
||||
void mpsse_clock_data_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset,
|
||||
unsigned length, uint8_t mode);
|
||||
void mpsse_clock_data_in(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_offset, unsigned length,
|
||||
void mpsse_clock_data_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
|
||||
unsigned int length, uint8_t mode);
|
||||
void mpsse_clock_data_in(struct mpsse_ctx *ctx, uint8_t *in, unsigned int in_offset, unsigned int length,
|
||||
uint8_t mode);
|
||||
void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in,
|
||||
unsigned in_offset, unsigned length, uint8_t mode);
|
||||
void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset,
|
||||
unsigned length, bool tdi, uint8_t mode);
|
||||
void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in,
|
||||
unsigned in_offset, unsigned length, bool tdi, uint8_t mode);
|
||||
void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in,
|
||||
unsigned int in_offset, unsigned int length, uint8_t mode);
|
||||
void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
|
||||
unsigned int length, bool tdi, uint8_t mode);
|
||||
void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in,
|
||||
unsigned int in_offset, unsigned int length, bool tdi, uint8_t mode);
|
||||
void mpsse_set_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t dir);
|
||||
void mpsse_set_data_bits_high_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t dir);
|
||||
void mpsse_read_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t *data);
|
||||
|
|
|
@ -3740,7 +3740,7 @@ static int stlink_open(struct hl_interface_param *param, enum stlink_mode mode,
|
|||
|
||||
h->st_mode = mode;
|
||||
|
||||
for (unsigned i = 0; param->vid[i]; i++) {
|
||||
for (unsigned int i = 0; param->vid[i]; i++) {
|
||||
LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s",
|
||||
h->st_mode, param->vid[i], param->pid[i],
|
||||
adapter_get_required_serial() ? adapter_get_required_serial() : "");
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define SECTION_BUFFERSIZE 16384
|
||||
|
||||
static int ublast2_libusb_read(struct ublast_lowlevel *low, uint8_t *buf,
|
||||
unsigned size, uint32_t *bytes_read)
|
||||
unsigned int size, uint32_t *bytes_read)
|
||||
{
|
||||
int ret, tmp = 0;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ struct ublast_lowlevel {
|
|||
|
||||
int (*write)(struct ublast_lowlevel *low, uint8_t *buf, int size,
|
||||
uint32_t *bytes_written);
|
||||
int (*read)(struct ublast_lowlevel *low, uint8_t *buf, unsigned size,
|
||||
int (*read)(struct ublast_lowlevel *low, uint8_t *buf, unsigned int size,
|
||||
uint32_t *bytes_read);
|
||||
int (*open)(struct ublast_lowlevel *low);
|
||||
int (*close)(struct ublast_lowlevel *low);
|
||||
|
|
|
@ -28,7 +28,7 @@ static struct ftdi_context *ublast_getftdic(struct ublast_lowlevel *low)
|
|||
}
|
||||
|
||||
static int ublast_ftdi_read(struct ublast_lowlevel *low, uint8_t *buf,
|
||||
unsigned size, uint32_t *bytes_read)
|
||||
unsigned int size, uint32_t *bytes_read)
|
||||
{
|
||||
int retval;
|
||||
int timeout = 100;
|
||||
|
|
|
@ -158,7 +158,7 @@ static char *hexdump(uint8_t *buf, unsigned int size)
|
|||
return str;
|
||||
}
|
||||
|
||||
static int ublast_buf_read(uint8_t *buf, unsigned size, uint32_t *bytes_read)
|
||||
static int ublast_buf_read(uint8_t *buf, unsigned int size, uint32_t *bytes_read)
|
||||
{
|
||||
int ret = info.drv->read(info.drv, buf, size, bytes_read);
|
||||
char *str = hexdump(buf, *bytes_read);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
struct xlnx_pcie_xvc {
|
||||
int fd;
|
||||
unsigned offset;
|
||||
unsigned int offset;
|
||||
char *device;
|
||||
};
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ static const struct name_mapping {
|
|||
|
||||
const char *tap_state_name(tap_state_t state)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tap_name_mapping); i++) {
|
||||
if (tap_name_mapping[i].symbol == state)
|
||||
|
@ -354,7 +354,7 @@ const char *tap_state_name(tap_state_t state)
|
|||
|
||||
tap_state_t tap_state_by_name(const char *name)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tap_name_mapping); i++) {
|
||||
/* be nice to the human */
|
||||
|
@ -376,11 +376,11 @@ tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
|
|||
{
|
||||
const uint8_t *tms_buffer;
|
||||
const uint8_t *tdi_buffer;
|
||||
unsigned tap_bytes;
|
||||
unsigned cur_byte;
|
||||
unsigned cur_bit;
|
||||
unsigned int tap_bytes;
|
||||
unsigned int cur_byte;
|
||||
unsigned int cur_bit;
|
||||
|
||||
unsigned tap_out_bits;
|
||||
unsigned int tap_out_bits;
|
||||
char tms_str[33];
|
||||
char tdi_str[33];
|
||||
|
||||
|
@ -400,7 +400,7 @@ tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
|
|||
for (cur_byte = 0; cur_byte < tap_bytes; cur_byte++) {
|
||||
for (cur_bit = 0; cur_bit < 8; cur_bit++) {
|
||||
/* make sure we do not run off the end of the buffers */
|
||||
unsigned tap_bit = cur_byte * 8 + cur_bit;
|
||||
unsigned int tap_bit = cur_byte * 8 + cur_bit;
|
||||
if (tap_bit == tap_bits)
|
||||
break;
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
|
|||
* @returns the final TAP state; pass as @a start_tap_state in following call.
|
||||
*/
|
||||
static inline tap_state_t jtag_debug_state_machine(const void *tms_buf,
|
||||
const void *tdi_buf, unsigned tap_len, tap_state_t start_tap_state)
|
||||
const void *tdi_buf, unsigned int tap_len, tap_state_t start_tap_state)
|
||||
{
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO))
|
||||
return jtag_debug_state_machine_(tms_buf, tdi_buf, tap_len, start_tap_state);
|
||||
|
@ -183,7 +183,7 @@ struct jtag_interface {
|
|||
/**
|
||||
* Bit vector listing capabilities exposed by this driver.
|
||||
*/
|
||||
unsigned supported;
|
||||
unsigned int supported;
|
||||
#define DEBUG_CAP_TMS_SEQ (1 << 0)
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,7 @@ int interface_jtag_add_tlr(void);
|
|||
int interface_jtag_add_pathmove(unsigned int num_states, const tap_state_t *path);
|
||||
int interface_jtag_add_runtest(unsigned int num_cycles, tap_state_t endstate);
|
||||
|
||||
int interface_add_tms_seq(unsigned num_bits,
|
||||
int interface_add_tms_seq(unsigned int num_bits,
|
||||
const uint8_t *bits, enum tap_state state);
|
||||
|
||||
/**
|
||||
|
|
|
@ -101,7 +101,7 @@ static const uint8_t swd_seq_line_reset[] = {
|
|||
/* At least 2 idle (low) cycles */
|
||||
0x00,
|
||||
};
|
||||
static const unsigned swd_seq_line_reset_len = 64;
|
||||
static const unsigned int swd_seq_line_reset_len = 64;
|
||||
|
||||
/**
|
||||
* JTAG-to-SWD sequence.
|
||||
|
@ -122,7 +122,7 @@ static const uint8_t swd_seq_jtag_to_swd[] = {
|
|||
/* At least 2 idle (low) cycles */
|
||||
0x00,
|
||||
};
|
||||
static const unsigned swd_seq_jtag_to_swd_len = 136;
|
||||
static const unsigned int swd_seq_jtag_to_swd_len = 136;
|
||||
|
||||
/**
|
||||
* SWD-to-JTAG sequence.
|
||||
|
@ -141,7 +141,7 @@ static const uint8_t swd_seq_swd_to_jtag[] = {
|
|||
/* At least 5 TCK/SWCLK cycles with TMS/SWDIO high */
|
||||
0xff,
|
||||
};
|
||||
static const unsigned swd_seq_swd_to_jtag_len = 80;
|
||||
static const unsigned int swd_seq_swd_to_jtag_len = 80;
|
||||
|
||||
/**
|
||||
* SWD-to-dormant sequence.
|
||||
|
@ -156,7 +156,7 @@ static const uint8_t swd_seq_swd_to_dormant[] = {
|
|||
/* Switching sequence from SWD to dormant */
|
||||
0xbc, 0xe3,
|
||||
};
|
||||
static const unsigned swd_seq_swd_to_dormant_len = 72;
|
||||
static const unsigned int swd_seq_swd_to_dormant_len = 72;
|
||||
|
||||
/**
|
||||
* Dormant-to-SWD sequence.
|
||||
|
@ -187,7 +187,7 @@ static const uint8_t swd_seq_dormant_to_swd[] = {
|
|||
/* At least 2 idle (low) cycles */
|
||||
0x00,
|
||||
};
|
||||
static const unsigned swd_seq_dormant_to_swd_len = 224;
|
||||
static const unsigned int swd_seq_dormant_to_swd_len = 224;
|
||||
|
||||
/**
|
||||
* JTAG-to-dormant sequence.
|
||||
|
@ -208,7 +208,7 @@ static const uint8_t swd_seq_jtag_to_dormant[] = {
|
|||
0x77, /* ((0xbb >> 7) & GENMASK(0, 0)) | ((0xbb << 1) & GENMASK(7, 1)) */
|
||||
0x67, /* ((0xbb >> 7) & GENMASK(0, 0)) | ((0x33 << 1) & GENMASK(7, 1)) */
|
||||
};
|
||||
static const unsigned swd_seq_jtag_to_dormant_len = 40;
|
||||
static const unsigned int swd_seq_jtag_to_dormant_len = 40;
|
||||
|
||||
/**
|
||||
* Dormant-to-JTAG sequence.
|
||||
|
@ -241,7 +241,7 @@ static const uint8_t swd_seq_dormant_to_jtag[] = {
|
|||
/* put the TAP in Run/Test Idle */
|
||||
0x00,
|
||||
};
|
||||
static const unsigned swd_seq_dormant_to_jtag_len = 160;
|
||||
static const unsigned int swd_seq_dormant_to_jtag_len = 160;
|
||||
|
||||
struct swd_driver {
|
||||
/**
|
||||
|
|
|
@ -843,7 +843,7 @@ COMMAND_HANDLER(handle_jtag_ntrst_delay_command)
|
|||
if (CMD_ARGC > 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
if (CMD_ARGC == 1) {
|
||||
unsigned delay;
|
||||
unsigned int delay;
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
|
||||
|
||||
jtag_set_ntrst_delay(delay);
|
||||
|
@ -857,7 +857,7 @@ COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command)
|
|||
if (CMD_ARGC > 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
if (CMD_ARGC == 1) {
|
||||
unsigned delay;
|
||||
unsigned int delay;
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
|
||||
|
||||
jtag_set_ntrst_assert_width(delay);
|
||||
|
@ -873,7 +873,7 @@ COMMAND_HANDLER(handle_jtag_rclk_command)
|
|||
|
||||
int retval = ERROR_OK;
|
||||
if (CMD_ARGC == 1) {
|
||||
unsigned khz = 0;
|
||||
unsigned int khz = 0;
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
|
||||
|
||||
retval = adapter_config_rclk(khz);
|
||||
|
@ -899,7 +899,7 @@ COMMAND_HANDLER(handle_runtest_command)
|
|||
if (CMD_ARGC != 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
unsigned num_clocks;
|
||||
unsigned int num_clocks;
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num_clocks);
|
||||
|
||||
jtag_add_runtest(num_clocks, TAP_IDLE);
|
||||
|
|
Loading…
Reference in New Issue