SuperTinyKernel™ RTOS 1.06.0
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk::IStackMemory Class Referenceabstract

Interface for a stack memory region. More...

#include <stk_common.h>

Inheritance diagram for stk::IStackMemory:

Public Member Functions

virtual WordGetStack () const =0
 Get pointer to the stack memory.
virtual size_t GetStackSize () const =0
 Get number of elements of the stack memory array.
virtual size_t GetStackSizeBytes () const =0
 Get size of the memory in bytes.
virtual size_t GetStackSpace ()
 Get available stack space.

Detailed Description

Interface for a stack memory region.

Definition at line 230 of file stk_common.h.

Member Function Documentation

◆ GetStack()

◆ GetStackSize()

virtual size_t stk::IStackMemory::GetStackSize ( ) const
pure virtual

◆ GetStackSizeBytes()

◆ GetStackSpace()

virtual size_t stk::IStackMemory::GetStackSpace ( )
inlinevirtual

Get available stack space.

Returns
Number of elements of the stack memory array remaining on the stack (computed via the watermark pattern). Returns 0 if the stack has been fully used or the watermark STK_STACK_MEMORY_FILLER was overwritten.
Warning
Stack type: Bottom to Top (index[0]).

Definition at line 252 of file stk_common.h.

253 {
254 const Word *stack = GetStack();
255 const size_t stack_size = GetStackSize();
256
257 // count leading Words equal to STK_STACK_MEMORY_FILLER (watermark)
258 size_t space = 0U;
259 for ( ; (space < stack_size) && (stack[space] == STK_STACK_MEMORY_FILLER); ++space)
260 {}
261
262 return space;
263 }
#define STK_STACK_MEMORY_FILLER
Sentinel value written to the entire stack region at initialization (stack watermark pattern).
Definition stk_defs.h:377
uintptr_t Word
Native processor word type.
Definition stk_common.h:113
virtual size_t GetStackSize() const =0
Get number of elements of the stack memory array.
virtual Word * GetStack() const =0
Get pointer to the stack memory.

References GetStack(), GetStackSize(), and STK_STACK_MEMORY_FILLER.

Referenced by osThreadGetStackSpace().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: