1 /*
2  * Copyright 2020-2023 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef POWER_IP_H
8 #define POWER_IP_H
9 
10 /**
11 *   @file       Power_Ip.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                                          INCLUDE FILES
27  1) system and project includes
28  2) needed interfaces from external units
29  3) internal and external interfaces from this unit
30 ==================================================================================================*/
31 #include "StandardTypes.h"
32 #include "Power_Ip_Cfg.h"
33 #include "Power_Ip_CortexM7.h"
34 
35 /*==================================================================================================
36                                SOURCE FILE VERSION INFORMATION
37 ==================================================================================================*/
38 #define POWER_IP_VENDOR_ID                       43
39 #define POWER_IP_AR_RELEASE_MAJOR_VERSION        4
40 #define POWER_IP_AR_RELEASE_MINOR_VERSION        7
41 #define POWER_IP_AR_RELEASE_REVISION_VERSION     0
42 #define POWER_IP_SW_MAJOR_VERSION                3
43 #define POWER_IP_SW_MINOR_VERSION                0
44 #define POWER_IP_SW_PATCH_VERSION                0
45 
46 /*==================================================================================================
47                                       FILE VERSION CHECKS
48 ==================================================================================================*/
49 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
50 /* Check if Power_Ip.h file and StandardTypes.h file are of the same Autosar version */
51 #if ((POWER_IP_AR_RELEASE_MAJOR_VERSION    != STD_AR_RELEASE_MAJOR_VERSION) || \
52      (POWER_IP_AR_RELEASE_MINOR_VERSION    != STD_AR_RELEASE_MINOR_VERSION))
53     #error "AutoSar Version Numbers of Power_Ip.h and StandardTypes.h are different"
54 #endif
55 #endif
56 
57 /* Check if Power_Ip.h file and Power_Ip_Cfg.h file have same versions */
58 #if (POWER_IP_VENDOR_ID  != POWER_IP_CFG_VENDOR_ID)
59     #error "Power_Ip.h and Power_Ip_Cfg.h have different vendor IDs"
60 #endif
61 
62 /* Check if Power_Ip.h file and Power_Ip_Cfg.h file are of the same Autosar version */
63 #if ((POWER_IP_AR_RELEASE_MAJOR_VERSION    != POWER_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
64      (POWER_IP_AR_RELEASE_MINOR_VERSION    != POWER_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
65      (POWER_IP_AR_RELEASE_REVISION_VERSION != POWER_IP_CFG_AR_RELEASE_REVISION_VERSION))
66     #error "AutoSar Version Numbers of Power_Ip.h and Power_Ip_Cfg.h are different"
67 #endif
68 
69 /* Check if Power_Ip.h file and Power_Ip_Cfg.h file are of the same Software version */
70 #if ((POWER_IP_SW_MAJOR_VERSION != POWER_IP_CFG_SW_MAJOR_VERSION) || \
71      (POWER_IP_SW_MINOR_VERSION != POWER_IP_CFG_SW_MINOR_VERSION) || \
72      (POWER_IP_SW_PATCH_VERSION != POWER_IP_CFG_SW_PATCH_VERSION))
73     #error "Software Version Numbers of Power_Ip.h and Power_Ip_Cfg.h are different"
74 #endif
75 
76 /* Check if Power_Ip.h file and Power_Ip_CortexM7.h file have same versions */
77 #if (POWER_IP_VENDOR_ID  != POWER_IP_CORTEXM7_VENDOR_ID)
78     #error "Power_Ip.h and Power_Ip_CortexM7.h have different vendor IDs"
79 #endif
80 
81 /* Check if Power_Ip.h file and Power_Ip_CortexM7.h file are of the same Autosar version */
82 #if ((POWER_IP_AR_RELEASE_MAJOR_VERSION    != POWER_IP_CORTEXM7_AR_RELEASE_MAJOR_VERSION) || \
83      (POWER_IP_AR_RELEASE_MINOR_VERSION    != POWER_IP_CORTEXM7_AR_RELEASE_MINOR_VERSION) || \
84      (POWER_IP_AR_RELEASE_REVISION_VERSION != POWER_IP_CORTEXM7_AR_RELEASE_REVISION_VERSION))
85     #error "AutoSar Version Numbers of Power_Ip.h and Power_Ip_CortexM7.h are different"
86 #endif
87 
88 /* Check if Power_Ip.h file and Power_Ip_CortexM7.h file are of the same Software version */
89 #if ((POWER_IP_SW_MAJOR_VERSION != POWER_IP_CORTEXM7_SW_MAJOR_VERSION) || \
90      (POWER_IP_SW_MINOR_VERSION != POWER_IP_CORTEXM7_SW_MINOR_VERSION) || \
91      (POWER_IP_SW_PATCH_VERSION != POWER_IP_CORTEXM7_SW_PATCH_VERSION))
92     #error "Software Version Numbers of Power_Ip.h and Power_Ip_CortexM7.h are different"
93 #endif
94 /*==================================================================================================
95 *                                          CONSTANTS
96 ==================================================================================================*/
97 
98 
99 /*==================================================================================================
100                                        DEFINES AND MACROS
101 ==================================================================================================*/
102 
103 /*==================================================================================================
104 *                                             ENUMS
105 ==================================================================================================*/
106 
107 
108 /*==================================================================================================
109 *                                STRUCTURES AND OTHER TYPEDEFS
110 ==================================================================================================*/
111 
112 
113 /*==================================================================================================
114                                  GLOBAL VARIABLE DECLARATIONS
115 ==================================================================================================*/
116 
117 
118 /*==================================================================================================
119                                      FUNCTION PROTOTYPES
120 ==================================================================================================*/
121 #define MCU_START_SEC_CODE
122 #include "Mcu_MemMap.h"
123 
124 /*!
125  * @brief Power initialization
126  *
127  * This function power initialization
128  *
129  * @param[in] HwIPsConfigPtr  power initialization configuration.
130  *
131  * @return void
132  */
133 void Power_Ip_Init(const Power_Ip_HwIPsConfigType * HwIPsConfigPtr);
134 
135 
136 /*!
137  * @brief Sets mode
138  *
139  * This function sets mode.
140  *
141  * @param[in] ModeConfigPtr  power set mote configuration.
142  *
143  * @return void
144  */
145 void Power_Ip_SetMode (const Power_Ip_ModeConfigType * ModeConfigPtr);
146 
147 #if (defined(POWER_IP_ENTER_LOW_POWER_MODE))
148   #if (POWER_IP_ENTER_LOW_POWER_MODE == STD_ON)
149 /**
150 * @brief            This function returns the previous mode.
151 * @details          This function returns the previous mode.
152 *
153 * @return           Status of the previous mode.
154 *
155 * @implements Power_Ip_GetPreviousMode_Activity
156 *
157 */
158 Power_Ip_PowerModeType Power_Ip_GetPreviousMode(void);
159   #endif /* (POWER_IP_ENTER_LOW_POWER_MODE == STD_ON) */
160 #endif
161 
162 #if (POWER_IP_PERFORM_RESET_API == STD_ON)
163 /*!
164  * @brief Performs reset
165  *
166  * This function performs reset.
167  *
168  * @param[in] HwIPsConfigPtr  reset initialization configuration.
169  *
170  * @return void
171  */
172 void Power_Ip_PerformReset(const Power_Ip_HwIPsConfigType * HwIPsConfigPtr);
173 #endif /* (POWER_IP_PERFORM_RESET_API == STD_ON) */
174 
175 /*!
176  * @brief Returns reset type
177  *
178  * This function returns reset type.
179  *
180  * @return Power_Ip_ResetType   Reset type
181  */
182 Power_Ip_ResetType Power_Ip_GetResetReason(void);
183 
184 /*!
185  * @brief Returns raw reset type
186  *
187  * This function returns raw reset type.
188  *
189  * @return Power_Ip_RawResetType   Raw reset type
190  */
191 Power_Ip_RawResetType Power_Ip_GetResetRawValue(void);
192 
193 /*!
194  * @brief Install report error callback
195  *
196  * This function installs a callback for reporting errors from power driver
197  *
198  *
199  * @param[in] ReportErrorsCallback      Callback to be installed.
200  *
201  * @return void
202  */
203 void Power_Ip_InstallNotificationsCallback(Power_Ip_ReportErrorsCallbackType ReportErrorsCallback);
204 
205 #ifdef POWER_IP_SLEEPONEXIT_SUPPORT
206   #if (POWER_IP_SLEEPONEXIT_SUPPORT == STD_ON)
207 
208 /**
209 * @brief        The function enable SLEEPONEXIT bit.
210 * @details      The function enable SLEEPONEXIT bit.
211 *
212 * @return void
213 *
214 * @implements Power_Ip_EnableSleepOnExit_Activity
215 */
216 void Power_Ip_EnableSleepOnExit(void);
217 
218 /**
219 * @brief        The function disable SLEEPONEXIT bit.
220 * @details      The function disable SLEEPONEXIT bit.
221 *
222 * @return void
223 *
224 * @implements Power_Ip_DisableSleepOnExit_Activity
225 */
226 void Power_Ip_DisableSleepOnExit(void);
227 
228   #endif
229 #endif
230 
231 
232 #ifdef POWER_IP_PMCAECONFIG_API
233 #if (POWER_IP_PMCAECONFIG_API == STD_ON)
234 void Power_Ip_PmcAeConfig(const Power_Ip_HwIPsConfigType * HwIPsConfigPtr);
235 #endif /* (POWER_IP_PMCAECONFIG_API == STD_ON) */
236 #endif
237 
238 #ifdef POWER_IP_AECRESETCONFIG_API
239 #if (POWER_IP_AECRESETCONFIG_API == STD_ON)
240 void Power_Ip_AecResetConfig(const Power_Ip_HwIPsConfigType * HwIPsConfigPtr);
241 #endif /* (POWER_IP_AECRESETCONFIG_API == STD_ON) */
242 #endif
243 
244 
245 #define MCU_STOP_SEC_CODE
246 #include "Mcu_MemMap.h"
247 
248 
249 #ifdef __cplusplus
250 }
251 #endif
252 
253 
254 /** @} */
255 #endif /* POWER_IP_H */
256 
257