Wdg_43_Instance1.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : Wdog,Ewm
  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
  26. *
  27. * @addtogroup Wdg
  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 "Wdg_43_Instance1.h"
  40. #include "Wdg_ChannelTypes.h"
  41. #include "Wdg_Channel.h"
  42. #ifdef WDG_INSTANCE1
  43. #if (WDG_INSTANCE1 == STD_ON)
  44. /*==================================================================================================
  45. * SOURCE FILE VERSION INFORMATION
  46. ==================================================================================================*/
  47. #define WDG_43_INSTANCE1_VENDOR_ID_C 43
  48. #define WDG_43_INSTANCE1_AR_RELEASE_MAJOR_VERSION_C 4
  49. #define WDG_43_INSTANCE1_AR_RELEASE_MINOR_VERSION_C 4
  50. #define WDG_43_INSTANCE1_AR_RELEASE_REVISION_VERSION_C 0
  51. #define WDG_43_INSTANCE1_SW_MAJOR_VERSION_C 1
  52. #define WDG_43_INSTANCE1_SW_MINOR_VERSION_C 0
  53. #define WDG_43_INSTANCE1_SW_PATCH_VERSION_C 0
  54. /*==================================================================================================
  55. FILE VERSION CHECKS
  56. ==================================================================================================*/
  57. /* Check if current file and Wdg_Channel.h header file are of the same vendor */
  58. #if (WDG_43_INSTANCE1_VENDOR_ID_C != WDG_CHANNEL_VENDOR_ID)
  59. #error "Wdg_Channel.c and Wdg_Channel.h have different vendor ids"
  60. #endif
  61. #if ((WDG_43_INSTANCE1_AR_RELEASE_MAJOR_VERSION_C != WDG_CHANNEL_AR_RELEASE_MAJOR_VERSION) || \
  62. (WDG_43_INSTANCE1_AR_RELEASE_MINOR_VERSION_C != WDG_CHANNEL_AR_RELEASE_MINOR_VERSION) || \
  63. (WDG_43_INSTANCE1_AR_RELEASE_REVISION_VERSION_C != WDG_CHANNEL_AR_RELEASE_REVISION_VERSION))
  64. #error "AutoSar Version Numbers of Wdg.c and Wdg_Channel.h are different"
  65. #endif
  66. #if ((WDG_43_INSTANCE1_SW_MAJOR_VERSION_C != WDG_CHANNEL_SW_MAJOR_VERSION) || \
  67. (WDG_43_INSTANCE1_SW_MINOR_VERSION_C != WDG_CHANNEL_SW_MINOR_VERSION) || \
  68. (WDG_43_INSTANCE1_SW_PATCH_VERSION_C != WDG_CHANNEL_SW_PATCH_VERSION))
  69. #error "Software Version Numbers of Wdg.c and Wdg_Channel.h are different"
  70. #endif
  71. /* Check if current file and Wdg header file are of the same vendor */
  72. #if (WDG_43_INSTANCE1_VENDOR_ID_C != WDG_43_INSTANCE1_VENDOR_ID)
  73. #error "Wdg_Channel.c and Wdg.h have different vendor ids"
  74. #endif
  75. #if ((WDG_43_INSTANCE1_AR_RELEASE_MAJOR_VERSION_C != WDG_43_INSTANCE1_AR_RELEASE_MAJOR_VERSION) || \
  76. (WDG_43_INSTANCE1_AR_RELEASE_MINOR_VERSION_C != WDG_43_INSTANCE1_AR_RELEASE_MINOR_VERSION) || \
  77. (WDG_43_INSTANCE1_AR_RELEASE_REVISION_VERSION_C != WDG_43_INSTANCE1_AR_RELEASE_REVISION_VERSION))
  78. #error "AutoSar Version Numbers of Wdg.c and Wdg.h are different"
  79. #endif
  80. #if ((WDG_43_INSTANCE1_SW_MAJOR_VERSION_C != WDG_43_INSTANCE1_SW_MAJOR_VERSION) || \
  81. (WDG_43_INSTANCE1_SW_MINOR_VERSION_C != WDG_43_INSTANCE1_SW_MINOR_VERSION) || \
  82. (WDG_43_INSTANCE1_SW_PATCH_VERSION_C != WDG_43_INSTANCE1_SW_PATCH_VERSION))
  83. #error "Software Version Numbers of Wdg.c and Wdg.h are different"
  84. #endif
  85. /* Check if current file and Wdg_ChannelTypes.h header file are of the same vendor */
  86. #if (WDG_43_INSTANCE1_VENDOR_ID_C != WDG_CHANNEL_TYPES_VENDOR_ID)
  87. #error "Wdg_Channel.c and Wdg_ChannelTypes.h have different vendor ids"
  88. #endif
  89. #if ((WDG_43_INSTANCE1_AR_RELEASE_MAJOR_VERSION_C != WDG_CHANNEL_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  90. (WDG_43_INSTANCE1_AR_RELEASE_MINOR_VERSION_C != WDG_CHANNEL_TYPES_AR_RELEASE_MINOR_VERSION) || \
  91. (WDG_43_INSTANCE1_AR_RELEASE_REVISION_VERSION_C != WDG_CHANNEL_TYPES_AR_RELEASE_REVISION_VERSION))
  92. #error "AutoSar Version Numbers of Wdg.c and Wdg_ChannelTypes.h are different"
  93. #endif
  94. #if ((WDG_43_INSTANCE1_SW_MAJOR_VERSION_C != WDG_CHANNEL_TYPES_SW_MAJOR_VERSION) || \
  95. (WDG_43_INSTANCE1_SW_MINOR_VERSION_C != WDG_CHANNEL_TYPES_SW_MINOR_VERSION) || \
  96. (WDG_43_INSTANCE1_SW_PATCH_VERSION_C != WDG_CHANNEL_TYPES_SW_PATCH_VERSION))
  97. #error "Software Version Numbers of Wdg.c and Wdg_ChannelTypes.h are different"
  98. #endif
  99. /*==================================================================================================
  100. * LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
  101. ==================================================================================================*/
  102. /*==================================================================================================
  103. * LOCAL MACROS
  104. ==================================================================================================*/
  105. /*==================================================================================================
  106. * LOCAL CONSTANTS
  107. ==================================================================================================*/
  108. /*==================================================================================================
  109. * LOCAL VARIABLES
  110. ==================================================================================================*/
  111. /*==================================================================================================
  112. * GLOBAL CONSTANTS
  113. ==================================================================================================*/
  114. /*==================================================================================================
  115. * GLOBAL VARIABLES
  116. ==================================================================================================*/
  117. /*==================================================================================================
  118. * LOCAL FUNCTION PROTOTYPES
  119. ==================================================================================================*/
  120. /*==================================================================================================
  121. * LOCAL FUNCTIONS
  122. ==================================================================================================*/
  123. /*==================================================================================================
  124. * GLOBAL FUNCTIONS
  125. ==================================================================================================*/
  126. #ifdef WDG_ROM
  127. #if (WDG_ROM == 1U)
  128. #define WDG_START_SEC_CODE
  129. #endif
  130. #else
  131. #if (WDG_RAM == 0U)
  132. #define WDG_START_SEC_RAMCODE
  133. #endif
  134. #endif
  135. #include "Wdg_MemMap.h"
  136. /**
  137. * @brief This function initializes the WDG module.
  138. * @details The @p Wdg_43_Instance1_Init function shall initialize the Wdg module and the
  139. * watchdog hardware, i.e. it shall set the default watchdog mode and
  140. * timeout period as provided in the configuration set.
  141. *
  142. * @param[in] ConfigPtr Pointer to configuration set.
  143. *
  144. *
  145. *
  146. **/
  147. void Wdg_43_Instance1_Init(const Wdg_ConfigType *ConfigPtr)
  148. {
  149. Wdg_ChannelInit(WDG_IPW_INSTANCE1, ConfigPtr);
  150. }
  151. /**
  152. * @brief Switches the watchdog into the mode Mode.
  153. * @details By choosing one of a limited number of statically configured
  154. * settings (e.g. toggle or window watchdog, different timeout periods)
  155. * the Wdg module and the watchdog hardware can be switched between the
  156. * following three different watchdog modes using the @p Wdg_43_Instance1_SetMode
  157. * function:<br>
  158. * - WDGIF_OFF_MODE,
  159. * - WDGIF_SLOW_MODE,
  160. * - WDGIF_FAST_MODE.
  161. * .
  162. *
  163. * @param[in] Mode One of the following statically configured modes:<br>
  164. * -# WDGIF_OFF_MODE,
  165. * -# WDGIF_SLOW_MODE,
  166. * -# WDGIF_FAST_MODE.
  167. * .
  168. *
  169. * @return Std_ReturnType.
  170. * @retval E_OK Mode switch executed completely and successfully.
  171. * @retval E_NOT_OK The mode switch encountered errors.
  172. *
  173. *
  174. *
  175. **/
  176. Std_ReturnType Wdg_43_Instance1_SetMode(WdgIf_ModeType Mode)
  177. {
  178. return Wdg_ChannelSetMode(WDG_IPW_INSTANCE1, Mode);
  179. }
  180. #if (WDG_DIRECT_SERVICE_INSTANCE1 == STD_OFF)
  181. /**
  182. * @brief Reset the watchdog timeout counter according to the timeout value passed.
  183. * @details
  184. *
  185. * @param[in] timeout Timeout value (milliseconds) for setting the trigger counter.
  186. *
  187. *
  188. **/
  189. void Wdg_43_Instance1_SetTriggerCondition(uint16 timeout)
  190. {
  191. Wdg_ChannelSetTriggerCondition(WDG_IPW_INSTANCE1, timeout);
  192. }
  193. #endif
  194. #if (WDG_DIRECT_SERVICE_INSTANCE1 == STD_ON)
  195. /**
  196. * @brief Service the Watchdog directly without using an external trigger.
  197. * @details
  198. *
  199. * @param
  200. *
  201. *
  202. *
  203. **/
  204. void Wdg_43_Instance1_Service(void)
  205. {
  206. Wdg_ChannelService(WDG_IPW_INSTANCE1);
  207. }
  208. #endif
  209. #if (WDG_43_INSTANCE1_VERSION_INFO_API == STD_ON)
  210. /**
  211. * @brief Returns the version information of the module.
  212. * @details The Wdg_43_Instance1_ChannelGetVersionInfo function shall return the version
  213. * information of this module. The version information includes:
  214. * - Module Id,
  215. * - Vendor Id,
  216. * - Vendor specific version numbers.
  217. * .
  218. *
  219. * @pre This function is only required if the WDG_VERSION_INFO_API has to be
  220. * equal STD_ON.
  221. *
  222. * @param[in,out] versioninfo Pointer to where to store the version
  223. * information of this module.
  224. *
  225. *
  226. * @implements Wdg_InstanceNo_GetVersionInfo_Activity
  227. *
  228. *
  229. **/
  230. void Wdg_43_Instance1_GetVersionInfo(Std_VersionInfoType *versioninfo)
  231. {
  232. Wdg_ChannelGetVersionInfo(WDG_IPW_INSTANCE1, versioninfo);
  233. }
  234. #endif /* WDG_VERSION_INFO_API == STD_ON */
  235. #ifdef WDG_ROM
  236. #if (WDG_ROM == 1U)
  237. #define WDG_STOP_SEC_CODE
  238. #endif
  239. #else
  240. #if (WDG_RAM == 0U)
  241. #define WDG_STOP_SEC_RAMCODE
  242. #endif
  243. #endif
  244. #include "Wdg_MemMap.h"
  245. #endif /*#if (WDG_INSTANCE1 == STD_ON)*/
  246. #ifdef __cplusplus
  247. }
  248. #endif
  249. #endif
  250. /** @} */