diff options
Diffstat (limited to 'os/rt/include')
-rw-r--r-- | os/rt/include/chsys.h | 6 | ||||
-rw-r--r-- | os/rt/include/chthreads.h | 40 | ||||
-rw-r--r-- | os/rt/include/chtm.h | 4 |
3 files changed, 45 insertions, 5 deletions
diff --git a/os/rt/include/chsys.h b/os/rt/include/chsys.h index eb1f859dd..6255b7d5a 100644 --- a/os/rt/include/chsys.h +++ b/os/rt/include/chsys.h @@ -179,14 +179,14 @@ /**
* @brief Returns the current value of the system real time counter.
* @note This function is only available if the port layer supports the
- * option @p CH_PORT_SUPPORTS_RT.
+ * option @p PORT_SUPPORTS_RT.
*
* @return The value of the system realtime counter of
* type rtcnt_t.
*
* @xclass
*/
-#if CH_PORT_SUPPORTS_RT || defined(__DOXYGEN__)
+#if PORT_SUPPORTS_RT || defined(__DOXYGEN__)
#define chSysGetRealtimeCounterX() (rtcnt_t)port_rt_get_counter_value()
#endif
@@ -220,7 +220,7 @@ extern "C" { void chSysTimerHandlerI(void);
syssts_t chSysGetStatusAndLockX(void);
void chSysRestoreStatusX(syssts_t sts);
-#if CH_PORT_SUPPORTS_RT
+#if PORT_SUPPORTS_RT
bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end);
void chSysPolledDelayX(rtcnt_t cycles);
#endif
diff --git a/os/rt/include/chthreads.h b/os/rt/include/chthreads.h index d53a0cb47..6da6b6518 100644 --- a/os/rt/include/chthreads.h +++ b/os/rt/include/chthreads.h @@ -108,6 +108,46 @@ typedef msg_t (*tfunc_t)(void *); /*===========================================================================*/
/**
+ * @name Working Areas and Alignment
+ */
+/**
+ * @brief Enforces a correct alignment for a stack area size value.
+ *
+ * @param[in] n the stack size to be aligned to the next stack
+ * alignment boundary
+ * @return The aligned stack size.
+ *
+ * @api
+ */
+#define THD_ALIGN_STACK_SIZE(n) \
+ ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1)
+
+/**
+ * @brief Calculates the total Working Area size.
+ *
+ * @param[in] n the stack size to be assigned to the thread
+ * @return The total used memory in bytes.
+ *
+ * @api
+ */
+#define THD_WORKING_AREA_SIZE(n) \
+ THD_ALIGN_STACK_SIZE(sizeof(thread_t) + PORT_WA_SIZE(n))
+
+/**
+ * @brief Static working area allocation.
+ * @details This macro is used to allocate a static thread working area
+ * aligned as both position and size.
+ *
+ * @param[in] s the name to be assigned to the stack array
+ * @param[in] n the stack size to be assigned to the thread
+ *
+ * @api
+ */
+#define THD_WORKING_AREA(s, n) \
+ stkalign_t s[THD_WORKING_AREA_SIZE(n) / sizeof(stkalign_t)]
+/** @} */
+
+/**
* @name Macro Functions
* @{
*/
diff --git a/os/rt/include/chtm.h b/os/rt/include/chtm.h index 93e24d48c..f85b68ca8 100644 --- a/os/rt/include/chtm.h +++ b/os/rt/include/chtm.h @@ -43,8 +43,8 @@ /* Derived constants and error checks. */
/*===========================================================================*/
-#if !CH_PORT_SUPPORTS_RT
-#error "CH_CFG_USE_TM requires CH_PORT_SUPPORTS_RT"
+#if !PORT_SUPPORTS_RT
+#error "CH_CFG_USE_TM requires PORT_SUPPORTS_RT"
#endif
/*===========================================================================*/
|