1 /*
2  * Copyright 2020-2023 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef POWER_IP_TYPES_H
8 #define POWER_IP_TYPES_H
9 
10 /**
11 *   @file       Power_Ip_Types.h
12 *   @version    3.0.0
13 *
14 *   @brief   POWER IP type header file.
15 *   @details POWER IP type 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 * @page misra_violations MISRA-C:2012 violations
28 *
29 */
30 
31 
32 /*==================================================================================================
33                                          INCLUDE FILES
34  1) system and project includes
35  2) needed interfaces from external units
36  3) internal and external interfaces from this unit
37 ==================================================================================================*/
38 #include "Power_Ip_MC_ME_Types.h"
39 #include "Power_Ip_MC_RGM_Types.h"
40 #include "Power_Ip_PMC_Types.h"
41 #include "Power_Ip_DCM_GPR_Types.h"
42 
43 #if(STD_ON == POWER_IP_AEC_SUPPORT)
44 #include "Power_Ip_AEC_Types.h"
45 #endif
46 /*==================================================================================================
47                                SOURCE FILE VERSION INFORMATION
48 ==================================================================================================*/
49 #define POWER_IP_TYPES_VENDOR_ID                       43
50 #define POWER_IP_TYPES_AR_RELEASE_MAJOR_VERSION        4
51 #define POWER_IP_TYPES_AR_RELEASE_MINOR_VERSION        7
52 #define POWER_IP_TYPES_AR_RELEASE_REVISION_VERSION     0
53 #define POWER_IP_TYPES_SW_MAJOR_VERSION                3
54 #define POWER_IP_TYPES_SW_MINOR_VERSION                0
55 #define POWER_IP_TYPES_SW_PATCH_VERSION                0
56 
57 /*==================================================================================================
58                                       FILE VERSION CHECKS
59 ==================================================================================================*/
60 /* Check if Power_Ip_Types.h file and Power_Ip_MC_ME_Types.h file have same versions */
61 #if (POWER_IP_TYPES_VENDOR_ID  != POWER_IP_MC_ME_TYPES_VENDOR_ID)
62     #error "Power_Ip_Types.h and Power_Ip_MC_ME_Types.h have different vendor IDs"
63 #endif
64 
65 /* Check if Power_Ip_Types.h file and Power_Ip_MC_ME_Types.h file are of the same Autosar version */
66 #if ((POWER_IP_TYPES_AR_RELEASE_MAJOR_VERSION    != POWER_IP_MC_ME_TYPES_AR_RELEASE_MAJOR_VERSION) || \
67      (POWER_IP_TYPES_AR_RELEASE_MINOR_VERSION    != POWER_IP_MC_ME_TYPES_AR_RELEASE_MINOR_VERSION) || \
68      (POWER_IP_TYPES_AR_RELEASE_REVISION_VERSION != POWER_IP_MC_ME_TYPES_AR_RELEASE_REVISION_VERSION))
69     #error "AutoSar Version Numbers of Power_Ip_Types.h and Power_Ip_MC_ME_Types.h are different"
70 #endif
71 
72 /* Check if Power_Ip_Types.h file and Power_Ip_MC_ME_Types.h file are of the same Software version */
73 #if ((POWER_IP_TYPES_SW_MAJOR_VERSION != POWER_IP_MC_ME_TYPES_SW_MAJOR_VERSION) || \
74      (POWER_IP_TYPES_SW_MINOR_VERSION != POWER_IP_MC_ME_TYPES_SW_MINOR_VERSION) || \
75      (POWER_IP_TYPES_SW_PATCH_VERSION != POWER_IP_MC_ME_TYPES_SW_PATCH_VERSION))
76     #error "Software Version Numbers of Power_Ip_Types.h and Power_Ip_MC_ME_Types.h are different"
77 #endif
78 
79 /* Check if Power_Ip_Types.h file and Power_Ip_MC_RGM_Types.h file have same versions */
80 #if (POWER_IP_TYPES_VENDOR_ID  != POWER_IP_MC_RGM_TYPES_VENDOR_ID)
81     #error "Power_Ip_Types.h and Power_Ip_MC_RGM_Types.h have different vendor IDs"
82 #endif
83 
84 /* Check if Power_Ip_Types.h file and Power_Ip_MC_RGM_Types.h file are of the same Autosar version */
85 #if ((POWER_IP_TYPES_AR_RELEASE_MAJOR_VERSION    != POWER_IP_MC_RGM_TYPES_AR_RELEASE_MAJOR_VERSION) || \
86      (POWER_IP_TYPES_AR_RELEASE_MINOR_VERSION    != POWER_IP_MC_RGM_TYPES_AR_RELEASE_MINOR_VERSION) || \
87      (POWER_IP_TYPES_AR_RELEASE_REVISION_VERSION != POWER_IP_MC_RGM_TYPES_AR_RELEASE_REVISION_VERSION))
88     #error "AutoSar Version Numbers of Power_Ip_Types.h and Power_Ip_MC_RGM_Types.h are different"
89 #endif
90 
91 /* Check if Power_Ip_Types.h file and Power_Ip_MC_RGM_Types.h file are of the same Software version */
92 #if ((POWER_IP_TYPES_SW_MAJOR_VERSION != POWER_IP_MC_RGM_TYPES_SW_MAJOR_VERSION) || \
93      (POWER_IP_TYPES_SW_MINOR_VERSION != POWER_IP_MC_RGM_TYPES_SW_MINOR_VERSION) || \
94      (POWER_IP_TYPES_SW_PATCH_VERSION != POWER_IP_MC_RGM_TYPES_SW_PATCH_VERSION))
95     #error "Software Version Numbers of Power_Ip_Types.h and Power_Ip_MC_RGM_Types.h are different"
96 #endif
97 
98 /* Check if Power_Ip_Types.h file and Power_Ip_PMC_Types.h file have same versions */
99 #if (POWER_IP_TYPES_VENDOR_ID  != POWER_IP_PMC_TYPES_VENDOR_ID)
100     #error "Power_Ip_Types.h and Power_Ip_PMC_Types.h have different vendor IDs"
101 #endif
102 
103 /* Check if Power_Ip_Types.h file and Power_Ip_PMC_Types.h file are of the same Autosar version */
104 #if ((POWER_IP_TYPES_AR_RELEASE_MAJOR_VERSION    != POWER_IP_PMC_TYPES_AR_RELEASE_MAJOR_VERSION) || \
105      (POWER_IP_TYPES_AR_RELEASE_MINOR_VERSION    != POWER_IP_PMC_TYPES_AR_RELEASE_MINOR_VERSION) || \
106      (POWER_IP_TYPES_AR_RELEASE_REVISION_VERSION != POWER_IP_PMC_TYPES_AR_RELEASE_REVISION_VERSION))
107     #error "AutoSar Version Numbers of Power_Ip_Types.h and Power_Ip_PMC_Types.h are different"
108 #endif
109 
110 /* Check if Power_Ip_Types.h file and Power_Ip_PMC_Types.h file are of the same Software version */
111 #if ((POWER_IP_TYPES_SW_MAJOR_VERSION != POWER_IP_PMC_TYPES_SW_MAJOR_VERSION) || \
112      (POWER_IP_TYPES_SW_MINOR_VERSION != POWER_IP_PMC_TYPES_SW_MINOR_VERSION) || \
113      (POWER_IP_TYPES_SW_PATCH_VERSION != POWER_IP_PMC_TYPES_SW_PATCH_VERSION))
114     #error "Software Version Numbers of Power_Ip_Types.h and Power_Ip_PMC_Types.h are different"
115 #endif
116 
117 /* Check if Power_Ip_Types.h file and Power_Ip_DCM_GPR_Types.h file have same versions */
118 #if (POWER_IP_TYPES_VENDOR_ID  != POWER_IP_DCM_GPR_TYPES_VENDOR_ID)
119     #error "Power_Ip_Types.h and Power_Ip_DCM_GPR_Types.h have different vendor IDs"
120 #endif
121 
122 /* Check if Power_Ip_Types.h file and Power_Ip_DCM_GPR_Types.h file are of the same Autosar version */
123 #if ((POWER_IP_TYPES_AR_RELEASE_MAJOR_VERSION    != POWER_IP_DCM_GPR_TYPES_AR_RELEASE_MAJOR_VERSION) || \
124      (POWER_IP_TYPES_AR_RELEASE_MINOR_VERSION    != POWER_IP_DCM_GPR_TYPES_AR_RELEASE_MINOR_VERSION) || \
125      (POWER_IP_TYPES_AR_RELEASE_REVISION_VERSION != POWER_IP_DCM_GPR_TYPES_AR_RELEASE_REVISION_VERSION))
126     #error "AutoSar Version Numbers of Power_Ip_Types.h and Power_Ip_DCM_GPR_Types.h are different"
127 #endif
128 
129 /* Check if Power_Ip_Types.h file and Power_Ip_DCM_GPR_Types.h file are of the same Software version */
130 #if ((POWER_IP_TYPES_SW_MAJOR_VERSION != POWER_IP_DCM_GPR_TYPES_SW_MAJOR_VERSION) || \
131      (POWER_IP_TYPES_SW_MINOR_VERSION != POWER_IP_DCM_GPR_TYPES_SW_MINOR_VERSION) || \
132      (POWER_IP_TYPES_SW_PATCH_VERSION != POWER_IP_DCM_GPR_TYPES_SW_PATCH_VERSION))
133     #error "Software Version Numbers of Power_Ip_Types.h and Power_Ip_DCM_GPR_Types.h are different"
134 #endif
135 
136 #if(STD_ON == POWER_IP_AEC_SUPPORT)
137 /* Check if Power_Ip_Types.h file and Power_Ip_AEC_Types.h file have same versions */
138 #if (POWER_IP_TYPES_VENDOR_ID  != POWER_IP_AEC_TYPES_VENDOR_ID)
139     #error "Power_Ip_Types.h and Power_Ip_AEC_Types.h have different vendor IDs"
140 #endif
141 
142 /* Check if Power_Ip_Types.h file and Power_Ip_AEC_Types.h file are of the same Autosar version */
143 #if ((POWER_IP_TYPES_AR_RELEASE_MAJOR_VERSION    != POWER_IP_AEC_TYPES_AR_RELEASE_MAJOR_VERSION) || \
144      (POWER_IP_TYPES_AR_RELEASE_MINOR_VERSION    != POWER_IP_AEC_TYPES_AR_RELEASE_MINOR_VERSION) || \
145      (POWER_IP_TYPES_AR_RELEASE_REVISION_VERSION != POWER_IP_AEC_TYPES_AR_RELEASE_REVISION_VERSION))
146     #error "AutoSar Version Numbers of Power_Ip_Types.h and Power_Ip_AEC_Types.h are different"
147 #endif
148 
149 /* Check if Power_Ip_Types.h file and Power_Ip_AEC_Types.h file are of the same Software version */
150 #if ((POWER_IP_TYPES_SW_MAJOR_VERSION != POWER_IP_AEC_TYPES_SW_MAJOR_VERSION) || \
151      (POWER_IP_TYPES_SW_MINOR_VERSION != POWER_IP_AEC_TYPES_SW_MINOR_VERSION) || \
152      (POWER_IP_TYPES_SW_PATCH_VERSION != POWER_IP_AEC_TYPES_SW_PATCH_VERSION))
153     #error "Software Version Numbers of Power_Ip_Types.h and Power_Ip_AEC_Types.h are different"
154 #endif
155 #endif
156 /*==================================================================================================
157 *                                          CONSTANTS
158 ==================================================================================================*/
159 
160 
161 /*==================================================================================================
162                                        DEFINES AND MACROS
163 ==================================================================================================*/
164 #define POWER_IP_ERR_CODE_RESERVED   0xFF
165 
166 #define POWER_IP_E_ISR_FUNC_RESET_ALT_FAILURE        ((uint8)0x03U)
167 #define POWER_IP_E_ISR_DEST_RESET_ALT_FAILURE        ((uint8)0x04U)
168 #define POWER_IP_E_ISR_VOLTAGE_ERROR                 ((uint8)0x08U)
169 #define POWER_IP_E_ISR_LOW_VOLTAGE_ERROR             ((uint8)0x09U)
170 #define POWER_IP_E_ISR_HIGH_VOLTAGE_ERROR            ((uint8)0x0AU)
171 #define POWER_IP_LAST_MILE_REGULATOR_DISABLED        ((uint8)0x55U)
172 #define POWER_IP_E_FLASH_HV_OPERATION_ONGOING        ((uint8)0x07U)
173 
174 #define POWER_IP_DATAWIDTH_8                     (8U)
175 #define POWER_IP_DATAWIDTH_16                    (16U)
176 #define POWER_IP_DATAWIDTH_32                    (32U)
177 /*==================================================================================================
178 *                                             ENUMS
179 ==================================================================================================*/
180 
181 
182 /*==================================================================================================
183 *                                STRUCTURES AND OTHER TYPEDEFS
184 ==================================================================================================*/
185 /**
186 * @brief
187 * @details
188 */
189 typedef struct
190 {
191     /**< @brief Configuration for MC_RGM (Reset Generation Module) hardware IP. */
192     const Power_Ip_MC_RGM_ConfigType * McRgmConfigPtr;
193     /**< @brief Configuration for PMC (Power Management Unit) hardware IP, part of PMC. */
194     const Power_Ip_PMC_ConfigType * PMCConfigPtr;
195 #if(STD_ON == POWER_IP_AEC_SUPPORT)
196     /**< @brief Configuration for AEC hardware IP. */
197     const Power_Ip_AEC_ConfigType * AECConfigPtr;
198 #endif
199 } Power_Ip_HwIPsConfigType;
200 
201 
202 /**
203 * @brief            Power Modes encoding.
204 * @details          Supported power modes for the MCU.
205 */
206 typedef enum
207 {
208     POWER_IP_DEST_RESET_MODE = 0U,           /**< @brief Destructive Reset Mode. */
209     POWER_IP_FUNC_RESET_MODE = 1U,           /**< @brief Functional Reset Mode. */
210     POWER_IP_RESET_MODE = 2U,                /**< @brief Any reset mode. Used when the particular type of reset doesn't matter. */
211     POWER_IP_CORE_WARM_RESET_MODE = 3U,      /**< @brief Core Warm Reset Mode. */
212 #if (defined(POWER_IP_ENTER_LOW_POWER_MODE))
213   #if (POWER_IP_ENTER_LOW_POWER_MODE == STD_ON)
214     POWER_IP_CORE_STANDBY_MODE = 13U,        /**< @brief Core Standby Mode */
215     POWER_IP_SOC_PREPARE_STANDBY_MODE = 14U, /**< @brief Prepare Standby Mode */
216     POWER_IP_SOC_STANDBY_MODE  = 15U,        /**< @brief StandBy Mode. */
217     POWER_IP_STANDBY_MODE  = 16U,            /**< @brief Prepare Standby and StandBy Mode. */
218     POWER_IP_SOC_PREPARE_FAST_STANDBY_MODE = 17U, /**< @brief Prepare Fast Standby Mode */
219     POWER_IP_SOC_FAST_STANDBY_MODE  = 18U,        /**< @brief Fast StandBy Mode. */
220     POWER_IP_FAST_STANDBY_MODE  = 19U,            /**< @brief Prepare Fast Standby and Fast StandBy Mode. */
221   #endif /* (POWER_IP_ENTER_LOW_POWER_MODE == STD_ON) */
222 #endif
223     POWER_IP_RUN_MODE   = 32U,               /**< @brief Run Mode. */
224 
225 } Power_Ip_PowerModeType;
226 
227 /**
228 * @brief            The type Mcu_RawResetType specifies the reset reason in raw register format, read from a reset status register.
229 * @details          The type shall be uint8, uint16 or uint32 based on best performance.
230 *
231 * @implements Mcu_RawResetType_typedef
232 *
233 */
234 typedef uint32 Power_Ip_RawResetType;   /**< @brief Destructive and Functional Reset Events Log. */
235 
236 /**
237 * @brief            The Mcu_ModeType specifies the identification (ID) for a MCU mode, configured via configuration structure.
238 * @details          The type shall be uint8, uint16 or uint32.
239 *
240 * @implements     Mcu_ModeType_typedef
241 *
242 */
243 typedef uint32 Power_Ip_ModeType;
244 
245 /**
246 * @brief
247 * @details
248 */
249 typedef struct
250 {
251     /**< @brief The ID for Power Mode configuration. */
252     Power_Ip_ModeType ModeConfigId;
253 
254     /**< @brief The Power Mode name (code). */
255     Power_Ip_PowerModeType PowerMode;
256 
257     /**< @brief Indicates sleep-on-exit configuration */
258     boolean SleepOnExit;
259 
260     /**< @brief MC_ME IP Mode settings. */
261     const Power_Ip_MC_ME_ModeConfigType * McMeModeConfigPtr;
262 
263 #if (defined(POWER_IP_RESET_DOMAINS_SUPPORTED))
264   #if (POWER_IP_RESET_DOMAINS_SUPPORTED == STD_ON)
265     /**< @brief MC_RGM IP Mode settings. */
266     const Power_Ip_MC_RGM_ModeConfigType * McRgmModeConfigPtr;
267   #endif /* (POWER_IP_RESET_DOMAINS_SUPPORTED == STD_ON) */
268 #endif
269     /**< @brief Configuration for DCM_GPR (Device Configuration Module General-Purpose Registers) hardware IP. */
270     const Power_Ip_DCM_GPR_ConfigType * DcmGprConfigPtr;
271 
272 } Power_Ip_ModeConfigType;
273 
274 
275 /** @brief Power ip report error types. */
276 typedef enum
277 {
278     POWER_IP_REPORT_TIMEOUT_ERROR               = 0U,   /**< @brief Report Timeout Error. */
279     POWER_IP_ISR_ERROR                          = 1U,   /**< @brief Notification Error. */
280     POWER_IP_PMC_ERROR                          = 2U,   /**< @brief Notification PMC. */
281     POWER_IP_ISR_VOLTAGE_HVD_VDDINT_DETECT      = 3U,   /**< @brief Report the Voltage on VDDINT is high-voltage detected. */
282     POWER_IP_ISR_VOLTAGE_HVD_15_DETECT          = 4U,   /**< @brief Report the Voltage on VDD15 is high-voltage detected. */
283     POWER_IP_ISR_VOLTAGE_HVD_VDD_DETECT         = 5U,   /**< @brief Report the Voltage on VDD is high-voltage detected. */
284     POWER_IP_ISR_VOLTAGE_LVD_VDDC_DETECT        = 6U,   /**< @brief Report the Voltage on VDDC is low-voltage detected. */
285     POWER_IP_ISR_VOLTAGE_LVD_VLS_DETECT         = 7U,   /**< @brief Report the Voltage on VLS is low-voltage detected. */
286 } Power_Ip_ReportErrorType;
287 
288 /*!
289  * @brief Power report error callback structure.
290  * Implements PowerReportErrorCallbackType_Class
291  */
292 typedef void (*Power_Ip_ReportErrorsCallbackType)(Power_Ip_ReportErrorType Error, uint8 ErrorCode);
293 
294 /*==================================================================================================
295 *                                GLOBAL VARIABLE DECLARATIONS
296 ==================================================================================================*/
297 
298 
299 /*==================================================================================================
300 *                                    FUNCTION PROTOTYPES
301 ==================================================================================================*/
302 
303 
304 #ifdef __cplusplus
305 }
306 #endif
307 
308 /** @} */
309 #endif /* POWER_IP_TYPES_H */
310 
311 
312