git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6646 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2014-01-27 10:46:47 +00:00
parent 9a9b70a61a
commit 9d9cbba7a6
2 changed files with 31 additions and 27 deletions

View File

@ -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_) */

View File

@ -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_ */
/** @} */