diff options
Diffstat (limited to 'os/rt')
-rw-r--r-- | os/rt/include/ch.h | 42 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/chcore_timer.h | 62 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/chcore_v6m.h | 6 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/chcore_v7m.h | 6 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/compilers/GCC/chtypes.h | 19 |
5 files changed, 53 insertions, 82 deletions
diff --git a/os/rt/include/ch.h b/os/rt/include/ch.h index c2c486c0f..21c172ec9 100644 --- a/os/rt/include/ch.h +++ b/os/rt/include/ch.h @@ -62,44 +62,6 @@ #define CH_KERNEL_PATCH 0
/** @} */
-/**
- * @name Common constants
- */
-/**
- * @brief Generic 'false' boolean constant.
- */
-#if !defined(FALSE) || defined(__DOXYGEN__)
-#define FALSE 0
-#endif
-
-/**
- * @brief Generic 'true' boolean constant.
- */
-#if !defined(TRUE) || defined(__DOXYGEN__)
-#define TRUE (!FALSE)
-#endif
-
-/**
- * @brief Generic success constant.
- * @details This constant is functionally equivalent to @p false but more
- * readable, it can be used as return value of all those functions
- * returning a @p bool as a status indicator.
- */
-#if !defined(CH_SUCCESS) || defined(__DOXYGEN__)
-#define CH_SUCCESS false
-#endif
-
-/**
- * @brief Generic failure constant.
- * @details This constant is functionally equivalent to @p true but more
- * readable, it can be used as return value of all those functions
- * returning a @p bool as a status indicator.
- */
-#if !defined(CH_FAILED) || defined(__DOXYGEN__)
-#define CH_FAILED true
-#endif
-/** @} */
-
/* Forward declarations.*/
typedef struct thread thread_t;
typedef struct virtual_timer virtual_timer_t;
@@ -114,10 +76,10 @@ extern "C" { #endif
/* Inclusion of all the kernel sub-headers.*/
-#include "chconf.h"
#include "chtypes.h"
-#include "chdebug.h"
+#include "chconf.h"
#include "chcore.h"
+#include "chdebug.h"
#include "chtm.h"
#include "chstats.h"
#include "chsys.h"
diff --git a/os/rt/ports/ARMCMx/chcore_timer.h b/os/rt/ports/ARMCMx/chcore_timer.h index da3bd82de..1a0f98ac0 100644 --- a/os/rt/ports/ARMCMx/chcore_timer.h +++ b/os/rt/ports/ARMCMx/chcore_timer.h @@ -60,26 +60,6 @@ /* Module macros. */
/*===========================================================================*/
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/**
- * @brief Returns the system time.
- *
- * @return The system time.
- *
- * @notapi
- */
-static inline systime_t port_timer_get_time(void) {
-
- return stGetCounter();
-}
-
/**
* @brief Starts the alarm.
* @note Makes sure that no spurious alarms are triggered after
@@ -89,11 +69,9 @@ static inline systime_t port_timer_get_time(void) { *
* @notapi
*/
-static inline void port_timer_start_alarm(systime_t time) {
-
- chDbgAssert(stIsAlarmActive() == false, "already active");
-
- stStartAlarm(time);
+#define port_timer_start_alarm(time) { \
+ chDbgAssert(stIsAlarmActive() == false, "already active"); \
+ stStartAlarm(time); \
}
/**
@@ -101,11 +79,9 @@ static inline void port_timer_start_alarm(systime_t time) { *
* @notapi
*/
-static inline void port_timer_stop_alarm(void) {
-
- chDbgAssert(stIsAlarmActive() != false, "not active");
-
- stStopAlarm();
+#define port_timer_stop_alarm() { \
+ chDbgAssert(stIsAlarmActive() != false, "not active"); \
+ stStopAlarm(); \
}
/**
@@ -115,11 +91,29 @@ static inline void port_timer_stop_alarm(void) { *
* @notapi
*/
-static inline void port_timer_set_alarm(systime_t time) {
+#define port_timer_set_alarm(time) { \
+ chDbgAssert(stIsAlarmActive() != false, "not active"); \
+ stSetAlarm(time); \
+}
- chDbgAssert(stIsAlarmActive() != false, "not active");
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
- stSetAlarm(time);
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Returns the system time.
+ *
+ * @return The system time.
+ *
+ * @notapi
+ */
+static inline systime_t port_timer_get_time(void) {
+
+ return stGetCounter();
}
/**
@@ -131,8 +125,6 @@ static inline void port_timer_set_alarm(systime_t time) { */
static inline systime_t port_timer_get_alarm(void) {
- chDbgAssert(stIsAlarmActive() != false, "not active");
-
return stGetAlarm();
}
diff --git a/os/rt/ports/ARMCMx/chcore_v6m.h b/os/rt/ports/ARMCMx/chcore_v6m.h index f1af44fdc..f72216f95 100644 --- a/os/rt/ports/ARMCMx/chcore_v6m.h +++ b/os/rt/ports/ARMCMx/chcore_v6m.h @@ -206,9 +206,9 @@ struct context { tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \
wsize - \
sizeof(struct port_intctx)); \
- tp->p_ctx.r13->r4 = (void *)(pf); \
- tp->p_ctx.r13->r5 = (void *)(arg); \
- tp->p_ctx.r13->lr = (void *)(_port_thread_start); \
+ tp->p_ctx.r13->r4 = (regarm_t)(pf); \
+ tp->p_ctx.r13->r5 = (regarm_t)(arg); \
+ tp->p_ctx.r13->lr = (regarm_t)(_port_thread_start); \
}
/**
diff --git a/os/rt/ports/ARMCMx/chcore_v7m.h b/os/rt/ports/ARMCMx/chcore_v7m.h index c2c47024f..d768afaef 100644 --- a/os/rt/ports/ARMCMx/chcore_v7m.h +++ b/os/rt/ports/ARMCMx/chcore_v7m.h @@ -305,9 +305,9 @@ struct context { tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \
wsize - \
sizeof(struct port_intctx)); \
- tp->p_ctx.r13->r4 = (void *)(pf); \
- tp->p_ctx.r13->r5 = (void *)(arg); \
- tp->p_ctx.r13->lr = (void *)(_port_thread_start); \
+ tp->p_ctx.r13->r4 = (regarm_t)(pf); \
+ tp->p_ctx.r13->r5 = (regarm_t)(arg); \
+ tp->p_ctx.r13->lr = (regarm_t)(_port_thread_start); \
}
/**
diff --git a/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h b/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h index 26a1e5c81..bc33d2e10 100644 --- a/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h +++ b/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h @@ -33,7 +33,24 @@ #include <stdint.h>
#include <stdbool.h>
-typedef bool bool_t; /**< Fast boolean type. */
+/**
+ * @name Common constants
+ */
+/**
+ * @brief Generic 'false' boolean constant.
+ */
+#if !defined(FALSE) || defined(__DOXYGEN__)
+#define FALSE 0
+#endif
+
+/**
+ * @brief Generic 'true' boolean constant.
+ */
+#if !defined(TRUE) || defined(__DOXYGEN__)
+#define TRUE (!FALSE)
+#endif
+/** @} */
+
typedef uint32_t systime_t; /**< System time. */
typedef uint32_t rtcnt_t; /**< Realtime counter. */
typedef uint64_t rttime_t; /**< Time accumulator. */
|