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