CMSIS-Core (Cortex-M)  Version 5.1.0
CMSIS-Core support for Cortex-M processor-based devices
 All Data Structures Files Functions Variables Enumerations Enumerator Groups Pages
RTOS Context Management

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

Functions

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

Description

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_MemoryId_t TZ_AllocModuleContext_S ( TZ_ModuleId_t  module)

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
uint32_t TZ_FreeModuleContext_S ( TZ_MemoryId_t  id)

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)
uint32_t TZ_InitContextSystem_S ( void  )

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)
uint32_t TZ_LoadContext_S ( TZ_MemoryId_t  id)

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)
uint32_t TZ_StoreContext_S ( TZ_MemoryId_t  id)

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)