CMSIS-Core (Cortex-M)  
CMSIS-Core support for Cortex-M processor-based devices
 
Loading...
Searching...
No Matches
RTOS Context Management

RTOS Thread Context Management for Armv8-M TrustZone. More...

Functions

uint32_t TZ_InitContextSystem_S (void)
 Initialize secure context memory system.
 
TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module)
 Allocate context memory for calling secure software modules in TrustZone.
 
uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id)
 Free context memory that was previously allocated with TZ_AllocModuleContext_S.
 
uint32_t TZ_LoadContext_S (TZ_MemoryId_t id)
 Load secure context (called on RTOS thread context switch)
 
uint32_t TZ_StoreContext_S (TZ_MemoryId_t id)
 Store secure context (called on RTOS thread context switch)
 

Description

RTOS Thread Context Management for Armv8-M TrustZone.

The CMSIS-Core provides the file tz_context.h which defines an API to standardize the context memory system for real-time operating systems. For more information refer to RTOS Thread Context Management.

Function Documentation

◆ TZ_AllocModuleContext_S()

TZ_MemoryId_t TZ_AllocModuleContext_S ( TZ_ModuleId_t  module)

Allocate context memory for calling secure software modules in TrustZone.

Allocates the secure memory regions for thread execution. The parameter module describes the set of secure functions that are called by the non-secure thread. Set module to zero if no secure calls are used/allowed. This leads to no secure memory to be assigned which results in zero being returned as memory id as well. This function should be called by an RTOS kernel at the start of a thread.

Parameters
[in]moduleA non-zero value identifies software modules called from non-secure mode. zero is used if no secure calls are used/allowed.
Returns
value != 0 id TrustZone memory slot identify
value 0 no memory available or internal error

◆ TZ_FreeModuleContext_S()

uint32_t TZ_FreeModuleContext_S ( TZ_MemoryId_t  id)

Free context memory that was previously allocated with TZ_AllocModuleContext_S.

De-allocates the secure memory regions. The parameter id refers to a TrustZone memory slot that has been obtained with TZ_AllocModuleContext_S. This function should be called by an RTOS kernel at the termination of a thread.

Parameters
[in]idTrustZone memory slot identifier
Returns
execution status (1: success, 0: error)

◆ TZ_InitContextSystem_S()

uint32_t TZ_InitContextSystem_S ( void  )

Initialize secure context memory system.

Initializes the memory allocation management for the secure memory regions. As a minimum the secure thread mode stack will be provided.

Returns
execution status (1: success, 0: error)

◆ TZ_LoadContext_S()

uint32_t TZ_LoadContext_S ( TZ_MemoryId_t  id)

Load secure context (called on RTOS thread context switch)

Prepare the secure context for execution so that a thread in the non-secure state can call secure library modules. The parameter id refers to a TrustZone memory slot that has been obtained with TZ_AllocModuleContext_S which might be zero if not used. This function should be called by an RTOS kernel at thread context switch before running a thread.

Parameters
[in]idTrustZone memory slot identifier
Returns
execution status (1: success, 0: error)

◆ TZ_StoreContext_S()

uint32_t TZ_StoreContext_S ( TZ_MemoryId_t  id)

Store secure context (called on RTOS thread context switch)

Free the secure context that has been previously loaded with TZ_LoadContext_S. The parameter id refers to a TrustZone memory slot that has been obtained with TZ_AllocModuleContext_S which might be zero if not used. This function should be called by an RTOS kernel at thread context switch after running a thread.

Parameters
[in]idTrustZone memory slot identifier
Returns
execution status (1: success, 0: error)