Skip to content

Commit 983f020

Browse files
committed
target/riscv: Consistent data type for trigger indexes
Cosmetic detail: Use `unsigned int` to index triggers (as opposed to riscv_reg_t), which corresponds to the data type of `trigger_count` in `struct riscv_info_t`. Change-Id: I83539abdffa41aec2060fbd0c81496ab9607c9ea Signed-off-by: Jan Matyas <[email protected]>
1 parent df5b531 commit 983f020

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/target/riscv/riscv.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5024,9 +5024,9 @@ static COMMAND_HELPER(report_reserved_triggers, struct target *target)
50245024
if (riscv_enumerate_triggers(target) != ERROR_OK)
50255025
return ERROR_FAIL;
50265026
const char *separator = "";
5027-
for (riscv_reg_t t = 0; t < r->trigger_count; ++t) {
5027+
for (unsigned int t = 0; t < r->trigger_count; ++t) {
50285028
if (r->reserved_triggers[t]) {
5029-
command_print_sameline(CMD, "%s%" PRIu64, separator, t);
5029+
command_print_sameline(CMD, "%s%u", separator, t);
50305030
separator = " ";
50315031
}
50325032
}
@@ -5043,8 +5043,8 @@ COMMAND_HANDLER(handle_reserve_trigger)
50435043
if (CMD_ARGC != 2)
50445044
return ERROR_COMMAND_SYNTAX_ERROR;
50455045

5046-
riscv_reg_t t;
5047-
COMMAND_PARSE_NUMBER(u64, CMD_ARGV[0], t);
5046+
unsigned int t;
5047+
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], t);
50485048

50495049
if (riscv_enumerate_triggers(target) != ERROR_OK)
50505050
return ERROR_FAIL;
@@ -5054,15 +5054,15 @@ COMMAND_HANDLER(handle_reserve_trigger)
50545054
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
50555055
}
50565056
if (t >= r->trigger_count) {
5057-
command_print(CMD, "Error: trigger with index %" PRIu64
5057+
command_print(CMD, "Error: trigger with index %u"
50585058
" does not exist. There are only %u triggers"
50595059
" on the target (with indexes 0 .. %u).",
50605060
t, r->trigger_count, r->trigger_count - 1);
50615061
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
50625062
}
50635063
if (r->trigger_unique_id[t] != -1) {
5064-
command_print(CMD, "Error: trigger with index %" PRIu64
5065-
" is already in use and can not be reserved.", t);
5064+
command_print(CMD, "Error: trigger with index %u"
5065+
" is already in use and cannot be reserved.", t);
50665066
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
50675067
}
50685068
COMMAND_PARSE_ON_OFF(CMD_ARGV[1], r->reserved_triggers[t]);

0 commit comments

Comments
 (0)