88 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /****************************************************************************
 | |
| 
 | |
| Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
 | |
| 
 | |
| This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
 | |
| be copied by any method or incorporated into another program without
 | |
| the express written consent of Aerospace C.Power. This Information or any portion
 | |
| thereof remains the property of Aerospace C.Power. The Information contained herein
 | |
| is believed to be accurate and Aerospace C.Power assumes no responsibility or
 | |
| liability for its use in any way and conveys no license or title under
 | |
| any patent or copyright and makes no representation or warranty that this
 | |
| Information is free from patent or copyright infringement.
 | |
| 
 | |
| ****************************************************************************/
 | |
| #ifndef LIB_MMON_H
 | |
| #define LIB_MMON_H
 | |
| 
 | |
| /**
 | |
|  * @addtogroup LIB
 | |
|  * @{
 | |
|  */
 | |
| 
 | |
| #define MMON_PRV_EXEC    (0x01)
 | |
| #define MMON_PRV_WRITE   (0x02)
 | |
| #define MMON_PRV_READ    (0x04)
 | |
| 
 | |
| /**
 | |
|  * @addtogroup MMON
 | |
|  * @{
 | |
|  * This section introduces the memory monitor module's enum, structure, functions and how to use this module.
 | |
|  */
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| /**
 | |
|  * @brief This function is to enable memory range access.
 | |
|  * @param region The PMP region to configure.
 | |
|  * @param start is memeory start address.
 | |
|  * @param size  is memory size.
 | |
|  * @return bool_t is true if pmp configure successfully.
 | |
|  */
 | |
| bool_t mmon_disable_address_access(uint32_t region,uint32_t start, uint32_t size);
 | |
| 
 | |
| /**
 | |
|  * @brief This function is to disable memory range access.
 | |
|  * @param start is memeory start address.
 | |
|  * @param size  is memory size.
 | |
|  * @param privilege  is permission required to enable.
 | |
|  * @return bool_t is true if pmp configure successfully.
 | |
|  */
 | |
| bool_t mmon_set_address_access(uint32_t start, uint32_t size, uint32_t privilege);
 | |
| 
 | |
| /**
 | |
|  * @brief This function is to config memory range access, support all
 | |
|  *        address-matching mode of the PMP.
 | |
|  *        This function will force clear the original configuration
 | |
|  *
 | |
|  * @param region is the PMP region to configure.
 | |
|  * @param mode  is PMP mode to configure.
 | |
|  * @param start is memeory start address.
 | |
|  * @param size_end is memory size(PMP_OFF/PMP_NA4/PMP_NAPOT) or
 | |
|  *                memeory end address(PMP_TOR).
 | |
|  * @param privilege is permission required to enable.
 | |
|  * @return bool_t is true if pmp configure successfully.
 | |
|  */
 | |
| bool_t mmon_set_mode_address_access(uint32_t region, enum pmp_address_mode mode,
 | |
|                                 uint32_t start, uint32_t size_end,
 | |
|                                 uint32_t privilege);
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| /**
 | |
|  * @}
 | |
|  * addtogroup MMON
 | |
|  */
 | |
| 
 | |
| /**
 | |
| * @}
 | |
|  * addtogroup LIB
 | |
| */
 | |
| 
 | |
| #endif   //LIB_MMON_H
 | |
| 
 |