1 /*
2  * Copyright 2020-2023 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef POWER_IP_PRIVATE_H
8 #define POWER_IP_PRIVATE_H
9 
10 /**
11 *   @file       Power_Ip_Private.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                                          INCLUDE FILES
28  1) system and project includes
29  2) needed interfaces from external units
30  3) internal and external interfaces from this unit
31 ==================================================================================================*/
32 #include "Power_Ip_Types.h"
33 #include "Power_Ip_Cfg.h"
34 #ifdef POWER_IP_DEV_ERROR_DETECT
35 #if (STD_ON == POWER_IP_DEV_ERROR_DETECT)
36     #include "Devassert.h"
37 #endif /* (STD_ON == POWER_IP_DEV_ERROR_DETECT) */
38 #endif /* #ifdef POWER_IP_DEV_ERROR_DETECT */
39 /*==================================================================================================
40                                SOURCE FILE VERSION INFORMATION
41 ==================================================================================================*/
42 #define POWER_IP_PRIVATE_VENDOR_ID                    43
43 #define POWER_IP_PRIVATE_AR_RELEASE_MAJOR_VERSION     4
44 #define POWER_IP_PRIVATE_AR_RELEASE_MINOR_VERSION     7
45 #define POWER_IP_PRIVATE_AR_RELEASE_REVISION_VERSION  0
46 #define POWER_IP_PRIVATE_SW_MAJOR_VERSION             3
47 #define POWER_IP_PRIVATE_SW_MINOR_VERSION             0
48 #define POWER_IP_PRIVATE_SW_PATCH_VERSION             0
49 
50 
51 /*==================================================================================================
52                                       FILE VERSION CHECKS
53 ==================================================================================================*/
54 /* Check if Power_Ip_Private.h file and Power_Ip_Types.h file have same versions */
55 #if (POWER_IP_PRIVATE_VENDOR_ID  != POWER_IP_TYPES_VENDOR_ID)
56     #error "Power_Ip_Private.h and Power_Ip_Types.h have different vendor IDs"
57 #endif
58 
59 /* Check if Power_Ip_Private.h file and Power_Ip_Types.h file are of the same Autosar version */
60 #if ((POWER_IP_PRIVATE_AR_RELEASE_MAJOR_VERSION    != POWER_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
61      (POWER_IP_PRIVATE_AR_RELEASE_MINOR_VERSION    != POWER_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
62      (POWER_IP_PRIVATE_AR_RELEASE_REVISION_VERSION != POWER_IP_TYPES_AR_RELEASE_REVISION_VERSION))
63     #error "AutoSar Version Numbers of Power_Ip_Private.h and Power_Ip_Types.h are different"
64 #endif
65 
66 /* Check if Power_Ip_Private.h file and Power_Ip_Types.h file are of the same Software version */
67 #if ((POWER_IP_PRIVATE_SW_MAJOR_VERSION != POWER_IP_TYPES_SW_MAJOR_VERSION) || \
68      (POWER_IP_PRIVATE_SW_MINOR_VERSION != POWER_IP_TYPES_SW_MINOR_VERSION) || \
69      (POWER_IP_PRIVATE_SW_PATCH_VERSION != POWER_IP_TYPES_SW_PATCH_VERSION))
70     #error "Software Version Numbers of Power_Ip_Private.h and Power_Ip_Types.h are different"
71 #endif
72 
73 /* Check if Power_Ip_Private.h file and Power_Ip_Cfg.h file have same versions */
74 #if (POWER_IP_PRIVATE_VENDOR_ID  != POWER_IP_CFG_VENDOR_ID)
75     #error "Power_Ip_Private.h and Power_Ip_Cfg.h have different vendor IDs"
76 #endif
77 
78 /* Check if Power_Ip_Private.h file and Power_Ip_Cfg.h file are of the same Autosar version */
79 #if ((POWER_IP_PRIVATE_AR_RELEASE_MAJOR_VERSION    != POWER_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
80      (POWER_IP_PRIVATE_AR_RELEASE_MINOR_VERSION    != POWER_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
81      (POWER_IP_PRIVATE_AR_RELEASE_REVISION_VERSION != POWER_IP_CFG_AR_RELEASE_REVISION_VERSION))
82     #error "AutoSar Version Numbers of Power_Ip_Private.h and Power_Ip_Cfg.h are different"
83 #endif
84 
85 /* Check if Power_Ip_Private.h file and Power_Ip_Cfg.h file are of the same Software version */
86 #if ((POWER_IP_PRIVATE_SW_MAJOR_VERSION != POWER_IP_CFG_SW_MAJOR_VERSION) || \
87      (POWER_IP_PRIVATE_SW_MINOR_VERSION != POWER_IP_CFG_SW_MINOR_VERSION) || \
88      (POWER_IP_PRIVATE_SW_PATCH_VERSION != POWER_IP_CFG_SW_PATCH_VERSION))
89     #error "Software Version Numbers of Power_Ip_Private.h and Power_Ip_Cfg.h are different"
90 #endif
91 
92 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
93 #ifdef POWER_IP_DEV_ERROR_DETECT
94 #if (STD_ON == POWER_IP_DEV_ERROR_DETECT)
95 /* Check if Power_Ip_Private.h file and Devassert.h file are of the same Autosar version */
96 #if ((POWER_IP_PRIVATE_AR_RELEASE_MAJOR_VERSION    != DEVASSERT_AR_RELEASE_MAJOR_VERSION) || \
97      (POWER_IP_PRIVATE_AR_RELEASE_MINOR_VERSION    != DEVASSERT_AR_RELEASE_MINOR_VERSION))
98     #error "AutoSar Version Numbers of Power_Ip_Private.h and Devassert.h are different"
99 #endif
100 #endif /* (STD_ON == POWER_IP_DEV_ERROR_DETECT) */
101 #endif /* #ifdef POWER_IP_DEV_ERROR_DETECT */
102 #endif
103 
104 /*==================================================================================================
105 *                                          CONSTANTS
106 ==================================================================================================*/
107 
108 
109 /*==================================================================================================
110                                        DEFINES AND MACROS
111 ==================================================================================================*/
112 #ifdef POWER_IP_DEV_ERROR_DETECT
113   #if (POWER_IP_DEV_ERROR_DETECT == STD_ON)
114     #define POWER_IP_DEV_ASSERT(x)      DevAssert(x)
115   #else
116     #define POWER_IP_DEV_ASSERT(x)
117   #endif
118 #else
119     #define POWER_IP_DEV_ASSERT(x)
120 #endif
121 /*==================================================================================================
122 *                                             ENUMS
123 ==================================================================================================*/
124 
125 /*==================================================================================================
126 *                                STRUCTURES AND OTHER TYPEDEFS
127 ==================================================================================================*/
128 
129 /*==================================================================================================
130 *                                GLOBAL VARIABLE DECLARATIONS
131 ==================================================================================================*/
132 
133 /*==================================================================================================
134                                        LOCAL VARIABLES
135 ==================================================================================================*/
136 #define MCU_START_SEC_VAR_INIT_UNSPECIFIED
137 #include "Mcu_MemMap.h"
138 
139 /* Power Report Error Callback */
140 extern Power_Ip_ReportErrorsCallbackType Power_Ip_pfReportErrorsCallback;
141 
142 #define MCU_STOP_SEC_VAR_INIT_UNSPECIFIED
143 #include "Mcu_MemMap.h"
144 
145 /*==================================================================================================
146 *                                    FUNCTION PROTOTYPES
147 ==================================================================================================*/
148 
149 #define MCU_START_SEC_CODE
150 #include "Mcu_MemMap.h"
151 
152 void Power_Ip_ReportPowerErrors(Power_Ip_ReportErrorType Error, uint8 ErrorCode);
153 void Power_Ip_ReportPowerErrorsEmptyCallback(Power_Ip_ReportErrorType Error, uint8 ErrorCode);
154 
155 /*!
156  * @brief Initializes a starting reference point for timeout
157  *
158  * @param[out] StartTimeOut    The starting time from which elapsed time is measured
159  * @param[out] ElapsedTimeOut  The elapsed time to be passed to Power_Ip_TimeoutExpired
160  * @param[out] TimeoutTicksOut The timeout value (in ticks) to be passed to Power_Ip_TimeoutExpired
161  * @param[in]  TimeoutUs       The timeout value (in microseconds)
162  */
163 void Power_Ip_StartTimeout(uint32 *StartTimeOut,
164                        uint32 *ElapsedTimeOut,
165                        uint32 *TimeoutTicksOut,
166                        uint32 TimeoutUs);
167 
168 /*!
169  * @brief Checks for timeout condition.
170  *
171  * @param[in,out] StartTimeInOut    The starting time from which elapsed time is measured
172  * @param[in,out] ElapsedTimeInOut  The accumulated elapsed time from the starting time reference
173  * @param[in]     TimeoutTicks      The timeout limit (in ticks)
174  */
175 boolean Power_Ip_TimeoutExpired(uint32 *StartTimeInOut,
176                             uint32 *ElapsedTimeInOut,
177                             uint32 TimeoutTicks);
178 
179 #define MCU_STOP_SEC_CODE
180 #include "Mcu_MemMap.h"
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 /** @} */
186 #endif /* POWER_IP_PRIVATE_H */
187 
188