Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
vmpu_exports.h
00001 /* 00002 * Copyright (c) 2013-2016, ARM Limited, All Rights Reserved 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00006 * not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #ifndef __UVISOR_API_VMPU_EXPORTS_H__ 00018 #define __UVISOR_API_VMPU_EXPORTS_H__ 00019 00020 #include "api/inc/uvisor_exports.h" 00021 #include <stdint.h> 00022 00023 /* The maximum box namespace length is 37 so that it is exactly big enough for 00024 * a human-readable hex string GUID (as formatted by RFC 4122) followed by a 00025 * terminating NULL. */ 00026 #define UVISOR_MAX_BOX_NAMESPACE_LENGTH 37 00027 00028 /* supervisor user access modes */ 00029 #define UVISOR_TACL_UEXECUTE 0x0001UL 00030 #define UVISOR_TACL_UWRITE 0x0002UL 00031 #define UVISOR_TACL_UREAD 0x0004UL 00032 #define UVISOR_TACL_UACL (UVISOR_TACL_UREAD |\ 00033 UVISOR_TACL_UWRITE |\ 00034 UVISOR_TACL_UEXECUTE) 00035 00036 /* supervisor access modes */ 00037 #define UVISOR_TACL_SEXECUTE 0x0008UL 00038 #define UVISOR_TACL_SWRITE 0x0010UL 00039 #define UVISOR_TACL_SREAD 0x0020UL 00040 #define UVISOR_TACL_SACL (UVISOR_TACL_SREAD |\ 00041 UVISOR_TACL_SWRITE |\ 00042 UVISOR_TACL_SEXECUTE) 00043 00044 #define UVISOR_TACL_EXECUTE (UVISOR_TACL_UEXECUTE |\ 00045 UVISOR_TACL_SEXECUTE) 00046 00047 /* all possible access control flags */ 00048 #define UVISOR_TACL_ACCESS (UVISOR_TACL_UACL |\ 00049 UVISOR_TACL_SACL) 00050 00051 /* various modes */ 00052 #define UVISOR_TACL_STACK 0x0040UL 00053 #define UVISOR_TACL_SIZE_ROUND_UP 0x0080UL 00054 #define UVISOR_TACL_SIZE_ROUND_DOWN 0x0100UL 00055 #define UVISOR_TACL_PERIPHERAL 0x0200UL 00056 #define UVISOR_TACL_SHARED 0x0400UL 00057 #define UVISOR_TACL_USER 0x0800UL 00058 #define UVISOR_TACL_IRQ 0x1000UL 00059 00060 #if defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 00061 00062 /* subregion mask for ARMv7M */ 00063 #if defined(ARCH_MPU_ARMv7M) 00064 #define UVISOR_TACL_SUBREGIONS_POS 24 00065 #define UVISOR_TACL_SUBREGIONS_MASK (0xFFUL << UVISOR_TACL_SUBREGIONS_POS) 00066 #define UVISOR_TACL_SUBREGIONS(x) ( (((uint32_t) (x)) << UVISOR_TACL_SUBREGIONS_POS) & UVISOR_TACL_SUBREGIONS_MASK ) 00067 #endif 00068 00069 #endif /* defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 */ 00070 00071 #define UVISOR_TACLDEF_SECURE_BSS (UVISOR_TACL_UREAD |\ 00072 UVISOR_TACL_UWRITE |\ 00073 UVISOR_TACL_SREAD |\ 00074 UVISOR_TACL_SWRITE |\ 00075 UVISOR_TACL_SIZE_ROUND_UP) 00076 00077 #define UVISOR_TACLDEF_SECURE_CONST (UVISOR_TACL_UREAD |\ 00078 UVISOR_TACL_SREAD |\ 00079 UVISOR_TACL_SIZE_ROUND_UP) 00080 00081 #define UVISOR_TACLDEF_DATA UVISOR_TACLDEF_SECURE_BSS 00082 00083 #define UVISOR_TACLDEF_PERIPH (UVISOR_TACL_PERIPHERAL |\ 00084 UVISOR_TACL_UREAD |\ 00085 UVISOR_TACL_UWRITE |\ 00086 UVISOR_TACL_SREAD |\ 00087 UVISOR_TACL_SWRITE |\ 00088 UVISOR_TACL_SIZE_ROUND_UP) 00089 00090 #define UVISOR_TACLDEF_STACK (UVISOR_TACL_STACK |\ 00091 UVISOR_TACL_UREAD |\ 00092 UVISOR_TACL_UWRITE |\ 00093 UVISOR_TACL_SREAD |\ 00094 UVISOR_TACL_SWRITE) 00095 00096 #define UVISOR_PAD32(x) (32 - (sizeof(x) & ~0x1FUL)) 00097 #define UVISOR_BOX_MAGIC 0x42CFB66FUL 00098 #define UVISOR_BOX_VERSION 100 00099 #define UVISOR_STACK_BAND_SIZE 128 00100 #define UVISOR_MEM_SIZE_ROUND(x) UVISOR_REGION_ROUND_UP(x) 00101 00102 #define UVISOR_MIN_STACK_SIZE 1024 00103 #define UVISOR_MIN_STACK(x) (((x) < UVISOR_MIN_STACK_SIZE) ? UVISOR_MIN_STACK_SIZE : (x)) 00104 00105 #if defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 00106 00107 /** Round an address down to the closest 32-byte boundary. 00108 * @param address[in] The address to round. 00109 */ 00110 #define UVISOR_ROUND32_DOWN(address) ((address) & ~0x1FUL) 00111 00112 /** Round an address up to the closest 32-byte boundary. 00113 * @param address[in] The address to round. 00114 */ 00115 #define UVISOR_ROUND32_UP(address) UVISOR_ROUND32_DOWN((address) + 31UL) 00116 00117 00118 #if defined(ARCH_MPU_ARMv7M) 00119 #define UVISOR_REGION_ROUND_DOWN(x) ((x) & ~((1UL << UVISOR_REGION_BITS(x)) - 1)) 00120 #define UVISOR_REGION_ROUND_UP(x) (1UL << UVISOR_REGION_BITS(x)) 00121 #define UVISOR_STACK_SIZE_ROUND(x) UVISOR_REGION_ROUND_UP(x) 00122 #elif defined(ARCH_MPU_KINETIS) 00123 #define UVISOR_REGION_ROUND_DOWN(x) UVISOR_ROUND32_DOWN(x) 00124 #define UVISOR_REGION_ROUND_UP(x) UVISOR_ROUND32_UP(x) 00125 #define UVISOR_STACK_SIZE_ROUND(x) UVISOR_REGION_ROUND_UP((x) + (UVISOR_STACK_BAND_SIZE * 2)) 00126 #else 00127 #error "Unknown MPU architecture. uvisor: Check your Makefile. uvisor-lib: Check if uVisor is supported" 00128 #endif 00129 00130 #else /* defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 */ 00131 00132 #define UVISOR_REGION_ROUND_DOWN(x) (x) 00133 #define UVISOR_REGION_ROUND_UP(x) (x) 00134 #define UVISOR_STACK_SIZE_ROUND(x) (x) 00135 00136 #endif 00137 00138 #ifndef UVISOR_BOX_STACK_SIZE 00139 #define UVISOR_BOX_STACK_SIZE UVISOR_MIN_STACK_SIZE 00140 #endif/*UVISOR_BOX_STACK*/ 00141 00142 /* NOPs added for write buffering synchronization (2 are for dsb. 16bits) */ 00143 #define UVISOR_NOP_CNT (2 + 3) 00144 #define UVISOR_NOP_GROUP \ 00145 "dsb\n" \ 00146 "nop\n" \ 00147 "nop\n" \ 00148 "nop\n" 00149 00150 typedef uint32_t UvisorBoxAcl; 00151 00152 typedef struct { 00153 void * param1; 00154 uint32_t param2; 00155 UvisorBoxAcl acl; 00156 } UVISOR_PACKED UvisorBoxAclItem; 00157 00158 typedef struct { 00159 uint32_t magic; 00160 uint32_t version; 00161 00162 /* Box stack size includes stack guards and rounding buffer. */ 00163 uint32_t stack_size; 00164 00165 /* Contains the size of the index (must be at least sizeof(UvisorBoxIndex)). */ 00166 uint32_t index_size; 00167 /* Contains user provided size of box context without guards of buffers. */ 00168 uint32_t context_size; 00169 /* Contains user provided size of box heap without guards of buffers. */ 00170 uint32_t heap_size; 00171 00172 /* Opaque-to-uVisor data that potentially contains uvisor-lib-specific or 00173 * OS-specific per-box configuration */ 00174 const void * const lib_config; 00175 00176 const char * box_namespace; 00177 const UvisorBoxAclItem * const acl_list; 00178 uint32_t acl_count; 00179 } UVISOR_PACKED UvisorBoxConfig; 00180 00181 typedef struct { 00182 /* Pointer to the user context */ 00183 void * ctx; 00184 /* Pointer to the box heap */ 00185 void * box_heap; 00186 /* Size of the box heap */ 00187 uint32_t box_heap_size; 00188 /* Pointer to the currently active heap. 00189 * This is set to `NULL` by uVisor, signalling to the user lib that the 00190 * box heap needs to be initialized before use! */ 00191 void * active_heap; 00192 /* Pointer to the box config */ 00193 const UvisorBoxConfig * config; 00194 } UVISOR_PACKED UvisorBoxIndex; 00195 00196 /* 00197 * only use this macro for rounding const values during compile time: 00198 * for variables please use uvisor_region_bits(x) instead 00199 */ 00200 #define UVISOR_REGION_BITS(x) (((x)<=32UL)?5:(((x)<=64UL)?\ 00201 6:(((x)<=128UL)?7:(((x)<=256UL)?8:(((x)<=512UL)?9:(((x)<=1024UL)?\ 00202 10:(((x)<=2048UL)?11:(((x)<=4096UL)?12:(((x)<=8192UL)?\ 00203 13:(((x)<=16384UL)?14:(((x)<=32768UL)?15:(((x)<=65536UL)?\ 00204 16:(((x)<=131072UL)?17:(((x)<=262144UL)?18:(((x)<=524288UL)?\ 00205 19:(((x)<=1048576UL)?20:(((x)<=2097152UL)?21:(((x)<=4194304UL)?\ 00206 22:(((x)<=8388608UL)?23:(((x)<=16777216UL)?24:(((x)<=33554432UL)?\ 00207 25:(((x)<=67108864UL)?26:(((x)<=134217728UL)?27:(((x)<=268435456UL)?\ 00208 28:(((x)<=536870912UL)?29:(((x)<=1073741824UL)?30:(((x)<=2147483648UL)?\ 00209 31:32))))))))))))))))))))))))))) 00210 00211 #if defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 00212 static UVISOR_FORCEINLINE int vmpu_bits(uint32_t size) 00213 { 00214 return 32 - __builtin_clz(size); 00215 } 00216 #endif /* defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 */ 00217 00218 #endif /* __UVISOR_API_VMPU_EXPORTS_H__ */
Generated on Tue Jul 12 2022 12:28:59 by
 1.7.2
 1.7.2 
    