forked from Imagelibrary/rtems
bsps/arm: Remove DWT based clock.
It seems that the DWT CYCCNT does not advance when the CPU waits on a WFI instruction. That leads to the effect that for example on the atsamv BSP a sleep(1) needs something in the range of a few minutes (depending on the configured systick). A debugger might disables some deep sleep modes so that the problem only appears if the application is executed without a debugger.
This commit is contained in:
committed by
Sebastian Huber
parent
205d8d71a6
commit
248f8679a7
@@ -88,18 +88,6 @@ static void _ARMV7M_TC_systick_tick(void)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t _ARMV7M_TC_dwt_get_timecount(struct timecounter *tc)
|
|
||||||
{
|
|
||||||
volatile ARMV7M_DWT *dwt = _ARMV7M_DWT;
|
|
||||||
|
|
||||||
return dwt->cyccnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _ARMV7M_TC_dwt_tick(void)
|
|
||||||
{
|
|
||||||
rtems_timecounter_tick();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _ARMV7M_TC_tick(void)
|
static void _ARMV7M_TC_tick(void)
|
||||||
{
|
{
|
||||||
(*_ARMV7M_TC.tick)();
|
(*_ARMV7M_TC.tick)();
|
||||||
@@ -131,7 +119,6 @@ static void _ARMV7M_Systick_initialize(void)
|
|||||||
#endif
|
#endif
|
||||||
uint64_t us_per_tick = rtems_configuration_get_microseconds_per_tick();
|
uint64_t us_per_tick = rtems_configuration_get_microseconds_per_tick();
|
||||||
uint64_t interval = (freq * us_per_tick) / 1000000ULL;
|
uint64_t interval = (freq * us_per_tick) / 1000000ULL;
|
||||||
bool cyccnt_enabled;
|
|
||||||
|
|
||||||
systick->rvr = (uint32_t) interval;
|
systick->rvr = (uint32_t) interval;
|
||||||
systick->cvr = 0;
|
systick->cvr = 0;
|
||||||
@@ -139,23 +126,13 @@ static void _ARMV7M_Systick_initialize(void)
|
|||||||
| ARMV7M_SYSTICK_CSR_TICKINT
|
| ARMV7M_SYSTICK_CSR_TICKINT
|
||||||
| ARMV7M_SYSTICK_CSR_CLKSOURCE;
|
| ARMV7M_SYSTICK_CSR_CLKSOURCE;
|
||||||
|
|
||||||
cyccnt_enabled = _ARMV7M_DWT_Enable_CYCCNT();
|
_ARMV7M_TC.tick = _ARMV7M_TC_systick_tick;
|
||||||
if (cyccnt_enabled) {
|
rtems_timecounter_simple_install(
|
||||||
_ARMV7M_TC.base.tc.tc_get_timecount = _ARMV7M_TC_dwt_get_timecount;
|
&_ARMV7M_TC.base,
|
||||||
_ARMV7M_TC.base.tc.tc_counter_mask = 0xffffffff;
|
freq,
|
||||||
_ARMV7M_TC.base.tc.tc_frequency = freq;
|
interval,
|
||||||
_ARMV7M_TC.base.tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
|
_ARMV7M_TC_systick_get_timecount
|
||||||
_ARMV7M_TC.tick = _ARMV7M_TC_dwt_tick;
|
);
|
||||||
rtems_timecounter_install(&_ARMV7M_TC.base.tc);
|
|
||||||
} else {
|
|
||||||
_ARMV7M_TC.tick = _ARMV7M_TC_systick_tick;
|
|
||||||
rtems_timecounter_simple_install(
|
|
||||||
&_ARMV7M_TC.base,
|
|
||||||
freq,
|
|
||||||
interval,
|
|
||||||
_ARMV7M_TC_systick_get_timecount
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _ARMV7M_Systick_cleanup(void)
|
static void _ARMV7M_Systick_cleanup(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user