001
cmsis/tz_context.h@0:13413ea9a877, 2022-06-12 (annotated)
- Committer:
- ganlikun
- Date:
- Sun Jun 12 14:02:44 2022 +0000
- Revision:
- 0:13413ea9a877
00
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ganlikun | 0:13413ea9a877 | 1 | /* |
ganlikun | 0:13413ea9a877 | 2 | * Copyright (c) 2015-2016 ARM Limited. All rights reserved. |
ganlikun | 0:13413ea9a877 | 3 | * |
ganlikun | 0:13413ea9a877 | 4 | * SPDX-License-Identifier: Apache-2.0 |
ganlikun | 0:13413ea9a877 | 5 | * |
ganlikun | 0:13413ea9a877 | 6 | * Licensed under the Apache License, Version 2.0 (the License); you may |
ganlikun | 0:13413ea9a877 | 7 | * not use this file except in compliance with the License. |
ganlikun | 0:13413ea9a877 | 8 | * You may obtain a copy of the License at |
ganlikun | 0:13413ea9a877 | 9 | * |
ganlikun | 0:13413ea9a877 | 10 | * www.apache.org/licenses/LICENSE-2.0 |
ganlikun | 0:13413ea9a877 | 11 | * |
ganlikun | 0:13413ea9a877 | 12 | * Unless required by applicable law or agreed to in writing, software |
ganlikun | 0:13413ea9a877 | 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
ganlikun | 0:13413ea9a877 | 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ganlikun | 0:13413ea9a877 | 15 | * See the License for the specific language governing permissions and |
ganlikun | 0:13413ea9a877 | 16 | * limitations under the License. |
ganlikun | 0:13413ea9a877 | 17 | * |
ganlikun | 0:13413ea9a877 | 18 | * ---------------------------------------------------------------------------- |
ganlikun | 0:13413ea9a877 | 19 | * |
ganlikun | 0:13413ea9a877 | 20 | * $Date: 21. September 2016 |
ganlikun | 0:13413ea9a877 | 21 | * $Revision: V1.0 |
ganlikun | 0:13413ea9a877 | 22 | * |
ganlikun | 0:13413ea9a877 | 23 | * Project: TrustZone for ARMv8-M |
ganlikun | 0:13413ea9a877 | 24 | * Title: Context Management for ARMv8-M TrustZone |
ganlikun | 0:13413ea9a877 | 25 | * |
ganlikun | 0:13413ea9a877 | 26 | * Version 1.0 |
ganlikun | 0:13413ea9a877 | 27 | * Initial Release |
ganlikun | 0:13413ea9a877 | 28 | *---------------------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 29 | |
ganlikun | 0:13413ea9a877 | 30 | #ifndef TZ_CONTEXT_H |
ganlikun | 0:13413ea9a877 | 31 | #define TZ_CONTEXT_H |
ganlikun | 0:13413ea9a877 | 32 | |
ganlikun | 0:13413ea9a877 | 33 | #include <stdint.h> |
ganlikun | 0:13413ea9a877 | 34 | |
ganlikun | 0:13413ea9a877 | 35 | #ifndef TZ_MODULEID_T |
ganlikun | 0:13413ea9a877 | 36 | #define TZ_MODULEID_T |
ganlikun | 0:13413ea9a877 | 37 | /// \details Data type that identifies secure software modules called by a process. |
ganlikun | 0:13413ea9a877 | 38 | typedef uint32_t TZ_ModuleId_t; |
ganlikun | 0:13413ea9a877 | 39 | #endif |
ganlikun | 0:13413ea9a877 | 40 | |
ganlikun | 0:13413ea9a877 | 41 | /// \details TZ Memory ID identifies an allocated memory slot. |
ganlikun | 0:13413ea9a877 | 42 | typedef uint32_t TZ_MemoryId_t; |
ganlikun | 0:13413ea9a877 | 43 | |
ganlikun | 0:13413ea9a877 | 44 | /// Initialize secure context memory system |
ganlikun | 0:13413ea9a877 | 45 | /// \return execution status (1: success, 0: error) |
ganlikun | 0:13413ea9a877 | 46 | uint32_t TZ_InitContextSystem_S (void); |
ganlikun | 0:13413ea9a877 | 47 | |
ganlikun | 0:13413ea9a877 | 48 | /// Allocate context memory for calling secure software modules in TrustZone |
ganlikun | 0:13413ea9a877 | 49 | /// \param[in] module identifies software modules called from non-secure mode |
ganlikun | 0:13413ea9a877 | 50 | /// \return value != 0 id TrustZone memory slot identifier |
ganlikun | 0:13413ea9a877 | 51 | /// \return value 0 no memory available or internal error |
ganlikun | 0:13413ea9a877 | 52 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); |
ganlikun | 0:13413ea9a877 | 53 | |
ganlikun | 0:13413ea9a877 | 54 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S |
ganlikun | 0:13413ea9a877 | 55 | /// \param[in] id TrustZone memory slot identifier |
ganlikun | 0:13413ea9a877 | 56 | /// \return execution status (1: success, 0: error) |
ganlikun | 0:13413ea9a877 | 57 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); |
ganlikun | 0:13413ea9a877 | 58 | |
ganlikun | 0:13413ea9a877 | 59 | /// Load secure context (called on RTOS thread context switch) |
ganlikun | 0:13413ea9a877 | 60 | /// \param[in] id TrustZone memory slot identifier |
ganlikun | 0:13413ea9a877 | 61 | /// \return execution status (1: success, 0: error) |
ganlikun | 0:13413ea9a877 | 62 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); |
ganlikun | 0:13413ea9a877 | 63 | |
ganlikun | 0:13413ea9a877 | 64 | /// Store secure context (called on RTOS thread context switch) |
ganlikun | 0:13413ea9a877 | 65 | /// \param[in] id TrustZone memory slot identifier |
ganlikun | 0:13413ea9a877 | 66 | /// \return execution status (1: success, 0: error) |
ganlikun | 0:13413ea9a877 | 67 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); |
ganlikun | 0:13413ea9a877 | 68 | |
ganlikun | 0:13413ea9a877 | 69 | #endif // TZ_CONTEXT_H |
ganlikun | 0:13413ea9a877 | 70 |