2 * Copyright (c) 2015-2016 ARM Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * ----------------------------------------------------------------------------
20 * $Date: 21. September 2016
23 * Project: TrustZone for ARMv8-M
24 * Title: Context Management for ARMv8-M TrustZone
28 *---------------------------------------------------------------------------*/
30 #if defined ( __ICCARM__ )
31 #pragma system_include /* treat file as system include file for MISRA check */
32 #elif defined (__clang__)
33 #pragma clang system_header /* treat file as system include file */
43 /// \details Data type that identifies secure software modules called by a process.
44 typedef uint32_t TZ_ModuleId_t;
47 /// \details TZ Memory ID identifies an allocated memory slot.
48 typedef uint32_t TZ_MemoryId_t;
50 /// Initialize secure context memory system
51 /// \return execution status (1: success, 0: error)
52 uint32_t TZ_InitContextSystem_S (void);
54 /// Allocate context memory for calling secure software modules in TrustZone
55 /// \param[in] module identifies software modules called from non-secure mode
56 /// \return value != 0 id TrustZone memory slot identifier
57 /// \return value 0 no memory available or internal error
58 TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
60 /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
61 /// \param[in] id TrustZone memory slot identifier
62 /// \return execution status (1: success, 0: error)
63 uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
65 /// Load secure context (called on RTOS thread context switch)
66 /// \param[in] id TrustZone memory slot identifier
67 /// \return execution status (1: success, 0: error)
68 uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
70 /// Store secure context (called on RTOS thread context switch)
71 /// \param[in] id TrustZone memory slot identifier
72 /// \return execution status (1: success, 0: error)
73 uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
75 #endif // TZ_CONTEXT_H