1 /*
2  * Copyright (c) 2019-2022 Cypress Semiconductor Corporation (an Infineon company)
3  * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __DRIVER_SMPU_H__
19 #define __DRIVER_SMPU_H__
20 
21 #include "cy_prot.h"
22 #include "RTE_Device.h"
23 #include "tfm_multi_core.h"
24 
25 typedef struct smpu_resources SMPU_Resources;
26 
27 /* API functions */
28 void SMPU_Get_Access_Rules(const void *p, size_t s,
29                            uint32_t pc,
30                            struct mem_attr_info_t *p_attr);
31 cy_en_prot_status_t SMPU_Configure(const SMPU_Resources *smpu_dev);
32 cy_en_prot_status_t protect_unconfigured_smpus(void);
33 void SMPU_Print_Config(const SMPU_Resources *smpu_dev);
34 
35 /* Exported per-SMPU macros */
36 #define DECLARE_SMPU(N) extern const SMPU_Resources SMPU##N##_Resources;
37 
38 #if (RTE_SMPU0)
39 DECLARE_SMPU(0)
40 #endif /* RTE_SMPU0 */
41 
42 #if (RTE_SMPU1)
43 DECLARE_SMPU(1)
44 #endif /* RTE_SMPU1 */
45 
46 #if (RTE_SMPU2)
47 DECLARE_SMPU(2)
48 #endif /* RTE_SMPU2 */
49 
50 #if (RTE_SMPU3)
51 DECLARE_SMPU(3)
52 #endif /* RTE_SMPU3 */
53 
54 #if (RTE_SMPU4)
55 DECLARE_SMPU(4)
56 #endif /* RTE_SMPU4 */
57 
58 #if (RTE_SMPU5)
59 DECLARE_SMPU(5)
60 #endif /* RTE_SMPU5 */
61 
62 #if (RTE_SMPU6)
63 DECLARE_SMPU(6)
64 #endif /* RTE_SMPU6 */
65 
66 #if (RTE_SMPU7)
67 DECLARE_SMPU(7)
68 #endif /* RTE_SMPU7 */
69 
70 #if (RTE_SMPU8)
71 DECLARE_SMPU(8)
72 #endif /* RTE_SMPU8 */
73 
74 #if (RTE_SMPU9)
75 DECLARE_SMPU(9)
76 #endif /* RTE_SMPU9 */
77 
78 #if (RTE_SMPU10)
79 DECLARE_SMPU(10)
80 #endif /* RTE_SMPU10 */
81 
82 #if (RTE_SMPU11)
83 DECLARE_SMPU(11)
84 #endif /* RTE_SMPU11 */
85 
86 #if (RTE_SMPU12)
87 DECLARE_SMPU(12)
88 #endif /* RTE_SMPU12 */
89 
90 #if (RTE_SMPU13)
91 DECLARE_SMPU(13)
92 #endif /* RTE_SMPU13 */
93 
94 /* Note that SMPUs 14 and 15 are fixed by romboot */
95 
96 #endif /* __DRIVER_SMPU_H__ */
97