1 /*
2  * Copyright (c) 2019, Cypress Semiconductor Corporation. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
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 __PPU_CONFIG_H__
19 #define __PPU_CONFIG_H__
20 
21 /* PPU configs */
22 
23 /* The majority will be configured in similar ways */
24 #define NON_SECURE_READ_ONLY_CONFIG { \
25     .user = CY_PROT_PERM_R, \
26     .priv = CY_PROT_PERM_R, \
27     .secure = false, \
28     .pcMask = ALL_PCS_MASK, \
29 }
30 #define NON_SECURE_READ_WRITE_CONFIG { \
31     .user = CY_PROT_PERM_RW, \
32     .priv = CY_PROT_PERM_RW, \
33     .secure = false, \
34     .pcMask = ALL_PCS_MASK, \
35 }
36 #define NON_SECURE_PRIV_ONLY_CONFIG { \
37     .user = CY_PROT_PERM_DISABLED, \
38     .priv = CY_PROT_PERM_RW, \
39     .secure = false, \
40     .pcMask = ALL_PCS_MASK, \
41 }
42 #define NON_SECURE_EXCEPT_TC_READ_WRITE_CONFIG { \
43     .user = CY_PROT_PERM_RW, \
44     .priv = CY_PROT_PERM_RW, \
45     .secure = false, \
46     .pcMask = ALL_PCS_EXCEPT_TC_MASK, \
47 }
48 #define SECURE_READ_ONLY_CONFIG { \
49     .user = CY_PROT_PERM_R, \
50     .priv = CY_PROT_PERM_R, \
51     .secure = false, \
52     .pcMask = SECURE_PCS_MASK, \
53 }
54 #define SECURE_READ_WRITE_CONFIG { \
55     .user = CY_PROT_PERM_R, \
56     .priv = CY_PROT_PERM_RW, \
57     .secure = false, \
58     .pcMask = SECURE_PCS_MASK, \
59 }
60 #define SECURE_PRIV_ONLY_CONFIG { \
61     .user = CY_PROT_PERM_DISABLED, \
62     .priv = CY_PROT_PERM_RW, \
63     .secure = false, \
64     .pcMask = SECURE_PCS_MASK, \
65 }
66 
67 /* Actual configs for each PPU */
68 
69 /* To provide a config for a programmable PPU,
70  * use something like this:
71 #define PPU_PR7_MASTER_CONFIG NON_SECURE_READ_ONLY_CONFIG
72 #define PPU_PR7_SLAVE_CONFIG { \
73     .user = CY_PROT_PERM_R, \
74     .priv = CY_PROT_PERM_R, \
75     .secure = true, \
76     .pcMask = SECURE_PCS_MASK, \
77 }
78 #define PPU_PR7_SLAVE_ADDRESS CPUSS_BASE
79 #define PPU_PR7_SLAVE_REGION_SIZE CY_PROT_SIZE_2KB
80 */
81 
82 #define PPU_CRYPTO_MAIN_MASTER_CONFIG NON_SECURE_READ_ONLY_CONFIG
83 #define PPU_CRYPTO_MAIN_SLAVE_CONFIG SECURE_PRIV_ONLY_CONFIG
84 
85 #define PPU_CRYPTO_CRYPTO_MASTER_CONFIG NON_SECURE_READ_ONLY_CONFIG
86 #define PPU_CRYPTO_CRYPTO_SLAVE_CONFIG SECURE_PRIV_ONLY_CONFIG
87 
88 #define PPU_CRYPTO_BUF_MASTER_CONFIG NON_SECURE_READ_ONLY_CONFIG
89 #define PPU_CRYPTO_BUF_SLAVE_CONFIG SECURE_PRIV_ONLY_CONFIG
90 
91 #endif /* __PPU_CONFIG_H__ */
92