EcuM.c 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral :
  5. * Dependencies :
  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
  26. *
  27. * @addtogroup ECUM_MODULE EcuM Module
  28. * @{
  29. */
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /*==================================================================================================
  34. * INCLUDE FILES
  35. * 1) system and project includes
  36. * 2) needed interfaces from external units
  37. * 3) internal and external interfaces from this unit
  38. ==================================================================================================*/
  39. #include "Std_Types.h"
  40. #ifdef TEST_CAN
  41. #include "CanIf.h"
  42. #endif
  43. #include "EcuM.h"
  44. #ifdef TEST_GPT
  45. #include "Gpt.h"
  46. #include "Gpt_TestNotifications.h"
  47. #endif
  48. #ifdef TEST_LIN
  49. #include "LinIf.h"
  50. #endif
  51. #ifdef TEST_ICU
  52. #include "Icu.h"
  53. #endif
  54. /*==================================================================================================
  55. * LOCAL MACROS
  56. ==================================================================================================*/
  57. #define ECUM_VENDOR_ID_C 43
  58. #define ECUM_AR_RELEASE_MAJOR_VERSION_C 4
  59. #define ECUM_AR_RELEASE_MINOR_VERSION_C 4
  60. #define ECUM_AR_RELEASE_REVISION_VERSION_C 0
  61. #define ECUM_SW_MAJOR_VERSION_C 1
  62. #define ECUM_SW_MINOR_VERSION_C 0
  63. #define ECUM_SW_PATCH_VERSION_C 0
  64. /*==================================================================================================
  65. FILE VERSION CHECKS
  66. ==================================================================================================*/
  67. /* Check if source file and ECUM header file are of the same vendor */
  68. #if (ECUM_VENDOR_ID_C != ECUM_VENDOR_ID)
  69. #error "EcuM.c and EcuM.h have different vendor ids"
  70. #endif
  71. /* Check if source file and ECUM header file are of the same Autosar version */
  72. #if ((ECUM_AR_RELEASE_MAJOR_VERSION_C != ECUM_AR_RELEASE_MAJOR_VERSION) || \
  73. (ECUM_AR_RELEASE_MINOR_VERSION_C != ECUM_AR_RELEASE_MINOR_VERSION) || \
  74. (ECUM_AR_RELEASE_REVISION_VERSION_C != ECUM_AR_RELEASE_REVISION_VERSION))
  75. #error "AutoSar Version Numbers of EcuM.c and EcuM.h are different"
  76. #endif
  77. /* Check if source file and ECUM header file are of the same Software version */
  78. #if ((ECUM_SW_MAJOR_VERSION_C != ECUM_SW_MAJOR_VERSION) || \
  79. (ECUM_SW_MINOR_VERSION_C != ECUM_SW_MINOR_VERSION) || \
  80. (ECUM_SW_PATCH_VERSION_C != ECUM_SW_PATCH_VERSION))
  81. #error "Software Version Numbers of EcuM.c and EcuM.h are different"
  82. #endif
  83. #ifdef TEST_CAN
  84. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  85. /* Check if source file and Can header file are of the same version */
  86. #if ((ECUM_AR_RELEASE_MAJOR_VERSION_C != CANIF_AR_RELEASE_MAJOR_VERSION) || \
  87. (ECUM_AR_RELEASE_MINOR_VERSION_C != CANIF_AR_RELEASE_MINOR_VERSION))
  88. #error "AutoSar Version Numbers of EcuM.c and CanIf.h are different"
  89. #endif
  90. #endif
  91. #endif
  92. #ifdef TEST_GPT
  93. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  94. /* Check if source file and Gpt header file are of the same version */
  95. #if ((ECUM_AR_RELEASE_MAJOR_VERSION_C != GPT_AR_RELEASE_MAJOR_VERSION) || \
  96. (ECUM_AR_RELEASE_MINOR_VERSION_C != GPT_AR_RELEASE_MINOR_VERSION))
  97. #error "AutoSar Version Numbers of EcuM.c and Gpt.h are different"
  98. #endif
  99. #endif
  100. #endif
  101. #ifdef TEST_LIN
  102. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  103. /* Check if source file and Lin header file are of the same version */
  104. #if ((ECUM_AR_RELEASE_MAJOR_VERSION_C != LIN_IF_AR_RELEASE_MAJOR_VERSION_CBK) || \
  105. (ECUM_AR_RELEASE_MINOR_VERSION_C != LIN_IF_AR_RELEASE_MINOR_VERSION_CBK))
  106. #error "AutoSar Version Numbers of EcuM.c and LinIf.h are different"
  107. #endif
  108. #endif
  109. #endif
  110. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  111. /* Check if source file and Std_Types header file are of the same version */
  112. #if ((ECUM_AR_RELEASE_MAJOR_VERSION_C != STD_AR_RELEASE_MAJOR_VERSION) || \
  113. (ECUM_AR_RELEASE_MINOR_VERSION_C != STD_AR_RELEASE_MINOR_VERSION))
  114. #error "AutoSar Version Numbers of EcuM.c and Std_Types.h are different"
  115. #endif
  116. #endif
  117. /*==================================================================================================
  118. LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
  119. ==================================================================================================*/
  120. /*==================================================================================================
  121. LOCAL CONSTANTS
  122. ==================================================================================================*/
  123. /*==================================================================================================
  124. LOCAL VARIABLES
  125. ==================================================================================================*/
  126. /*==================================================================================================
  127. GLOBAL CONSTANTS
  128. ==================================================================================================*/
  129. /*==================================================================================================
  130. GLOBAL VARIABLES
  131. ==================================================================================================*/
  132. #define ECUM_START_SEC_VAR_CLEARED_32
  133. #include "Ecum_MemMap.h"
  134. EcuM_WakeupSourceType EcuMLastWakeupEvent; /**< @brief last wakeup event to EcuM (source ID)*/
  135. #define ECUM_STOP_SEC_VAR_CLEARED_32
  136. #include "Ecum_MemMap.h"
  137. /*==================================================================================================
  138. * LOCAL FUNCTION PROTOTYPES
  139. ==================================================================================================*/
  140. /*==================================================================================================
  141. * LOCAL FUNCTIONS
  142. ==================================================================================================*/
  143. /*==================================================================================================
  144. * GLOBAL FUNCTIONS
  145. ==================================================================================================*/
  146. #define ECUM_START_SEC_CODE
  147. #include "Ecum_MemMap.h"
  148. /**
  149. * @brief This function sets the last wakeup event of the ECUM.
  150. * @details This is a function stub only.
  151. *
  152. * @param[in] events last wakeup event
  153. *
  154. */
  155. void EcuM_SetWakeupEvent(EcuM_WakeupSourceType events)
  156. {
  157. EcuMLastWakeupEvent = events;
  158. }
  159. /*================================================================================================*/
  160. /**
  161. * @brief This function validates the wakeup event.
  162. * @details This is a function stub only. Functionality is void in this implementation
  163. *
  164. * @param[in] events wakeup event to validate
  165. */
  166. void EcuM_ValidateWakeupEvent(EcuM_WakeupSourceType events)
  167. {
  168. (void)events;
  169. }
  170. /*================================================================================================*/
  171. /**
  172. * @brief This function checks the wakeup source against possible sources of wakeup.
  173. * @details This is a function stub only. It calls the wakeup interfaces of CANIf, GPT and LIN with the wakeupSource parameter.
  174. *
  175. * @param[in] wakeupSource wakeup source ID
  176. *
  177. */
  178. void EcuM_CheckWakeup(EcuM_WakeupSourceType wakeupSource)
  179. {
  180. #ifdef TEST_CAN
  181. #if (CANIF_WAKEUP_SUPPORT == STD_ON)
  182. CanIf_CheckWakeup(wakeupSource);
  183. #endif
  184. #endif
  185. #ifdef TEST_GPT
  186. Gpt_CheckWakeup(wakeupSource);
  187. #endif
  188. #ifdef TEST_LIN
  189. LinIf_CheckWakeup(wakeupSource);
  190. #endif
  191. #ifdef TEST_ICU
  192. Icu_CheckWakeup(wakeupSource);
  193. #endif
  194. (void)wakeupSource;
  195. }
  196. #define ECUM_STOP_SEC_CODE
  197. #include "Ecum_MemMap.h"
  198. #ifdef __cplusplus
  199. }
  200. #endif
  201. /** @} */