diff --git a/bsp_sedi/drivers/hpet/sedi_hpet.c b/bsp_sedi/drivers/hpet/sedi_hpet.c index 218ab71..20bc796 100644 --- a/bsp_sedi/drivers/hpet/sedi_hpet.c +++ b/bsp_sedi/drivers/hpet/sedi_hpet.c @@ -34,6 +34,7 @@ SEDI_REG_DEFINE(HPET, MCV, 0x0f0, RW, (uint64_t)-1, (uint64_t)0x0); SEDI_RBFM(HPET, HPET_CTRL_STS, HPET_CTRL_STS8)) #define CTRL_STS_TIMER1_COMPARATOR SEDI_RBFM(HPET, HPET_CTRL_STS, HPET_CTRL_STS9) #define CTRL_STS_TIMER2_COMPARATOR SEDI_RBFM(HPET, HPET_CTRL_STS, HPET_CTRL_STS10) +#define CTRL_STS_MAIN_COUNTER_VALUE_INVALID SEDI_RBFM(HPET, HPET_CTRL_STS, HPET_CTRL_STS13) /*Macro for interrupt routing*/ #define TIMER2_INT_ROUTE (0x0b) @@ -157,6 +158,7 @@ uint64_t sedi_hpet_get_main_counter(void) uint32_t highBits; uint32_t lowBits; + wait_for_idle(CTRL_STS_MAIN_COUNTER_VALUE_INVALID); do { highBits = SEDI_REG_GET(HPET, MCV_HIGH); lowBits = SEDI_REG_GET(HPET, MCV_LOW);