diff options
| author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-09-03 09:51:32 +0000 |
|---|---|---|
| committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-09-03 09:51:32 +0000 |
| commit | 3368f57424db121a96207e9ee6f5e9f746d34ca6 (patch) | |
| tree | dc023278c59177909c23ca1cc168d57097efbaba /os/rt/include | |
| parent | 9d0c6fb8bf7bf63c137d7c19fdefc7760d2f133a (diff) | |
| download | ChibiOS-3368f57424db121a96207e9ee6f5e9f746d34ca6.tar.gz ChibiOS-3368f57424db121a96207e9ee6f5e9f746d34ca6.tar.bz2 ChibiOS-3368f57424db121a96207e9ee6f5e9f746d34ca6.zip | |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6251 35acf78f-673a-0410-8e92-d51de3d6d3f4
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
/*===========================================================================*/
|
