Mistake on this page?
Report an issue in GitHub or email us
mbed_mpu_mgmt.h
1 /** \addtogroup platform */
2 /** @{*/
3 /**
4  * \defgroup platform_mpu_mgmt MPU management functions
5  * @{
6  */
7 
8 /* mbed Microcontroller Library
9  * Copyright (c) 2006-2018 ARM Limited
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 #ifndef MBED_MPU_MGMT_H
24 #define MBED_MPU_MGMT_H
25 
26 #include "mbed_toolchain.h"
27 #include "hal/mpu_api.h"
28 #include <stdbool.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #if (DEVICE_MPU && MBED_CONF_PLATFORM_USE_MPU) || defined(DOXYGEN_ONLY)
35 
36 #define mbed_mpu_manager_init() mbed_mpu_init()
37 
38 #define mbed_mpu_manager_deinit() mbed_mpu_free()
39 
40 /** Lock ram execute never mode off
41  *
42  * This disables the MPU's execute never ram protection and allows
43  * functions to run from RAM. Execution directly from ram will be
44  * allowed if this function is invoked at least once (the internal
45  * counter is non-zero).
46  *
47  * Use this locking mechanism for code which needs to execute from
48  * ram such as flash programming algorithms and ram thunks.
49  *
50  * The lock is a counter, can be locked up to USHRT_MAX
51  * This function is IRQ and thread safe
52  */
54 
55 /** Unlock ram execute never mode
56  *
57  * Use unlocking in pair with mbed_mpu_manager_lock_ram_execution().
58  *
59  * The lock is a counter, should be equally unlocked as locked
60  * This function is IRQ and thread safe
61  */
63 
64 /** Lock rom write never mode off
65  *
66  * This disables the MPU's read only ROM protection and allows
67  * ROM to be written to. Writing to ROM will not result in an MPU
68  * fault if this function is invoked at least once (the internal
69  * counter is non-zero).
70  *
71  * Use this locking mechanism for code which needs to write to
72  * ROM such as flash programming algorithms.
73  *
74  * The lock is a counter, can be locked up to USHRT_MAX
75  * This function is IRQ and thread safe
76  */
78 
79 /** Unlock rom write never mode
80  *
81  * Use unlocking in pair with mbed_mpu_manager_lock_rom_write().
82  *
83  * The lock is a counter, should be equally unlocked as locked
84  * This function is IRQ and thread safe
85  */
87 
88 #else
89 
90 #define mbed_mpu_manager_init() (void)0
91 
92 #define mbed_mpu_manager_deinit() (void)0
93 
94 #define mbed_mpu_manager_lock_ram_execution() (void)0
95 
96 #define mbed_mpu_manager_unlock_ram_execution() (void)0
97 
98 #define mbed_mpu_manager_lock_rom_write() (void)0
99 
100 #define mbed_mpu_manager_unlock_rom_write() (void)0
101 
102 #endif
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif
109 
110 /** @}*/
111 /** @}*/
void mbed_mpu_manager_lock_ram_execution(void)
Lock ram execute never mode off.
void mbed_mpu_manager_unlock_rom_write(void)
Unlock rom write never mode.
void mbed_mpu_manager_unlock_ram_execution(void)
Unlock ram execute never mode.
void mbed_mpu_manager_lock_rom_write(void)
Lock rom write never mode off.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.