MT2523 API Reference  LinkIt SDK v4
hal_mpu.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __HAL_MPU_H__
36 #define __HAL_MPU_H__
37 #include "hal_platform.h"
38 
39 #ifdef HAL_MPU_MODULE_ENABLED
40 
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
131 
132 
133 /*****************************************************************************
134  * Enums
135  *****************************************************************************/
136 
142 typedef enum {
151 
153 typedef enum {
164 
166 typedef enum {
198 
200 typedef enum {
209 
214 /*****************************************************************************
215  * Structures
216  *****************************************************************************/
217 
223 typedef struct {
224  bool privdefena;
225  bool hfnmiena;
227 
229 typedef struct {
231  hal_mpu_region_size_t mpu_region_size;
234  bool mpu_xn;
236 
241 /*****************************************************************************
242  * Functions
243  *****************************************************************************/
244 
254 
261 
268 
275 
283 hal_mpu_status_t hal_mpu_region_enable(hal_mpu_region_t region);
284 
292 hal_mpu_status_t hal_mpu_region_disable(hal_mpu_region_t region);
293 
305 hal_mpu_status_t hal_mpu_region_configure(hal_mpu_region_t region, const hal_mpu_region_config_t *region_config);
306 
307 #ifdef __cplusplus
308 }
309 #endif
310 
316 #endif /* HAL_MPU_MODULE_ENABLED */
317 #endif /* __HAL_MPU_H__ */
318 
MPU region size is 64MB.
Definition: hal_mpu.h:189
MPU region size is 128B.
Definition: hal_mpu.h:170
MPU region size is 512MB.
Definition: hal_mpu.h:192
Access from privileged software only.
Definition: hal_mpu.h:202
MPU region 4.
Definition: hal_mpu.h:158
Reserved access permission, results in unpredictable MPU behavior.
Definition: hal_mpu.h:205
hal_mpu_access_permission_t
MPU access permission indicates the access rights of the specified region.
Definition: hal_mpu.h:200
MPU region size is 128MB.
Definition: hal_mpu.h:190
MPU region size is 16MB.
Definition: hal_mpu.h:187
MPU region size is 32MB.
Definition: hal_mpu.h:188
Invalid parameter.
Definition: hal_mpu.h:143
MPU error, errors other than reasons described above.
Definition: hal_mpu.h:148
MPU region size is 4KB.
Definition: hal_mpu.h:175
MPU region size is 4GB.
Definition: hal_mpu.h:195
MPU region size is 512KB.
Definition: hal_mpu.h:182
hal_mpu_status_t hal_mpu_init(const hal_mpu_config_t *mpu_config)
MPU initialization function.
MPU region size is 2GB.
Definition: hal_mpu.h:194
MPU is busy.
Definition: hal_mpu.h:144
MPU region size error, MPU region size is not a value of type hal_mpu_region_size_t.
Definition: hal_mpu.h:147
hal_mpu_status_t
This enum defines the MPU API return status.
Definition: hal_mpu.h:142
MPU region size is 32KB.
Definition: hal_mpu.h:178
hal_mpu_status_t hal_mpu_region_configure(hal_mpu_region_t region, const hal_mpu_region_config_t *region_config)
MPU region configuration function.
MPU region size is 64KB.
Definition: hal_mpu.h:179
MPU region 6.
Definition: hal_mpu.h:160
hal_mpu_status_t hal_mpu_deinit(void)
MPU deinitialization function.
Full access for both the privileged and unprivileged software.
Definition: hal_mpu.h:204
MPU ok.
Definition: hal_mpu.h:149
MPU region size is 1MB.
Definition: hal_mpu.h:183
bool mpu_xn
XN attribute of MPU, if set TRUE, execution of an instruction fetched from the corresponding region i...
Definition: hal_mpu.h:234
MPU region size is 64B.
Definition: hal_mpu.h:169
hal_mpu_status_t hal_mpu_region_disable(hal_mpu_region_t region)
MPU region disable function.
MPU region 3.
Definition: hal_mpu.h:157
MPU region size is 32B.
Definition: hal_mpu.h:168
MPU region 7.
Definition: hal_mpu.h:161
hal_mpu_status_t hal_mpu_enable(void)
MPU enable function.
hal_mpu_region_size_t
MPU region size.
Definition: hal_mpu.h:166
MPU region number error, MPU region is not a value of type hal_mpu_region_t.
Definition: hal_mpu.h:145
uint8_t mpu_subregion_mask
MPU sub region mask.
Definition: hal_mpu.h:233
MPU region size is 256B.
Definition: hal_mpu.h:171
MPU region size is 256KB.
Definition: hal_mpu.h:181
MPU region address error, MPU region address is not valid.
Definition: hal_mpu.h:146
hal_mpu_region_t
MPU region number.
Definition: hal_mpu.h:153
MPU region 1.
Definition: hal_mpu.h:155
hal_mpu_access_permission_t mpu_region_access_permission
MPU region access permission.
Definition: hal_mpu.h:232
MPU region size is 2KB.
Definition: hal_mpu.h:174
MPU region size is 8KB.
Definition: hal_mpu.h:176
hal_mpu_status_t hal_mpu_region_enable(hal_mpu_region_t region)
MPU region enable function.
MPU region 2.
Definition: hal_mpu.h:156
MPU configuration structure for the MPU features "PRIVDEFENA" and "HFNMIENA".
Definition: hal_mpu.h:223
Max MPU region size (invalid)
Definition: hal_mpu.h:196
bool privdefena
Enables MPU privileged default memory map.
Definition: hal_mpu.h:224
MPU region 5.
Definition: hal_mpu.h:159
MPU region size is 256MB.
Definition: hal_mpu.h:191
Max MPU region number (invalid)
Definition: hal_mpu.h:162
MPU region size is 128KB.
Definition: hal_mpu.h:180
Read only for the privileged software.
Definition: hal_mpu.h:206
MPU region size is 1KB.
Definition: hal_mpu.h:173
MPU region size is 16KB.
Definition: hal_mpu.h:177
MPU region size is 1GB.
Definition: hal_mpu.h:193
uint32_t mpu_region_address
MPU region start address.
Definition: hal_mpu.h:230
hal_mpu_status_t hal_mpu_disable(void)
MPU disable function.
Read only for both the privileged and unprivileged software.
Definition: hal_mpu.h:207
Minimum MPU size (invalid)
Definition: hal_mpu.h:167
hal_mpu_region_size_t mpu_region_size
MPU region size.
Definition: hal_mpu.h:231
MPU region size is 4MB.
Definition: hal_mpu.h:185
MPU region size is 2MB.
Definition: hal_mpu.h:184
MPU region 0.
Definition: hal_mpu.h:154
MPU region size is 512B.
Definition: hal_mpu.h:172
bool hfnmiena
MPU enabled or not during the HardFault and NMI handler.
Definition: hal_mpu.h:225
No access for both the privileged and unprivileged software.
Definition: hal_mpu.h:201
Read and write for the privileged software, read only for the unprivileged software.
Definition: hal_mpu.h:203
MPU region config structure contains the start address, the size and access rights of the region...
Definition: hal_mpu.h:229
MPU region size is 8MB.
Definition: hal_mpu.h:186