Moved thread macros in chthreads.h.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9200 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
ba153ec697
commit
9fd8d44b06
|
@ -106,59 +106,6 @@
|
||||||
flag. */
|
flag. */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Working Areas
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @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) \
|
|
||||||
MEM_ALIGN_NEXT(sizeof(thread_t) + PORT_WA_SIZE(n), PORT_STACK_ALIGN)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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) PORT_WORKING_AREA(s, n)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Base of a working area casted to the correct type.
|
|
||||||
*
|
|
||||||
* @param[in] s name of the working area
|
|
||||||
*/
|
|
||||||
#define THD_WORKING_AREA_BASE(s) ((stkalign_t *)(s))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief End of a working area casted to the correct type.
|
|
||||||
*
|
|
||||||
* @param[in] s name of the working area
|
|
||||||
*/
|
|
||||||
#define THD_WORKING_AREA_END(s) (THD_WORKING_AREA_BASE(s) + \
|
|
||||||
(sizeof (s) / sizeof (stkalign_t)))
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Threads abstraction macros
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @brief Thread declaration macro.
|
|
||||||
* @note Thread declarations should be performed using this macro because
|
|
||||||
* the port layer could define optimizations for thread functions.
|
|
||||||
*/
|
|
||||||
#define THD_FUNCTION(tname, arg) PORT_THD_FUNCTION(tname, arg)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Module pre-compile time settings. */
|
/* Module pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
|
@ -120,6 +120,59 @@ typedef struct {
|
||||||
threads_queue_t name = _THREADS_QUEUE_DATA(name)
|
threads_queue_t name = _THREADS_QUEUE_DATA(name)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Working Areas
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @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) \
|
||||||
|
MEM_ALIGN_NEXT(sizeof(thread_t) + PORT_WA_SIZE(n), PORT_STACK_ALIGN)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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) PORT_WORKING_AREA(s, n)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Base of a working area casted to the correct type.
|
||||||
|
*
|
||||||
|
* @param[in] s name of the working area
|
||||||
|
*/
|
||||||
|
#define THD_WORKING_AREA_BASE(s) ((stkalign_t *)(s))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief End of a working area casted to the correct type.
|
||||||
|
*
|
||||||
|
* @param[in] s name of the working area
|
||||||
|
*/
|
||||||
|
#define THD_WORKING_AREA_END(s) (THD_WORKING_AREA_BASE(s) + \
|
||||||
|
(sizeof (s) / sizeof (stkalign_t)))
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Threads abstraction macros
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief Thread declaration macro.
|
||||||
|
* @note Thread declarations should be performed using this macro because
|
||||||
|
* the port layer could define optimizations for thread functions.
|
||||||
|
*/
|
||||||
|
#define THD_FUNCTION(tname, arg) PORT_THD_FUNCTION(tname, arg)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Macro Functions
|
* @name Macro Functions
|
||||||
* @{
|
* @{
|
||||||
|
|
Loading…
Reference in New Issue