1 /* 2 * Copyright 2020-2023 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef POWER_IP_PMC_TYPES_H 8 #define POWER_IP_PMC_TYPES_H 9 10 /** 11 * @file Power_Ip_PMC_Types.h 12 * @version 3.0.0 13 * 14 * @brief POWER IP driver header file. 15 * @details POWER IP driver header file. 16 * 17 * @addtogroup POWER_DRIVER Power Ip Driver 18 * @{ 19 */ 20 21 #ifdef __cplusplus 22 extern "C"{ 23 #endif 24 25 26 27 28 /*================================================================================================== 29 INCLUDE FILES 30 1) system and project includes 31 2) needed interfaces from external units 32 3) internal and external interfaces from this unit 33 ==================================================================================================*/ 34 #include "Power_Ip_Specific.h" 35 36 /*================================================================================================== 37 SOURCE FILE VERSION INFORMATION 38 ==================================================================================================*/ 39 #define POWER_IP_PMC_TYPES_VENDOR_ID 43 40 #define POWER_IP_PMC_TYPES_AR_RELEASE_MAJOR_VERSION 4 41 #define POWER_IP_PMC_TYPES_AR_RELEASE_MINOR_VERSION 7 42 #define POWER_IP_PMC_TYPES_AR_RELEASE_REVISION_VERSION 0 43 #define POWER_IP_PMC_TYPES_SW_MAJOR_VERSION 3 44 #define POWER_IP_PMC_TYPES_SW_MINOR_VERSION 0 45 #define POWER_IP_PMC_TYPES_SW_PATCH_VERSION 0 46 47 /*================================================================================================== 48 FILE VERSION CHECKS 49 ==================================================================================================*/ 50 /* Check if Power_Ip_PMC_Types.h file and Power_Ip_Specific.h file have same versions */ 51 #if (POWER_IP_PMC_TYPES_VENDOR_ID != POWER_IP_SPECIFIC_VENDOR_ID) 52 #error "Power_Ip_PMC_Types.h and Power_Ip_Specific.h have different vendor IDs" 53 #endif 54 55 /* Check if Power_Ip_PMC_Types.h file and Power_Ip_Specific.h file are of the same Autosar version */ 56 #if ((POWER_IP_PMC_TYPES_AR_RELEASE_MAJOR_VERSION != POWER_IP_SPECIFIC_AR_RELEASE_MAJOR_VERSION) || \ 57 (POWER_IP_PMC_TYPES_AR_RELEASE_MINOR_VERSION != POWER_IP_SPECIFIC_AR_RELEASE_MINOR_VERSION) || \ 58 (POWER_IP_PMC_TYPES_AR_RELEASE_REVISION_VERSION != POWER_IP_SPECIFIC_AR_RELEASE_REVISION_VERSION)) 59 #error "AutoSar Version Numbers of Power_Ip_PMC_Types.h and Power_Ip_Specific.h are different" 60 #endif 61 62 /* Check if Power_Ip_PMC_Types.h file and Power_Ip_Specific.h file are of the same Software version */ 63 #if ((POWER_IP_PMC_TYPES_SW_MAJOR_VERSION != POWER_IP_SPECIFIC_SW_MAJOR_VERSION) || \ 64 (POWER_IP_PMC_TYPES_SW_MINOR_VERSION != POWER_IP_SPECIFIC_SW_MINOR_VERSION) || \ 65 (POWER_IP_PMC_TYPES_SW_PATCH_VERSION != POWER_IP_SPECIFIC_SW_PATCH_VERSION)) 66 #error "Software Version Numbers of Power_Ip_PMC_Types.h and Power_Ip_Specific.h are different" 67 #endif 68 /*================================================================================================== 69 * CONSTANTS 70 ==================================================================================================*/ 71 72 /*================================================================================================== 73 DEFINES AND MACROS 74 ==================================================================================================*/ 75 #if defined(POWER_IP_DERIVATIVE_001) || defined(POWER_IP_DERIVATIVE_002) || defined(POWER_IP_DERIVATIVE_006) || defined(POWER_IP_DERIVATIVE_009) 76 /***********************************************************/ 77 /* PMC_LVSC */ 78 /***********************************************************/ 79 80 #define PMC_LVSC_RAMP_UP_RESET_FLAGS_RWBITS_MASK32 ((uint32)0x80F30000U) 81 #define PMC_LVSC_RESET_FLAGS_RWBITS_MASK32 ((uint32)0x83F30000U) 82 #define PMC_LVSC_OV_UV_STATUS_FLAGS_MASK32 ((uint32)0x00001D00U) 83 #define PMC_LVSC_OV_UV_IRQ_FLAGS_MASK32 ((uint32)0x0000001DU) 84 85 #define PMC_LVSC_UV_IRQ_FLAGS_MASK32 ((uint32)0x00000010U) 86 #define PMC_LVSC_OV_IRQ_FLAGS_MASK32 ((uint32)0x0000000DU) 87 88 #define PMC_LVSC_RWBITS_MASK32 ((uint32)0x83F3001DU) 89 #define PMC_LVSC_RESET_MASK32 ((uint32)0x00001000U) 90 #define PMC_LVSC_RESERVED_MASK32 ((uint32)( (uint32)(~PMC_LVSC_RWBITS_MASK32) & PMC_LVSC_RESET_MASK32 )) 91 92 /***********************************************************/ 93 /* PMC_CONFIG */ 94 /***********************************************************/ 95 #define PMC_CONFIG_LVD_INTERRUPTS_ENABLE ((uint32)PMC_CONFIG_LVDIE_MASK) 96 #define PMC_CONFIG_LVD_INTERRUPTS_DISABLE ((uint32)0x00000000U) 97 98 #define PMC_CONFIG_HVD_INTERRUPTS_ENABLE ((uint32)PMC_CONFIG_HVDIE_MASK) 99 #define PMC_CONFIG_HVD_INTERRUPTS_DISABLE ((uint32)0x00000000U) 100 101 #define PMC_CONFIG_LPM25_ENABLE ((uint32)PMC_CONFIG_LPM25EN_MASK) 102 #define PMC_CONFIG_LPM25_DISABLE ((uint32)0x00000000U) 103 104 #define PMC_CONFIG_FAST_RECOVERY_ENABLE ((uint32)PMC_CONFIG_FASTREC_MASK) 105 #define PMC_CONFIG_FAST_RECOVERY_DISABLE ((uint32)0x00000000U) 106 107 #else /* S32K34x, S32K32x and S32K314 */ 108 /***********************************************************/ 109 /* PMC_LVSC */ 110 /***********************************************************/ 111 #define PMC_LVSC_V15_BELOW_LV ((uint32)PMC_LVSC_LVD15S_MASK) 112 #define PMC_LVSC_V15_ABOVE_LV ((uint32)0x00000000U) 113 114 #define PMC_LVSC_RAMP_UP_RESET_FLAGS_RWBITS_MASK32 ((uint32)0x80FF0000U) 115 #define PMC_LVSC_RESET_FLAGS_RWBITS_MASK32 ((uint32)0x83FF0000U) 116 #define PMC_LVSC_OV_UV_STATUS_FLAGS_MASK32 ((uint32)0x00003F00U) 117 #define PMC_LVSC_OV_UV_IRQ_FLAGS_MASK32 ((uint32)0x0000003FU) 118 119 #define PMC_LVSC_UV_IRQ_FLAGS_MASK32 ((uint32)0x00000030U) 120 #define PMC_LVSC_OV_IRQ_FLAGS_MASK32 ((uint32)0x0000000FU) 121 122 #define PMC_LVSC_RWBITS_MASK32 ((uint32)0x83FF003FU) 123 #define PMC_LVSC_RESET_MASK32 ((uint32)0x00003000U) 124 #define PMC_LVSC_RESERVED_MASK32 ((uint32)( (uint32)(~PMC_LVSC_RWBITS_MASK32) & PMC_LVSC_RESET_MASK32 )) 125 /***********************************************************/ 126 /* PMC_CONFIG */ 127 /***********************************************************/ 128 #define PMC_CONFIG_LVD_INTERRUPTS_ENABLE ((uint32)PMC_CONFIG_LVDIE_MASK) 129 #define PMC_CONFIG_LVD_INTERRUPTS_DISABLE ((uint32)0x00000000U) 130 131 #define PMC_CONFIG_HVD_INTERRUPTS_ENABLE ((uint32)PMC_CONFIG_HVDIE_MASK) 132 #define PMC_CONFIG_HVD_INTERRUPTS_DISABLE ((uint32)0x00000000U) 133 134 #define PMC_CONFIG_LPM25_ENABLE ((uint32)PMC_CONFIG_LPM25EN_MASK) 135 #define PMC_CONFIG_LPM25_DISABLE ((uint32)0x00000000U) 136 137 #define PMC_CONFIG_FAST_RECOVERY_ENABLE ((uint32)PMC_CONFIG_FASTREC_MASK) 138 #define PMC_CONFIG_FAST_RECOVERY_DISABLE ((uint32)0x00000000U) 139 140 #define PMC_CONFIG_LVRBLP_ENABLE ((uint32)PMC_CONFIG_LVRBLPEN_MASK) 141 #define PMC_CONFIG_LVRBLP_DISABLE ((uint32)0x00000000U) 142 143 #define PMC_CONFIG_LM_BASE_CONTROL_ENABLE ((uint32)PMC_CONFIG_LMBCTLEN_MASK) 144 #define PMC_CONFIG_LM_BASE_CONTROL_DISABLE ((uint32)0x00000000U) 145 146 #define PMC_CONFIG_LAST_MILE_REG_ENABLE ((uint32)PMC_CONFIG_LMEN_MASK) 147 #define PMC_CONFIG_LAST_MILE_REG_DISABLE ((uint32)0x00000000U) 148 149 #define PMC_CONFIG_LAST_MILE_REG_AUTO_ENABLE ((uint32)PMC_CONFIG_LMAUTOEN_MASK) 150 #define PMC_CONFIG_LAST_MILE_REG_AUTO_DISABLE ((uint32)0x00000000U) 151 152 #define PMC_CONFIG_LAST_MILE_REG_ON ((uint32)PMC_CONFIG_LMSTAT_MASK) 153 #define PMC_CONFIG_LAST_MILE_REG_OFF ((uint32)0x00000000U) 154 155 #endif /* #ifdef POWER_IP_DERIVATIVE_001 */ 156 157 158 #if defined(POWER_IP_DERIVATIVE_002) 159 160 #define PMC_AE_CONFIG_LINSUPEN_ENABLE_U32 ((uint32)(0x40)) 161 #define PMC_AE_CONFIG_LINSUPEN_DISABLE_U32 ((uint32)(0x00)) 162 #define PMC_AE_CONFIG_VDDCEN_ENABLE_U32 ((uint32)(0x08)) 163 #define PMC_AE_CONFIG_VDDCEN_DISABLE_U32 ((uint32)(0x00)) 164 #define PMC_AE_CONFIG_LVDVLSSEL_6_5V_U32 ((uint32)(0x20)) 165 #define PMC_AE_CONFIG_LVDVLSSEL_5_5V_U32 ((uint32)(0x00)) 166 #define PMC_AE_CONFIG_LINSUPSEL_VSUP_PIN_U32 ((uint32)(0x00)) 167 #define PMC_AE_CONFIG_LINSUPSEL_HD_PIN_U32 ((uint32)(0x10)) 168 #define PMC_AE_CONFIG_VDDSEL5V_3_3V_U32 ((uint32)(0x00)) 169 #define PMC_AE_CONFIG_VDDSEL5V_5V_U32 ((uint32)(0x01)) 170 171 #define PMC_AE_MONITOR_LVDVLSIE_ENABLE_U32 ((uint32)(0x10000000)) 172 #define PMC_AE_MONITOR_LVDVLSIE_DISABLE_U32 ((uint32)(0x00000000)) 173 #define PMC_AE_MONITOR_LVDCIE_ENABLE_U32 ((uint32)(0x08000000)) 174 #define PMC_AE_MONITOR_LVDCIE_DISABLE_U32 ((uint32)(0x00000000)) 175 #define PMC_AE_MONITOR_HVDVDDIE_ENABLE_U32 ((uint32)(0x04000000)) 176 #define PMC_AE_MONITOR_HVDVDDIE_DISABLE_U32 ((uint32)(0x00000000)) 177 #define PMC_AE_MONITOR_HVDINT15IE_ENABLE_U32 ((uint32)(0x01000000)) 178 #define PMC_AE_MONITOR_HVDINT15IE_DISABLE_U32 ((uint32)(0x00000000)) 179 180 #define PMC_AE_CONFIG_RWBITS_MASK32 ((uint32)PMC_AE_CONFIG_LINSUPEN_MASK | \ 181 PMC_AE_CONFIG_LVDVLSSEL_MASK | \ 182 PMC_AE_CONFIG_LINSUPSEL_MASK | \ 183 PMC_AE_CONFIG_VDDCEN_MASK | \ 184 PMC_AE_CONFIG_VDDSEL5V_MASK) 185 186 #define PMC_AE_MONITOR_RWBITS_MASK32 ((uint32)PMC_AE_MONITOR_LVDVLSIE_MASK | \ 187 PMC_AE_MONITOR_LVDCIE_MASK | \ 188 PMC_AE_MONITOR_HVDVDDIE_MASK | \ 189 PMC_AE_MONITOR_HVDINT15IE_MASK) 190 #endif /* #ifdef POWER_IP_DERIVATIVE_002 */ 191 192 /*================================================================================================== 193 * ENUMS 194 ==================================================================================================*/ 195 196 197 /*================================================================================================== 198 * STRUCTURES AND OTHER TYPEDEFS 199 ==================================================================================================*/ 200 /** 201 * @brief Configuration for PMC. 202 * @details The power control unit (PMC) acts as a bridge for mapping the PMC peripheral 203 * to the PMC address space. 204 */ 205 typedef struct 206 { 207 uint32 ConfigRegister; /**< @brief PMC configuration register (CONFIG) */ 208 #if (defined(POWER_IP_ENABLE_SMPS_INIT)) 209 #if (STD_ON == POWER_IP_ENABLE_SMPS_INIT) 210 uint32 SMPSRegister; /**< @brief SMPS configuration register (CONFIG) */ 211 #endif 212 #endif 213 #if(STD_ON == POWER_IP_PMC_AE_SUPPORT) 214 uint32 PmcAeConfig; /**< @brief Trimming Register (PMC_AE_CONFIG). */ 215 uint32 PmcAeMonitor; /**< @brief Trimming Register (PMC_AE_MONITOR). */ 216 #endif 217 } Power_Ip_PMC_ConfigType; 218 219 #if (defined(POWER_IP_VOLTAGE_ERROR_ISR_USED)) 220 #if(POWER_IP_VOLTAGE_ERROR_ISR_USED == STD_ON) 221 typedef enum 222 { 223 PMC_UNINIT = 0, /**< @brief The PMC driver is uninitialized. */ 224 PMC_INIT = 1 /**< @brief The PMC driver is initialized. */ 225 } Power_Ip_PMC_StatusType; 226 #endif 227 #endif 228 /*================================================================================================== 229 * GLOBAL VARIABLE DECLARATIONS 230 ==================================================================================================*/ 231 232 233 /*================================================================================================== 234 * FUNCTION PROTOTYPES 235 ==================================================================================================*/ 236 237 238 #ifdef __cplusplus 239 } 240 #endif 241 242 /** @} */ 243 #endif /* POWER_IP_PMC_TYPES_H */ 244 245