Changeset 248f867 in rtems


Ignore:
Timestamp:
Oct 17, 2017, 9:46:15 AM (20 months ago)
Author:
Christian Mauderer <Christian.Mauderer@…>
Branches:
master
Children:
dbb30e26
Parents:
205d8d71
git-author:
Christian Mauderer <Christian.Mauderer@…> (10/17/17 09:46:15)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/18/17 07:02:01)
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/shared/armv7m/clock/armv7m-clock-config.c

    r205d8d71 r248f867  
    8989}
    9090
    91 static uint32_t _ARMV7M_TC_dwt_get_timecount(struct timecounter *tc)
    92 {
    93   volatile ARMV7M_DWT *dwt = _ARMV7M_DWT;
    94 
    95   return dwt->cyccnt;
    96 }
    97 
    98 static void _ARMV7M_TC_dwt_tick(void)
    99 {
    100   rtems_timecounter_tick();
    101 }
    102 
    10391static void _ARMV7M_TC_tick(void)
    10492{
     
    132120  uint64_t us_per_tick = rtems_configuration_get_microseconds_per_tick();
    133121  uint64_t interval = (freq * us_per_tick) / 1000000ULL;
    134   bool cyccnt_enabled;
    135122
    136123  systick->rvr = (uint32_t) interval;
     
    140127    | ARMV7M_SYSTICK_CSR_CLKSOURCE;
    141128
    142   cyccnt_enabled = _ARMV7M_DWT_Enable_CYCCNT();
    143   if (cyccnt_enabled) {
    144     _ARMV7M_TC.base.tc.tc_get_timecount = _ARMV7M_TC_dwt_get_timecount;
    145     _ARMV7M_TC.base.tc.tc_counter_mask = 0xffffffff;
    146     _ARMV7M_TC.base.tc.tc_frequency = freq;
    147     _ARMV7M_TC.base.tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
    148     _ARMV7M_TC.tick = _ARMV7M_TC_dwt_tick;
    149     rtems_timecounter_install(&_ARMV7M_TC.base.tc);
    150   } else {
    151     _ARMV7M_TC.tick = _ARMV7M_TC_systick_tick;
    152     rtems_timecounter_simple_install(
    153       &_ARMV7M_TC.base,
    154       freq,
    155       interval,
    156       _ARMV7M_TC_systick_get_timecount
    157     );
    158   }
     129  _ARMV7M_TC.tick = _ARMV7M_TC_systick_tick;
     130  rtems_timecounter_simple_install(
     131    &_ARMV7M_TC.base,
     132    freq,
     133    interval,
     134    _ARMV7M_TC_systick_get_timecount
     135  );
    159136}
    160137
Note: See TracChangeset for help on using the changeset viewer.