[PATCH 4/4] arm: Simplify CPU counter support
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jun 15 11:13:03 UTC 2018
Use the standard ARMv7-M systick module for the ARMv7-M CPU counter
instead of DWT counter since the DWT counter is affected by power saving
states.
Use an inline function for _CPU_Counter_difference() for all ARM BSPs.
Update #3456.
---
bsps/arm/include/bsp/clock-armv7m.h | 78 +++++++++++
bsps/arm/lpc176x/start/system-clocks.c | 9 --
bsps/arm/shared/clock/clock-armv7m.c | 151 ++++++++--------------
bsps/arm/shared/cpucounter/cpucounter-armv7m.c | 37 +-----
c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am | 1 -
c/src/lib/libbsp/arm/atsam/Makefile.am | 1 -
c/src/lib/libbsp/arm/beagle/Makefile.am | 1 -
c/src/lib/libbsp/arm/csb336/Makefile.am | 1 -
c/src/lib/libbsp/arm/csb337/Makefile.am | 1 -
c/src/lib/libbsp/arm/edb7312/Makefile.am | 1 -
c/src/lib/libbsp/arm/gdbarmsim/Makefile.am | 1 -
c/src/lib/libbsp/arm/gumstix/Makefile.am | 1 -
c/src/lib/libbsp/arm/imx/Makefile.am | 1 -
c/src/lib/libbsp/arm/lm3s69xx/Makefile.am | 1 -
c/src/lib/libbsp/arm/lpc24xx/Makefile.am | 1 -
c/src/lib/libbsp/arm/lpc32xx/Makefile.am | 1 -
c/src/lib/libbsp/arm/raspberrypi/Makefile.am | 1 -
c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am | 1 -
c/src/lib/libbsp/arm/rtl22xx/Makefile.am | 1 -
c/src/lib/libbsp/arm/smdk2410/Makefile.am | 1 -
c/src/lib/libbsp/arm/stm32f4/Makefile.am | 1 -
c/src/lib/libbsp/arm/tms570/Makefile.am | 1 -
c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am | 1 -
cpukit/score/cpu/arm/include/rtems/score/cpu.h | 7 +-
24 files changed, 138 insertions(+), 163 deletions(-)
create mode 100644 bsps/arm/include/bsp/clock-armv7m.h
diff --git a/bsps/arm/include/bsp/clock-armv7m.h b/bsps/arm/include/bsp/clock-armv7m.h
new file mode 100644
index 0000000000..d635fb0c1b
--- /dev/null
+++ b/bsps/arm/include/bsp/clock-armv7m.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2011, 2018 Sebastian Huber. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef BSP_CLOCK_ARMV7M_H
+#define BSP_CLOCK_ARMV7M_H
+
+#include <rtems/score/armv7m.h>
+#include <rtems/timecounter.h>
+
+#include <bsp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef ARM_MULTILIB_ARCH_V7M
+
+typedef struct {
+ struct timecounter base;
+ uint32_t ticks;
+} ARMV7M_Timecounter;
+
+extern ARMV7M_Timecounter _ARMV7M_TC;
+
+static inline uint32_t _ARMV7M_Clock_frequency(void)
+{
+#ifdef BSP_ARMV7M_SYSTICK_FREQUENCY
+ return BSP_ARMV7M_SYSTICK_FREQUENCY;
+#else
+ volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
+ return ARMV7M_SYSTICK_CALIB_TENMS_GET(systick->calib) * 100;
+#endif
+}
+
+static uint32_t _ARMV7M_Clock_counter(ARMV7M_Timecounter *tc)
+{
+ volatile ARMV7M_Systick *systick;
+ rtems_interrupt_level level;
+ uint32_t interval;
+ uint32_t counter;
+ uint32_t ticks;
+
+ systick = _ARMV7M_Systick;
+ interval = systick->rvr;
+
+ rtems_interrupt_disable(level);
+ counter = systick->cvr;
+ ticks = tc->ticks;
+
+ if ((systick->csr & ARMV7M_SYSTICK_CSR_COUNTFLAG) != 0) {
+ ticks += interval;
+ tc->ticks = ticks;
+ }
+
+ counter = interval - counter + ticks;
+ rtems_interrupt_enable(level);
+
+ return counter;
+}
+
+#endif /* ARM_MULTILIB_ARCH_V7M */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BSP_CLOCK_ARMV7M_H */
diff --git a/bsps/arm/lpc176x/start/system-clocks.c b/bsps/arm/lpc176x/start/system-clocks.c
index 2ec58727eb..6af52be053 100644
--- a/bsps/arm/lpc176x/start/system-clocks.c
+++ b/bsps/arm/lpc176x/start/system-clocks.c
@@ -118,12 +118,3 @@ CPU_Counter_ticks _CPU_Counter_read( void )
{
return lpc176x_get_timer1();
}
-
-inline CPU_Counter_ticks _CPU_Counter_difference(
- CPU_Counter_ticks second,
- CPU_Counter_ticks first
-)
-{
- return second - first;
-}
-
diff --git a/bsps/arm/shared/clock/clock-armv7m.c b/bsps/arm/shared/clock/clock-armv7m.c
index 39cd4efdc7..2efe4c2654 100644
--- a/bsps/arm/shared/clock/clock-armv7m.c
+++ b/bsps/arm/shared/clock/clock-armv7m.c
@@ -1,8 +1,8 @@
/*
- * Copyright (c) 2011-2012 Sebastian Huber. All rights reserved.
+ * Copyright (c) 2011, 2018 Sebastian Huber. All rights reserved.
*
* embedded brains GmbH
- * Obere Lagerstr. 30
+ * Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems at embedded-brains.de>
@@ -12,146 +12,97 @@
* http://www.rtems.org/license/LICENSE.
*/
-#include <rtems.h>
-#include <rtems/timecounter.h>
-#include <rtems/score/armv7m.h>
+#include <bsp/clock-armv7m.h>
-#include <bsp.h>
+#include <rtems.h>
+#include <rtems/sysinit.h>
#ifdef ARM_MULTILIB_ARCH_V7M
/* This is defined in dev/clock/clockimpl.h */
static void Clock_isr(void *arg);
-typedef struct {
- rtems_timecounter_simple base;
- void (*tick)(void);
- bool countflag;
-} ARMV7M_Timecounter;
-
-static ARMV7M_Timecounter _ARMV7M_TC;
-
-static uint32_t _ARMV7M_TC_systick_get(rtems_timecounter_simple *tc)
-{
- volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
-
- return systick->cvr;
-}
-
-static bool _ARMV7M_TC_systick_is_pending(rtems_timecounter_simple *base)
-{
- ARMV7M_Timecounter *tc = (ARMV7M_Timecounter *) base;
- rtems_interrupt_level level;
- bool countflag;
-
- rtems_interrupt_disable(level);
-
- countflag = tc->countflag;
- if (!countflag) {
- volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
-
- countflag = ((systick->csr & ARMV7M_SYSTICK_CSR_COUNTFLAG) != 0);
- tc->countflag = countflag;
- }
-
- rtems_interrupt_enable(level);
-
- return countflag;
-}
-
-static uint32_t _ARMV7M_TC_systick_get_timecount(struct timecounter *tc)
-{
- return rtems_timecounter_simple_downcounter_get(
- tc,
- _ARMV7M_TC_systick_get,
- _ARMV7M_TC_systick_is_pending
- );
-}
-
-static void _ARMV7M_TC_systick_at_tick(rtems_timecounter_simple *base)
-{
- ARMV7M_Timecounter *tc = (ARMV7M_Timecounter *) base;
- volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
-
- tc->countflag = false;
-
- /* Clear COUNTFLAG */
- systick->csr;
-}
+ARMV7M_Timecounter _ARMV7M_TC;
-static void _ARMV7M_TC_systick_tick(void)
+static uint32_t _ARMV7M_TC_get_timecount(struct timecounter *base)
{
- rtems_timecounter_simple_downcounter_tick(
- &_ARMV7M_TC.base,
- _ARMV7M_TC_systick_get,
- _ARMV7M_TC_systick_at_tick
- );
+ return _ARMV7M_Clock_counter((ARMV7M_Timecounter *) base);
}
-static void _ARMV7M_TC_tick(void)
-{
- (*_ARMV7M_TC.tick)();
-}
-
-static void _ARMV7M_Systick_handler(void)
+static void _ARMV7M_Clock_handler(void)
{
_ARMV7M_Interrupt_service_enter();
Clock_isr(NULL);
_ARMV7M_Interrupt_service_leave();
}
-static void _ARMV7M_Systick_handler_install(void)
+static void _ARMV7M_Clock_handler_install(void)
{
_ARMV7M_Set_exception_priority_and_handler(
ARMV7M_VECTOR_SYSTICK,
BSP_ARMV7M_SYSTICK_PRIORITY,
- _ARMV7M_Systick_handler
+ _ARMV7M_Clock_handler
);
}
-static void _ARMV7M_Systick_initialize(void)
+static void _ARMV7M_Clock_initialize(void)
{
- volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
- #ifdef BSP_ARMV7M_SYSTICK_FREQUENCY
- uint64_t freq = BSP_ARMV7M_SYSTICK_FREQUENCY;
- #else
- uint64_t freq = ARMV7M_SYSTICK_CALIB_TENMS_GET(systick->calib) * 100ULL;
- #endif
- uint64_t us_per_tick = rtems_configuration_get_microseconds_per_tick();
- uint64_t interval = (freq * us_per_tick) / 1000000ULL;
-
- systick->rvr = (uint32_t) interval;
- systick->cvr = 0;
+ volatile ARMV7M_Systick *systick;
+ ARMV7M_Timecounter *tc;
+
+ systick = _ARMV7M_Systick;
+ tc = &_ARMV7M_TC;
+
systick->csr = ARMV7M_SYSTICK_CSR_ENABLE
| ARMV7M_SYSTICK_CSR_TICKINT
| ARMV7M_SYSTICK_CSR_CLKSOURCE;
- _ARMV7M_TC.tick = _ARMV7M_TC_systick_tick;
- rtems_timecounter_simple_install(
- &_ARMV7M_TC.base,
- freq,
- interval,
- _ARMV7M_TC_systick_get_timecount
- );
+ tc->base.tc_get_timecount = _ARMV7M_TC_get_timecount;
+ tc->base.tc_counter_mask = 0xffffffff;
+ tc->base.tc_frequency = _ARMV7M_Clock_frequency();
+ tc->base.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
+ rtems_timecounter_install(&tc->base);
}
-static void _ARMV7M_Systick_cleanup(void)
+static void _ARMV7M_Clock_initialize_early(void)
+{
+ volatile ARMV7M_Systick *systick;
+ uint32_t us_per_tick;
+ uint64_t freq;
+ uint32_t interval;
+
+ systick = _ARMV7M_Systick;
+ us_per_tick = rtems_configuration_get_microseconds_per_tick();
+ freq = _ARMV7M_Clock_frequency();
+
+ interval = (uint32_t) ((freq * us_per_tick) / 1000000);
+
+ systick->rvr = interval;
+ systick->cvr = 0;
+ systick->csr = ARMV7M_SYSTICK_CSR_ENABLE | ARMV7M_SYSTICK_CSR_CLKSOURCE;
+}
+
+RTEMS_SYSINIT_ITEM(
+ _ARMV7M_Clock_initialize_early,
+ RTEMS_SYSINIT_CPU_COUNTER,
+ RTEMS_SYSINIT_ORDER_FIRST
+);
+
+static void _ARMV7M_Clock_cleanup(void)
{
volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
systick->csr = 0;
}
-#define Clock_driver_timecounter_tick() _ARMV7M_TC_tick()
-
#define Clock_driver_support_initialize_hardware() \
- _ARMV7M_Systick_initialize()
+ _ARMV7M_Clock_initialize()
#define Clock_driver_support_install_isr(isr) \
- _ARMV7M_Systick_handler_install()
+ _ARMV7M_Clock_handler_install()
#define Clock_driver_support_shutdown_hardware() \
- _ARMV7M_Systick_cleanup()
+ _ARMV7M_Clock_cleanup()
/* Include shared source clock driver code */
#include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/shared/cpucounter/cpucounter-armv7m.c b/bsps/arm/shared/cpucounter/cpucounter-armv7m.c
index b7593602ed..bb7cdc441b 100644
--- a/bsps/arm/shared/cpucounter/cpucounter-armv7m.c
+++ b/bsps/arm/shared/cpucounter/cpucounter-armv7m.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2016, 2018 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -12,43 +12,14 @@
* http://www.rtems.org/license/LICENSE.
*/
-#include <rtems/score/armv7m.h>
-#include <rtems/counter.h>
-#include <rtems/sysinit.h>
-
-#include <bsp.h>
-#include <bsp/fatal.h>
+#include <bsp/clock-armv7m.h>
uint32_t _CPU_Counter_frequency(void)
{
-#ifdef BSP_ARMV7M_SYSTICK_FREQUENCY
- return = BSP_ARMV7M_SYSTICK_FREQUENCY;
-#else
- volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
- return ARMV7M_SYSTICK_CALIB_TENMS_GET(systick->calib) * 100;
-#endif
+ return _ARMV7M_Clock_frequency();
}
CPU_Counter_ticks _CPU_Counter_read(void)
{
- volatile ARMV7M_DWT *dwt = _ARMV7M_DWT;
-
- return dwt->cyccnt;
-}
-
-static void armv7m_cpu_counter_initialize(void)
-{
- bool cyccnt_enabled;
-
- cyccnt_enabled = _ARMV7M_DWT_Enable_CYCCNT();
-
- if (!cyccnt_enabled) {
- bsp_fatal(BSP_ARM_ARMV7M_CPU_COUNTER_INIT);
- }
+ return _ARMV7M_Clock_counter(&_ARMV7M_TC);
}
-
-RTEMS_SYSINIT_ITEM(
- armv7m_cpu_counter_initialize,
- RTEMS_SYSINIT_CPU_COUNTER,
- RTEMS_SYSINIT_ORDER_FIRST
-);
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
index 5c7513ac78..3c5bea2029 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
@@ -43,7 +43,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/altera-cyclone-v/contrib/hwl
# Shared
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bsp-fdt.c
diff --git a/c/src/lib/libbsp/arm/atsam/Makefile.am b/c/src/lib/libbsp/arm/atsam/Makefile.am
index a10a0ab744..a0b2d92129 100644
--- a/c/src/lib/libbsp/arm/atsam/Makefile.am
+++ b/c/src/lib/libbsp/arm/atsam/Makefile.am
@@ -36,7 +36,6 @@ librtemsbsp_a_LIBADD =
# Shared
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
diff --git a/c/src/lib/libbsp/arm/beagle/Makefile.am b/c/src/lib/libbsp/arm/beagle/Makefile.am
index 03f57758e9..2d9ed069e9 100644
--- a/c/src/lib/libbsp/arm/beagle/Makefile.am
+++ b/c/src/lib/libbsp/arm/beagle/Makefile.am
@@ -44,7 +44,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-defa
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/gpio/gpio-support.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
diff --git a/c/src/lib/libbsp/arm/csb336/Makefile.am b/c/src/lib/libbsp/arm/csb336/Makefile.am
index 0ef7b9a725..0cd6f11f63 100644
--- a/c/src/lib/libbsp/arm/csb336/Makefile.am
+++ b/c/src/lib/libbsp/arm/csb336/Makefile.am
@@ -27,7 +27,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES +=../../../../../../bsps/arm/csb336/clock/clockdrv.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/csb336/btimer/btimer.c
# console
diff --git a/c/src/lib/libbsp/arm/csb337/Makefile.am b/c/src/lib/libbsp/arm/csb337/Makefile.am
index 29921c4fb0..554afaac8e 100644
--- a/c/src/lib/libbsp/arm/csb337/Makefile.am
+++ b/c/src/lib/libbsp/arm/csb337/Makefile.am
@@ -36,7 +36,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/csb337/start/pmc.c
librtemsbsp_a_SOURCES +=../../../../../../bsps/arm/csb337/clock/clock.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/csb337/btimer/btimer.c
diff --git a/c/src/lib/libbsp/arm/edb7312/Makefile.am b/c/src/lib/libbsp/arm/edb7312/Makefile.am
index e48f08b552..d54ceb2888 100644
--- a/c/src/lib/libbsp/arm/edb7312/Makefile.am
+++ b/c/src/lib/libbsp/arm/edb7312/Makefile.am
@@ -25,7 +25,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/edb7312/start/bspreset.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
# clock
librtemsbsp_a_SOURCES +=../../../../../../bsps/arm/edb7312/clock/clockdrv.c
diff --git a/c/src/lib/libbsp/arm/gdbarmsim/Makefile.am b/c/src/lib/libbsp/arm/gdbarmsim/Makefile.am
index 685870a661..933ba1bf28 100644
--- a/c/src/lib/libbsp/arm/gdbarmsim/Makefile.am
+++ b/c/src/lib/libbsp/arm/gdbarmsim/Makefile.am
@@ -27,7 +27,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gdbarmsim/start/syscalls.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
# console
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-polled.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gdbarmsim/console/console-io.c
diff --git a/c/src/lib/libbsp/arm/gumstix/Makefile.am b/c/src/lib/libbsp/arm/gumstix/Makefile.am
index 4f41719b93..9e2e5fd631 100644
--- a/c/src/lib/libbsp/arm/gumstix/Makefile.am
+++ b/c/src/lib/libbsp/arm/gumstix/Makefile.am
@@ -26,7 +26,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gumstix/start/bspreset.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gumstix/start/memmap.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES +=../../../../../../bsps/arm/gumstix/clock/clock.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gumstix/btimer/btimer.c
diff --git a/c/src/lib/libbsp/arm/imx/Makefile.am b/c/src/lib/libbsp/arm/imx/Makefile.am
index b8aba82447..8bc835362c 100644
--- a/c/src/lib/libbsp/arm/imx/Makefile.am
+++ b/c/src/lib/libbsp/arm/imx/Makefile.am
@@ -31,7 +31,6 @@ librtemsbsp_a_SOURCES =
# Shared
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am b/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
index feffa3093f..206db1855b 100644
--- a/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
@@ -36,7 +36,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
diff --git a/c/src/lib/libbsp/arm/lpc24xx/Makefile.am b/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
index 14d836f5a8..642e75b5cc 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
@@ -55,7 +55,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-defa
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/uart-output-char.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
# Startup
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/start/bsp-start-memcpy.S
diff --git a/c/src/lib/libbsp/arm/lpc32xx/Makefile.am b/c/src/lib/libbsp/arm/lpc32xx/Makefile.am
index c5037b7152..c6e7d390ee 100644
--- a/c/src/lib/libbsp/arm/lpc32xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/lpc32xx/Makefile.am
@@ -43,7 +43,6 @@ librtemsbsp_a_SOURCES =
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/uart-output-char.c
diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
index 13f9696c17..8aa4e4304e 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
+++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
@@ -41,7 +41,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/start/bsp-start-memcpy.S
diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am b/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
index ea35334a55..e41e065ba1 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
@@ -40,7 +40,6 @@ librtemsbsp_a_SOURCES =
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
diff --git a/c/src/lib/libbsp/arm/rtl22xx/Makefile.am b/c/src/lib/libbsp/arm/rtl22xx/Makefile.am
index c34d812885..286b5a726a 100644
--- a/c/src/lib/libbsp/arm/rtl22xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/rtl22xx/Makefile.am
@@ -27,7 +27,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/rtl22xx/btimer/btimer.c
librtemsbsp_a_SOURCES +=../../../../../../bsps/arm/rtl22xx/clock/clockdrv.c
# console
diff --git a/c/src/lib/libbsp/arm/smdk2410/Makefile.am b/c/src/lib/libbsp/arm/smdk2410/Makefile.am
index 6e57275e59..ba38b1ac26 100644
--- a/c/src/lib/libbsp/arm/smdk2410/Makefile.am
+++ b/c/src/lib/libbsp/arm/smdk2410/Makefile.am
@@ -27,7 +27,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/smdk2410/btimer/btimer.c
librtemsbsp_a_SOURCES +=../../../../../../bsps/arm/smdk2410/clock/clockdrv.c
librtemsbsp_a_SOURCES +=../../../../../../bsps/arm/smdk2410/clock/support.c
diff --git a/c/src/lib/libbsp/arm/stm32f4/Makefile.am b/c/src/lib/libbsp/arm/stm32f4/Makefile.am
index 70fee358f0..02e9dd48b1 100644
--- a/c/src/lib/libbsp/arm/stm32f4/Makefile.am
+++ b/c/src/lib/libbsp/arm/stm32f4/Makefile.am
@@ -35,7 +35,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
diff --git a/c/src/lib/libbsp/arm/tms570/Makefile.am b/c/src/lib/libbsp/arm/tms570/Makefile.am
index 44e89faaf0..2e017f3105 100644
--- a/c/src/lib/libbsp/arm/tms570/Makefile.am
+++ b/c/src/lib/libbsp/arm/tms570/Makefile.am
@@ -44,7 +44,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
diff --git a/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am b/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am
index a3f988f34c..ac04c212d7 100644
--- a/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am
+++ b/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am
@@ -38,7 +38,6 @@ librtemsbsp_a_SOURCES =
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/stackalloc.c
diff --git a/cpukit/score/cpu/arm/include/rtems/score/cpu.h b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
index 7ea6980959..f5827b4fc6 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
@@ -600,10 +600,13 @@ uint32_t _CPU_Counter_frequency( void );
CPU_Counter_ticks _CPU_Counter_read( void );
-CPU_Counter_ticks _CPU_Counter_difference(
+static inline CPU_Counter_ticks _CPU_Counter_difference(
CPU_Counter_ticks second,
CPU_Counter_ticks first
-);
+)
+{
+ return second - first;
+}
#if CPU_PROVIDES_IDLE_THREAD_BODY == TRUE
void *_CPU_Thread_Idle_body( uintptr_t ignored );
--
2.13.7
More information about the devel
mailing list