cmd_bios.c: Fix wrong byte size of uptime in uptime_handler.

- It's a 64bit not 32bit unsigned and it caused overflow/negative
    cycles display.
This commit is contained in:
Denis Ryndine 2024-02-13 21:56:06 +00:00 committed by Andrew Dennison
parent dbc1f665f7
commit 93a7cc2523
1 changed files with 4 additions and 4 deletions

View File

@ -73,13 +73,13 @@ define_command(ident, ident_handler, "Identifier of the system", SYSTEM_CMDS);
#ifdef CSR_TIMER0_UPTIME_CYCLES_ADDR
static void uptime_handler(int nb_params, char **params)
{
unsigned long uptime;
uint64_t uptime;
timer0_uptime_latch_write(1);
uptime = timer0_uptime_cycles_read();
printf("Uptime: %ld sys_clk cycles / %ld seconds",
uptime,
uptime/CONFIG_CLOCK_FREQUENCY
printf("Uptime: %" PRIu64 " sys_clk cycles / %" PRIu64 " seconds\n",
uptime,
uptime / CONFIG_CLOCK_FREQUENCY
);
}