From 9d9cbba7a6550075f2fc3c0a1b85d9dc64655458 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 27 Jan 2014 10:46:47 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6646 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/nil/ports/ARMCMx/nilcore.h | 14 +++++++++ os/nil/ports/ARMCMx/nilcore_timer.h | 44 +++++++++++------------------ 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/os/nil/ports/ARMCMx/nilcore.h b/os/nil/ports/ARMCMx/nilcore.h index 2f32f3cc0..b7f60d1ff 100644 --- a/os/nil/ports/ARMCMx/nilcore.h +++ b/os/nil/ports/ARMCMx/nilcore.h @@ -77,6 +77,16 @@ /* Module pre-compile time settings. */ /*===========================================================================*/ +/** + * @brief Enables an alternative timer implementation. + * @details Usually the port uses a timer interface defined in the file + * @p nilcore_timer.h, if this option is enabled then the file + * @p nilcore_timer_alt.h is included instead. + */ +#if !defined(PORT_USE_ALT_TIMER) +#define PORT_USE_ALT_TIMER FALSE +#endif + /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ @@ -212,7 +222,11 @@ struct port_intctx {}; #if !defined(_FROM_ASM_) #if NIL_CFG_ST_TIMEDELTA > 0 +#if !PORT_USE_ALT_TIMER #include "nilcore_timer.h" +#else /* PORT_USE_ALT_TIMER */ +#include "nilcore_timer_alt.h" +#endif /* PORT_USE_ALT_TIMER */ #endif #endif /* !defined(_FROM_ASM_) */ diff --git a/os/nil/ports/ARMCMx/nilcore_timer.h b/os/nil/ports/ARMCMx/nilcore_timer.h index 9079dea8c..a045ef544 100644 --- a/os/nil/ports/ARMCMx/nilcore_timer.h +++ b/os/nil/ports/ARMCMx/nilcore_timer.h @@ -29,14 +29,6 @@ #ifndef _NILCORE_TIMER_H_ #define _NILCORE_TIMER_H_ -#if defined(PORT_DO_NOT_USE_ST) -/* If, for some reason, the use of the HAL-provided ST timer port interface - is not wanted, it is possible to provide the timer interface into a custom - module.*/ -#include "nilcore_timer_ext.h" - -#else /* !defined(PORT_DO_NOT_USE_ST) */ - /* This is the only header in the HAL designed to be include-able alone.*/ #include "st.h" @@ -60,6 +52,14 @@ /* Module macros. */ /*===========================================================================*/ +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module inline functions. */ +/*===========================================================================*/ + /** * @brief Starts the alarm. * @note Makes sure that no spurious alarms are triggered after @@ -69,9 +69,9 @@ * * @notapi */ -#define port_timer_start_alarm(time) { \ - chDbgAssert(stIsAlarmActive() == false, "already active"); \ - stStartAlarm(time); \ +static inline void port_timer_start_alarm(systime_t time) { + + stStartAlarm(time); } /** @@ -79,9 +79,9 @@ * * @notapi */ -#define port_timer_stop_alarm() { \ - chDbgAssert(stIsAlarmActive() != false, "not active"); \ - stStopAlarm(); \ +static inline void port_timer_stop_alarm(void) { + + stStopAlarm(); } /** @@ -91,19 +91,11 @@ * * @notapi */ -#define port_timer_set_alarm(time) { \ - chDbgAssert(stIsAlarmActive() != false, "not active"); \ - stSetAlarm(time); \ +static inline void port_timer_set_alarm(systime_t time) { + + stSetAlarm(time); } -/*===========================================================================*/ -/* External declarations. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Module inline functions. */ -/*===========================================================================*/ - /** * @brief Returns the system time. * @@ -128,8 +120,6 @@ static inline systime_t port_timer_get_alarm(void) { return stGetAlarm(); } -#endif /* !defined(PORT_DO_NOT_USE_ST) */ - #endif /* _NILCORE_TIMER_H_ */ /** @} */