1 /* 2 * Copyright 2020-2021,2023 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.2. 25 * 26 * Current version: 2.0.2 27 * 28 * Change log: 29 * - Version 2.0.0 30 * - Initial version 31 * - Version 2.0.1 32 * - Fixed MISRA issues. 33 * - Version 2.0.2 34 * - Update to newer version of implementation in HW. 35 */ 36 #define FSL_IEE_APC_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) 37 /*! @} */ 38 39 /*! @brief APC IEE regions. */ 40 typedef enum _iee_apc_region 41 { 42 kIEE_APC_Region0 = 0U, /*!< APC IEE region 0 */ 43 kIEE_APC_Region1 = 1U, /*!< APC IEE region 1 */ 44 kIEE_APC_Region2 = 2U, /*!< APC IEE region 2 */ 45 kIEE_APC_Region3 = 3U, /*!< APC IEE region 3 */ 46 kIEE_APC_Region4 = 4U, /*!< APC IEE region 4 */ 47 kIEE_APC_Region5 = 5U, /*!< APC IEE region 5 */ 48 kIEE_APC_Region6 = 6U, /*!< APC IEE region 6 */ 49 kIEE_APC_Region7 = 7U /*!< APC IEE region 7 */ 50 } iee_apc_region_t; 51 52 /*! @brief APC IEE domains. */ 53 typedef enum _apc_iee_domain 54 { 55 kIEE_APC_Domain0 = 0U, /*!< APC IEE region 0 */ 56 kIEE_APC_Domain1 = 1U /*!< APC IEE region 1 */ 57 } iee_apc_domain_t; 58 59 /******************************************************************************* 60 * API 61 ******************************************************************************/ 62 #if defined(__cplusplus) 63 extern "C" { 64 #endif 65 66 /*! 67 * @brief Enable the APC IEE Region setting. 68 * 69 * This function enables IOMUXC LPSR GPR and APC IEE for setting the region. 70 * 71 * @param base APC IEE peripheral address. 72 */ 73 void IEE_APC_GlobalEnable(IEE_APC_Type *base); 74 75 /*! 76 * @brief Disables the APC IEE Region setting. 77 * 78 * This function disables IOMUXC LPSR GPR and APC IEE for setting the region. 79 * 80 * @param base APC IEE peripheral address. 81 */ 82 void IEE_APC_GlobalDisable(IEE_APC_Type *base); 83 84 /*! 85 * @brief Sets the APC IEE Memory Region Descriptors. 86 * 87 * This function configures APC IEE Memory Region Descriptor according to region configuration structure. 88 * 89 * @param base APC IEE peripheral address. 90 * @param region Selection of the APC IEE region to be configured. 91 * @param startAddr Start encryption adress for the selected APC IEE region. 92 * @param endAddr End encryption adress for the selected APC IEE region. 93 */ 94 status_t IEE_APC_SetRegionConfig(IEE_APC_Type *base, iee_apc_region_t region, uint32_t startAddr, uint32_t endAddr); 95 96 97 #if !(defined(FSL_FEATURE_IEE_APC_USE_GPR) && (FSL_FEATURE_IEE_APC_USE_GPR > 0u)) 98 /*! 99 * @brief Lock the APC IEE configuration. 100 * 101 * This function locks writting to APC IEE encryption region setting registers. 102 * Only system reset can clear Lock bit 103 * 104 * @param base APC IEE peripheral address. 105 * @param region Selection of the APC IEE region to be locked. 106 * @param domain The ID is driven by TRDC 107 */ 108 status_t IEE_APC_LockRegionConfig(IEE_APC_Type *base, iee_apc_region_t region, uint8_t domain); 109 #endif /* !(defined(FSL_FEATURE_IEE_APC_USE_GPR) && (FSL_FEATURE_IEE_APC_USE_GPR > 0u)) */ 110 111 #if !(defined(FSL_FEATURE_IEE_APC_USE_GPR) && (FSL_FEATURE_IEE_APC_USE_GPR > 0u)) 112 /*! 113 * @brief Set access control of the APC IEE. 114 * 115 * This function configure APC IEE encryption region access control settings. 116 * 117 * @param base APC IEE peripheral address. 118 * @param region Selection of the APC IEE region to be locked. 119 * @param allowNonSecure Allow nonsecure mode access 120 * @param allowUser Allow user mode access 121 */ 122 status_t IEE_APC_SetAccessControl(IEE_APC_Type *base, iee_apc_region_t region, bool allowNonSecure, bool allowUser); 123 #endif /* !(defined(FSL_FEATURE_IEE_APC_USE_GPR) && (FSL_FEATURE_IEE_APC_USE_GPR > 0u)) */ 124 125 126 #if defined(FSL_FEATURE_IEE_APC_USE_GPR) && (FSL_FEATURE_IEE_APC_USE_GPR > 0u) 127 /*! 128 * @brief Lock the LPSR GPR and APC IEE configuration. 129 * 130 * This function locks writting to IOMUXC LPSR GPR and APC IEE encryption region setting registers. 131 * Only system reset can clear the LPSR GPR and APC IEE-RDC_D0/1 Lock bit 132 * 133 * @param base APC IEE peripheral address. 134 * @param region Selection of the APC IEE region to be locked. 135 * @param domain Core domain ID 136 */ 137 status_t IEE_APC_LockRegionConfig(IEE_APC_Type *base, iee_apc_region_t region, iee_apc_domain_t domain); 138 #endif 139 140 /*! 141 * @brief Enable the IEE encryption/decryption and can lock this setting. 142 * 143 * This function enables encryption/decryption by writting to IOMUXC LPSR GPR. 144 * 145 * @param base APC IEE peripheral address. 146 * @param region Selection of the APC IEE region to be enabled. 147 */ 148 void IEE_APC_RegionEnable(IEE_APC_Type *base, iee_apc_region_t region); 149 150 #if !(defined(FSL_FEATURE_IEE_APC_USE_GPR) && (FSL_FEATURE_IEE_APC_USE_GPR > 0u)) 151 /*! 152 * @brief Disable the IEE encryption/decryption for specific region. 153 * 154 * This function disables encryption/decryption by writting to IOMUXC LPSR GPR. 155 * 156 * @param base APC IEE peripheral address. 157 * @param region Selection of the APC IEE region to be enabled. 158 */ 159 void IEE_APC_RegionDisable(IEE_APC_Type *base, iee_apc_region_t region); 160 #endif /* !(defined(FSL_FEATURE_IEE_APC_USE_GPR) && (FSL_FEATURE_IEE_APC_USE_GPR > 0u)) */ 161 162 #if defined(__cplusplus) 163 } 164 #endif 165 166 /*! 167 *@} 168 */ 169 170 #endif /* FSL_IEE_APC_H_ */ 171