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

Concrete implementation of IPlatform driver for the Arm Cortex-M0, M3, M4, M7 processors. More...

#include <stk_arch_arm-cortex-m.h>

Inheritance diagram for stk::PlatformArmCortexM:
Collaboration diagram for stk::PlatformArmCortexM:

Public Member Functions

 ~PlatformArmCortexM ()
 Destructor.
void Initialize (IEventHandler *event_handler, IKernelService *service, uint32_t resolution_us, Stack *exit_trap)
 Initialize scheduler's context.
void Start ()
 Start scheduling.
void Stop ()
 Stop scheduling.
bool InitStack (EStackType stack_type, Stack *stack, IStackMemory *stack_memory, ITask *user_task)
 Initialize stack memory of the user task.
uint32_t GetTickResolution () const
 Get resolution of the system tick timer in microseconds. Resolution means a number of microseconds between system tick timer ISRs.
void SwitchToNext ()
 Switch to a next task.
void Sleep (Timeout ticks)
 Put calling process into a sleep state.
void SleepUntil (Ticks timestamp)
 Put calling process into a sleep state until the specified timestamp.
IWaitObjectWait (ISyncObject *sync_obj, IMutex *mutex, Timeout timeout)
void ProcessTick ()
 Process one tick.
void ProcessHardFault ()
 Cause a hard fault of the system.
void SetEventOverrider (IEventOverrider *overrider)
 Set platform event overrider.
Word GetCallerSP () const
 Get caller's Stack Pointer (SP).
TId GetTid () const
 Get thread Id.

Detailed Description

Concrete implementation of IPlatform driver for the Arm Cortex-M0, M3, M4, M7 processors.

Definition at line 24 of file stk_arch_arm-cortex-m.h.

Constructor & Destructor Documentation

◆ ~PlatformArmCortexM()

stk::PlatformArmCortexM::~PlatformArmCortexM ( )
inline

Destructor.

Note
MISRA deviation: [STK-DEV-005] Rule 10-3-2.

Definition at line 30 of file stk_arch_arm-cortex-m.h.

31 {}

Member Function Documentation

◆ GetCallerSP()

Word stk::PlatformArmCortexM::GetCallerSP ( ) const
virtual

Get caller's Stack Pointer (SP).

Note
Valid for a Thread process only.
Returns
Current value of the Stack Pointer (SP) of the calling process.

Implements stk::IPlatform.

◆ GetTickResolution()

uint32_t stk::PlatformArmCortexM::GetTickResolution ( ) const
virtual

Get resolution of the system tick timer in microseconds. Resolution means a number of microseconds between system tick timer ISRs.

Returns
Microseconds.

Implements stk::IPlatform.

◆ GetTid()

TId stk::PlatformArmCortexM::GetTid ( ) const
virtual

Get thread Id.

Returns
Thread Id.

Implements stk::IPlatform.

◆ Initialize()

void stk::PlatformArmCortexM::Initialize ( IEventHandler * event_handler,
IKernelService * service,
uint32_t resolution_us,
Stack * exit_trap )
virtual

Initialize scheduler's context.

Parameters
[in]event_handlerEvent handler.
[in]serviceKernel service.
[in]resolution_usTick resolution in microseconds (for example 1000 equals to 1 millisecond resolution).
[in]exit_trapStack of the Exit trap (optional, provided if kernel is operating in KERNEL_DYNAMIC mode).
Note
Must be called once before Start().

Implements stk::IPlatform.

◆ InitStack()

bool stk::PlatformArmCortexM::InitStack ( EStackType stack_type,
Stack * stack,
IStackMemory * stack_memory,
ITask * user_task )
virtual

Initialize stack memory of the user task.

Parameters
[in]stack_typeStack type.
[in]stackStack descriptor.
[in]stack_memoryStack memory.
[in]user_taskUser task to which Stack belongs.
Returns
true on success, false if the stack memory is too small, misaligned, or the stack type is unsupported.

Implements stk::IPlatform.

◆ ProcessHardFault()

void stk::PlatformArmCortexM::ProcessHardFault ( )
virtual

Cause a hard fault of the system.

Note
Normally called by the Kernel when one of the scheduled tasks missed its deadline (see stk::KERNEL_HRT).

Implements stk::IPlatform.

◆ ProcessTick()

void stk::PlatformArmCortexM::ProcessTick ( )
virtual

Process one tick.

Note
Normally system tick is processed by the platform driver implementation. In case system tick handler is used by the application and should not be implemented by the driver then disable driver's handler in stk_config.h like this:
#define STK_SYSTICK_HANDLER _STK_SYSTICK_HANDLER_DISABLE
and then call ProcessTick() from your custom tick handler.

Implements stk::IPlatform.

◆ SetEventOverrider()

void stk::PlatformArmCortexM::SetEventOverrider ( IEventOverrider * overrider)
virtual

Set platform event overrider.

Note
Must be set prior call to IKernel::Start.
Parameters
[in]overriderPlatform event overrider.

Implements stk::IPlatform.

◆ Sleep()

void stk::PlatformArmCortexM::Sleep ( Timeout ticks)
virtual

Put calling process into a sleep state.

Note
Unlike Delay this function does not waste CPU cycles and allows kernel to put CPU into a low-power state.
Parameters
[in]ticksTime to sleep (ticks).

Implements stk::IPlatform.

◆ SleepUntil()

void stk::PlatformArmCortexM::SleepUntil ( Ticks timestamp)
virtual

Put calling process into a sleep state until the specified timestamp.

Note
Unlike Delay this function does not waste CPU cycles and allows kernel to put CPU into a low-power state.
Unsupported in HRT mode (see stk::KERNEL_HRT); in HRT mode tasks sleep automatically according to their periodicity and workload.
Parameters
[in]timestampAbsolute timestamp (ticks).
Warning
ISR-unsafe. Calling from an ISR context is not permitted and will trigger an assertion.

Implements stk::IPlatform.

◆ Start()

void stk::PlatformArmCortexM::Start ( )
virtual

Start scheduling.

Note
This function never returns if kernel is initialized as KERNEL_STATIC. Must be called after Initialize().

Implements stk::IPlatform.

◆ Stop()

void stk::PlatformArmCortexM::Stop ( )
virtual

Stop scheduling.

Implements stk::IPlatform.

◆ SwitchToNext()

void stk::PlatformArmCortexM::SwitchToNext ( )
virtual

Switch to a next task.

Implements stk::IPlatform.

◆ Wait()

IWaitObject * stk::PlatformArmCortexM::Wait ( ISyncObject * sync_obj,
IMutex * mutex,
Timeout timeout )

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