SuperTinyKernel™ RTOS 1.06.x
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 const 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 () const
 Get available stack space.

Detailed Description

Interface for a stack memory region.

Definition at line 296 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 ( ) const
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 318 of file stk_common.h.

319 {
320 ArrayView<const Word> stack(GetStack(), GetStackSize());
321
322 // count leading Words equal to STK_STACK_MEMORY_FILLER (watermark)
323 size_t space = 0U;
324 for ( ; (space < stack.GetSize()) && (stack[space] == STK_STACK_MEMORY_FILLER); ++space)
325 {}
326
327 return space;
328 }
#define STK_STACK_MEMORY_FILLER
Sentinel value written to the entire stack region at initialization (stack watermark pattern).
Definition stk_defs.h:458
virtual size_t GetStackSize() const =0
Get number of elements of the stack memory array.
virtual const Word * GetStack() const =0
Get pointer to the stack memory.

References stk::ArrayView< T >::GetSize(), GetStack(), GetStackSize(), and STK_STACK_MEMORY_FILLER.

Referenced by FrtosTask::GetStackHighWaterMark(), and 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: