1 /*
2  * Copyright 2020-2023 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 /**
7 *   @file       Power_Ip_CortexM7.c
8 *   @version    3.0.0
9 *
10 *   @brief   POWER driver implementations.
11 *   @details POWER driver implementations.
12 *
13 *   @addtogroup POWER_DRIVER Power Ip Driver
14 *   @{
15 */
16 
17 #ifdef __cplusplus
18 extern "C"{
19 #endif
20 
21 /*==================================================================================================
22 *                                         INCLUDE FILES
23 * 1) system and project includes
24 * 2) needed interfaces from external units
25 * 3) internal and external interfaces from this unit
26 ==================================================================================================*/
27 #include "Power_Ip_Private.h"
28 #include "Power_Ip_CortexM7.h"
29 /*==================================================================================================
30                                SOURCE FILE VERSION INFORMATION
31 ==================================================================================================*/
32 #define POWER_IP_CORTEXM7_VENDOR_ID_C                      43
33 #define POWER_IP_CORTEXM7_AR_RELEASE_MAJOR_VERSION_C       4
34 #define POWER_IP_CORTEXM7_AR_RELEASE_MINOR_VERSION_C       7
35 #define POWER_IP_CORTEXM7_AR_RELEASE_REVISION_VERSION_C    0
36 #define POWER_IP_CORTEXM7_SW_MAJOR_VERSION_C               3
37 #define POWER_IP_CORTEXM7_SW_MINOR_VERSION_C               0
38 #define POWER_IP_CORTEXM7_SW_PATCH_VERSION_C               0
39 
40 /*==================================================================================================
41 *                                     FILE VERSION CHECKS
42 ==================================================================================================*/
43 /* Check if Power_Ip_CortexM7.c file and Power_Ip_Private.h file are of the same vendor */
44 #if (POWER_IP_CORTEXM7_VENDOR_ID_C != POWER_IP_PRIVATE_VENDOR_ID)
45     #error "Power_Ip_CortexM7.c and Power_Ip_Private.h have different vendor ids"
46 #endif
47 
48 /* Check if Power_Ip_CortexM7.c file and Power_Ip_Private.h file are of the same Autosar version */
49 #if ((POWER_IP_CORTEXM7_AR_RELEASE_MAJOR_VERSION_C != POWER_IP_PRIVATE_AR_RELEASE_MAJOR_VERSION) || \
50      (POWER_IP_CORTEXM7_AR_RELEASE_MINOR_VERSION_C != POWER_IP_PRIVATE_AR_RELEASE_MINOR_VERSION) || \
51      (POWER_IP_CORTEXM7_AR_RELEASE_REVISION_VERSION_C != POWER_IP_PRIVATE_AR_RELEASE_REVISION_VERSION) \
52     )
53     #error "AutoSar Version Numbers of Power_Ip_CortexM7.c and Power_Ip_Private.h are different"
54 #endif
55 
56 /* Check if Power_Ip_CortexM7.c file and Power_Ip_Private.h file are of the same Software version */
57 #if ((POWER_IP_CORTEXM7_SW_MAJOR_VERSION_C != POWER_IP_PRIVATE_SW_MAJOR_VERSION) || \
58      (POWER_IP_CORTEXM7_SW_MINOR_VERSION_C != POWER_IP_PRIVATE_SW_MINOR_VERSION) || \
59      (POWER_IP_CORTEXM7_SW_PATCH_VERSION_C != POWER_IP_PRIVATE_SW_PATCH_VERSION) \
60     )
61     #error "Software Version Numbers of Power_Ip_CortexM7.c and Power_Ip_Private.h are different"
62 #endif
63 
64 /* Check if Power_Ip_CortexM7.c file and Power_Ip_CortexM7.h file are of the same vendor */
65 #if (POWER_IP_CORTEXM7_VENDOR_ID_C != POWER_IP_CORTEXM7_VENDOR_ID)
66     #error "Power_Ip_CortexM7.c and Power_Ip_CortexM7.h have different vendor ids"
67 #endif
68 
69 /* Check if Power_Ip_CortexM7.c file and Power_Ip_CortexM7.h file are of the same Autosar version */
70 #if ((POWER_IP_CORTEXM7_AR_RELEASE_MAJOR_VERSION_C != POWER_IP_CORTEXM7_AR_RELEASE_MAJOR_VERSION) || \
71      (POWER_IP_CORTEXM7_AR_RELEASE_MINOR_VERSION_C != POWER_IP_CORTEXM7_AR_RELEASE_MINOR_VERSION) || \
72      (POWER_IP_CORTEXM7_AR_RELEASE_REVISION_VERSION_C != POWER_IP_CORTEXM7_AR_RELEASE_REVISION_VERSION) \
73     )
74     #error "AutoSar Version Numbers of Power_Ip_CortexM7.c and Power_Ip_CortexM7.h are different"
75 #endif
76 
77 /* Check if Power_Ip_CortexM7.c file and Power_Ip_CortexM7.h file are of the same Software version */
78 #if ((POWER_IP_CORTEXM7_SW_MAJOR_VERSION_C != POWER_IP_CORTEXM7_SW_MAJOR_VERSION) || \
79      (POWER_IP_CORTEXM7_SW_MINOR_VERSION_C != POWER_IP_CORTEXM7_SW_MINOR_VERSION) || \
80      (POWER_IP_CORTEXM7_SW_PATCH_VERSION_C != POWER_IP_CORTEXM7_SW_PATCH_VERSION) \
81     )
82     #error "Software Version Numbers of Power_Ip_CortexM7.c and Power_Ip_CortexM7.h are different"
83 #endif
84 /*==================================================================================================
85 *                                 GLOBAL VARIABLE DECLARATIONS
86 ==================================================================================================*/
87 
88 /*==================================================================================================
89 *                                             ENUMS
90 ==================================================================================================*/
91 
92 
93 /*==================================================================================================
94 *                                           CONSTANTS
95 ==================================================================================================*/
96 
97 /*==================================================================================================
98 *                                       DEFINES AND MACROS
99 ==================================================================================================*/
100 
101 /*==================================================================================================
102 *                                 STRUCTURES AND OTHER TYPEDEFS
103 ==================================================================================================*/
104 
105 
106 /*==================================================================================================
107 *                                     LOCAL FUNCTION
108 ==================================================================================================*/
109 #define MCU_START_SEC_CODE
110 #include "Mcu_MemMap.h"
111 
112 #ifdef POWER_IP_SLEEPONEXIT_SUPPORT
113 #if (POWER_IP_SLEEPONEXIT_SUPPORT == STD_ON)
114 /**
115 * @brief        The function disable SLEEPONEXIT bit.
116 * @details      The function disable SLEEPONEXIT bit.
117 *
118 * @param[in]    none
119 *
120 * @return void
121 *
122 * @implements Power_Ip_DisableSleepOnExit_Activity
123 *
124 */
Power_Ip_CM7_DisableSleepOnExit(void)125 void Power_Ip_CM7_DisableSleepOnExit(void)
126 {
127     S32_SCB->SCR &= ~S32_SCB_SCR_SLEEPONEXIT_MASK;
128 }
129 
130 /**
131 * @brief        The function enable SLEEPONEXIT bit.
132 * @details      The function enable SLEEPONEXIT bit.
133 *
134 * @param[in]    none
135 *
136 * @return void
137 *
138 * @implements Power_Ip_EnableSleepOnExit_Activity
139 *
140 */
Power_Ip_CM7_EnableSleepOnExit(void)141 void Power_Ip_CM7_EnableSleepOnExit(void)
142 {
143     S32_SCB->SCR |= S32_SCB_SCR_SLEEPONEXIT_MASK;
144 }
145 #endif
146 #endif
147 
148 /**
149 * @brief        The function disable SLEEPDEEP bit.
150 * @details      The function disable SLEEPDEEP bit.
151 *
152 * @param[in]    none
153 *
154 * @return void
155 */
Power_Ip_CM7_DisableDeepSleep(void)156 void Power_Ip_CM7_DisableDeepSleep(void)
157 {
158     S32_SCB->SCR &= ~S32_SCB_SCR_SLEEPDEEP_MASK;
159 }
160 
161 /**
162 * @brief        The function enable SLEEPDEEP bit.
163 * @details      The function enable SLEEPDEEP bit.
164 *
165 * @param[in]    none
166 *
167 * @return void
168 */
Power_Ip_CM7_EnableDeepSleep(void)169 void Power_Ip_CM7_EnableDeepSleep(void)
170 {
171     S32_SCB->SCR |= S32_SCB_SCR_SLEEPDEEP_MASK;
172 }
173 
174 #define MCU_STOP_SEC_CODE
175 #include "Mcu_MemMap.h"
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 /** @} */
182