test

Dependencies:   mbed Watchdog

Dependents:   STM32-MC_node

Committer:
ommpy
Date:
Mon Jul 06 17:18:59 2020 +0530
Revision:
0:d383e2dee0f7
first commit

Who changed what in which revision?

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