5.2.1 - Updated I2C files
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
cmsis/core_ca_mmu.h@0:098463de4c5d, 2017-01-25 (annotated)
- Committer:
- group-onsemi
- Date:
- Wed Jan 25 20:34:15 2017 +0000
- Revision:
- 0:098463de4c5d
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-onsemi | 0:098463de4c5d | 1 | ;/**************************************************************************//** |
group-onsemi | 0:098463de4c5d | 2 | ; * @file core_ca_mmu.h |
group-onsemi | 0:098463de4c5d | 3 | ; * @brief MMU Startup File for A9_MP Device Series |
group-onsemi | 0:098463de4c5d | 4 | ; * @version V1.01 |
group-onsemi | 0:098463de4c5d | 5 | ; * @date 10 Sept 2014 |
group-onsemi | 0:098463de4c5d | 6 | ; * |
group-onsemi | 0:098463de4c5d | 7 | ; * @note |
group-onsemi | 0:098463de4c5d | 8 | ; * |
group-onsemi | 0:098463de4c5d | 9 | ; ******************************************************************************/ |
group-onsemi | 0:098463de4c5d | 10 | ;/* Copyright (c) 2012-2014 ARM LIMITED |
group-onsemi | 0:098463de4c5d | 11 | ; |
group-onsemi | 0:098463de4c5d | 12 | ; All rights reserved. |
group-onsemi | 0:098463de4c5d | 13 | ; Redistribution and use in source and binary forms, with or without |
group-onsemi | 0:098463de4c5d | 14 | ; modification, are permitted provided that the following conditions are met: |
group-onsemi | 0:098463de4c5d | 15 | ; - Redistributions of source code must retain the above copyright |
group-onsemi | 0:098463de4c5d | 16 | ; notice, this list of conditions and the following disclaimer. |
group-onsemi | 0:098463de4c5d | 17 | ; - Redistributions in binary form must reproduce the above copyright |
group-onsemi | 0:098463de4c5d | 18 | ; notice, this list of conditions and the following disclaimer in the |
group-onsemi | 0:098463de4c5d | 19 | ; documentation and/or other materials provided with the distribution. |
group-onsemi | 0:098463de4c5d | 20 | ; - Neither the name of ARM nor the names of its contributors may be used |
group-onsemi | 0:098463de4c5d | 21 | ; to endorse or promote products derived from this software without |
group-onsemi | 0:098463de4c5d | 22 | ; specific prior written permission. |
group-onsemi | 0:098463de4c5d | 23 | ; * |
group-onsemi | 0:098463de4c5d | 24 | ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
group-onsemi | 0:098463de4c5d | 25 | ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
group-onsemi | 0:098463de4c5d | 26 | ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
group-onsemi | 0:098463de4c5d | 27 | ; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
group-onsemi | 0:098463de4c5d | 28 | ; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
group-onsemi | 0:098463de4c5d | 29 | ; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
group-onsemi | 0:098463de4c5d | 30 | ; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
group-onsemi | 0:098463de4c5d | 31 | ; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
group-onsemi | 0:098463de4c5d | 32 | ; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
group-onsemi | 0:098463de4c5d | 33 | ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
group-onsemi | 0:098463de4c5d | 34 | ; POSSIBILITY OF SUCH DAMAGE. |
group-onsemi | 0:098463de4c5d | 35 | ; ---------------------------------------------------------------------------*/ |
group-onsemi | 0:098463de4c5d | 36 | |
group-onsemi | 0:098463de4c5d | 37 | #ifdef __cplusplus |
group-onsemi | 0:098463de4c5d | 38 | extern "C" { |
group-onsemi | 0:098463de4c5d | 39 | #endif |
group-onsemi | 0:098463de4c5d | 40 | |
group-onsemi | 0:098463de4c5d | 41 | #ifndef _MMU_FUNC_H |
group-onsemi | 0:098463de4c5d | 42 | #define _MMU_FUNC_H |
group-onsemi | 0:098463de4c5d | 43 | |
group-onsemi | 0:098463de4c5d | 44 | #define SECTION_DESCRIPTOR (0x2) |
group-onsemi | 0:098463de4c5d | 45 | #define SECTION_MASK (0xFFFFFFFC) |
group-onsemi | 0:098463de4c5d | 46 | |
group-onsemi | 0:098463de4c5d | 47 | #define SECTION_TEXCB_MASK (0xFFFF8FF3) |
group-onsemi | 0:098463de4c5d | 48 | #define SECTION_B_SHIFT (2) |
group-onsemi | 0:098463de4c5d | 49 | #define SECTION_C_SHIFT (3) |
group-onsemi | 0:098463de4c5d | 50 | #define SECTION_TEX0_SHIFT (12) |
group-onsemi | 0:098463de4c5d | 51 | #define SECTION_TEX1_SHIFT (13) |
group-onsemi | 0:098463de4c5d | 52 | #define SECTION_TEX2_SHIFT (14) |
group-onsemi | 0:098463de4c5d | 53 | |
group-onsemi | 0:098463de4c5d | 54 | #define SECTION_XN_MASK (0xFFFFFFEF) |
group-onsemi | 0:098463de4c5d | 55 | #define SECTION_XN_SHIFT (4) |
group-onsemi | 0:098463de4c5d | 56 | |
group-onsemi | 0:098463de4c5d | 57 | #define SECTION_DOMAIN_MASK (0xFFFFFE1F) |
group-onsemi | 0:098463de4c5d | 58 | #define SECTION_DOMAIN_SHIFT (5) |
group-onsemi | 0:098463de4c5d | 59 | |
group-onsemi | 0:098463de4c5d | 60 | #define SECTION_P_MASK (0xFFFFFDFF) |
group-onsemi | 0:098463de4c5d | 61 | #define SECTION_P_SHIFT (9) |
group-onsemi | 0:098463de4c5d | 62 | |
group-onsemi | 0:098463de4c5d | 63 | #define SECTION_AP_MASK (0xFFFF73FF) |
group-onsemi | 0:098463de4c5d | 64 | #define SECTION_AP_SHIFT (10) |
group-onsemi | 0:098463de4c5d | 65 | #define SECTION_AP2_SHIFT (15) |
group-onsemi | 0:098463de4c5d | 66 | |
group-onsemi | 0:098463de4c5d | 67 | #define SECTION_S_MASK (0xFFFEFFFF) |
group-onsemi | 0:098463de4c5d | 68 | #define SECTION_S_SHIFT (16) |
group-onsemi | 0:098463de4c5d | 69 | |
group-onsemi | 0:098463de4c5d | 70 | #define SECTION_NG_MASK (0xFFFDFFFF) |
group-onsemi | 0:098463de4c5d | 71 | #define SECTION_NG_SHIFT (17) |
group-onsemi | 0:098463de4c5d | 72 | |
group-onsemi | 0:098463de4c5d | 73 | #define SECTION_NS_MASK (0xFFF7FFFF) |
group-onsemi | 0:098463de4c5d | 74 | #define SECTION_NS_SHIFT (19) |
group-onsemi | 0:098463de4c5d | 75 | |
group-onsemi | 0:098463de4c5d | 76 | |
group-onsemi | 0:098463de4c5d | 77 | #define PAGE_L1_DESCRIPTOR (0x1) |
group-onsemi | 0:098463de4c5d | 78 | #define PAGE_L1_MASK (0xFFFFFFFC) |
group-onsemi | 0:098463de4c5d | 79 | |
group-onsemi | 0:098463de4c5d | 80 | #define PAGE_L2_4K_DESC (0x2) |
group-onsemi | 0:098463de4c5d | 81 | #define PAGE_L2_4K_MASK (0xFFFFFFFD) |
group-onsemi | 0:098463de4c5d | 82 | |
group-onsemi | 0:098463de4c5d | 83 | #define PAGE_L2_64K_DESC (0x1) |
group-onsemi | 0:098463de4c5d | 84 | #define PAGE_L2_64K_MASK (0xFFFFFFFC) |
group-onsemi | 0:098463de4c5d | 85 | |
group-onsemi | 0:098463de4c5d | 86 | #define PAGE_4K_TEXCB_MASK (0xFFFFFE33) |
group-onsemi | 0:098463de4c5d | 87 | #define PAGE_4K_B_SHIFT (2) |
group-onsemi | 0:098463de4c5d | 88 | #define PAGE_4K_C_SHIFT (3) |
group-onsemi | 0:098463de4c5d | 89 | #define PAGE_4K_TEX0_SHIFT (6) |
group-onsemi | 0:098463de4c5d | 90 | #define PAGE_4K_TEX1_SHIFT (7) |
group-onsemi | 0:098463de4c5d | 91 | #define PAGE_4K_TEX2_SHIFT (8) |
group-onsemi | 0:098463de4c5d | 92 | |
group-onsemi | 0:098463de4c5d | 93 | #define PAGE_64K_TEXCB_MASK (0xFFFF8FF3) |
group-onsemi | 0:098463de4c5d | 94 | #define PAGE_64K_B_SHIFT (2) |
group-onsemi | 0:098463de4c5d | 95 | #define PAGE_64K_C_SHIFT (3) |
group-onsemi | 0:098463de4c5d | 96 | #define PAGE_64K_TEX0_SHIFT (12) |
group-onsemi | 0:098463de4c5d | 97 | #define PAGE_64K_TEX1_SHIFT (13) |
group-onsemi | 0:098463de4c5d | 98 | #define PAGE_64K_TEX2_SHIFT (14) |
group-onsemi | 0:098463de4c5d | 99 | |
group-onsemi | 0:098463de4c5d | 100 | #define PAGE_TEXCB_MASK (0xFFFF8FF3) |
group-onsemi | 0:098463de4c5d | 101 | #define PAGE_B_SHIFT (2) |
group-onsemi | 0:098463de4c5d | 102 | #define PAGE_C_SHIFT (3) |
group-onsemi | 0:098463de4c5d | 103 | #define PAGE_TEX_SHIFT (12) |
group-onsemi | 0:098463de4c5d | 104 | |
group-onsemi | 0:098463de4c5d | 105 | #define PAGE_XN_4K_MASK (0xFFFFFFFE) |
group-onsemi | 0:098463de4c5d | 106 | #define PAGE_XN_4K_SHIFT (0) |
group-onsemi | 0:098463de4c5d | 107 | #define PAGE_XN_64K_MASK (0xFFFF7FFF) |
group-onsemi | 0:098463de4c5d | 108 | #define PAGE_XN_64K_SHIFT (15) |
group-onsemi | 0:098463de4c5d | 109 | |
group-onsemi | 0:098463de4c5d | 110 | |
group-onsemi | 0:098463de4c5d | 111 | #define PAGE_DOMAIN_MASK (0xFFFFFE1F) |
group-onsemi | 0:098463de4c5d | 112 | #define PAGE_DOMAIN_SHIFT (5) |
group-onsemi | 0:098463de4c5d | 113 | |
group-onsemi | 0:098463de4c5d | 114 | #define PAGE_P_MASK (0xFFFFFDFF) |
group-onsemi | 0:098463de4c5d | 115 | #define PAGE_P_SHIFT (9) |
group-onsemi | 0:098463de4c5d | 116 | |
group-onsemi | 0:098463de4c5d | 117 | #define PAGE_AP_MASK (0xFFFFFDCF) |
group-onsemi | 0:098463de4c5d | 118 | #define PAGE_AP_SHIFT (4) |
group-onsemi | 0:098463de4c5d | 119 | #define PAGE_AP2_SHIFT (9) |
group-onsemi | 0:098463de4c5d | 120 | |
group-onsemi | 0:098463de4c5d | 121 | #define PAGE_S_MASK (0xFFFFFBFF) |
group-onsemi | 0:098463de4c5d | 122 | #define PAGE_S_SHIFT (10) |
group-onsemi | 0:098463de4c5d | 123 | |
group-onsemi | 0:098463de4c5d | 124 | #define PAGE_NG_MASK (0xFFFFF7FF) |
group-onsemi | 0:098463de4c5d | 125 | #define PAGE_NG_SHIFT (11) |
group-onsemi | 0:098463de4c5d | 126 | |
group-onsemi | 0:098463de4c5d | 127 | #define PAGE_NS_MASK (0xFFFFFFF7) |
group-onsemi | 0:098463de4c5d | 128 | #define PAGE_NS_SHIFT (3) |
group-onsemi | 0:098463de4c5d | 129 | |
group-onsemi | 0:098463de4c5d | 130 | #define OFFSET_1M (0x00100000) |
group-onsemi | 0:098463de4c5d | 131 | #define OFFSET_64K (0x00010000) |
group-onsemi | 0:098463de4c5d | 132 | #define OFFSET_4K (0x00001000) |
group-onsemi | 0:098463de4c5d | 133 | |
group-onsemi | 0:098463de4c5d | 134 | #define DESCRIPTOR_FAULT (0x00000000) |
group-onsemi | 0:098463de4c5d | 135 | |
group-onsemi | 0:098463de4c5d | 136 | /* ########################### MMU Function Access ########################### */ |
group-onsemi | 0:098463de4c5d | 137 | /** \ingroup MMU_FunctionInterface |
group-onsemi | 0:098463de4c5d | 138 | \defgroup MMU_Functions MMU Functions Interface |
group-onsemi | 0:098463de4c5d | 139 | @{ |
group-onsemi | 0:098463de4c5d | 140 | */ |
group-onsemi | 0:098463de4c5d | 141 | |
group-onsemi | 0:098463de4c5d | 142 | /* Attributes enumerations */ |
group-onsemi | 0:098463de4c5d | 143 | |
group-onsemi | 0:098463de4c5d | 144 | /* Region size attributes */ |
group-onsemi | 0:098463de4c5d | 145 | typedef enum |
group-onsemi | 0:098463de4c5d | 146 | { |
group-onsemi | 0:098463de4c5d | 147 | SECTION, |
group-onsemi | 0:098463de4c5d | 148 | PAGE_4k, |
group-onsemi | 0:098463de4c5d | 149 | PAGE_64k, |
group-onsemi | 0:098463de4c5d | 150 | } mmu_region_size_Type; |
group-onsemi | 0:098463de4c5d | 151 | |
group-onsemi | 0:098463de4c5d | 152 | /* Region type attributes */ |
group-onsemi | 0:098463de4c5d | 153 | typedef enum |
group-onsemi | 0:098463de4c5d | 154 | { |
group-onsemi | 0:098463de4c5d | 155 | NORMAL, |
group-onsemi | 0:098463de4c5d | 156 | DEVICE, |
group-onsemi | 0:098463de4c5d | 157 | SHARED_DEVICE, |
group-onsemi | 0:098463de4c5d | 158 | NON_SHARED_DEVICE, |
group-onsemi | 0:098463de4c5d | 159 | STRONGLY_ORDERED |
group-onsemi | 0:098463de4c5d | 160 | } mmu_memory_Type; |
group-onsemi | 0:098463de4c5d | 161 | |
group-onsemi | 0:098463de4c5d | 162 | /* Region cacheability attributes */ |
group-onsemi | 0:098463de4c5d | 163 | typedef enum |
group-onsemi | 0:098463de4c5d | 164 | { |
group-onsemi | 0:098463de4c5d | 165 | NON_CACHEABLE, |
group-onsemi | 0:098463de4c5d | 166 | WB_WA, |
group-onsemi | 0:098463de4c5d | 167 | WT, |
group-onsemi | 0:098463de4c5d | 168 | WB_NO_WA, |
group-onsemi | 0:098463de4c5d | 169 | } mmu_cacheability_Type; |
group-onsemi | 0:098463de4c5d | 170 | |
group-onsemi | 0:098463de4c5d | 171 | /* Region parity check attributes */ |
group-onsemi | 0:098463de4c5d | 172 | typedef enum |
group-onsemi | 0:098463de4c5d | 173 | { |
group-onsemi | 0:098463de4c5d | 174 | ECC_DISABLED, |
group-onsemi | 0:098463de4c5d | 175 | ECC_ENABLED, |
group-onsemi | 0:098463de4c5d | 176 | } mmu_ecc_check_Type; |
group-onsemi | 0:098463de4c5d | 177 | |
group-onsemi | 0:098463de4c5d | 178 | /* Region execution attributes */ |
group-onsemi | 0:098463de4c5d | 179 | typedef enum |
group-onsemi | 0:098463de4c5d | 180 | { |
group-onsemi | 0:098463de4c5d | 181 | EXECUTE, |
group-onsemi | 0:098463de4c5d | 182 | NON_EXECUTE, |
group-onsemi | 0:098463de4c5d | 183 | } mmu_execute_Type; |
group-onsemi | 0:098463de4c5d | 184 | |
group-onsemi | 0:098463de4c5d | 185 | /* Region global attributes */ |
group-onsemi | 0:098463de4c5d | 186 | typedef enum |
group-onsemi | 0:098463de4c5d | 187 | { |
group-onsemi | 0:098463de4c5d | 188 | GLOBAL, |
group-onsemi | 0:098463de4c5d | 189 | NON_GLOBAL, |
group-onsemi | 0:098463de4c5d | 190 | } mmu_global_Type; |
group-onsemi | 0:098463de4c5d | 191 | |
group-onsemi | 0:098463de4c5d | 192 | /* Region shareability attributes */ |
group-onsemi | 0:098463de4c5d | 193 | typedef enum |
group-onsemi | 0:098463de4c5d | 194 | { |
group-onsemi | 0:098463de4c5d | 195 | NON_SHARED, |
group-onsemi | 0:098463de4c5d | 196 | SHARED, |
group-onsemi | 0:098463de4c5d | 197 | } mmu_shared_Type; |
group-onsemi | 0:098463de4c5d | 198 | |
group-onsemi | 0:098463de4c5d | 199 | /* Region security attributes */ |
group-onsemi | 0:098463de4c5d | 200 | typedef enum |
group-onsemi | 0:098463de4c5d | 201 | { |
group-onsemi | 0:098463de4c5d | 202 | SECURE, |
group-onsemi | 0:098463de4c5d | 203 | NON_SECURE, |
group-onsemi | 0:098463de4c5d | 204 | } mmu_secure_Type; |
group-onsemi | 0:098463de4c5d | 205 | |
group-onsemi | 0:098463de4c5d | 206 | /* Region access attributes */ |
group-onsemi | 0:098463de4c5d | 207 | typedef enum |
group-onsemi | 0:098463de4c5d | 208 | { |
group-onsemi | 0:098463de4c5d | 209 | NO_ACCESS, |
group-onsemi | 0:098463de4c5d | 210 | RW, |
group-onsemi | 0:098463de4c5d | 211 | READ, |
group-onsemi | 0:098463de4c5d | 212 | } mmu_access_Type; |
group-onsemi | 0:098463de4c5d | 213 | |
group-onsemi | 0:098463de4c5d | 214 | /* Memory Region definition */ |
group-onsemi | 0:098463de4c5d | 215 | typedef struct RegionStruct { |
group-onsemi | 0:098463de4c5d | 216 | mmu_region_size_Type rg_t; |
group-onsemi | 0:098463de4c5d | 217 | mmu_memory_Type mem_t; |
group-onsemi | 0:098463de4c5d | 218 | uint8_t domain; |
group-onsemi | 0:098463de4c5d | 219 | mmu_cacheability_Type inner_norm_t; |
group-onsemi | 0:098463de4c5d | 220 | mmu_cacheability_Type outer_norm_t; |
group-onsemi | 0:098463de4c5d | 221 | mmu_ecc_check_Type e_t; |
group-onsemi | 0:098463de4c5d | 222 | mmu_execute_Type xn_t; |
group-onsemi | 0:098463de4c5d | 223 | mmu_global_Type g_t; |
group-onsemi | 0:098463de4c5d | 224 | mmu_secure_Type sec_t; |
group-onsemi | 0:098463de4c5d | 225 | mmu_access_Type priv_t; |
group-onsemi | 0:098463de4c5d | 226 | mmu_access_Type user_t; |
group-onsemi | 0:098463de4c5d | 227 | mmu_shared_Type sh_t; |
group-onsemi | 0:098463de4c5d | 228 | |
group-onsemi | 0:098463de4c5d | 229 | } mmu_region_attributes_Type; |
group-onsemi | 0:098463de4c5d | 230 | |
group-onsemi | 0:098463de4c5d | 231 | /** \brief Set section execution-never attribute |
group-onsemi | 0:098463de4c5d | 232 | |
group-onsemi | 0:098463de4c5d | 233 | The function sets section execution-never attribute |
group-onsemi | 0:098463de4c5d | 234 | |
group-onsemi | 0:098463de4c5d | 235 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 236 | \param [in] xn Section execution-never attribute : EXECUTE , NON_EXECUTE. |
group-onsemi | 0:098463de4c5d | 237 | |
group-onsemi | 0:098463de4c5d | 238 | \return 0 |
group-onsemi | 0:098463de4c5d | 239 | */ |
group-onsemi | 0:098463de4c5d | 240 | __STATIC_INLINE int __xn_section(uint32_t *descriptor_l1, mmu_execute_Type xn) |
group-onsemi | 0:098463de4c5d | 241 | { |
group-onsemi | 0:098463de4c5d | 242 | *descriptor_l1 &= SECTION_XN_MASK; |
group-onsemi | 0:098463de4c5d | 243 | *descriptor_l1 |= ((xn & 0x1) << SECTION_XN_SHIFT); |
group-onsemi | 0:098463de4c5d | 244 | return 0; |
group-onsemi | 0:098463de4c5d | 245 | } |
group-onsemi | 0:098463de4c5d | 246 | |
group-onsemi | 0:098463de4c5d | 247 | /** \brief Set section domain |
group-onsemi | 0:098463de4c5d | 248 | |
group-onsemi | 0:098463de4c5d | 249 | The function sets section domain |
group-onsemi | 0:098463de4c5d | 250 | |
group-onsemi | 0:098463de4c5d | 251 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 252 | \param [in] domain Section domain |
group-onsemi | 0:098463de4c5d | 253 | |
group-onsemi | 0:098463de4c5d | 254 | \return 0 |
group-onsemi | 0:098463de4c5d | 255 | */ |
group-onsemi | 0:098463de4c5d | 256 | __STATIC_INLINE int __domain_section(uint32_t *descriptor_l1, uint8_t domain) |
group-onsemi | 0:098463de4c5d | 257 | { |
group-onsemi | 0:098463de4c5d | 258 | *descriptor_l1 &= SECTION_DOMAIN_MASK; |
group-onsemi | 0:098463de4c5d | 259 | *descriptor_l1 |= ((domain & 0xF) << SECTION_DOMAIN_SHIFT); |
group-onsemi | 0:098463de4c5d | 260 | return 0; |
group-onsemi | 0:098463de4c5d | 261 | } |
group-onsemi | 0:098463de4c5d | 262 | |
group-onsemi | 0:098463de4c5d | 263 | /** \brief Set section parity check |
group-onsemi | 0:098463de4c5d | 264 | |
group-onsemi | 0:098463de4c5d | 265 | The function sets section parity check |
group-onsemi | 0:098463de4c5d | 266 | |
group-onsemi | 0:098463de4c5d | 267 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 268 | \param [in] p_bit Parity check: ECC_DISABLED, ECC_ENABLED |
group-onsemi | 0:098463de4c5d | 269 | |
group-onsemi | 0:098463de4c5d | 270 | \return 0 |
group-onsemi | 0:098463de4c5d | 271 | */ |
group-onsemi | 0:098463de4c5d | 272 | __STATIC_INLINE int __p_section(uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit) |
group-onsemi | 0:098463de4c5d | 273 | { |
group-onsemi | 0:098463de4c5d | 274 | *descriptor_l1 &= SECTION_P_MASK; |
group-onsemi | 0:098463de4c5d | 275 | *descriptor_l1 |= ((p_bit & 0x1) << SECTION_P_SHIFT); |
group-onsemi | 0:098463de4c5d | 276 | return 0; |
group-onsemi | 0:098463de4c5d | 277 | } |
group-onsemi | 0:098463de4c5d | 278 | |
group-onsemi | 0:098463de4c5d | 279 | /** \brief Set section access privileges |
group-onsemi | 0:098463de4c5d | 280 | |
group-onsemi | 0:098463de4c5d | 281 | The function sets section access privileges |
group-onsemi | 0:098463de4c5d | 282 | |
group-onsemi | 0:098463de4c5d | 283 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 284 | \param [in] user User Level Access: NO_ACCESS, RW, READ |
group-onsemi | 0:098463de4c5d | 285 | \param [in] priv Privilege Level Access: NO_ACCESS, RW, READ |
group-onsemi | 0:098463de4c5d | 286 | \param [in] afe Access flag enable |
group-onsemi | 0:098463de4c5d | 287 | |
group-onsemi | 0:098463de4c5d | 288 | \return 0 |
group-onsemi | 0:098463de4c5d | 289 | */ |
group-onsemi | 0:098463de4c5d | 290 | __STATIC_INLINE int __ap_section(uint32_t *descriptor_l1, mmu_access_Type user, mmu_access_Type priv, uint32_t afe) |
group-onsemi | 0:098463de4c5d | 291 | { |
group-onsemi | 0:098463de4c5d | 292 | uint32_t ap = 0; |
group-onsemi | 0:098463de4c5d | 293 | |
group-onsemi | 0:098463de4c5d | 294 | if (afe == 0) { //full access |
group-onsemi | 0:098463de4c5d | 295 | if ((priv == NO_ACCESS) && (user == NO_ACCESS)) { ap = 0x0; } |
group-onsemi | 0:098463de4c5d | 296 | else if ((priv == RW) && (user == NO_ACCESS)) { ap = 0x1; } |
group-onsemi | 0:098463de4c5d | 297 | else if ((priv == RW) && (user == READ)) { ap = 0x2; } |
group-onsemi | 0:098463de4c5d | 298 | else if ((priv == RW) && (user == RW)) { ap = 0x3; } |
group-onsemi | 0:098463de4c5d | 299 | else if ((priv == READ) && (user == NO_ACCESS)) { ap = 0x5; } |
group-onsemi | 0:098463de4c5d | 300 | else if ((priv == READ) && (user == READ)) { ap = 0x7; } |
group-onsemi | 0:098463de4c5d | 301 | } |
group-onsemi | 0:098463de4c5d | 302 | |
group-onsemi | 0:098463de4c5d | 303 | else { //Simplified access |
group-onsemi | 0:098463de4c5d | 304 | if ((priv == RW) && (user == NO_ACCESS)) { ap = 0x1; } |
group-onsemi | 0:098463de4c5d | 305 | else if ((priv == RW) && (user == RW)) { ap = 0x3; } |
group-onsemi | 0:098463de4c5d | 306 | else if ((priv == READ) && (user == NO_ACCESS)) { ap = 0x5; } |
group-onsemi | 0:098463de4c5d | 307 | else if ((priv == READ) && (user == READ)) { ap = 0x7; } |
group-onsemi | 0:098463de4c5d | 308 | } |
group-onsemi | 0:098463de4c5d | 309 | |
group-onsemi | 0:098463de4c5d | 310 | *descriptor_l1 &= SECTION_AP_MASK; |
group-onsemi | 0:098463de4c5d | 311 | *descriptor_l1 |= (ap & 0x3) << SECTION_AP_SHIFT; |
group-onsemi | 0:098463de4c5d | 312 | *descriptor_l1 |= ((ap & 0x4)>>2) << SECTION_AP2_SHIFT; |
group-onsemi | 0:098463de4c5d | 313 | |
group-onsemi | 0:098463de4c5d | 314 | return 0; |
group-onsemi | 0:098463de4c5d | 315 | } |
group-onsemi | 0:098463de4c5d | 316 | |
group-onsemi | 0:098463de4c5d | 317 | /** \brief Set section shareability |
group-onsemi | 0:098463de4c5d | 318 | |
group-onsemi | 0:098463de4c5d | 319 | The function sets section shareability |
group-onsemi | 0:098463de4c5d | 320 | |
group-onsemi | 0:098463de4c5d | 321 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 322 | \param [in] s_bit Section shareability: NON_SHARED, SHARED |
group-onsemi | 0:098463de4c5d | 323 | |
group-onsemi | 0:098463de4c5d | 324 | \return 0 |
group-onsemi | 0:098463de4c5d | 325 | */ |
group-onsemi | 0:098463de4c5d | 326 | __STATIC_INLINE int __shared_section(uint32_t *descriptor_l1, mmu_shared_Type s_bit) |
group-onsemi | 0:098463de4c5d | 327 | { |
group-onsemi | 0:098463de4c5d | 328 | *descriptor_l1 &= SECTION_S_MASK; |
group-onsemi | 0:098463de4c5d | 329 | *descriptor_l1 |= ((s_bit & 0x1) << SECTION_S_SHIFT); |
group-onsemi | 0:098463de4c5d | 330 | return 0; |
group-onsemi | 0:098463de4c5d | 331 | } |
group-onsemi | 0:098463de4c5d | 332 | |
group-onsemi | 0:098463de4c5d | 333 | /** \brief Set section Global attribute |
group-onsemi | 0:098463de4c5d | 334 | |
group-onsemi | 0:098463de4c5d | 335 | The function sets section Global attribute |
group-onsemi | 0:098463de4c5d | 336 | |
group-onsemi | 0:098463de4c5d | 337 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 338 | \param [in] g_bit Section attribute: GLOBAL, NON_GLOBAL |
group-onsemi | 0:098463de4c5d | 339 | |
group-onsemi | 0:098463de4c5d | 340 | \return 0 |
group-onsemi | 0:098463de4c5d | 341 | */ |
group-onsemi | 0:098463de4c5d | 342 | __STATIC_INLINE int __global_section(uint32_t *descriptor_l1, mmu_global_Type g_bit) |
group-onsemi | 0:098463de4c5d | 343 | { |
group-onsemi | 0:098463de4c5d | 344 | *descriptor_l1 &= SECTION_NG_MASK; |
group-onsemi | 0:098463de4c5d | 345 | *descriptor_l1 |= ((g_bit & 0x1) << SECTION_NG_SHIFT); |
group-onsemi | 0:098463de4c5d | 346 | return 0; |
group-onsemi | 0:098463de4c5d | 347 | } |
group-onsemi | 0:098463de4c5d | 348 | |
group-onsemi | 0:098463de4c5d | 349 | /** \brief Set section Security attribute |
group-onsemi | 0:098463de4c5d | 350 | |
group-onsemi | 0:098463de4c5d | 351 | The function sets section Global attribute |
group-onsemi | 0:098463de4c5d | 352 | |
group-onsemi | 0:098463de4c5d | 353 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 354 | \param [in] s_bit Section Security attribute: SECURE, NON_SECURE |
group-onsemi | 0:098463de4c5d | 355 | |
group-onsemi | 0:098463de4c5d | 356 | \return 0 |
group-onsemi | 0:098463de4c5d | 357 | */ |
group-onsemi | 0:098463de4c5d | 358 | __STATIC_INLINE int __secure_section(uint32_t *descriptor_l1, mmu_secure_Type s_bit) |
group-onsemi | 0:098463de4c5d | 359 | { |
group-onsemi | 0:098463de4c5d | 360 | *descriptor_l1 &= SECTION_NS_MASK; |
group-onsemi | 0:098463de4c5d | 361 | *descriptor_l1 |= ((s_bit & 0x1) << SECTION_NS_SHIFT); |
group-onsemi | 0:098463de4c5d | 362 | return 0; |
group-onsemi | 0:098463de4c5d | 363 | } |
group-onsemi | 0:098463de4c5d | 364 | |
group-onsemi | 0:098463de4c5d | 365 | /* Page 4k or 64k */ |
group-onsemi | 0:098463de4c5d | 366 | /** \brief Set 4k/64k page execution-never attribute |
group-onsemi | 0:098463de4c5d | 367 | |
group-onsemi | 0:098463de4c5d | 368 | The function sets 4k/64k page execution-never attribute |
group-onsemi | 0:098463de4c5d | 369 | |
group-onsemi | 0:098463de4c5d | 370 | \param [out] descriptor_l2 L2 descriptor. |
group-onsemi | 0:098463de4c5d | 371 | \param [in] xn Page execution-never attribute : EXECUTE , NON_EXECUTE. |
group-onsemi | 0:098463de4c5d | 372 | \param [in] page Page size: PAGE_4k, PAGE_64k, |
group-onsemi | 0:098463de4c5d | 373 | |
group-onsemi | 0:098463de4c5d | 374 | \return 0 |
group-onsemi | 0:098463de4c5d | 375 | */ |
group-onsemi | 0:098463de4c5d | 376 | __STATIC_INLINE int __xn_page(uint32_t *descriptor_l2, mmu_execute_Type xn, mmu_region_size_Type page) |
group-onsemi | 0:098463de4c5d | 377 | { |
group-onsemi | 0:098463de4c5d | 378 | if (page == PAGE_4k) |
group-onsemi | 0:098463de4c5d | 379 | { |
group-onsemi | 0:098463de4c5d | 380 | *descriptor_l2 &= PAGE_XN_4K_MASK; |
group-onsemi | 0:098463de4c5d | 381 | *descriptor_l2 |= ((xn & 0x1) << PAGE_XN_4K_SHIFT); |
group-onsemi | 0:098463de4c5d | 382 | } |
group-onsemi | 0:098463de4c5d | 383 | else |
group-onsemi | 0:098463de4c5d | 384 | { |
group-onsemi | 0:098463de4c5d | 385 | *descriptor_l2 &= PAGE_XN_64K_MASK; |
group-onsemi | 0:098463de4c5d | 386 | *descriptor_l2 |= ((xn & 0x1) << PAGE_XN_64K_SHIFT); |
group-onsemi | 0:098463de4c5d | 387 | } |
group-onsemi | 0:098463de4c5d | 388 | return 0; |
group-onsemi | 0:098463de4c5d | 389 | } |
group-onsemi | 0:098463de4c5d | 390 | |
group-onsemi | 0:098463de4c5d | 391 | /** \brief Set 4k/64k page domain |
group-onsemi | 0:098463de4c5d | 392 | |
group-onsemi | 0:098463de4c5d | 393 | The function sets 4k/64k page domain |
group-onsemi | 0:098463de4c5d | 394 | |
group-onsemi | 0:098463de4c5d | 395 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 396 | \param [in] domain Page domain |
group-onsemi | 0:098463de4c5d | 397 | |
group-onsemi | 0:098463de4c5d | 398 | \return 0 |
group-onsemi | 0:098463de4c5d | 399 | */ |
group-onsemi | 0:098463de4c5d | 400 | __STATIC_INLINE int __domain_page(uint32_t *descriptor_l1, uint8_t domain) |
group-onsemi | 0:098463de4c5d | 401 | { |
group-onsemi | 0:098463de4c5d | 402 | *descriptor_l1 &= PAGE_DOMAIN_MASK; |
group-onsemi | 0:098463de4c5d | 403 | *descriptor_l1 |= ((domain & 0xf) << PAGE_DOMAIN_SHIFT); |
group-onsemi | 0:098463de4c5d | 404 | return 0; |
group-onsemi | 0:098463de4c5d | 405 | } |
group-onsemi | 0:098463de4c5d | 406 | |
group-onsemi | 0:098463de4c5d | 407 | /** \brief Set 4k/64k page parity check |
group-onsemi | 0:098463de4c5d | 408 | |
group-onsemi | 0:098463de4c5d | 409 | The function sets 4k/64k page parity check |
group-onsemi | 0:098463de4c5d | 410 | |
group-onsemi | 0:098463de4c5d | 411 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 412 | \param [in] p_bit Parity check: ECC_DISABLED, ECC_ENABLED |
group-onsemi | 0:098463de4c5d | 413 | |
group-onsemi | 0:098463de4c5d | 414 | \return 0 |
group-onsemi | 0:098463de4c5d | 415 | */ |
group-onsemi | 0:098463de4c5d | 416 | __STATIC_INLINE int __p_page(uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit) |
group-onsemi | 0:098463de4c5d | 417 | { |
group-onsemi | 0:098463de4c5d | 418 | *descriptor_l1 &= SECTION_P_MASK; |
group-onsemi | 0:098463de4c5d | 419 | *descriptor_l1 |= ((p_bit & 0x1) << SECTION_P_SHIFT); |
group-onsemi | 0:098463de4c5d | 420 | return 0; |
group-onsemi | 0:098463de4c5d | 421 | } |
group-onsemi | 0:098463de4c5d | 422 | |
group-onsemi | 0:098463de4c5d | 423 | /** \brief Set 4k/64k page access privileges |
group-onsemi | 0:098463de4c5d | 424 | |
group-onsemi | 0:098463de4c5d | 425 | The function sets 4k/64k page access privileges |
group-onsemi | 0:098463de4c5d | 426 | |
group-onsemi | 0:098463de4c5d | 427 | \param [out] descriptor_l2 L2 descriptor. |
group-onsemi | 0:098463de4c5d | 428 | \param [in] user User Level Access: NO_ACCESS, RW, READ |
group-onsemi | 0:098463de4c5d | 429 | \param [in] priv Privilege Level Access: NO_ACCESS, RW, READ |
group-onsemi | 0:098463de4c5d | 430 | \param [in] afe Access flag enable |
group-onsemi | 0:098463de4c5d | 431 | |
group-onsemi | 0:098463de4c5d | 432 | \return 0 |
group-onsemi | 0:098463de4c5d | 433 | */ |
group-onsemi | 0:098463de4c5d | 434 | __STATIC_INLINE int __ap_page(uint32_t *descriptor_l2, mmu_access_Type user, mmu_access_Type priv, uint32_t afe) |
group-onsemi | 0:098463de4c5d | 435 | { |
group-onsemi | 0:098463de4c5d | 436 | uint32_t ap = 0; |
group-onsemi | 0:098463de4c5d | 437 | |
group-onsemi | 0:098463de4c5d | 438 | if (afe == 0) { //full access |
group-onsemi | 0:098463de4c5d | 439 | if ((priv == NO_ACCESS) && (user == NO_ACCESS)) { ap = 0x0; } |
group-onsemi | 0:098463de4c5d | 440 | else if ((priv == RW) && (user == NO_ACCESS)) { ap = 0x1; } |
group-onsemi | 0:098463de4c5d | 441 | else if ((priv == RW) && (user == READ)) { ap = 0x2; } |
group-onsemi | 0:098463de4c5d | 442 | else if ((priv == RW) && (user == RW)) { ap = 0x3; } |
group-onsemi | 0:098463de4c5d | 443 | else if ((priv == READ) && (user == NO_ACCESS)) { ap = 0x5; } |
group-onsemi | 0:098463de4c5d | 444 | else if ((priv == READ) && (user == READ)) { ap = 0x6; } |
group-onsemi | 0:098463de4c5d | 445 | } |
group-onsemi | 0:098463de4c5d | 446 | |
group-onsemi | 0:098463de4c5d | 447 | else { //Simplified access |
group-onsemi | 0:098463de4c5d | 448 | if ((priv == RW) && (user == NO_ACCESS)) { ap = 0x1; } |
group-onsemi | 0:098463de4c5d | 449 | else if ((priv == RW) && (user == RW)) { ap = 0x3; } |
group-onsemi | 0:098463de4c5d | 450 | else if ((priv == READ) && (user == NO_ACCESS)) { ap = 0x5; } |
group-onsemi | 0:098463de4c5d | 451 | else if ((priv == READ) && (user == READ)) { ap = 0x7; } |
group-onsemi | 0:098463de4c5d | 452 | } |
group-onsemi | 0:098463de4c5d | 453 | |
group-onsemi | 0:098463de4c5d | 454 | *descriptor_l2 &= PAGE_AP_MASK; |
group-onsemi | 0:098463de4c5d | 455 | *descriptor_l2 |= (ap & 0x3) << PAGE_AP_SHIFT; |
group-onsemi | 0:098463de4c5d | 456 | *descriptor_l2 |= ((ap & 0x4)>>2) << PAGE_AP2_SHIFT; |
group-onsemi | 0:098463de4c5d | 457 | |
group-onsemi | 0:098463de4c5d | 458 | return 0; |
group-onsemi | 0:098463de4c5d | 459 | } |
group-onsemi | 0:098463de4c5d | 460 | |
group-onsemi | 0:098463de4c5d | 461 | /** \brief Set 4k/64k page shareability |
group-onsemi | 0:098463de4c5d | 462 | |
group-onsemi | 0:098463de4c5d | 463 | The function sets 4k/64k page shareability |
group-onsemi | 0:098463de4c5d | 464 | |
group-onsemi | 0:098463de4c5d | 465 | \param [out] descriptor_l2 L2 descriptor. |
group-onsemi | 0:098463de4c5d | 466 | \param [in] s_bit 4k/64k page shareability: NON_SHARED, SHARED |
group-onsemi | 0:098463de4c5d | 467 | |
group-onsemi | 0:098463de4c5d | 468 | \return 0 |
group-onsemi | 0:098463de4c5d | 469 | */ |
group-onsemi | 0:098463de4c5d | 470 | __STATIC_INLINE int __shared_page(uint32_t *descriptor_l2, mmu_shared_Type s_bit) |
group-onsemi | 0:098463de4c5d | 471 | { |
group-onsemi | 0:098463de4c5d | 472 | *descriptor_l2 &= PAGE_S_MASK; |
group-onsemi | 0:098463de4c5d | 473 | *descriptor_l2 |= ((s_bit & 0x1) << PAGE_S_SHIFT); |
group-onsemi | 0:098463de4c5d | 474 | return 0; |
group-onsemi | 0:098463de4c5d | 475 | } |
group-onsemi | 0:098463de4c5d | 476 | |
group-onsemi | 0:098463de4c5d | 477 | /** \brief Set 4k/64k page Global attribute |
group-onsemi | 0:098463de4c5d | 478 | |
group-onsemi | 0:098463de4c5d | 479 | The function sets 4k/64k page Global attribute |
group-onsemi | 0:098463de4c5d | 480 | |
group-onsemi | 0:098463de4c5d | 481 | \param [out] descriptor_l2 L2 descriptor. |
group-onsemi | 0:098463de4c5d | 482 | \param [in] g_bit 4k/64k page attribute: GLOBAL, NON_GLOBAL |
group-onsemi | 0:098463de4c5d | 483 | |
group-onsemi | 0:098463de4c5d | 484 | \return 0 |
group-onsemi | 0:098463de4c5d | 485 | */ |
group-onsemi | 0:098463de4c5d | 486 | __STATIC_INLINE int __global_page(uint32_t *descriptor_l2, mmu_global_Type g_bit) |
group-onsemi | 0:098463de4c5d | 487 | { |
group-onsemi | 0:098463de4c5d | 488 | *descriptor_l2 &= PAGE_NG_MASK; |
group-onsemi | 0:098463de4c5d | 489 | *descriptor_l2 |= ((g_bit & 0x1) << PAGE_NG_SHIFT); |
group-onsemi | 0:098463de4c5d | 490 | return 0; |
group-onsemi | 0:098463de4c5d | 491 | } |
group-onsemi | 0:098463de4c5d | 492 | |
group-onsemi | 0:098463de4c5d | 493 | /** \brief Set 4k/64k page Security attribute |
group-onsemi | 0:098463de4c5d | 494 | |
group-onsemi | 0:098463de4c5d | 495 | The function sets 4k/64k page Global attribute |
group-onsemi | 0:098463de4c5d | 496 | |
group-onsemi | 0:098463de4c5d | 497 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 498 | \param [in] s_bit 4k/64k page Security attribute: SECURE, NON_SECURE |
group-onsemi | 0:098463de4c5d | 499 | |
group-onsemi | 0:098463de4c5d | 500 | \return 0 |
group-onsemi | 0:098463de4c5d | 501 | */ |
group-onsemi | 0:098463de4c5d | 502 | __STATIC_INLINE int __secure_page(uint32_t *descriptor_l1, mmu_secure_Type s_bit) |
group-onsemi | 0:098463de4c5d | 503 | { |
group-onsemi | 0:098463de4c5d | 504 | *descriptor_l1 &= PAGE_NS_MASK; |
group-onsemi | 0:098463de4c5d | 505 | *descriptor_l1 |= ((s_bit & 0x1) << PAGE_NS_SHIFT); |
group-onsemi | 0:098463de4c5d | 506 | return 0; |
group-onsemi | 0:098463de4c5d | 507 | } |
group-onsemi | 0:098463de4c5d | 508 | |
group-onsemi | 0:098463de4c5d | 509 | |
group-onsemi | 0:098463de4c5d | 510 | /** \brief Set Section memory attributes |
group-onsemi | 0:098463de4c5d | 511 | |
group-onsemi | 0:098463de4c5d | 512 | The function sets section memory attributes |
group-onsemi | 0:098463de4c5d | 513 | |
group-onsemi | 0:098463de4c5d | 514 | \param [out] descriptor_l1 L1 descriptor. |
group-onsemi | 0:098463de4c5d | 515 | \param [in] mem Section memory type: NORMAL, DEVICE, SHARED_DEVICE, NON_SHARED_DEVICE, STRONGLY_ORDERED |
group-onsemi | 0:098463de4c5d | 516 | \param [in] outer Outer cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA, |
group-onsemi | 0:098463de4c5d | 517 | \param [in] inner Inner cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA, |
group-onsemi | 0:098463de4c5d | 518 | |
group-onsemi | 0:098463de4c5d | 519 | \return 0 |
group-onsemi | 0:098463de4c5d | 520 | */ |
group-onsemi | 0:098463de4c5d | 521 | __STATIC_INLINE int __memory_section(uint32_t *descriptor_l1, mmu_memory_Type mem, mmu_cacheability_Type outer, mmu_cacheability_Type inner) |
group-onsemi | 0:098463de4c5d | 522 | { |
group-onsemi | 0:098463de4c5d | 523 | *descriptor_l1 &= SECTION_TEXCB_MASK; |
group-onsemi | 0:098463de4c5d | 524 | |
group-onsemi | 0:098463de4c5d | 525 | if (STRONGLY_ORDERED == mem) |
group-onsemi | 0:098463de4c5d | 526 | { |
group-onsemi | 0:098463de4c5d | 527 | return 0; |
group-onsemi | 0:098463de4c5d | 528 | } |
group-onsemi | 0:098463de4c5d | 529 | else if (SHARED_DEVICE == mem) |
group-onsemi | 0:098463de4c5d | 530 | { |
group-onsemi | 0:098463de4c5d | 531 | *descriptor_l1 |= (1 << SECTION_B_SHIFT); |
group-onsemi | 0:098463de4c5d | 532 | } |
group-onsemi | 0:098463de4c5d | 533 | else if (NON_SHARED_DEVICE == mem) |
group-onsemi | 0:098463de4c5d | 534 | { |
group-onsemi | 0:098463de4c5d | 535 | *descriptor_l1 |= (1 << SECTION_TEX1_SHIFT); |
group-onsemi | 0:098463de4c5d | 536 | } |
group-onsemi | 0:098463de4c5d | 537 | else if (NORMAL == mem) |
group-onsemi | 0:098463de4c5d | 538 | { |
group-onsemi | 0:098463de4c5d | 539 | *descriptor_l1 |= 1 << SECTION_TEX2_SHIFT; |
group-onsemi | 0:098463de4c5d | 540 | switch(inner) |
group-onsemi | 0:098463de4c5d | 541 | { |
group-onsemi | 0:098463de4c5d | 542 | case NON_CACHEABLE: |
group-onsemi | 0:098463de4c5d | 543 | break; |
group-onsemi | 0:098463de4c5d | 544 | case WB_WA: |
group-onsemi | 0:098463de4c5d | 545 | *descriptor_l1 |= (1 << SECTION_B_SHIFT); |
group-onsemi | 0:098463de4c5d | 546 | break; |
group-onsemi | 0:098463de4c5d | 547 | case WT: |
group-onsemi | 0:098463de4c5d | 548 | *descriptor_l1 |= 1 << SECTION_C_SHIFT; |
group-onsemi | 0:098463de4c5d | 549 | break; |
group-onsemi | 0:098463de4c5d | 550 | case WB_NO_WA: |
group-onsemi | 0:098463de4c5d | 551 | *descriptor_l1 |= (1 << SECTION_B_SHIFT) | (1 << SECTION_C_SHIFT); |
group-onsemi | 0:098463de4c5d | 552 | break; |
group-onsemi | 0:098463de4c5d | 553 | } |
group-onsemi | 0:098463de4c5d | 554 | switch(outer) |
group-onsemi | 0:098463de4c5d | 555 | { |
group-onsemi | 0:098463de4c5d | 556 | case NON_CACHEABLE: |
group-onsemi | 0:098463de4c5d | 557 | break; |
group-onsemi | 0:098463de4c5d | 558 | case WB_WA: |
group-onsemi | 0:098463de4c5d | 559 | *descriptor_l1 |= (1 << SECTION_TEX0_SHIFT); |
group-onsemi | 0:098463de4c5d | 560 | break; |
group-onsemi | 0:098463de4c5d | 561 | case WT: |
group-onsemi | 0:098463de4c5d | 562 | *descriptor_l1 |= 1 << SECTION_TEX1_SHIFT; |
group-onsemi | 0:098463de4c5d | 563 | break; |
group-onsemi | 0:098463de4c5d | 564 | case WB_NO_WA: |
group-onsemi | 0:098463de4c5d | 565 | *descriptor_l1 |= (1 << SECTION_TEX0_SHIFT) | (1 << SECTION_TEX0_SHIFT); |
group-onsemi | 0:098463de4c5d | 566 | break; |
group-onsemi | 0:098463de4c5d | 567 | } |
group-onsemi | 0:098463de4c5d | 568 | } |
group-onsemi | 0:098463de4c5d | 569 | |
group-onsemi | 0:098463de4c5d | 570 | return 0; |
group-onsemi | 0:098463de4c5d | 571 | } |
group-onsemi | 0:098463de4c5d | 572 | |
group-onsemi | 0:098463de4c5d | 573 | /** \brief Set 4k/64k page memory attributes |
group-onsemi | 0:098463de4c5d | 574 | |
group-onsemi | 0:098463de4c5d | 575 | The function sets 4k/64k page memory attributes |
group-onsemi | 0:098463de4c5d | 576 | |
group-onsemi | 0:098463de4c5d | 577 | \param [out] descriptor_l2 L2 descriptor. |
group-onsemi | 0:098463de4c5d | 578 | \param [in] mem 4k/64k page memory type: NORMAL, DEVICE, SHARED_DEVICE, NON_SHARED_DEVICE, STRONGLY_ORDERED |
group-onsemi | 0:098463de4c5d | 579 | \param [in] outer Outer cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA, |
group-onsemi | 0:098463de4c5d | 580 | \param [in] inner Inner cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA, |
group-onsemi | 0:098463de4c5d | 581 | |
group-onsemi | 0:098463de4c5d | 582 | \return 0 |
group-onsemi | 0:098463de4c5d | 583 | */ |
group-onsemi | 0:098463de4c5d | 584 | __STATIC_INLINE int __memory_page(uint32_t *descriptor_l2, mmu_memory_Type mem, mmu_cacheability_Type outer, mmu_cacheability_Type inner, mmu_region_size_Type page) |
group-onsemi | 0:098463de4c5d | 585 | { |
group-onsemi | 0:098463de4c5d | 586 | *descriptor_l2 &= PAGE_4K_TEXCB_MASK; |
group-onsemi | 0:098463de4c5d | 587 | |
group-onsemi | 0:098463de4c5d | 588 | if (page == PAGE_64k) |
group-onsemi | 0:098463de4c5d | 589 | { |
group-onsemi | 0:098463de4c5d | 590 | //same as section |
group-onsemi | 0:098463de4c5d | 591 | __memory_section(descriptor_l2, mem, outer, inner); |
group-onsemi | 0:098463de4c5d | 592 | } |
group-onsemi | 0:098463de4c5d | 593 | else |
group-onsemi | 0:098463de4c5d | 594 | { |
group-onsemi | 0:098463de4c5d | 595 | if (STRONGLY_ORDERED == mem) |
group-onsemi | 0:098463de4c5d | 596 | { |
group-onsemi | 0:098463de4c5d | 597 | return 0; |
group-onsemi | 0:098463de4c5d | 598 | } |
group-onsemi | 0:098463de4c5d | 599 | else if (SHARED_DEVICE == mem) |
group-onsemi | 0:098463de4c5d | 600 | { |
group-onsemi | 0:098463de4c5d | 601 | *descriptor_l2 |= (1 << PAGE_4K_B_SHIFT); |
group-onsemi | 0:098463de4c5d | 602 | } |
group-onsemi | 0:098463de4c5d | 603 | else if (NON_SHARED_DEVICE == mem) |
group-onsemi | 0:098463de4c5d | 604 | { |
group-onsemi | 0:098463de4c5d | 605 | *descriptor_l2 |= (1 << PAGE_4K_TEX1_SHIFT); |
group-onsemi | 0:098463de4c5d | 606 | } |
group-onsemi | 0:098463de4c5d | 607 | else if (NORMAL == mem) |
group-onsemi | 0:098463de4c5d | 608 | { |
group-onsemi | 0:098463de4c5d | 609 | *descriptor_l2 |= 1 << PAGE_4K_TEX2_SHIFT; |
group-onsemi | 0:098463de4c5d | 610 | switch(inner) |
group-onsemi | 0:098463de4c5d | 611 | { |
group-onsemi | 0:098463de4c5d | 612 | case NON_CACHEABLE: |
group-onsemi | 0:098463de4c5d | 613 | break; |
group-onsemi | 0:098463de4c5d | 614 | case WB_WA: |
group-onsemi | 0:098463de4c5d | 615 | *descriptor_l2 |= (1 << PAGE_4K_B_SHIFT); |
group-onsemi | 0:098463de4c5d | 616 | break; |
group-onsemi | 0:098463de4c5d | 617 | case WT: |
group-onsemi | 0:098463de4c5d | 618 | *descriptor_l2 |= 1 << PAGE_4K_C_SHIFT; |
group-onsemi | 0:098463de4c5d | 619 | break; |
group-onsemi | 0:098463de4c5d | 620 | case WB_NO_WA: |
group-onsemi | 0:098463de4c5d | 621 | *descriptor_l2 |= (1 << PAGE_4K_B_SHIFT) | (1 << PAGE_4K_C_SHIFT); |
group-onsemi | 0:098463de4c5d | 622 | break; |
group-onsemi | 0:098463de4c5d | 623 | } |
group-onsemi | 0:098463de4c5d | 624 | switch(outer) |
group-onsemi | 0:098463de4c5d | 625 | { |
group-onsemi | 0:098463de4c5d | 626 | case NON_CACHEABLE: |
group-onsemi | 0:098463de4c5d | 627 | break; |
group-onsemi | 0:098463de4c5d | 628 | case WB_WA: |
group-onsemi | 0:098463de4c5d | 629 | *descriptor_l2 |= (1 << PAGE_4K_TEX0_SHIFT); |
group-onsemi | 0:098463de4c5d | 630 | break; |
group-onsemi | 0:098463de4c5d | 631 | case WT: |
group-onsemi | 0:098463de4c5d | 632 | *descriptor_l2 |= 1 << PAGE_4K_TEX1_SHIFT; |
group-onsemi | 0:098463de4c5d | 633 | break; |
group-onsemi | 0:098463de4c5d | 634 | case WB_NO_WA: |
group-onsemi | 0:098463de4c5d | 635 | *descriptor_l2 |= (1 << PAGE_4K_TEX0_SHIFT) | (1 << PAGE_4K_TEX0_SHIFT); |
group-onsemi | 0:098463de4c5d | 636 | break; |
group-onsemi | 0:098463de4c5d | 637 | } |
group-onsemi | 0:098463de4c5d | 638 | } |
group-onsemi | 0:098463de4c5d | 639 | } |
group-onsemi | 0:098463de4c5d | 640 | |
group-onsemi | 0:098463de4c5d | 641 | return 0; |
group-onsemi | 0:098463de4c5d | 642 | } |
group-onsemi | 0:098463de4c5d | 643 | |
group-onsemi | 0:098463de4c5d | 644 | /** \brief Create a L1 section descriptor |
group-onsemi | 0:098463de4c5d | 645 | |
group-onsemi | 0:098463de4c5d | 646 | The function creates a section descriptor. |
group-onsemi | 0:098463de4c5d | 647 | |
group-onsemi | 0:098463de4c5d | 648 | Assumptions: |
group-onsemi | 0:098463de4c5d | 649 | - 16MB super sections not supported |
group-onsemi | 0:098463de4c5d | 650 | - TEX remap disabled, so memory type and attributes are described directly by bits in the descriptor |
group-onsemi | 0:098463de4c5d | 651 | - Functions always return 0 |
group-onsemi | 0:098463de4c5d | 652 | |
group-onsemi | 0:098463de4c5d | 653 | \param [out] descriptor L1 descriptor |
group-onsemi | 0:098463de4c5d | 654 | \param [out] descriptor2 L2 descriptor |
group-onsemi | 0:098463de4c5d | 655 | \param [in] reg Section attributes |
group-onsemi | 0:098463de4c5d | 656 | |
group-onsemi | 0:098463de4c5d | 657 | \return 0 |
group-onsemi | 0:098463de4c5d | 658 | */ |
group-onsemi | 0:098463de4c5d | 659 | __STATIC_INLINE int __get_section_descriptor(uint32_t *descriptor, mmu_region_attributes_Type reg) |
group-onsemi | 0:098463de4c5d | 660 | { |
group-onsemi | 0:098463de4c5d | 661 | *descriptor = 0; |
group-onsemi | 0:098463de4c5d | 662 | |
group-onsemi | 0:098463de4c5d | 663 | __memory_section(descriptor, reg.mem_t, reg.outer_norm_t, reg.inner_norm_t); |
group-onsemi | 0:098463de4c5d | 664 | __xn_section(descriptor,reg.xn_t); |
group-onsemi | 0:098463de4c5d | 665 | __domain_section(descriptor, reg.domain); |
group-onsemi | 0:098463de4c5d | 666 | __p_section(descriptor, reg.e_t); |
group-onsemi | 0:098463de4c5d | 667 | __ap_section(descriptor, reg.priv_t, reg.user_t, 1); |
group-onsemi | 0:098463de4c5d | 668 | __shared_section(descriptor,reg.sh_t); |
group-onsemi | 0:098463de4c5d | 669 | __global_section(descriptor,reg.g_t); |
group-onsemi | 0:098463de4c5d | 670 | __secure_section(descriptor,reg.sec_t); |
group-onsemi | 0:098463de4c5d | 671 | *descriptor &= SECTION_MASK; |
group-onsemi | 0:098463de4c5d | 672 | *descriptor |= SECTION_DESCRIPTOR; |
group-onsemi | 0:098463de4c5d | 673 | |
group-onsemi | 0:098463de4c5d | 674 | return 0; |
group-onsemi | 0:098463de4c5d | 675 | |
group-onsemi | 0:098463de4c5d | 676 | } |
group-onsemi | 0:098463de4c5d | 677 | |
group-onsemi | 0:098463de4c5d | 678 | |
group-onsemi | 0:098463de4c5d | 679 | /** \brief Create a L1 and L2 4k/64k page descriptor |
group-onsemi | 0:098463de4c5d | 680 | |
group-onsemi | 0:098463de4c5d | 681 | The function creates a 4k/64k page descriptor. |
group-onsemi | 0:098463de4c5d | 682 | Assumptions: |
group-onsemi | 0:098463de4c5d | 683 | - TEX remap disabled, so memory type and attributes are described directly by bits in the descriptor |
group-onsemi | 0:098463de4c5d | 684 | - Functions always return 0 |
group-onsemi | 0:098463de4c5d | 685 | |
group-onsemi | 0:098463de4c5d | 686 | \param [out] descriptor L1 descriptor |
group-onsemi | 0:098463de4c5d | 687 | \param [out] descriptor2 L2 descriptor |
group-onsemi | 0:098463de4c5d | 688 | \param [in] reg 4k/64k page attributes |
group-onsemi | 0:098463de4c5d | 689 | |
group-onsemi | 0:098463de4c5d | 690 | \return 0 |
group-onsemi | 0:098463de4c5d | 691 | */ |
group-onsemi | 0:098463de4c5d | 692 | __STATIC_INLINE int __get_page_descriptor(uint32_t *descriptor, uint32_t *descriptor2, mmu_region_attributes_Type reg) |
group-onsemi | 0:098463de4c5d | 693 | { |
group-onsemi | 0:098463de4c5d | 694 | *descriptor = 0; |
group-onsemi | 0:098463de4c5d | 695 | *descriptor2 = 0; |
group-onsemi | 0:098463de4c5d | 696 | |
group-onsemi | 0:098463de4c5d | 697 | switch (reg.rg_t) |
group-onsemi | 0:098463de4c5d | 698 | { |
group-onsemi | 0:098463de4c5d | 699 | case PAGE_4k: |
group-onsemi | 0:098463de4c5d | 700 | __memory_page(descriptor2, reg.mem_t, reg.outer_norm_t, reg.inner_norm_t, PAGE_4k); |
group-onsemi | 0:098463de4c5d | 701 | __xn_page(descriptor2, reg.xn_t, PAGE_4k); |
group-onsemi | 0:098463de4c5d | 702 | __domain_page(descriptor, reg.domain); |
group-onsemi | 0:098463de4c5d | 703 | __p_page(descriptor, reg.e_t); |
group-onsemi | 0:098463de4c5d | 704 | __ap_page(descriptor2, reg.priv_t, reg.user_t, 1); |
group-onsemi | 0:098463de4c5d | 705 | __shared_page(descriptor2,reg.sh_t); |
group-onsemi | 0:098463de4c5d | 706 | __global_page(descriptor2,reg.g_t); |
group-onsemi | 0:098463de4c5d | 707 | __secure_page(descriptor,reg.sec_t); |
group-onsemi | 0:098463de4c5d | 708 | *descriptor &= PAGE_L1_MASK; |
group-onsemi | 0:098463de4c5d | 709 | *descriptor |= PAGE_L1_DESCRIPTOR; |
group-onsemi | 0:098463de4c5d | 710 | *descriptor2 &= PAGE_L2_4K_MASK; |
group-onsemi | 0:098463de4c5d | 711 | *descriptor2 |= PAGE_L2_4K_DESC; |
group-onsemi | 0:098463de4c5d | 712 | break; |
group-onsemi | 0:098463de4c5d | 713 | |
group-onsemi | 0:098463de4c5d | 714 | case PAGE_64k: |
group-onsemi | 0:098463de4c5d | 715 | __memory_page(descriptor2, reg.mem_t, reg.outer_norm_t, reg.inner_norm_t, PAGE_64k); |
group-onsemi | 0:098463de4c5d | 716 | __xn_page(descriptor2, reg.xn_t, PAGE_64k); |
group-onsemi | 0:098463de4c5d | 717 | __domain_page(descriptor, reg.domain); |
group-onsemi | 0:098463de4c5d | 718 | __p_page(descriptor, reg.e_t); |
group-onsemi | 0:098463de4c5d | 719 | __ap_page(descriptor2, reg.priv_t, reg.user_t, 1); |
group-onsemi | 0:098463de4c5d | 720 | __shared_page(descriptor2,reg.sh_t); |
group-onsemi | 0:098463de4c5d | 721 | __global_page(descriptor2,reg.g_t); |
group-onsemi | 0:098463de4c5d | 722 | __secure_page(descriptor,reg.sec_t); |
group-onsemi | 0:098463de4c5d | 723 | *descriptor &= PAGE_L1_MASK; |
group-onsemi | 0:098463de4c5d | 724 | *descriptor |= PAGE_L1_DESCRIPTOR; |
group-onsemi | 0:098463de4c5d | 725 | *descriptor2 &= PAGE_L2_64K_MASK; |
group-onsemi | 0:098463de4c5d | 726 | *descriptor2 |= PAGE_L2_64K_DESC; |
group-onsemi | 0:098463de4c5d | 727 | break; |
group-onsemi | 0:098463de4c5d | 728 | |
group-onsemi | 0:098463de4c5d | 729 | case SECTION: |
group-onsemi | 0:098463de4c5d | 730 | //error |
group-onsemi | 0:098463de4c5d | 731 | break; |
group-onsemi | 0:098463de4c5d | 732 | |
group-onsemi | 0:098463de4c5d | 733 | } |
group-onsemi | 0:098463de4c5d | 734 | |
group-onsemi | 0:098463de4c5d | 735 | return 0; |
group-onsemi | 0:098463de4c5d | 736 | |
group-onsemi | 0:098463de4c5d | 737 | } |
group-onsemi | 0:098463de4c5d | 738 | |
group-onsemi | 0:098463de4c5d | 739 | /** \brief Create a 1MB Section |
group-onsemi | 0:098463de4c5d | 740 | |
group-onsemi | 0:098463de4c5d | 741 | \param [in] ttb Translation table base address |
group-onsemi | 0:098463de4c5d | 742 | \param [in] base_address Section base address |
group-onsemi | 0:098463de4c5d | 743 | \param [in] count Number of sections to create |
group-onsemi | 0:098463de4c5d | 744 | \param [in] descriptor_l1 L1 descriptor (region attributes) |
group-onsemi | 0:098463de4c5d | 745 | |
group-onsemi | 0:098463de4c5d | 746 | */ |
group-onsemi | 0:098463de4c5d | 747 | __STATIC_INLINE void __TTSection(uint32_t *ttb, uint32_t base_address, uint32_t count, uint32_t descriptor_l1) |
group-onsemi | 0:098463de4c5d | 748 | { |
group-onsemi | 0:098463de4c5d | 749 | uint32_t offset; |
group-onsemi | 0:098463de4c5d | 750 | uint32_t entry; |
group-onsemi | 0:098463de4c5d | 751 | uint32_t i; |
group-onsemi | 0:098463de4c5d | 752 | |
group-onsemi | 0:098463de4c5d | 753 | offset = base_address >> 20; |
group-onsemi | 0:098463de4c5d | 754 | entry = (base_address & 0xFFF00000) | descriptor_l1; |
group-onsemi | 0:098463de4c5d | 755 | |
group-onsemi | 0:098463de4c5d | 756 | //4 bytes aligned |
group-onsemi | 0:098463de4c5d | 757 | ttb = ttb + offset; |
group-onsemi | 0:098463de4c5d | 758 | |
group-onsemi | 0:098463de4c5d | 759 | for (i = 0; i < count; i++ ) |
group-onsemi | 0:098463de4c5d | 760 | { |
group-onsemi | 0:098463de4c5d | 761 | //4 bytes aligned |
group-onsemi | 0:098463de4c5d | 762 | *ttb++ = entry; |
group-onsemi | 0:098463de4c5d | 763 | entry += OFFSET_1M; |
group-onsemi | 0:098463de4c5d | 764 | } |
group-onsemi | 0:098463de4c5d | 765 | } |
group-onsemi | 0:098463de4c5d | 766 | |
group-onsemi | 0:098463de4c5d | 767 | /** \brief Create a 4k page entry |
group-onsemi | 0:098463de4c5d | 768 | |
group-onsemi | 0:098463de4c5d | 769 | \param [in] ttb L1 table base address |
group-onsemi | 0:098463de4c5d | 770 | \param [in] base_address 4k base address |
group-onsemi | 0:098463de4c5d | 771 | \param [in] count Number of 4k pages to create |
group-onsemi | 0:098463de4c5d | 772 | \param [in] descriptor_l1 L1 descriptor (region attributes) |
group-onsemi | 0:098463de4c5d | 773 | \param [in] ttb_l2 L2 table base address |
group-onsemi | 0:098463de4c5d | 774 | \param [in] descriptor_l2 L2 descriptor (region attributes) |
group-onsemi | 0:098463de4c5d | 775 | |
group-onsemi | 0:098463de4c5d | 776 | */ |
group-onsemi | 0:098463de4c5d | 777 | __STATIC_INLINE void __TTPage_4k(uint32_t *ttb, uint32_t base_address, uint32_t count, uint32_t descriptor_l1, uint32_t *ttb_l2, uint32_t descriptor_l2 ) |
group-onsemi | 0:098463de4c5d | 778 | { |
group-onsemi | 0:098463de4c5d | 779 | |
group-onsemi | 0:098463de4c5d | 780 | uint32_t offset, offset2; |
group-onsemi | 0:098463de4c5d | 781 | uint32_t entry, entry2; |
group-onsemi | 0:098463de4c5d | 782 | uint32_t i; |
group-onsemi | 0:098463de4c5d | 783 | |
group-onsemi | 0:098463de4c5d | 784 | |
group-onsemi | 0:098463de4c5d | 785 | offset = base_address >> 20; |
group-onsemi | 0:098463de4c5d | 786 | entry = ((int)ttb_l2 & 0xFFFFFC00) | descriptor_l1; |
group-onsemi | 0:098463de4c5d | 787 | |
group-onsemi | 0:098463de4c5d | 788 | //4 bytes aligned |
group-onsemi | 0:098463de4c5d | 789 | ttb += offset; |
group-onsemi | 0:098463de4c5d | 790 | //create l1_entry |
group-onsemi | 0:098463de4c5d | 791 | *ttb = entry; |
group-onsemi | 0:098463de4c5d | 792 | |
group-onsemi | 0:098463de4c5d | 793 | offset2 = (base_address & 0xff000) >> 12; |
group-onsemi | 0:098463de4c5d | 794 | ttb_l2 += offset2; |
group-onsemi | 0:098463de4c5d | 795 | entry2 = (base_address & 0xFFFFF000) | descriptor_l2; |
group-onsemi | 0:098463de4c5d | 796 | for (i = 0; i < count; i++ ) |
group-onsemi | 0:098463de4c5d | 797 | { |
group-onsemi | 0:098463de4c5d | 798 | //4 bytes aligned |
group-onsemi | 0:098463de4c5d | 799 | *ttb_l2++ = entry2; |
group-onsemi | 0:098463de4c5d | 800 | entry2 += OFFSET_4K; |
group-onsemi | 0:098463de4c5d | 801 | } |
group-onsemi | 0:098463de4c5d | 802 | } |
group-onsemi | 0:098463de4c5d | 803 | |
group-onsemi | 0:098463de4c5d | 804 | /** \brief Create a 64k page entry |
group-onsemi | 0:098463de4c5d | 805 | |
group-onsemi | 0:098463de4c5d | 806 | \param [in] ttb L1 table base address |
group-onsemi | 0:098463de4c5d | 807 | \param [in] base_address 64k base address |
group-onsemi | 0:098463de4c5d | 808 | \param [in] count Number of 64k pages to create |
group-onsemi | 0:098463de4c5d | 809 | \param [in] descriptor_l1 L1 descriptor (region attributes) |
group-onsemi | 0:098463de4c5d | 810 | \param [in] ttb_l2 L2 table base address |
group-onsemi | 0:098463de4c5d | 811 | \param [in] descriptor_l2 L2 descriptor (region attributes) |
group-onsemi | 0:098463de4c5d | 812 | |
group-onsemi | 0:098463de4c5d | 813 | */ |
group-onsemi | 0:098463de4c5d | 814 | __STATIC_INLINE void __TTPage_64k(uint32_t *ttb, uint32_t base_address, uint32_t count, uint32_t descriptor_l1, uint32_t *ttb_l2, uint32_t descriptor_l2 ) |
group-onsemi | 0:098463de4c5d | 815 | { |
group-onsemi | 0:098463de4c5d | 816 | uint32_t offset, offset2; |
group-onsemi | 0:098463de4c5d | 817 | uint32_t entry, entry2; |
group-onsemi | 0:098463de4c5d | 818 | uint32_t i,j; |
group-onsemi | 0:098463de4c5d | 819 | |
group-onsemi | 0:098463de4c5d | 820 | |
group-onsemi | 0:098463de4c5d | 821 | offset = base_address >> 20; |
group-onsemi | 0:098463de4c5d | 822 | entry = ((int)ttb_l2 & 0xFFFFFC00) | descriptor_l1; |
group-onsemi | 0:098463de4c5d | 823 | |
group-onsemi | 0:098463de4c5d | 824 | //4 bytes aligned |
group-onsemi | 0:098463de4c5d | 825 | ttb += offset; |
group-onsemi | 0:098463de4c5d | 826 | //create l1_entry |
group-onsemi | 0:098463de4c5d | 827 | *ttb = entry; |
group-onsemi | 0:098463de4c5d | 828 | |
group-onsemi | 0:098463de4c5d | 829 | offset2 = (base_address & 0xff000) >> 12; |
group-onsemi | 0:098463de4c5d | 830 | ttb_l2 += offset2; |
group-onsemi | 0:098463de4c5d | 831 | entry2 = (base_address & 0xFFFF0000) | descriptor_l2; |
group-onsemi | 0:098463de4c5d | 832 | for (i = 0; i < count; i++ ) |
group-onsemi | 0:098463de4c5d | 833 | { |
group-onsemi | 0:098463de4c5d | 834 | //create 16 entries |
group-onsemi | 0:098463de4c5d | 835 | for (j = 0; j < 16; j++) |
group-onsemi | 0:098463de4c5d | 836 | //4 bytes aligned |
group-onsemi | 0:098463de4c5d | 837 | *ttb_l2++ = entry2; |
group-onsemi | 0:098463de4c5d | 838 | entry2 += OFFSET_64K; |
group-onsemi | 0:098463de4c5d | 839 | } |
group-onsemi | 0:098463de4c5d | 840 | } |
group-onsemi | 0:098463de4c5d | 841 | |
group-onsemi | 0:098463de4c5d | 842 | /*@} end of MMU_Functions */ |
group-onsemi | 0:098463de4c5d | 843 | #endif |
group-onsemi | 0:098463de4c5d | 844 | |
group-onsemi | 0:098463de4c5d | 845 | #ifdef __cplusplus |
group-onsemi | 0:098463de4c5d | 846 | } |
group-onsemi | 0:098463de4c5d | 847 | #endif |