aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-01-27 10:46:47 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-01-27 10:46:47 +0000
commit9d9cbba7a6550075f2fc3c0a1b85d9dc64655458 (patch)
tree7b7b72851c6d5aede24c4911de24c83dc2c84d76 /os
parent9a9b70a61aa9f762d99737442bf883a26ff31768 (diff)
downloadChibiOS-9d9cbba7a6550075f2fc3c0a1b85d9dc64655458.tar.gz
ChibiOS-9d9cbba7a6550075f2fc3c0a1b85d9dc64655458.tar.bz2
ChibiOS-9d9cbba7a6550075f2fc3c0a1b85d9dc64655458.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6646 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/nil/ports/ARMCMx/nilcore.h14
-rw-r--r--os/nil/ports/ARMCMx/nilcore_timer.h44
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,18 +91,10 @@
*
* @notapi
*/
-#define port_timer_set_alarm(time) { \
- chDbgAssert(stIsAlarmActive() != false, "not active"); \
- stSetAlarm(time); \
-}
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
+static inline void port_timer_set_alarm(systime_t time) {
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
+ stSetAlarm(time);
+}
/**
* @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_ */
/** @} */