forked

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers tz_context.h Source File

tz_context.h

00001 /*
00002  * Copyright (c) 2015-2016 ARM Limited. All rights reserved.
00003  *
00004  * SPDX-License-Identifier: Apache-2.0
00005  *
00006  * Licensed under the Apache License, Version 2.0 (the License); you may
00007  * not use this file except in compliance with the License.
00008  * You may obtain a copy of the License at
00009  *
00010  * www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00014  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  * See the License for the specific language governing permissions and
00016  * limitations under the License.
00017  *
00018  * ----------------------------------------------------------------------------
00019  *
00020  * $Date:        21. September 2016
00021  * $Revision:    V1.0
00022  *
00023  * Project:      TrustZone for ARMv8-M
00024  * Title:        Context Management for ARMv8-M TrustZone
00025  *
00026  * Version 1.0
00027  *    Initial Release
00028  *---------------------------------------------------------------------------*/
00029   
00030 #ifndef TZ_CONTEXT_H
00031 #define TZ_CONTEXT_H
00032  
00033 #include <stdint.h>
00034  
00035 #ifndef TZ_MODULEID_T
00036 #define TZ_MODULEID_T
00037 /// \details Data type that identifies secure software modules called by a process.
00038 typedef uint32_t TZ_ModuleId_t;
00039 #endif
00040  
00041 /// \details TZ Memory ID identifies an allocated memory slot.
00042 typedef uint32_t TZ_MemoryId_t;
00043   
00044 /// Initialize secure context memory system
00045 /// \return execution status (1: success, 0: error)
00046 uint32_t TZ_InitContextSystem_S (void);
00047  
00048 /// Allocate context memory for calling secure software modules in TrustZone
00049 /// \param[in]  module   identifies software modules called from non-secure mode
00050 /// \return value != 0 id TrustZone memory slot identifier
00051 /// \return value 0    no memory available or internal error
00052 TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
00053  
00054 /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
00055 /// \param[in]  id  TrustZone memory slot identifier
00056 /// \return execution status (1: success, 0: error)
00057 uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
00058  
00059 /// Load secure context (called on RTOS thread context switch)
00060 /// \param[in]  id  TrustZone memory slot identifier
00061 /// \return execution status (1: success, 0: error)
00062 uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
00063  
00064 /// Store secure context (called on RTOS thread context switch)
00065 /// \param[in]  id  TrustZone memory slot identifier
00066 /// \return execution status (1: success, 0: error)
00067 uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
00068  
00069 #endif  // TZ_CONTEXT_H