mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
186:707f6e361f3e
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anna Bridge 186:707f6e361f3e 1 /******************************************************************************
Anna Bridge 186:707f6e361f3e 2 * @file tz_context.h
Anna Bridge 186:707f6e361f3e 3 * @brief Context Management for Armv8-M TrustZone
Anna Bridge 186:707f6e361f3e 4 * @version V1.0.1
Anna Bridge 186:707f6e361f3e 5 * @date 10. January 2018
Anna Bridge 186:707f6e361f3e 6 ******************************************************************************/
AnnaBridge 167:e84263d55307 7 /*
Anna Bridge 186:707f6e361f3e 8 * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
AnnaBridge 167:e84263d55307 9 *
AnnaBridge 167:e84263d55307 10 * SPDX-License-Identifier: Apache-2.0
AnnaBridge 167:e84263d55307 11 *
AnnaBridge 167:e84263d55307 12 * Licensed under the Apache License, Version 2.0 (the License); you may
AnnaBridge 167:e84263d55307 13 * not use this file except in compliance with the License.
AnnaBridge 167:e84263d55307 14 * You may obtain a copy of the License at
AnnaBridge 167:e84263d55307 15 *
AnnaBridge 167:e84263d55307 16 * www.apache.org/licenses/LICENSE-2.0
AnnaBridge 167:e84263d55307 17 *
AnnaBridge 167:e84263d55307 18 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 167:e84263d55307 19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
AnnaBridge 167:e84263d55307 20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 167:e84263d55307 21 * See the License for the specific language governing permissions and
AnnaBridge 167:e84263d55307 22 * limitations under the License.
Anna Bridge 186:707f6e361f3e 23 */
Anna Bridge 186:707f6e361f3e 24
Anna Bridge 186:707f6e361f3e 25 #if defined ( __ICCARM__ )
Anna Bridge 186:707f6e361f3e 26 #pragma system_include /* treat file as system include file for MISRA check */
Anna Bridge 186:707f6e361f3e 27 #elif defined (__clang__)
Anna Bridge 186:707f6e361f3e 28 #pragma clang system_header /* treat file as system include file */
Anna Bridge 186:707f6e361f3e 29 #endif
Anna Bridge 186:707f6e361f3e 30
AnnaBridge 167:e84263d55307 31 #ifndef TZ_CONTEXT_H
AnnaBridge 167:e84263d55307 32 #define TZ_CONTEXT_H
AnnaBridge 167:e84263d55307 33
AnnaBridge 167:e84263d55307 34 #include <stdint.h>
AnnaBridge 167:e84263d55307 35
AnnaBridge 167:e84263d55307 36 #ifndef TZ_MODULEID_T
AnnaBridge 167:e84263d55307 37 #define TZ_MODULEID_T
AnnaBridge 167:e84263d55307 38 /// \details Data type that identifies secure software modules called by a process.
AnnaBridge 167:e84263d55307 39 typedef uint32_t TZ_ModuleId_t;
AnnaBridge 167:e84263d55307 40 #endif
AnnaBridge 167:e84263d55307 41
AnnaBridge 167:e84263d55307 42 /// \details TZ Memory ID identifies an allocated memory slot.
AnnaBridge 167:e84263d55307 43 typedef uint32_t TZ_MemoryId_t;
AnnaBridge 167:e84263d55307 44
AnnaBridge 167:e84263d55307 45 /// Initialize secure context memory system
AnnaBridge 167:e84263d55307 46 /// \return execution status (1: success, 0: error)
AnnaBridge 167:e84263d55307 47 uint32_t TZ_InitContextSystem_S (void);
AnnaBridge 167:e84263d55307 48
AnnaBridge 167:e84263d55307 49 /// Allocate context memory for calling secure software modules in TrustZone
AnnaBridge 167:e84263d55307 50 /// \param[in] module identifies software modules called from non-secure mode
AnnaBridge 167:e84263d55307 51 /// \return value != 0 id TrustZone memory slot identifier
AnnaBridge 167:e84263d55307 52 /// \return value 0 no memory available or internal error
AnnaBridge 167:e84263d55307 53 TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
AnnaBridge 167:e84263d55307 54
AnnaBridge 167:e84263d55307 55 /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
AnnaBridge 167:e84263d55307 56 /// \param[in] id TrustZone memory slot identifier
AnnaBridge 167:e84263d55307 57 /// \return execution status (1: success, 0: error)
AnnaBridge 167:e84263d55307 58 uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
AnnaBridge 167:e84263d55307 59
AnnaBridge 167:e84263d55307 60 /// Load secure context (called on RTOS thread context switch)
AnnaBridge 167:e84263d55307 61 /// \param[in] id TrustZone memory slot identifier
AnnaBridge 167:e84263d55307 62 /// \return execution status (1: success, 0: error)
AnnaBridge 167:e84263d55307 63 uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
AnnaBridge 167:e84263d55307 64
AnnaBridge 167:e84263d55307 65 /// Store secure context (called on RTOS thread context switch)
AnnaBridge 167:e84263d55307 66 /// \param[in] id TrustZone memory slot identifier
AnnaBridge 167:e84263d55307 67 /// \return execution status (1: success, 0: error)
AnnaBridge 167:e84263d55307 68 uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
AnnaBridge 167:e84263d55307 69
AnnaBridge 167:e84263d55307 70 #endif // TZ_CONTEXT_H