Thread stack. More...
#include <cmsis-plus/rtos/os.h>
Public Types | |
using | allocation_element_t = os::rtos::port::stack::allocation_element_t |
Type of a stack allocation element. | |
using | element_t = os::rtos::port::stack::element_t |
Type of a stack element. | |
Public Member Functions | |
Constructors & Destructor | |
stack () | |
Construct a thread stack object instance. | |
~stack ()=default | |
Destruct the stack object instance. | |
Public Member Functions | |
void | clear (void) |
Clear the stack pointer and size. | |
void | set (stack::element_t *address, std::size_t size_bytes) |
Set the stack address and size. | |
void | initialize (void) |
Align the pointers and initialise to a known pattern. | |
stack::element_t * | bottom (void) |
Get the stack lowest reserved address. | |
stack::element_t * | top (void) |
Get the top stack address. | |
std::size_t | size (void) |
Get the stack size. | |
bool | check_bottom_magic (void) |
Check if bottom magic word is still there. | |
bool | check_top_magic (void) |
Check if top magic word is still there. | |
std::size_t | available (void) |
Compute how much available stack remains. | |
Static Public Member Functions | |
Public Static Member Functions | |
static std::size_t | min_size (void) |
Get the min stack size. | |
static std::size_t | min_size (std::size_t size_bytes) |
Set the min stack size. | |
static std::size_t | default_size (void) |
Get the default stack size. | |
static std::size_t | default_size (std::size_t size_bytes) |
Set the default stack size. | |
Static Public Attributes | |
static const element_t | magic = os::rtos::port::stack::magic |
Thread stack.
This class does not contain the stack space itself, it is allocated outside, but stores the address and the size of the stack.
It also manages the global variables storing the min and default stack sizes.
Definition at line 426 of file os-thread.h.
using os::rtos::thread::stack::allocation_element_t = os::rtos::port::stack::allocation_element_t |
Type of a stack allocation element.
For alignment reasons, the stack is allocated in larger chunks, usually 8-bytes long on Cortex-M cores.
Definition at line 444 of file os-thread.h.
using os::rtos::thread::stack::element_t = os::rtos::port::stack::element_t |
Type of a stack element.
The stack is organised as an array of platform words (usually 4-bytes long on Cortex-M cores).
Definition at line 436 of file os-thread.h.
|
inline |
Construct a thread stack object instance.
Definition at line 2114 of file os-thread.h.
|
default |
Destruct the stack object instance.
std::size_t os::rtos::thread::stack::available | ( | void | ) |
Compute how much available stack remains.
Count the number of bytes where the magic is still there.
Definition at line 202 of file os-thread.cpp.
|
inline |
Get the stack lowest reserved address.
Definition at line 2144 of file os-thread.h.
|
inline |
Check if bottom magic word is still there.
true | The magic word is still there. |
false | The magic word was overwritten. |
Definition at line 2171 of file os-thread.h.
|
inline |
Check if top magic word is still there.
true | The magic word is still there. |
false | The magic word was overwritten. |
Definition at line 2180 of file os-thread.h.
|
inline |
Clear the stack pointer and size.
Definition at line 2123 of file os-thread.h.
|
inlinestatic |
Set the default stack size.
[in] | size_bytes | Default stack size in bytes. |
Definition at line 2218 of file os-thread.h.
|
inlinestatic |
Get the default stack size.
Definition at line 2209 of file os-thread.h.
void os::rtos::thread::stack::initialize | ( | void | ) |
Align the pointers and initialise to a known pattern.
|
inlinestatic |
Set the min stack size.
[in] | size_bytes | Minimum stack size in bytes. |
Definition at line 2198 of file os-thread.h.
|
inlinestatic |
Get the min stack size.
Definition at line 2189 of file os-thread.h.
|
inline |
Set the stack address and size.
[in] | address | Bottom stack address. |
[in] | size_bytes | Reserved stack size, in bytes. |
Definition at line 2133 of file os-thread.h.
|
inline |
Get the stack size.
Definition at line 2162 of file os-thread.h.
|
inline |
Get the top stack address.
Definition at line 2153 of file os-thread.h.
|
static |
Definition at line 446 of file os-thread.h.