]> www.infradead.org Git - users/borneoa/openocd-next.git/commitdiff
jtag: convert 'unsigned' to 'unsigned int'
authorAntonio Borneo <borneo.antonio@gmail.com>
Sun, 8 Sep 2024 19:21:35 +0000 (21:21 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 5 Oct 2024 15:45:57 +0000 (15:45 +0000)
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
24 files changed:
src/jtag/adapter.c
src/jtag/core.c
src/jtag/drivers/bitbang.c
src/jtag/drivers/cmsis_dap.c
src/jtag/drivers/driver.c
src/jtag/drivers/ft232r.c
src/jtag/drivers/ftdi.c
src/jtag/drivers/jlink.c
src/jtag/drivers/jtag_vpi.c
src/jtag/drivers/libusb_helper.c
src/jtag/drivers/minidriver_imp.h
src/jtag/drivers/mpsse.c
src/jtag/drivers/mpsse.h
src/jtag/drivers/stlink_usb.c
src/jtag/drivers/usb_blaster/ublast2_access_libusb.c
src/jtag/drivers/usb_blaster/ublast_access.h
src/jtag/drivers/usb_blaster/ublast_access_ftdi.c
src/jtag/drivers/usb_blaster/usb_blaster.c
src/jtag/drivers/xlnx-pcie-xvc.c
src/jtag/interface.c
src/jtag/interface.h
src/jtag/minidriver.h
src/jtag/swd.h
src/jtag/tcl.c

index bbf1cb3d2e2e8c4a8f04c3fd53697058579fb048..996a23f1ff601a5d2d6b37203daa4fcd69ae249c 100644 (file)
@@ -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);
index 6515d716099630e886ef770abd86f9e4d0db35d1..907883f0997a4c778d78ff28384bad9fb19e8245 100644 (file)
@@ -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;
 
index e41659263c90d3a6e4f7da366f381750a5350aad..17e01a2330302c17ecfba0dec4fc02590a086ca0 100644 (file)
@@ -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));
index 4ba6b51beaf01d5442f141fb8ef05534f4b29413..2f776cb387287ad1946eac92665f1cb6a512f29f 100644 (file)
@@ -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]);
index 2aad4a0c13601c0a03581709b8c1b79843efb141..d52a345a0a91f41e5c7cc4b3a67ce070ef12239a 100644 (file)
@@ -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;
 
index a4d072cd77a47eaebc0993c243f915599e405173..6dc13049305bd8f1fbf280e84200e6cb9d6de2af 100644 (file)
@@ -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);
index 82117f12c17970c89900255476f8540f4f4bc28d..42ecda117b777b46d8cb59fc0cac44c8768aa168 100644 (file)
@@ -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]);
index 1b2fb4e3045e06dfe7b7c63e13925753879e22e9..74660744a7805e6597277ce118d6f07e6d80ba05 100644 (file)
@@ -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)
index 15b2679bbab63542302769a0ce7e925d35ce8a1a..079bb1d0a1c35bf860c3d967cbcecdfc0ba6c9b9 100644 (file)
@@ -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);
index 57ea8cd3fa0fe9fe85498f83f0e80a22d91975d3..ee90e78b3745ace41c0349c82dbc3067b6abce5d 100644 (file)
@@ -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;
index 7afb46345fa3052ea5974378765e17edb9ba3005..b29b3c9ccaed5b3aab34e0d7d8e95887e20f6a22 100644 (file)
@@ -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);
 }
 
index 3decddb0e861ce2873634d94dbb7504939d0c0d5..1ef9550a08b50d616ea1c039fc5c3c1f80fed293 100644 (file)
@@ -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)
index 737560d956d6672b786e5c38ecd98921c786aece..4a625d890b3034aa4f05b0a145c40a715312a6f4 100644 (file)
@@ -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);
index 8cf3b0c73aa38243efdab63fc78042f98da72fa6..812a192c220da9f31a18f92efea1b318408f304a 100644 (file)
@@ -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() : "");
index de0d2d8472d1aae57580dbc81e61414949eab8f8..e790f3ae53e8e4db9b4d80c32b99d3836261f650 100644 (file)
@@ -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;
 
index 3e138bd23ba0679a59aadc4b6df70402510a8329..e9c926813115a965880e58027a1bdc140672bf94 100644 (file)
@@ -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);
index eb312ef4eeab548049f4aa15029969448a08fa42..9647f2b82c3200eb314282c359fba626cc628185 100644 (file)
@@ -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;
index 53dd158f661857085725c1260d9f27af585a802a..496466ca3d9a2e3024d89f32363bd6ddbefb9286 100644 (file)
@@ -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);
index b5c7e2fd6916497e72c05d78c63114ef4679a3ad..d90a022cdab5b31c92d7b1e2956ea9c678be417c 100644 (file)
@@ -43,7 +43,7 @@
 
 struct xlnx_pcie_xvc {
        int fd;
-       unsigned offset;
+       unsigned int offset;
        char *device;
 };
 
index 1230bb1b3d914dc8b77a583ee2a2442e84be0f30..87d704db971a39de2597d8e702af89696399e856 100644 (file)
@@ -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;
 
index 28c1458cb0bb85b8afa50d89335a38f0bd61aaaa..b448851dc4dd97ce78963d71d5e62b1a39198010 100644 (file)
@@ -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)
 
        /**
index 45b0bf619d0359c8d38362fc062146248db13a26..1b1094dd5b91aee468f2a9d30947bfc40095612a 100644 (file)
@@ -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);
 
 /**
index 5f626c1bf8612f190680a23a4a82f0bea03f7e64..3fe1365b58095b0422bbd77521e9af13564108f5 100644 (file)
@@ -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 {
        /**
index e2b3b45a6001f5798825a38024c11af3b89254d9..790aedfc4618eb168297205b4abb473299c78830 100644 (file)
@@ -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);