AM263x MCU+ SDK  10.00.00
MpuP_armv7.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2023 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef MPUP_ARM_V7_H
34 #define MPUP_ARM_V7_H
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include <stdint.h>
41 #include <kernel/dpl/SystemP.h>
42 
55 typedef enum MpuP_AccessPerm_
56 {
57  MpuP_AP_ALL_BLOCK = (0x0u),
58  MpuP_AP_S_RW = (0x1u),
59  MpuP_AP_S_RW_U_R = (0x2u),
60  MpuP_AP_ALL_RW = (0x3u),
61  MpuP_AP_S_R = (0x5u),
62  MpuP_AP_ALL_R = (0x6u)
64 
68 typedef enum MpuP_RegionSize_ {
98 
107 typedef struct MpuP_RegionAttrs_ {
108 
109  uint8_t isEnable;
110  uint8_t isCacheable;
111  uint8_t isBufferable;
112  uint8_t isSharable;
113  uint8_t isExecuteNever;
114  uint8_t tex;
115  uint8_t accessPerm;
118 
122 typedef struct MpuP_RegionConfig_ {
123 
124  uint32_t baseAddr;
125  uint32_t size;
129 
133 typedef struct MpuP_Config_ {
134 
135  uint32_t numRegions;
137  uint32_t enableMpu;
139 } MpuP_Config;
140 
149 
161 void MpuP_setRegion(uint32_t regionNum, void * addr, uint32_t size, MpuP_RegionAttrs *attrs);
162 
166 void MpuP_enable(void);
167 
171 void MpuP_disable(void);
172 
178 uint32_t MpuP_isEnable(void);
179 
184 void MpuP_init(void);
185 
188 #ifdef __cplusplus
189 }
190 #endif
191 
192 #endif /* MPUP_ARM_V7_H */
MpuP_RegionSize_2M
@ MpuP_RegionSize_2M
Definition: MpuP_armv7.h:85
MpuP_RegionAttrs::tex
uint8_t tex
Definition: MpuP_armv7.h:114
MpuP_RegionAttrs_init
void MpuP_RegionAttrs_init(MpuP_RegionAttrs *region)
Set default values to MpuP_RegionAttrs.
MpuP_RegionConfig::size
uint32_t size
Definition: MpuP_armv7.h:125
MpuP_RegionSize_8K
@ MpuP_RegionSize_8K
Definition: MpuP_armv7.h:77
MpuP_Config::enableMpu
uint32_t enableMpu
Definition: MpuP_armv7.h:137
MpuP_RegionSize_4G
@ MpuP_RegionSize_4G
Definition: MpuP_armv7.h:96
MpuP_RegionSize_32
@ MpuP_RegionSize_32
Definition: MpuP_armv7.h:69
SystemP.h
MpuP_RegionAttrs::subregionDisableMask
uint8_t subregionDisableMask
Definition: MpuP_armv7.h:116
MpuP_RegionSize_512
@ MpuP_RegionSize_512
Definition: MpuP_armv7.h:73
MpuP_RegionSize_256K
@ MpuP_RegionSize_256K
Definition: MpuP_armv7.h:82
MpuP_RegionSize_64
@ MpuP_RegionSize_64
Definition: MpuP_armv7.h:70
MpuP_RegionSize_16M
@ MpuP_RegionSize_16M
Definition: MpuP_armv7.h:88
MpuP_RegionAttrs::isCacheable
uint8_t isCacheable
Definition: MpuP_armv7.h:110
MpuP_AP_ALL_R
@ MpuP_AP_ALL_R
Definition: MpuP_armv7.h:62
MpuP_RegionAttrs::isExecuteNever
uint8_t isExecuteNever
Definition: MpuP_armv7.h:113
MpuP_disable
void MpuP_disable(void)
Disable MPU sub-system.
MpuP_RegionAttrs::isSharable
uint8_t isSharable
Definition: MpuP_armv7.h:112
MpuP_RegionSize
MpuP_RegionSize
Enum's to represent different possible MPU region size.
Definition: MpuP_armv7.h:68
MpuP_RegionAttrs::isEnable
uint8_t isEnable
Definition: MpuP_armv7.h:109
MpuP_Config::numRegions
uint32_t numRegions
Definition: MpuP_armv7.h:135
MpuP_RegionSize_256
@ MpuP_RegionSize_256
Definition: MpuP_armv7.h:72
MpuP_AP_S_R
@ MpuP_AP_S_R
Definition: MpuP_armv7.h:61
MpuP_RegionSize_2K
@ MpuP_RegionSize_2K
Definition: MpuP_armv7.h:75
MpuP_RegionSize_32M
@ MpuP_RegionSize_32M
Definition: MpuP_armv7.h:89
MpuP_RegionSize_4K
@ MpuP_RegionSize_4K
Definition: MpuP_armv7.h:76
MpuP_RegionSize_64K
@ MpuP_RegionSize_64K
Definition: MpuP_armv7.h:80
MpuP_RegionSize_128K
@ MpuP_RegionSize_128K
Definition: MpuP_armv7.h:81
MpuP_RegionSize_1K
@ MpuP_RegionSize_1K
Definition: MpuP_armv7.h:74
MpuP_RegionSize_4M
@ MpuP_RegionSize_4M
Definition: MpuP_armv7.h:86
MpuP_RegionAttrs::accessPerm
uint8_t accessPerm
Definition: MpuP_armv7.h:115
MpuP_Config
MPU config structure, this used by SysConfig and not to be used by end-users directly.
Definition: MpuP_armv7.h:133
MpuP_RegionSize_16K
@ MpuP_RegionSize_16K
Definition: MpuP_armv7.h:78
MpuP_AP_ALL_RW
@ MpuP_AP_ALL_RW
Definition: MpuP_armv7.h:60
MpuP_AccessPerm
MpuP_AccessPerm
Enum's to represent different types of access permissions that are possible for a given MPU region.
Definition: MpuP_armv7.h:56
MpuP_AP_S_RW_U_R
@ MpuP_AP_S_RW_U_R
Definition: MpuP_armv7.h:59
MpuP_init
void MpuP_init(void)
Initialize MPU sub-system, called by SysConfig, not to be called by end users.
MpuP_AP_ALL_BLOCK
@ MpuP_AP_ALL_BLOCK
Definition: MpuP_armv7.h:57
MpuP_RegionConfig::attrs
MpuP_RegionAttrs attrs
Definition: MpuP_armv7.h:126
MpuP_RegionConfig
Region config structure, this used by SysConfig and not to be used by end-users directly.
Definition: MpuP_armv7.h:122
MpuP_RegionSize_8M
@ MpuP_RegionSize_8M
Definition: MpuP_armv7.h:87
MpuP_RegionSize_1M
@ MpuP_RegionSize_1M
Definition: MpuP_armv7.h:84
MpuP_RegionSize_128
@ MpuP_RegionSize_128
Definition: MpuP_armv7.h:71
MpuP_Config::enableBackgroundRegion
uint32_t enableBackgroundRegion
Definition: MpuP_armv7.h:136
MpuP_RegionAttrs
Attribute's to apply for a MPU region.
Definition: MpuP_armv7.h:107
MpuP_RegionSize_64M
@ MpuP_RegionSize_64M
Definition: MpuP_armv7.h:90
MpuP_RegionSize_256M
@ MpuP_RegionSize_256M
Definition: MpuP_armv7.h:92
MpuP_RegionSize_1G
@ MpuP_RegionSize_1G
Definition: MpuP_armv7.h:94
MpuP_RegionSize_512K
@ MpuP_RegionSize_512K
Definition: MpuP_armv7.h:83
MpuP_RegionSize_2G
@ MpuP_RegionSize_2G
Definition: MpuP_armv7.h:95
MpuP_RegionSize_32K
@ MpuP_RegionSize_32K
Definition: MpuP_armv7.h:79
MpuP_RegionSize_128M
@ MpuP_RegionSize_128M
Definition: MpuP_armv7.h:91
MpuP_RegionConfig::baseAddr
uint32_t baseAddr
Definition: MpuP_armv7.h:124
MpuP_AP_S_RW
@ MpuP_AP_S_RW
Definition: MpuP_armv7.h:58
MpuP_setRegion
void MpuP_setRegion(uint32_t regionNum, void *addr, uint32_t size, MpuP_RegionAttrs *attrs)
Setup a region in the MPU.
MpuP_isEnable
uint32_t MpuP_isEnable(void)
Check if MPU sub-system is enabled.
MpuP_RegionSize_512M
@ MpuP_RegionSize_512M
Definition: MpuP_armv7.h:93
MpuP_enable
void MpuP_enable(void)
Enable MPU sub-system using the region that are setup using MpuP_setRegion.
MpuP_RegionAttrs::isBufferable
uint8_t isBufferable
Definition: MpuP_armv7.h:111