jtag: Use 'unsigned int' for 'ir_length'
This patch modifies as little code as possible in order to simplify the review. Data types that are affected by these changes will be modified in following patches. Change-Id: I83921d70e017095d63547e0bc9fe61779191d9d0 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/8403 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
4fac13827f
commit
42450345dd
|
@ -1396,7 +1396,7 @@ static int jtag_validate_ircapture(void)
|
|||
&& tap->ir_length < JTAG_IRLEN_MAX) {
|
||||
tap->ir_length++;
|
||||
}
|
||||
LOG_WARNING("AUTO %s - use \"jtag newtap %s %s -irlen %d "
|
||||
LOG_WARNING("AUTO %s - use \"jtag newtap %s %s -irlen %u "
|
||||
"-expected-id 0x%08" PRIx32 "\"",
|
||||
tap->dotted_name, tap->chip, tap->tapname, tap->ir_length, tap->idcode);
|
||||
}
|
||||
|
@ -1472,7 +1472,7 @@ void jtag_tap_init(struct jtag_tap *tap)
|
|||
jtag_tap_add(tap);
|
||||
|
||||
LOG_DEBUG("Created Tap: %s @ abs position %u, "
|
||||
"irlen %d, capture: 0x%x mask: 0x%x", tap->dotted_name,
|
||||
"irlen %u, capture: 0x%x mask: 0x%x", tap->dotted_name,
|
||||
tap->abs_chain_position, tap->ir_length,
|
||||
(unsigned) tap->ir_capture_value,
|
||||
(unsigned) tap->ir_capture_mask);
|
||||
|
|
|
@ -107,7 +107,7 @@ struct jtag_tap {
|
|||
bool disabled_after_reset;
|
||||
/** Is this TAP currently enabled? */
|
||||
bool enabled;
|
||||
int ir_length; /**< size of instruction register */
|
||||
unsigned int ir_length; /**< size of instruction register */
|
||||
uint32_t ir_capture_value;
|
||||
uint8_t *expected; /**< Capture-IR expected value */
|
||||
uint32_t ir_capture_mask;
|
||||
|
|
|
@ -448,11 +448,11 @@ static COMMAND_HELPER(handle_jtag_newtap_args, struct jtag_tap *tap)
|
|||
if (!CMD_ARGC)
|
||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||
|
||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tap->ir_length);
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], tap->ir_length);
|
||||
CMD_ARGC--;
|
||||
CMD_ARGV++;
|
||||
if (tap->ir_length > (int)(8 * sizeof(tap->ir_capture_value)))
|
||||
LOG_WARNING("%s: huge IR length %d", tap->dotted_name, tap->ir_length);
|
||||
if (tap->ir_length > (8 * sizeof(tap->ir_capture_value)))
|
||||
LOG_WARNING("%s: huge IR length %u", tap->dotted_name, tap->ir_length);
|
||||
break;
|
||||
|
||||
case NTAP_OPT_IRMASK:
|
||||
|
@ -814,13 +814,13 @@ COMMAND_HANDLER(handle_scan_chain_command)
|
|||
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
|
||||
|
||||
command_print(CMD,
|
||||
"%2u %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
|
||||
"%2u %-18s %c 0x%08x %s %5u 0x%02x 0x%02x",
|
||||
tap->abs_chain_position,
|
||||
tap->dotted_name,
|
||||
tap->enabled ? 'Y' : 'n',
|
||||
(unsigned int)(tap->idcode),
|
||||
expected_id,
|
||||
(unsigned int)(tap->ir_length),
|
||||
tap->ir_length,
|
||||
(unsigned int)(expected),
|
||||
(unsigned int)(expected_mask));
|
||||
|
||||
|
@ -972,7 +972,7 @@ COMMAND_HANDLER(handle_irscan_command)
|
|||
if (retval != ERROR_OK)
|
||||
goto error_return;
|
||||
|
||||
int field_size = tap->ir_length;
|
||||
unsigned int field_size = tap->ir_length;
|
||||
fields[i].num_bits = field_size;
|
||||
uint8_t *v = calloc(1, DIV_ROUND_UP(field_size, 8));
|
||||
if (!v) {
|
||||
|
|
|
@ -153,7 +153,7 @@ static int mcu_write_ir(struct jtag_tap *tap, uint8_t *ir_in, uint8_t *ir_out,
|
|||
LOG_ERROR("invalid tap");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
if (ir_len != tap->ir_length) {
|
||||
if ((unsigned int)ir_len != tap->ir_length) {
|
||||
LOG_ERROR("invalid ir_len");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
|
|
@ -224,10 +224,10 @@ static int irscan(struct target *t, uint8_t *out,
|
|||
if (ir_len != t->tap->ir_length) {
|
||||
retval = ERROR_FAIL;
|
||||
if (t->tap->enabled)
|
||||
LOG_ERROR("%s tap enabled but tap irlen=%d",
|
||||
LOG_ERROR("%s tap enabled but tap irlen=%u",
|
||||
__func__, t->tap->ir_length);
|
||||
else
|
||||
LOG_ERROR("%s tap not enabled and irlen=%d",
|
||||
LOG_ERROR("%s tap not enabled and irlen=%u",
|
||||
__func__, t->tap->ir_length);
|
||||
return retval;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue