Wdg_Channel.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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. #ifndef WDG_CHANNEL_H
  25. #define WDG_CHANNEL_H
  26. /**
  27. * @file
  28. *
  29. * @addtogroup Wdg
  30. * @{
  31. */
  32. #ifdef __cplusplus
  33. extern "C"{
  34. #endif
  35. /*==================================================================================================
  36. * INCLUDE FILES
  37. * 1) system and project includes
  38. * 2) needed interfaces from external units
  39. * 3) internal and external interfaces from this unit
  40. ==================================================================================================*/
  41. #include "Mcal.h"
  42. #include "Wdg_ChannelTypes.h"
  43. #include "Wdg_Cfg.h"
  44. #if (WDG_DIRECT_SERVICE == STD_OFF)
  45. #include "Gpt.h"
  46. #endif
  47. #include "Wdg_Ipw_Types.h"
  48. /*==================================================================================================
  49. * SOURCE FILE VERSION INFORMATION
  50. ==================================================================================================*/
  51. #define WDG_CHANNEL_VENDOR_ID 43
  52. #define WDG_CHANNEL_MODULE_ID 102
  53. #define WDG_CHANNEL_AR_RELEASE_MAJOR_VERSION 4
  54. #define WDG_CHANNEL_AR_RELEASE_MINOR_VERSION 4
  55. #define WDG_CHANNEL_AR_RELEASE_REVISION_VERSION 0
  56. #define WDG_CHANNEL_SW_MAJOR_VERSION 1
  57. #define WDG_CHANNEL_SW_MINOR_VERSION 0
  58. #define WDG_CHANNEL_SW_PATCH_VERSION 0
  59. /*==================================================================================================
  60. FILE VERSION CHECKS
  61. ==================================================================================================*/
  62. /* Check if current file and WDG configuration header file are of the same vendor */
  63. #if (WDG_CHANNEL_VENDOR_ID != WDG_VENDOR_ID_CFG)
  64. #error "Wdg_Channel.h and Wdg_Cfg.h have different vendor ids"
  65. #endif
  66. /* Check if current file and Wdg_Cfg header file are of the same Autosar version */
  67. #if ((WDG_CHANNEL_AR_RELEASE_MAJOR_VERSION != WDG_AR_RELEASE_MAJOR_VERSION_CFG) || \
  68. (WDG_CHANNEL_AR_RELEASE_MINOR_VERSION != WDG_AR_RELEASE_MINOR_VERSION_CFG) || \
  69. (WDG_CHANNEL_AR_RELEASE_REVISION_VERSION != WDG_AR_RELEASE_REVISION_VERSION_CFG))
  70. #error "AutoSar Version Numbers of Wdg_Channel.h and Wdg_Cfg.h are different"
  71. #endif
  72. /* Check if current file and Wdg_Cfg header file are of the same software version */
  73. #if ((WDG_CHANNEL_SW_MAJOR_VERSION != WDG_SW_MAJOR_VERSION_CFG) || \
  74. (WDG_CHANNEL_SW_MINOR_VERSION != WDG_SW_MINOR_VERSION_CFG) || \
  75. (WDG_CHANNEL_SW_PATCH_VERSION != WDG_SW_PATCH_VERSION_CFG))
  76. #error "Software Version Numbers of Wdg_Channel.h and Wdg_Cfg.h are different"
  77. #endif
  78. /* Check if current file and Wdg_ChannelTypes header file are of the same vendor */
  79. #if (WDG_CHANNEL_VENDOR_ID != WDG_CHANNEL_TYPES_VENDOR_ID)
  80. #error "Wdg_Channel.h and Wdg_ChannelTypes.h have different vendor ids"
  81. #endif
  82. #if ((WDG_CHANNEL_AR_RELEASE_MAJOR_VERSION != WDG_CHANNEL_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  83. (WDG_CHANNEL_AR_RELEASE_MINOR_VERSION != WDG_CHANNEL_TYPES_AR_RELEASE_MINOR_VERSION) || \
  84. (WDG_CHANNEL_AR_RELEASE_REVISION_VERSION != WDG_CHANNEL_TYPES_AR_RELEASE_REVISION_VERSION))
  85. #error "AutoSar Version Numbers of Wdg_Channel.h and Wdg_ChannelTypes.h are different"
  86. #endif
  87. #if ((WDG_CHANNEL_SW_MAJOR_VERSION != WDG_CHANNEL_TYPES_SW_MAJOR_VERSION) || \
  88. (WDG_CHANNEL_SW_MINOR_VERSION != WDG_CHANNEL_TYPES_SW_MINOR_VERSION) || \
  89. (WDG_CHANNEL_SW_PATCH_VERSION != WDG_CHANNEL_TYPES_SW_PATCH_VERSION))
  90. #error "Software Version Numbers of Wdg_Channel.h and Wdg_ChannelTypes.h are different"
  91. #endif
  92. /* Check if current file and Wdg_Ipw_Types header file are of the same vendor */
  93. #if (WDG_CHANNEL_VENDOR_ID != WDG_IPW_TYPES_VENDOR_ID)
  94. #error "Wdg_Channel.h and Wdg_Ipw_Types.h have different vendor ids"
  95. #endif
  96. #if ((WDG_CHANNEL_AR_RELEASE_MAJOR_VERSION != WDG_IPW_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  97. (WDG_CHANNEL_AR_RELEASE_MINOR_VERSION != WDG_IPW_TYPES_AR_RELEASE_MINOR_VERSION) || \
  98. (WDG_CHANNEL_AR_RELEASE_REVISION_VERSION != WDG_IPW_TYPES_AR_RELEASE_REVISION_VERSION))
  99. #error "AutoSar Version Numbers of Wdg_Channel.h and Wdg_Ipw_Types.h are different"
  100. #endif
  101. #if ((WDG_CHANNEL_SW_MAJOR_VERSION != WDG_IPW_TYPES_SW_MAJOR_VERSION) || \
  102. (WDG_CHANNEL_SW_MINOR_VERSION != WDG_IPW_TYPES_SW_MINOR_VERSION) || \
  103. (WDG_CHANNEL_SW_PATCH_VERSION != WDG_IPW_TYPES_SW_PATCH_VERSION))
  104. #error "Software Version Numbers of Wdg_Channel.h and Wdg_Ipw_Types.h are different"
  105. #endif
  106. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  107. /* Check if current file and Mcal header file are of the same version */
  108. #if ((WDG_CHANNEL_AR_RELEASE_MAJOR_VERSION != MCAL_AR_RELEASE_MAJOR_VERSION) || \
  109. (WDG_CHANNEL_AR_RELEASE_MINOR_VERSION != MCAL_AR_RELEASE_MINOR_VERSION))
  110. #error "AutoSar Version Numbers of Wdg_Channel.h and Mcal.h are different"
  111. #endif
  112. /* Check if source file and Gpt header file are of the same Autosar version */
  113. #if (WDG_DIRECT_SERVICE == STD_OFF)
  114. #if ((WDG_CHANNEL_AR_RELEASE_MAJOR_VERSION != GPT_AR_RELEASE_MAJOR_VERSION) || \
  115. (WDG_CHANNEL_AR_RELEASE_MINOR_VERSION != GPT_AR_RELEASE_MINOR_VERSION))
  116. #error "AutoSar Version Numbers of Wdg_Channel.h and Gpt.h are different"
  117. #endif
  118. #endif
  119. #endif /* DISABLE_MCAL_INTERMODULE_ASR_CHECK */
  120. /*==================================================================================================
  121. * CONSTANTS
  122. ==================================================================================================*/
  123. /*==================================================================================================
  124. * DEFINES AND MACROS
  125. ==================================================================================================*/
  126. #if (WDG_MULTICORE_ENABLED == STD_ON)
  127. #define Wdg_GetCoreID() OsIf_GetCoreID()
  128. #endif /* (WDG_MULTICORE_ENABLED == STD_ON) */
  129. /*==================================================================================================
  130. * ENUMS
  131. ==================================================================================================*/
  132. /*==================================================================================================
  133. * STRUCTURES AND OTHER TYPEDEFS
  134. ==================================================================================================*/
  135. /*==================================================================================================
  136. * GLOBAL VARIABLE DECLARATIONS
  137. ==================================================================================================*/
  138. #define WDG_START_SEC_CONFIG_DATA_UNSPECIFIED
  139. #include "Wdg_MemMap.h"
  140. #define WDG_STOP_SEC_CONFIG_DATA_UNSPECIFIED
  141. #include "Wdg_MemMap.h"
  142. /*==================================================================================================
  143. * FUNCTION PROTOTYPES
  144. ==================================================================================================*/
  145. #ifdef WDG_ROM
  146. #if (WDG_ROM == 1U)
  147. #define WDG_START_SEC_CODE
  148. #endif
  149. #else
  150. #if (WDG_RAM == 0U)
  151. #define WDG_START_SEC_RAMCODE
  152. #endif
  153. #endif
  154. #include "Wdg_MemMap.h"
  155. /**
  156. * @brief This function initializes the WDG module.
  157. * @details The @p Wdg_Init function shall initialize the Wdg module and the
  158. * watchdog hardware, i.e. it shall set the default watchdog mode and
  159. * timeout period as provided in the configuration set.
  160. *
  161. * @param[in] pConfigPtr Pointer to configuration set.
  162. * @param[in] Wdg_Instance Harwdware instance.
  163. *
  164. * @return void
  165. *
  166. * @implements Wdg_ChannelInit_Activity
  167. */
  168. void Wdg_ChannelInit(const Wdg_Ipw_InstanceType Wdg_Instance,
  169. const Wdg_ConfigType *pConfigPtr);
  170. /**
  171. * @brief Switches the watchdog into the mode Mode.
  172. * @details By choosing one of a limited number of statically configured
  173. * settings (e.g. toggle or window watchdog, different timeout periods)
  174. * the Wdg module and the watchdog hardware can be switched between the
  175. * following three different watchdog modes using the @p Wdg_SetMode
  176. * function:<br>
  177. * - WDGIF_OFF_MODE,
  178. * - WDGIF_SLOW_MODE,
  179. * - WDGIF_FAST_MODE.
  180. * .
  181. *
  182. * @param[in] Mode One of the following statically configured modes:<br>
  183. * -# WDGIF_OFF_MODE,
  184. * -# WDGIF_SLOW_MODE,
  185. * -# WDGIF_FAST_MODE.
  186. *
  187. * @param[in] Wdg_Instance Harwdware instance.
  188. *
  189. * @return Std_ReturnType.
  190. * @retval E_OK Mode switch executed completely and successfully.
  191. * @retval E_NOT_OK The mode switch encountered errors.
  192. *
  193. * @implements Wdg_ChannelSetMode_Activity
  194. */
  195. Std_ReturnType Wdg_ChannelSetMode(const Wdg_Ipw_InstanceType Wdg_Instance,
  196. WdgIf_ModeType Mode);
  197. #if (WDG_DIRECT_SERVICE == STD_OFF)
  198. /**
  199. * @brief Reset the watchdog timeout counter according to the timeout value passed.
  200. * @details
  201. *
  202. * @param[in] u16Timeout value (milliseconds) for setting the trigger counter.
  203. * @param[in] Wdg_Instance Harwdware instance.
  204. *
  205. * @implements Wdg_ChannelSetTriggerCondition_Activity
  206. */
  207. void Wdg_ChannelSetTriggerCondition(const Wdg_Ipw_InstanceType Wdg_Instance,
  208. uint16 u16Timeout);
  209. #endif
  210. /*Returns the version information of the module.*/
  211. #if (WDG_VERSION_INFO_API == STD_ON)
  212. /**
  213. * @brief Returns the version information of the module.
  214. * @details The Wdg_ChannelGetVersionInfo function shall return the version
  215. * information of this module. The version information includes:
  216. * - Module Id,
  217. * - Vendor Id,
  218. * - Vendor specific version numbers.
  219. * .
  220. *
  221. * @pre This function is available if the WDG_VERSION_INFO_API must be
  222. * equal STD_ON.
  223. *
  224. * @param[in,out] pVersioninfo Pointer to where to store the version
  225. * information of this module.
  226. *
  227. *
  228. *
  229. * @implements Wdg_ChannelGetVersionInfo_Activity
  230. */
  231. void Wdg_ChannelGetVersionInfo(const Wdg_Ipw_InstanceType Wdg_Instance,
  232. Std_VersionInfoType *pVersioninfo);
  233. #endif /* WDG_VERSION_INFO_API == STD_ON */
  234. #if (WDG_DIRECT_SERVICE == STD_ON)
  235. /**
  236. * @brief Perform a wdg channel service.
  237. * @details
  238. *
  239. * @pre This this function is availble if the WDG_DIRECT_SERVICE must be
  240. * equal STD_ON.
  241. * @param[in] Wdg_Instance Harwdware instance.
  242. *
  243. * @implements Wdg_ChannelService_Activity
  244. *
  245. * @return void
  246. */
  247. void Wdg_ChannelService(const Wdg_Ipw_InstanceType Wdg_Instance);
  248. #endif /* WDG_DIRECT_SERVICE == STD_ON */
  249. #if (WDG_DISABLE_ALLOWED == STD_ON)
  250. #if (WDG_CLEAR_RESET_REQUEST == STD_ON)
  251. /**
  252. * @brief Clear a reset request occurring after Watchdog timeout is reached.
  253. * @details
  254. *
  255. * @pre This this function is availble if the WDG_DISABLE_ALLOWED and WDG_CLEAR_RESET_REQUEST must be
  256. * equal STD_ON.
  257. * @param[in] Wdg_Instance Harwdware instance.
  258. *
  259. * @implements Wdg_ChannelClearResetRequest_Activity
  260. *
  261. * @return void
  262. * @retval E_OK Clear reset request successfully.
  263. * @retval E_NOT_OK returned if watchdog instance unlocks sequence failed
  264. * or it has not requested a reset.
  265. *
  266. */
  267. void Wdg_ChannelClearResetRequest(const Wdg_Ipw_InstanceType Wdg_Instance);
  268. #endif /* WDG_CLEAR_RESET_REQUEST == STD_ON */
  269. #endif /* WDG_DISABLE_ALLOWED == STD_ON */
  270. #ifdef WDG_ROM
  271. #if (WDG_ROM == 1U)
  272. #define WDG_STOP_SEC_CODE
  273. #endif
  274. #else
  275. #if (WDG_RAM == 0U)
  276. #define WDG_STOP_SEC_RAMCODE
  277. #endif
  278. #endif
  279. #include "Wdg_MemMap.h"
  280. #ifdef __cplusplus
  281. }
  282. #endif
  283. /** @} */
  284. #endif /* WDG_CHANNEL_H */