mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
mbed_mpu_mgmt.h
00001 /** \addtogroup platform */ 00002 /** @{*/ 00003 /** 00004 * \defgroup platform_mpu_mgmt MPU management functions 00005 * @{ 00006 */ 00007 00008 /* mbed Microcontroller Library 00009 * Copyright (c) 2006-2018 ARM Limited 00010 * 00011 * Licensed under the Apache License, Version 2.0 (the "License"); 00012 * you may not use this file except in compliance with the License. 00013 * You may obtain a copy of the License at 00014 * 00015 * http://www.apache.org/licenses/LICENSE-2.0 00016 * 00017 * Unless required by applicable law or agreed to in writing, software 00018 * distributed under the License is distributed on an "AS IS" BASIS, 00019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 * See the License for the specific language governing permissions and 00021 * limitations under the License. 00022 */ 00023 #ifndef MBED_MPU_MGMT_H 00024 #define MBED_MPU_MGMT_H 00025 00026 #include "mbed_toolchain.h" 00027 #include "hal/mpu_api.h" 00028 #include <stdbool.h> 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 #if (DEVICE_MPU && MBED_CONF_PLATFORM_USE_MPU) || defined(DOXYGEN_ONLY) 00035 00036 #define mbed_mpu_manager_init() mbed_mpu_init() 00037 00038 #define mbed_mpu_manager_deinit() mbed_mpu_free() 00039 00040 /** Lock ram execute never mode off 00041 * 00042 * This disables the MPU's execute never ram protection and allows 00043 * functions to run from RAM. Execution directly from ram will be 00044 * allowed if this function is invoked at least once (the internal 00045 * counter is non-zero). 00046 * 00047 * Use this locking mechanism for code which needs to execute from 00048 * ram such as flash programming algorithms and ram thunks. 00049 * 00050 * The lock is a counter, can be locked up to USHRT_MAX 00051 * This function is IRQ and thread safe 00052 */ 00053 void mbed_mpu_manager_lock_ram_execution(void); 00054 00055 /** Unlock ram execute never mode 00056 * 00057 * Use unlocking in pair with mbed_mpu_manager_lock_ram_execution(). 00058 * 00059 * The lock is a counter, should be equally unlocked as locked 00060 * This function is IRQ and thread safe 00061 */ 00062 void mbed_mpu_manager_unlock_ram_execution(void); 00063 00064 /** Lock rom write never mode off 00065 * 00066 * This disables the MPU's read only ROM protection and allows 00067 * ROM to be written to. Writing to ROM will not result in an MPU 00068 * fault if this function is invoked at least once (the internal 00069 * counter is non-zero). 00070 * 00071 * Use this locking mechanism for code which needs to write to 00072 * ROM such as flash programming algorithms. 00073 * 00074 * The lock is a counter, can be locked up to USHRT_MAX 00075 * This function is IRQ and thread safe 00076 */ 00077 void mbed_mpu_manager_lock_rom_write(void); 00078 00079 /** Unlock rom write never mode 00080 * 00081 * Use unlocking in pair with mbed_mpu_manager_lock_rom_write(). 00082 * 00083 * The lock is a counter, should be equally unlocked as locked 00084 * This function is IRQ and thread safe 00085 */ 00086 void mbed_mpu_manager_unlock_rom_write(void); 00087 00088 #else 00089 00090 #define mbed_mpu_manager_init() (void)0 00091 00092 #define mbed_mpu_manager_deinit() (void)0 00093 00094 #define mbed_mpu_manager_lock_ram_execution() (void)0 00095 00096 #define mbed_mpu_manager_unlock_ram_execution() (void)0 00097 00098 #define mbed_mpu_manager_lock_rom_write() (void)0 00099 00100 #define mbed_mpu_manager_unlock_rom_write() (void)0 00101 00102 #endif 00103 00104 #ifdef __cplusplus 00105 } 00106 #endif 00107 00108 #endif 00109 00110 /** @}*/ 00111 /** @}*/
Generated on Tue Jul 12 2022 20:41:15 by 1.7.2