diff --git a/src/include/status.h b/src/include/status.h index 381d030d..aeca9748 100644 --- a/src/include/status.h +++ b/src/include/status.h @@ -91,4 +91,4 @@ typedef enum status } status_t; #define STATUS_CHECK_POINTER(x) RET_ON_FAIL(x, error_inval_pointer) -#define STATUS_CHECK_COREID(x) RET_ON_FAIL((x <= N_CORES), error_system_inval_cpu) +#define STATUS_CHECK_COREID(x) RET_ON_FAIL((x < N_CORES), error_system_inval_cpu) diff --git a/src/platform/sifive/common_fe310/platform/plat_timer.c b/src/platform/sifive/common_fe310/platform/plat_timer.c index 0e6f9ab2..40bbc91d 100644 --- a/src/platform/sifive/common_fe310/platform/plat_timer.c +++ b/src/platform/sifive/common_fe310/platform/plat_timer.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -50,7 +51,13 @@ static void plat_tmr_isr(void) { arch_di_mtime(); uint64_t t = clint_read_time(); - clint_config_tcmp(arch_core_index(), (t + ticks)); + status_t ret = clint_config_tcmp(arch_core_index(), (t + ticks)); + if(ret) + { + syslog_stdout_enable(); + syslog(fail, "Failed to configure timer, Err = %p\n", ret); + plat_panic_handler(); + } arch_ei_mtime(); if(tmr_cb != NULL) @@ -119,7 +126,13 @@ static void plat_timer_set_period(unsigned int p) ticks = plat_get_timer_ticks_msec(tm->clk); ticks *= p; nt = ticks + clint_read_time(); - clint_config_tcmp(arch_core_index(), nt); + status_t ret = clint_config_tcmp(arch_core_index(), nt); + if(ret) + { + syslog_stdout_enable(); + syslog(fail, "Failed to configure timer, Err = %p\n", ret); + plat_panic_handler(); + } arch_ei_mtime(); }