PDK API Guide for J721E
SafeRTOS_MPU.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2021 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 
44 #ifndef SAFERTOS_MPU_H
45 #define SAFERTOS_MPU_H
46 /* ========================================================================== */
47 /* Include Files */
48 /* ========================================================================== */
49 /* Generic headers */
50 #include <stdlib.h>
51 #include <stdint.h>
52 #include <string.h>
53 #include <ti/csl/csl_types.h>
54 
55 /* SafeRTOS includes */
56 #include "SafeRTOS_API.h"
57 
58 #define CSL_ARM_R5F_MPU_REGIONS_MAX ((uint32_t) 16U)
59 #define CSL_ARM_R5_MPU_REGION_SIZE_32BYTE ((uint32_t) 32U)
60 
61 #define CSL_ARM_R5_ACC_PERM_PRIV_USR_RD_WR ((uint32_t) 0x3U)
62 
63 #define CSL_ARM_R5_CACHE_POLICY_NON_CACHEABLE ((uint32_t) 0x0U)
64 
65 #define CSL_ARM_R5_CACHE_POLICY_WB_WA ((uint32_t) 0x1U)
66 
67 #define CSL_ARM_R5_MEM_ATTR_MAX ((uint32_t) 0x7U)
68 #define CSL_ARM_R5_MPU_REGION_AC_XN_SHIFT (0x0000000CU)
69 #define CSL_ARM_R5_MPU_REGION_AC_AP_SHIFT (0x00000008U)
70 #define CSL_ARM_R5_MPU_REGION_AC_S_SHIFT (0x00000002U)
71 #define CSL_ARM_R5_MPU_REGION_AC_TEX_SHIFT (0x00000003U)
72 #define CSL_ARM_R5_MPU_REGION_AC_CB_SHIFT (0x00000000U)
73 #define CSL_ARM_R5_MPU_REGION_AC_B_SHIFT (0x00000000U)
74 #define CSL_ARM_R5_MPU_REGION_AC_C_SHIFT (0x00000001U)
75 
76 
77 /* The structure passed to xMPUConfigureGlobalRegion() to configure the kernel
78  * with MPU global region id. */
79 typedef struct MPU_CONFIG_ACCESS
80 {
81  portUInt32Type ulexeNeverControl;
82  portUInt32Type ulaccessPermission;
83  portUInt32Type ulshareable;
84  portUInt32Type ulcacheable;
85  portUInt32Type ulcachePolicy;
86  portUInt32Type ulmemAttr;
88 
89 /* The structure passed to xMPUConfigureGlobalRegion() to configure the kernel
90  * with MPU global region id. */
91 typedef struct MPU_CONFIG_PARAMETERS
92 {
95  portUInt32Type ulRegionNumber;
97  portUInt32Type ulRegionBeginAddress;
99  portUInt32Type ulRegionSize;
100  portUInt32Type ulSubRegionDisable;
102 
103 /* ========================================================================== */
104 /* Function Declaration */
105 /* ========================================================================== */
106 
107 __attribute__((section(".startupCode"))) portBaseType xConfigureMPU(void);
108 
109 #endif /* SAFERTOS_MPU_H */
110 
111 /* @} */
portUInt32Type ulshareable
Definition: SafeRTOS_MPU.h:83
portUInt32Type ulSubRegionDisable
Definition: SafeRTOS_MPU.h:100
xMPU_CONFIG_ACCESS xRegionAccess
Definition: SafeRTOS_MPU.h:98
portUInt32Type ulRegionNumber
Definition: SafeRTOS_MPU.h:95
portUInt32Type ulaccessPermission
Definition: SafeRTOS_MPU.h:82
__attribute__((section(".startupCode"))) portBaseType xConfigureMPU(void)
Definition: SafeRTOS_MPU.h:79
portUInt32Type ulmemAttr
Definition: SafeRTOS_MPU.h:86
portUInt32Type ulexeNeverControl
Definition: SafeRTOS_MPU.h:81
Definition: SafeRTOS_MPU.h:91
This file contains the Register Desciptions for CSL types.
portUInt32Type ulcachePolicy
Definition: SafeRTOS_MPU.h:85
portUInt32Type ulRegionSize
Definition: SafeRTOS_MPU.h:99
portUInt32Type ulcacheable
Definition: SafeRTOS_MPU.h:84
portUInt32Type ulRegionBeginAddress
Definition: SafeRTOS_MPU.h:97