kernel: add macros to allow declaring extern stack arrays
A stack can already be declared extern via K_KERNEL_STACK_EXTERN(). This adds similar macros for stack arrays. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
a3413a30e3
commit
c6163e93cb
1 changed files with 45 additions and 0 deletions
|
@ -122,6 +122,36 @@ static inline char *z_stack_ptr_align(char *ptr)
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def K_KERNEL_STACK_ARRAY_EXTERN
|
||||||
|
* @brief Obtain an extern reference to a stack array
|
||||||
|
*
|
||||||
|
* This macro properly brings the symbol of a stack array declared
|
||||||
|
* elsewhere into scope.
|
||||||
|
*
|
||||||
|
* @param sym Thread stack symbol name
|
||||||
|
* @param nmemb Number of stacks to declare
|
||||||
|
* @param size Size of the stack memory region
|
||||||
|
*/
|
||||||
|
#define K_KERNEL_STACK_ARRAY_EXTERN(sym, nmemb, size) \
|
||||||
|
extern struct z_thread_stack_element \
|
||||||
|
sym[nmemb][Z_KERNEL_STACK_LEN(size)]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def K_KERNEL_PINNED_STACK_ARRAY_EXTERN
|
||||||
|
* @brief Obtain an extern reference to a pinned stack array
|
||||||
|
*
|
||||||
|
* This macro properly brings the symbol of a pinned stack array
|
||||||
|
* declared elsewhere into scope.
|
||||||
|
*
|
||||||
|
* @param sym Thread stack symbol name
|
||||||
|
* @param nmemb Number of stacks to declare
|
||||||
|
* @param size Size of the stack memory region
|
||||||
|
*/
|
||||||
|
#define K_KERNEL_PINNED_STACK_ARRAY_EXTERN(sym, nmemb, size) \
|
||||||
|
extern struct z_thread_stack_element \
|
||||||
|
sym[nmemb][Z_KERNEL_STACK_LEN(size)]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def Z_KERNEL_STACK_DEFINE_IN
|
* @def Z_KERNEL_STACK_DEFINE_IN
|
||||||
* @brief Define a toplevel kernel stack memory region in specified section
|
* @brief Define a toplevel kernel stack memory region in specified section
|
||||||
|
@ -272,6 +302,7 @@ static inline char *Z_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
|
||||||
#define K_THREAD_STACK_MEMBER K_KERNEL_STACK_MEMBER
|
#define K_THREAD_STACK_MEMBER K_KERNEL_STACK_MEMBER
|
||||||
#define Z_THREAD_STACK_BUFFER Z_KERNEL_STACK_BUFFER
|
#define Z_THREAD_STACK_BUFFER Z_KERNEL_STACK_BUFFER
|
||||||
#define K_THREAD_STACK_EXTERN K_KERNEL_STACK_EXTERN
|
#define K_THREAD_STACK_EXTERN K_KERNEL_STACK_EXTERN
|
||||||
|
#define K_THREAD_STACK_ARRAY_EXTERN K_KERNEL_STACK_ARRAY_EXTERN
|
||||||
#else
|
#else
|
||||||
/**
|
/**
|
||||||
* @def K_THREAD_STACK_RESERVED
|
* @def K_THREAD_STACK_RESERVED
|
||||||
|
@ -371,6 +402,20 @@ static inline char *Z_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
|
||||||
*/
|
*/
|
||||||
#define K_THREAD_STACK_EXTERN(sym) extern k_thread_stack_t sym[]
|
#define K_THREAD_STACK_EXTERN(sym) extern k_thread_stack_t sym[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Obtain an extern reference to a thread stack array
|
||||||
|
*
|
||||||
|
* This macro properly brings the symbol of a stack array declared
|
||||||
|
* elsewhere into scope.
|
||||||
|
*
|
||||||
|
* @param sym Thread stack symbol name
|
||||||
|
* @param nmemb Number of stacks to declare
|
||||||
|
* @param size Size of the stack memory region
|
||||||
|
*/
|
||||||
|
#define K_THREAD_STACK_ARRAY_EXTERN(sym, nmemb, size) \
|
||||||
|
extern struct z_thread_stack_element \
|
||||||
|
sym[nmemb][K_THREAD_STACK_LEN(size)]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup thread_stack_api
|
* @addtogroup thread_stack_api
|
||||||
* @{
|
* @{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue