From 78b866e0a7046a893025fe1304064f255e37c411 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 21 Aug 2013 13:33:40 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6192 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/rt/ports/ARMCMx/devices/STM32F0xx/systick.h | 33 +++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'os/rt') diff --git a/os/rt/ports/ARMCMx/devices/STM32F0xx/systick.h b/os/rt/ports/ARMCMx/devices/STM32F0xx/systick.h index 585eecd61..e61926c7e 100644 --- a/os/rt/ports/ARMCMx/devices/STM32F0xx/systick.h +++ b/os/rt/ports/ARMCMx/devices/STM32F0xx/systick.h @@ -19,16 +19,23 @@ */ /** - * @file STM32F30x/systick.h + * @file ARMCMx/systick.h * @brief System timer header file. * - * @addtogroup STM32F30X_TIMER + * @addtogroup ARMCMx_SYSTICK * @{ */ #ifndef _SYSTICK_H_ #define _SYSTICK_H_ +#if defined(CH_PORT_DO_NOT_USE_ST) +#include "systick_ext.h" + +#else /* !defined(CH_PORT_DO_NOT_USE_ST) */ + +#include "st.h" + /*===========================================================================*/ /* Module constants. */ /*===========================================================================*/ @@ -66,7 +73,7 @@ */ static inline systime_t port_timer_get_time(void) { - return TIM2->CNT; + return stGetCounter(); } /** @@ -80,11 +87,7 @@ static inline systime_t port_timer_get_time(void) { */ static inline void port_timer_start_alarm(systime_t time) { - chDbgAssert((TIM2->DIER & 2) == 0, "already started"); - - TIM2->CCR1 = time; - TIM2->SR = 0; - TIM2->DIER = 2; /* CC1IE */ + stStartAlarm(time); } /** @@ -94,9 +97,7 @@ static inline void port_timer_start_alarm(systime_t time) { */ static inline void port_timer_stop_alarm(void) { - chDbgAssert((TIM2->DIER & 2) != 0, "not started"); - - TIM2->DIER = 0; + stStopAlarm(); } /** @@ -108,9 +109,7 @@ static inline void port_timer_stop_alarm(void) { */ static inline void port_timer_set_alarm(systime_t time) { - chDbgAssert((TIM2->DIER & 2) != 0, "not started"); - - TIM2->CCR1 = time; + stSetAlarm(time); } /** @@ -122,11 +121,11 @@ static inline void port_timer_set_alarm(systime_t time) { */ static inline systime_t port_timer_get_alarm(void) { - chDbgAssert((TIM2->DIER & 2) != 0, "not started"); - - return TIM2->CCR1; + return stGetAlarm(); } +#endif /* !defined(CH_PORT_DO_NOT_USE_ST) */ + #endif /* _SYSTICK_H_ */ /** @} */ -- cgit v1.2.3