Mcu_Dem_Wrapper.c 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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 Mcu_Dem_Wrapper.c
  26. * @version 1.0.0
  27. *
  28. * @brief AUTOSAR Mcu - Implements the AUTOSAR MCU driver functionality.
  29. * @details Implements the AUTOSAR MCU driver. All the API functions are described by AUTOSAR
  30. *
  31. * @addtogroup MCU_DRIVER Mcu Driver
  32. * @{
  33. */
  34. #ifdef __cplusplus
  35. extern "C"{
  36. #endif
  37. /*==================================================================================================
  38. INCLUDE FILES
  39. 1) system and project includes
  40. 2) needed interfaces from external units
  41. 3) internal and external interfaces from this unit
  42. ==================================================================================================*/
  43. #include "Mcu_Dem_Wrapper.h"
  44. /*==================================================================================================
  45. SOURCE FILE VERSION INFORMATION
  46. ==================================================================================================*/
  47. #define MCU_DEM_WRAPPER_VENDOR_ID_C 43
  48. #define MCU_DEM_WRAPPER_AR_RELEASE_MAJOR_VERSION_C 4
  49. #define MCU_DEM_WRAPPER_AR_RELEASE_MINOR_VERSION_C 4
  50. #define MCU_DEM_WRAPPER_AR_RELEASE_REVISION_VERSION_C 0
  51. #define MCU_DEM_WRAPPER_SW_MAJOR_VERSION_C 1
  52. #define MCU_DEM_WRAPPER_SW_MINOR_VERSION_C 0
  53. #define MCU_DEM_WRAPPER_SW_PATCH_VERSION_C 0
  54. /*==================================================================================================
  55. * FILE VERSION CHECKS
  56. ==================================================================================================*/
  57. /* Check if Mcu_Dem_Wrapper.c file and Mcu_Dem_Wrapper.h file are of the same vendor */
  58. #if (MCU_DEM_WRAPPER_VENDOR_ID_C != MCU_DEM_WRAPPER_VENDOR_ID)
  59. #error "Mcu_Dem_Wrapper.c and Mcu_Dem_Wrapper.h have different vendor ids"
  60. #endif
  61. /* Check if Mcu_Dem_Wrapper.c file and Mcu_Dem_Wrapper.h file are of the same Autosar version */
  62. #if ((MCU_DEM_WRAPPER_AR_RELEASE_MAJOR_VERSION_C != MCU_DEM_WRAPPER_AR_RELEASE_MAJOR_VERSION) || \
  63. (MCU_DEM_WRAPPER_AR_RELEASE_MINOR_VERSION_C != MCU_DEM_WRAPPER_AR_RELEASE_MINOR_VERSION) || \
  64. (MCU_DEM_WRAPPER_AR_RELEASE_REVISION_VERSION_C != MCU_DEM_WRAPPER_AR_RELEASE_REVISION_VERSION) \
  65. )
  66. #error "AutoSar Version Numbers of Mcu_Dem_Wrapper.c and Mcu_Dem_Wrapper.h are different"
  67. #endif
  68. /* Check if Mcu_Dem_Wrapper.c file and Mcu_Dem_Wrapper.h file are of the same Software version */
  69. #if ((MCU_DEM_WRAPPER_SW_MAJOR_VERSION_C != MCU_DEM_WRAPPER_SW_MAJOR_VERSION) || \
  70. (MCU_DEM_WRAPPER_SW_MINOR_VERSION_C != MCU_DEM_WRAPPER_SW_MINOR_VERSION) || \
  71. (MCU_DEM_WRAPPER_SW_PATCH_VERSION_C != MCU_DEM_WRAPPER_SW_PATCH_VERSION) \
  72. )
  73. #error "Software Version Numbers of Mcu_Dem_Wrapper.c and Mcu_Dem_Wrapper.h are different"
  74. #endif
  75. /*==================================================================================================
  76. LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
  77. ==================================================================================================*/
  78. /*==================================================================================================
  79. LOCAL CONSTANTS
  80. ==================================================================================================*/
  81. /*==================================================================================================
  82. LOCAL VARIABLES
  83. ==================================================================================================*/
  84. /*==================================================================================================
  85. GLOBAL CONSTANTS
  86. ==================================================================================================*/
  87. /*==================================================================================================
  88. GLOBAL VARIABLES
  89. ==================================================================================================*/
  90. /*==================================================================================================
  91. LOCAL FUNCTION PROTOTYPES
  92. ==================================================================================================*/
  93. /*==================================================================================================
  94. LOCAL FUNCTIONS
  95. ==================================================================================================*/
  96. /*==================================================================================================
  97. GLOBAL FUNCTIONS
  98. ==================================================================================================*/
  99. #define MCU_START_SEC_CODE
  100. #include "Mcu_MemMap.h"
  101. #if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
  102. /**
  103. * @brief Reports timeout error to DEM.
  104. * @details Checks if the timeout expired and reports the timeout error to DEM if that is the case.
  105. *
  106. * @param[in] u32Timeout Maximum timeout to be waited.
  107. *
  108. * @return void.
  109. */
  110. void Mcu_ReportDemTimeoutError(void)
  111. {
  112. if ((uint32)STD_ON == Mcu_pDemCfgPtr->Mcu_E_TimeoutFailureCfg.state)
  113. {
  114. /* According to requirement [SWS_Dem_00183] from the ASR 4.3.1 "AUTOSAR_SWS_DiagnosticEventManager" document,
  115. * "BSW modules calling Dem_SetEventStatus can safely ignore the return value." */
  116. (void)Dem_SetEventStatus((Dem_EventIdType)Mcu_pDemCfgPtr->Mcu_E_TimeoutFailureCfg.id, DEM_EVENT_STATUS_FAILED);
  117. }
  118. }
  119. #endif
  120. #if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
  121. /**
  122. * @brief Reports incorrect FXOSC configuration to DEM.
  123. * @details Directly reports the FXOSC configuration error to DEM.
  124. *
  125. * @param[in] void.
  126. *
  127. * @return void.
  128. */
  129. void Mcu_ReportDemFxoscError(void)
  130. {
  131. if ((uint32)STD_ON == Mcu_pDemCfgPtr->Mcu_E_InvalidFxoscConfigCfg.state)
  132. {
  133. /* According to requirement [SWS_Dem_00183] from the ASR 4.3.1 "AUTOSAR_SWS_DiagnosticEventManager" document,
  134. * "BSW modules calling Dem_SetEventStatus can safely ignore the return value." */
  135. (void)Dem_SetEventStatus((Dem_EventIdType)Mcu_pDemCfgPtr->Mcu_E_InvalidFxoscConfigCfg.id, DEM_EVENT_STATUS_FAILED);
  136. }
  137. }
  138. #endif
  139. #if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
  140. /**
  141. * @brief Reports failed clock multiplexer switch to DEM.
  142. * @details Directly reports the clock multiplexer switch error to DEM.
  143. *
  144. * @param[in] void.
  145. *
  146. * @return void.
  147. */
  148. void Mcu_ReportDemClockMuxSwitchError(void)
  149. {
  150. if ((uint32)STD_ON == Mcu_pDemCfgPtr->Mcu_E_ClockMuxSwitchFailureCfg.state)
  151. {
  152. /* According to requirement [SWS_Dem_00183] from the ASR 4.3.1 "AUTOSAR_SWS_DiagnosticEventManager" document,
  153. * "BSW modules calling Dem_SetEventStatus can safely ignore the return value." */
  154. (void)Dem_SetEventStatus((Dem_EventIdType)Mcu_pDemCfgPtr->Mcu_E_ClockMuxSwitchFailureCfg.id, DEM_EVENT_STATUS_FAILED);
  155. }
  156. }
  157. #endif
  158. #if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
  159. /**
  160. * @brief Reports timeout error to DEM.
  161. * @details Checks if the switch mode failure and reports the timeout error to DEM if that is the case.
  162. *
  163. * @param[in] void.
  164. *
  165. * @return void.
  166. */
  167. void Mcu_ReportDemSwitchModeError(void)
  168. {
  169. if ((uint32)STD_ON == Mcu_pDemCfgPtr->Mcu_E_SwitchModeFailureCfg.state)
  170. {
  171. /* According to requirement [SWS_Dem_00183] from the ASR 4.3.1 "AUTOSAR_SWS_DiagnosticEventManager" document,
  172. * "BSW modules calling Dem_SetEventStatus can safely ignore the return value." */
  173. (void)Dem_SetEventStatus((Dem_EventIdType)Mcu_pDemCfgPtr->Mcu_E_SwitchModeFailureCfg.id, DEM_EVENT_STATUS_FAILED);
  174. }
  175. }
  176. #endif
  177. #define MCU_STOP_SEC_CODE
  178. #include "Mcu_MemMap.h"
  179. #ifdef __cplusplus
  180. }
  181. #endif
  182. /** @} */