1 /*
2  * Copyright 2020-2021, NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef _FSL_IEE_APC_H_
9 #define _FSL_IEE_APC_H_
10 
11 #include "fsl_common.h"
12 
13 /*!
14  * @addtogroup ieer
15  * @{
16  */
17 
18 /*******************************************************************************
19  * Definitions
20  ******************************************************************************/
21 
22 /*! @name Driver version */
23 /*@{*/
24 /*! @brief IEE_APC driver version. Version 2.0.1.
25  *
26  * Current version: 2.0.1
27  *
28  * Change log:
29  * - Version 2.0.0
30  *   - Initial version
31  * - Version 2.0.1
32  *   - Fixed MISRA issues.
33  */
34 #define FSL_IEE_APC_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))
35 /*@}*/
36 
37 /*! @brief APC IEE regions. */
38 typedef enum _iee_apc_region
39 {
40     kIEE_APC_Region0 = 0U, /*!< APC IEE region 0 */
41     kIEE_APC_Region1 = 1U, /*!< APC IEE region 1 */
42     kIEE_APC_Region2 = 2U, /*!< APC IEE region 2 */
43     kIEE_APC_Region3 = 3U, /*!< APC IEE region 3 */
44     kIEE_APC_Region4 = 4U, /*!< APC IEE region 4 */
45     kIEE_APC_Region5 = 5U, /*!< APC IEE region 5 */
46     kIEE_APC_Region6 = 6U, /*!< APC IEE region 6 */
47     kIEE_APC_Region7 = 7U  /*!< APC IEE region 7 */
48 } iee_apc_region_t;
49 
50 /*! @brief APC IEE domains. */
51 typedef enum _apc_iee_domain
52 {
53     kIEE_APC_Domain0 = 0U, /*!< APC IEE region 0 */
54     kIEE_APC_Domain1 = 1U  /*!< APC IEE region 1 */
55 } iee_apc_domain_t;
56 
57 /*******************************************************************************
58  * API
59  ******************************************************************************/
60 #if defined(__cplusplus)
61 extern "C" {
62 #endif
63 
64 /*!
65  * @brief Enable the APC IEE Region setting.
66  *
67  * This function enables IOMUXC LPSR GPR and APC IEE for setting the region.
68  *
69  * @param base APC IEE peripheral address.
70  */
71 void IEE_APC_GlobalEnable(IEE_APC_Type *base);
72 
73 /*!
74  * @brief Disables the APC IEE Region setting.
75  *
76  * This function disables IOMUXC LPSR GPR and APC IEE for setting the region.
77  *
78  * @param base APC IEE peripheral address.
79  */
80 void IEE_APC_GlobalDisable(IEE_APC_Type *base);
81 
82 /*!
83  * @brief Sets the APC IEE Memory Region Descriptors.
84  *
85  * This function configures APC IEE Memory Region Descriptor according to region configuration structure.
86  *
87  * @param base APC IEE peripheral address.
88  * @param region Selection of the APC IEE region to be configured.
89  * @param startAddr Start encryption adress for the selected APC IEE region.
90  * @param endAddr End encryption adress for the selected APC IEE region.
91  */
92 status_t IEE_APC_SetRegionConfig(IEE_APC_Type *base, iee_apc_region_t region, uint32_t startAddr, uint32_t endAddr);
93 
94 /*!
95  * @brief Lock the LPSR GPR and APC IEE configuration.
96  *
97  * This function locks writting to IOMUXC LPSR GPR and APC IEE encryption region setting registers.
98  * Only system reset can clear the LPSR GPR and APC IEE-RDC_D0/1 Lock bit
99  *
100  * @param base APC IEE peripheral address.
101  * @param region Selection of the APC IEE region to be locked.
102  * @param domain
103  */
104 status_t IEE_APC_LockRegionConfig(IEE_APC_Type *base, iee_apc_region_t region, iee_apc_domain_t domain);
105 
106 /*!
107  * @brief Enable the IEE encryption/decryption and can lock this setting.
108  *
109  * This function enables encryption/decryption by writting to IOMUXC LPSR GPR.
110  *
111  * @param base APC IEE peripheral address.
112  * @param region Selection of the APC IEE region to be enabled.
113  */
114 void IEE_APC_RegionEnable(IEE_APC_Type *base, iee_apc_region_t region);
115 
116 #if defined(__cplusplus)
117 }
118 #endif
119 
120 /*!
121  *@}
122  */
123 
124 #endif /* _FSL_IEE_APC_H_ */
125