Power_Ip_CortexM4.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral :
  5. * Dependencies : none
  6. *
  7. * Autosar Version : 4.4.0
  8. * Autosar Revision : ASR_REL_4_4_REV_0000
  9. * Autosar Conf.Variant :
  10. * SW Version : 1.0.0
  11. * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
  12. *
  13. * (c) Copyright 2020-2021 NXP Semiconductors
  14. * All Rights Reserved.
  15. *
  16. * NXP Confidential. This software is owned or controlled by NXP and may only be
  17. * used strictly in accordance with the applicable license terms. By expressly
  18. * accepting such terms or by downloading, installing, activating and/or otherwise
  19. * using the software, you are agreeing that you have read, and that you agree to
  20. * comply with and are bound by, such license terms. If you do not agree to be
  21. * bound by the applicable license terms, then you may not retain, install,
  22. * activate or otherwise use the software.
  23. ==================================================================================================*/
  24. /**
  25. * @file Power_Ip_CotexM4.h
  26. * @version 1.0.0
  27. *
  28. * @brief POWER IP driver header file.
  29. * @details POWER IP driver header file.
  30. *
  31. * @addtogroup POWER_DRIVER Power Ip Driver
  32. * @{
  33. */
  34. #ifndef POWER_IP_CORTEXM4_H
  35. #define POWER_IP_CORTEXM4_H
  36. #ifdef __cplusplus
  37. extern "C"{
  38. #endif
  39. /*==================================================================================================
  40. * INCLUDE FILES
  41. * 1) system and project includes
  42. * 2) needed interfaces from external units
  43. * 3) internal and external interfaces from this unit
  44. ==================================================================================================*/
  45. #include "Power_Ip_Types.h"
  46. /*==================================================================================================
  47. SOURCE FILE VERSION INFORMATION
  48. ==================================================================================================*/
  49. #define POWER_IP_CORTEXM4_VENDOR_ID 43
  50. #define POWER_IP_CORTEXM4_AR_RELEASE_MAJOR_VERSION 4
  51. #define POWER_IP_CORTEXM4_AR_RELEASE_MINOR_VERSION 4
  52. #define POWER_IP_CORTEXM4_AR_RELEASE_REVISION_VERSION 0
  53. #define POWER_IP_CORTEXM4_SW_MAJOR_VERSION 1
  54. #define POWER_IP_CORTEXM4_SW_MINOR_VERSION 0
  55. #define POWER_IP_CORTEXM4_SW_PATCH_VERSION 0
  56. /*==================================================================================================
  57. FILE VERSION CHECKS
  58. ==================================================================================================*/
  59. /* Check if Power_Ip_CortexM4.h file and Power_Ip_Types.h file have same versions */
  60. #if (POWER_IP_CORTEXM4_VENDOR_ID != POWER_IP_TYPES_VENDOR_ID)
  61. #error "Power_Ip_CortexM4.h and Power_Ip_Types.h have different vendor IDs"
  62. #endif
  63. /* Check if Power_Ip_CortexM4.h file and Power_Ip_Types.h file are of the same Autosar version */
  64. #if ((POWER_IP_CORTEXM4_AR_RELEASE_MAJOR_VERSION != POWER_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  65. (POWER_IP_CORTEXM4_AR_RELEASE_MINOR_VERSION != POWER_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
  66. (POWER_IP_CORTEXM4_AR_RELEASE_REVISION_VERSION != POWER_IP_TYPES_AR_RELEASE_REVISION_VERSION))
  67. #error "AutoSar Version Numbers of Power_Ip_CortexM4.h and Power_Ip_Types.h are different"
  68. #endif
  69. /* Check if Power_Ip_CortexM4.h file and Power_Ip_Types.h file are of the same Software version */
  70. #if ((POWER_IP_CORTEXM4_SW_MAJOR_VERSION != POWER_IP_TYPES_SW_MAJOR_VERSION) || \
  71. (POWER_IP_CORTEXM4_SW_MINOR_VERSION != POWER_IP_TYPES_SW_MINOR_VERSION) || \
  72. (POWER_IP_CORTEXM4_SW_PATCH_VERSION != POWER_IP_TYPES_SW_PATCH_VERSION))
  73. #error "Software Version Numbers of Power_Ip_CortexM4.h and Power_Ip_Types.h are different"
  74. #endif
  75. /*==================================================================================================
  76. * GLOBAL VARIABLE DECLARATIONS
  77. ==================================================================================================*/
  78. /*==================================================================================================
  79. * ENUMS
  80. ==================================================================================================*/
  81. /*==================================================================================================
  82. * CONSTANTS
  83. ==================================================================================================*/
  84. /*==================================================================================================
  85. * DEFINES AND MACROS
  86. ==================================================================================================*/
  87. /***********************************************************/
  88. /* CortexM4 System Control Register */
  89. /***********************************************************/
  90. #define CM4_AIRCR_BASEADDR ((uint32)0xE000ED0CU)
  91. #define CM4_AIRCR_SYSRESETREQ_MASK 0x4u
  92. #define CM4_AIRCR_PRIGROUP_MASK 0x700u
  93. #define CM4_AIRCR_VECTKEY_MASK 0xFFFF0000u
  94. #define CM4_AIRCR_VECTKEY_SHIFT 16u
  95. #define CM4_AIRCR_VECTKEY(x) (((uint32)(((uint32)(x))<<CM4_AIRCR_VECTKEY_SHIFT))&CM4_AIRCR_VECTKEY_MASK)
  96. #define CM4_SCR_SLEEPONEXIT_MASK32 ((uint32)0x00000002U)
  97. #define CM4_SCR_SLEEPDEEP_MASK32 ((uint32)0x00000004U)
  98. /*==================================================================================================
  99. * STRUCTURES AND OTHER TYPEDEFS
  100. ==================================================================================================*/
  101. typedef struct{
  102. volatile uint32 AIRCR; /**< Application Interrupt and Reset Control Register , offset: 0xC */
  103. volatile uint32 SCR; /**< System Control Register, offset: 0x0 */
  104. } Power_Ip_CM4_Type;
  105. /*==================================================================================================
  106. * FUNCTION PROTOTYPES
  107. ==================================================================================================*/
  108. #define MCU_START_SEC_CODE
  109. #include "Mcu_MemMap.h"
  110. #ifdef POWER_IP_SLEEPONEXIT_SUPPORT
  111. #if (POWER_IP_SLEEPONEXIT_SUPPORT == STD_ON)
  112. #ifdef POWER_IP_ENABLE_USER_MODE_SUPPORT
  113. #if (STD_ON == POWER_IP_ENABLE_USER_MODE_SUPPORT)
  114. #define Call_Power_Ip_CM4_EnableSleepOnExit() OsIf_Trusted_Call(Power_Ip_CM4_EnableSleepOnExit)
  115. #define Call_Power_Ip_CM4_DisableSleepOnExit() OsIf_Trusted_Call(Power_Ip_CM4_DisableSleepOnExit)
  116. #else
  117. #define Call_Power_Ip_CM4_EnableSleepOnExit() Power_Ip_CM4_EnableSleepOnExit()
  118. #define Call_Power_Ip_CM4_DisableSleepOnExit() Power_Ip_CM4_DisableSleepOnExit()
  119. #endif /* (STD_ON == POWER_IP_ENABLE_USER_MODE_SUPPORT) */
  120. #else /* POWER_IP_ENABLE_USER_MODE_SUPPORT */
  121. #define Call_Power_Ip_CM4_EnableSleepOnExit() Power_Ip_CM4_EnableSleepOnExit()
  122. #define Call_Power_Ip_CM4_DisableSleepOnExit() Power_Ip_CM4_DisableSleepOnExit()
  123. #endif /* POWER_IP_ENABLE_USER_MODE_SUPPORT */
  124. #endif /* POWER_IP_SLEEPONEXIT_SUPPORT == STD_ON */
  125. #endif /* POWER_IP_SLEEPONEXIT_SUPPORT */
  126. #ifdef POWER_IP_ENABLE_USER_MODE_SUPPORT
  127. #if (STD_ON == POWER_IP_ENABLE_USER_MODE_SUPPORT)
  128. #define Call_Power_Ip_CM4_EnableDeepSleep() \
  129. do\
  130. { \
  131. OsIf_Trusted_Call(Power_Ip_CM4_EnableDeepSleep); \
  132. }\
  133. while(0)
  134. #define Call_Power_Ip_CM4_DisableDeepSleep() \
  135. do\
  136. { \
  137. OsIf_Trusted_Call(Power_Ip_CM4_DisableDeepSleep); \
  138. }\
  139. while(0)
  140. #else
  141. #define Call_Power_Ip_CM4_EnableDeepSleep() \
  142. do\
  143. { \
  144. Power_Ip_CM4_EnableDeepSleep(); \
  145. }\
  146. while(0)
  147. #define Call_Power_Ip_CM4_DisableDeepSleep() \
  148. do\
  149. { \
  150. Power_Ip_CM4_DisableDeepSleep(); \
  151. }\
  152. while(0)
  153. #endif
  154. #endif
  155. #if (MCU_PERFORM_RESET_API == STD_ON)
  156. #ifdef POWER_IP_ENABLE_USER_MODE_SUPPORT
  157. #if (STD_ON == POWER_IP_ENABLE_USER_MODE_SUPPORT)
  158. #define Call_Power_Ip_CM4_SystemReset() \
  159. do\
  160. { \
  161. OsIf_Trusted_Call(Power_Ip_CM4_SystemReset); \
  162. }\
  163. while(0)
  164. #else
  165. #define Call_Power_Ip_CM4_SystemReset() \
  166. do\
  167. { \
  168. Power_Ip_CM4_SystemReset(); \
  169. }\
  170. while(0)
  171. #endif
  172. #endif
  173. #endif /* (MCU_PERFORM_RESET_API == STD_ON) */
  174. #if (MCU_PERFORM_RESET_API == STD_ON)
  175. /**
  176. * @brief The function initiates a system reset request to reset the SoC.
  177. * @details The function initiates a system reset request to reset the SoC
  178. *
  179. * @param[in] none
  180. *
  181. * @return void
  182. *
  183. */
  184. void Power_Ip_CM4_SystemReset(void);
  185. #endif
  186. #ifdef POWER_IP_SLEEPONEXIT_SUPPORT
  187. #if (POWER_IP_SLEEPONEXIT_SUPPORT == STD_ON)
  188. void Power_Ip_CM4_EnableSleepOnExit(void);
  189. void Power_Ip_CM4_DisableSleepOnExit(void);
  190. #endif
  191. #endif
  192. void Power_Ip_CM4_EnableDeepSleep(void);
  193. void Power_Ip_CM4_DisableDeepSleep(void);
  194. #define MCU_STOP_SEC_CODE
  195. #include "Mcu_MemMap.h"
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199. #endif /* POWER_IP_CORTEXM4_H */
  200. /** @} */