Wdog_Ip.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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 WDOG_IP_H
  25. #define WDOG_IP_H
  26. /**
  27. * @file
  28. *
  29. * @addtogroup Wdog_Ip
  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 "Wdog_Ip_Types.h"
  42. #include "Wdog_Ip_DeviceRegisters.h"
  43. /*==================================================================================================
  44. * SOURCE FILE VERSION INFORMATION
  45. ==================================================================================================*/
  46. #define WDOG_IP_VENDOR_ID 43
  47. #define WDOG_IP_MODULE_ID 102
  48. #define WDOG_IP_AR_RELEASE_MAJOR_VERSION 4
  49. #define WDOG_IP_AR_RELEASE_MINOR_VERSION 4
  50. #define WDOG_IP_AR_RELEASE_REVISION_VERSION 0
  51. #define WDOG_IP_SW_MAJOR_VERSION 1
  52. #define WDOG_IP_SW_MINOR_VERSION 0
  53. #define WDOG_IP_SW_PATCH_VERSION 0
  54. /*==================================================================================================
  55. * FILE VERSION CHECKS
  56. ==================================================================================================*/
  57. /* Check if current file and Wdog_Ip_Types header file are of the same vendor */
  58. #if (WDOG_IP_VENDOR_ID != WDOG_IP_TYPES_VENDOR_ID)
  59. #error "Wdog_Ip.h and Wdog_Ip_Types.h have different vendor ids"
  60. #endif
  61. #if ((WDOG_IP_AR_RELEASE_MAJOR_VERSION != WDOG_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  62. (WDOG_IP_AR_RELEASE_MINOR_VERSION != WDOG_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
  63. (WDOG_IP_AR_RELEASE_REVISION_VERSION != WDOG_IP_TYPES_AR_RELEASE_REVISION_VERSION))
  64. #error "AutoSar Version Numbers of Wdog_Ip.h and Wdog_Ip_Types.h are different"
  65. #endif
  66. #if ((WDOG_IP_SW_MAJOR_VERSION != WDOG_IP_TYPES_SW_MAJOR_VERSION) || \
  67. (WDOG_IP_SW_MINOR_VERSION != WDOG_IP_TYPES_SW_MINOR_VERSION) || \
  68. (WDOG_IP_SW_PATCH_VERSION != WDOG_IP_TYPES_SW_PATCH_VERSION))
  69. #error "Software Version Numbers of Wdog_Ip.h and Wdog_Ip_Types.h are different"
  70. #endif
  71. /* Check if current file and Wdog_Ip_DeviceRegisters header file are of the same vendor */
  72. #if (WDOG_IP_VENDOR_ID != WDOG_IP_DEVICE_REGISTERS_VENDOR_ID)
  73. #error "Wdog_Ip.h and Wdog_Ip_DeviceRegisters.h have different vendor ids"
  74. #endif
  75. #if ((WDOG_IP_AR_RELEASE_MAJOR_VERSION != WDOG_IP_DEVICE_REGISTERS_AR_RELEASE_MAJOR_VERSION) || \
  76. (WDOG_IP_AR_RELEASE_MINOR_VERSION != WDOG_IP_DEVICE_REGISTERS_AR_RELEASE_MINOR_VERSION) || \
  77. (WDOG_IP_AR_RELEASE_REVISION_VERSION != WDOG_IP_DEVICE_REGISTERS_AR_RELEASE_REVISION_VERSION))
  78. #error "AutoSar Version Numbers of Wdog_Ip.h and Wdog_Ip_DeviceRegisters.h are different"
  79. #endif
  80. #if ((WDOG_IP_SW_MAJOR_VERSION != WDOG_IP_DEVICE_REGISTERS_SW_MAJOR_VERSION) || \
  81. (WDOG_IP_SW_MINOR_VERSION != WDOG_IP_DEVICE_REGISTERS_SW_MINOR_VERSION) || \
  82. (WDOG_IP_SW_PATCH_VERSION != WDOG_IP_DEVICE_REGISTERS_SW_PATCH_VERSION))
  83. #error "Software Version Numbers of Wdog_Ip.h and Wdog_Ip_DeviceRegisters.h are different"
  84. #endif
  85. /*==================================================================================================
  86. * CONSTANTS
  87. ==================================================================================================*/
  88. /*==================================================================================================
  89. * DEFINES AND MACROS
  90. ==================================================================================================*/
  91. /*==================================================================================================
  92. * ENUMS
  93. ==================================================================================================*/
  94. /*==================================================================================================
  95. * STRUCTURES AND OTHER TYPEDEFS
  96. ==================================================================================================*/
  97. /*==================================================================================================
  98. * GLOBAL VARIABLE DECLARATIONS
  99. ==================================================================================================*/
  100. /*==================================================================================================
  101. * FUNCTION PROTOTYPES
  102. ==================================================================================================*/
  103. #if (WDOG_IP_ENABLE == STD_ON)
  104. #ifdef WDG_ROM
  105. #if (WDG_ROM == 1U)
  106. #define WDG_START_SEC_CODE
  107. #endif
  108. #else
  109. #if (WDG_RAM == 0U)
  110. #define WDG_START_SEC_RAMCODE
  111. #endif
  112. #endif
  113. #include "Wdg_MemMap.h"
  114. /*!
  115. * @brief Initializes the WDOG driver.
  116. *
  117. * @param[in] Instance WDOG peripheral instance number
  118. * @param[in] ConfigPtr pointer to the WDOG user configuration structure
  119. * @return operation status
  120. * - WDOG_IP_STATUS_SUCCESS: WDOG initialization was successful.
  121. * - WDOG_IP_STATUS_ERROR: Operation failed. Possible causes: WDOG configuration updates are not allowed;
  122. * If window mode enabled and window value greater than or equal to the timeout value.
  123. * - WDOG_IP_STATUS_TIMEOUT: The unlock operation was unsuccesful and has timed out.
  124. */
  125. Wdog_Ip_StatusType Wdog_Ip_Init(const uint8 Instance,
  126. const Wdog_Ip_ConfigType * const ConfigPtr);
  127. #if (WDOG_IP_DEINIT == STD_ON)
  128. /*!
  129. * @brief De-initializes the WDOG driver
  130. *
  131. * @param[in] Instance WDOG peripheral instance number
  132. * @return operation status
  133. * - WDOG_IP_STATUS_SUCCESS: If the WDOG module is de-initialized successfulully.
  134. * - WDOG_IP_STATUS_ERROR: Operation failed. Possible causes: WDOG updates are not allowed.
  135. * - WDOG_IP_STATUS_TIMEOUT: The unlock operation was unsuccesful and has timed out.
  136. */
  137. Wdog_Ip_StatusType Wdog_Ip_DeInit(const uint8 Instance);
  138. #endif
  139. /*!
  140. * @brief Refreshes the WDOG counter.
  141. *
  142. * @param[in] Instance WDOG peripheral instance number
  143. */
  144. void Wdog_Ip_Service(const uint8 Instance);
  145. /*!
  146. * @brief Sets the value of the WDOG timeout.
  147. *
  148. * This function sets the value of the WDOG timeout and enables the window mode if WindowValue is greater than 0.
  149. *
  150. * @param[in] Instance WDOG peripheral instance number.
  151. * @param[in] Timeout the value of the WDOG timeout.
  152. * @param[in] WindowValue the value of the WDOG window.
  153. * @return operation status
  154. * - WDOG_IP_STATUS_SUCCESS: The WDOG timeout and window are configured succesfully.
  155. * - WDOG_IP_STATUS_ERROR: Operation failed. Possible causes: WDOG updates are not allowed.
  156. * - WDOG_IP_STATUS_TIMEOUT: The unlock operation was unsuccesful and has timed out.
  157. */
  158. Wdog_Ip_StatusType Wdog_Ip_SetTimeout(const uint8 Instance,
  159. uint16 Timeout, uint16 WindowValue);
  160. #if (WDOG_IP_ENABLE_TEST_MODE == STD_ON)
  161. /*!
  162. * @brief Changes the WDOG test mode.
  163. *
  164. * This function changes the test mode of the WDOG. If the WDOG is tested in
  165. * mode, software should set this field to 0x01U in order to indicate that the
  166. * WDOG is functioning normally.
  167. *
  168. * @param[in] Instance WDOG peripheral instance number
  169. * @param[in] testMode Test modes for the WDOG.
  170. * @return operation status
  171. * - WDOG_IP_STATUS_SUCCESS: The WDOG test mode is configured succesfully.
  172. * - WDOG_IP_STATUS_ERROR: Operation failed. Possible causes: WDOG updates are not allowed.
  173. * - WDOG_IP_STATUS_TIMEOUT: The unlock operation was unsuccesful and has timed out.
  174. */
  175. Wdog_Ip_StatusType Wdog_Ip_SetTestMode(const uint8 Instance,
  176. Wdog_Ip_TestModeType TestMode);
  177. /*!
  178. * @brief Returns the current WDOG test mode.
  179. *
  180. * This function returns the test mode of the WDOG.
  181. *
  182. * @param[in] Instance WDOG peripheral instance number
  183. * @return Wdog_Ip_TestModeType the current WDOG test mode.
  184. */
  185. Wdog_Ip_TestModeType Wdog_Ip_GetTestMode(const uint8 Instance);
  186. #endif /* WDOG_IP_ENABLE_TEST_MODE == STD_ON */
  187. /*!
  188. * @brief Configures the WDOG driver, but does not enable or disable it.
  189. *
  190. * @param[in] Instance WDOG peripheral instance number
  191. * @param[in] ConfigPtr pointer to the WDOG user configuration structure
  192. * @return operation status
  193. * - WDOG_IP_STATUS_SUCCESS: WDOG configuration was successful.
  194. * - WDOG_IP_STATUS_ERROR: Operation failed. Possible causes: WDOG configuration updates are not allowed;
  195. * If window mode enabled and window value greater than or equal to the timeout value.
  196. * - WDOG_IP_STATUS_TIMEOUT: The unlock operation was unsuccesful and has timed out.
  197. */
  198. Wdog_Ip_StatusType Wdog_Ip_Config(const uint8 Instance,
  199. const Wdog_Ip_ConfigType * const ConfigPtr);
  200. /*!
  201. * @brief Starts the WDOG counter.
  202. *
  203. * @param[in] Instance WDOG peripheral instance number
  204. * @return operation status
  205. * - WDOG_IP_STATUS_SUCCESS: WDOG timer was started successfully.
  206. * - WDOG_IP_STATUS_ERROR: Operation failed. Possible causes: WDOG updates are not allowed.
  207. * - WDOG_IP_STATUS_TIMEOUT: The unlock operation was unsuccesful and has timed out.
  208. */
  209. Wdog_Ip_StatusType Wdog_Ip_StartTimer(const uint8 Instance);
  210. /*!
  211. * @brief Stops the WDOG counter.
  212. *
  213. * @param[in] Instance WDOG peripheral instance number
  214. * @return operation status
  215. * - WDOG_IP_STATUS_SUCCESS: WDOG timer was stopped successfully.
  216. * - WDOG_IP_STATUS_ERROR: Operation failed. Possible causes: WDOG updates are not allowed.
  217. * - WDOG_IP_STATUS_TIMEOUT: The unlock operation was unsuccesful and has timed out.
  218. */
  219. Wdog_Ip_StatusType Wdog_Ip_StopTimer(const uint8 Instance);
  220. #ifdef WDG_ROM
  221. #if (WDG_ROM == 1U)
  222. #define WDG_STOP_SEC_CODE
  223. #endif
  224. #else
  225. #if (WDG_RAM == 0U)
  226. #define WDG_STOP_SEC_RAMCODE
  227. #endif
  228. #endif
  229. #include "Wdg_MemMap.h"
  230. #endif /* (WDOG_IP_ENABLE == STD_ON) */
  231. #ifdef __cplusplus
  232. }
  233. #endif
  234. /** @} */
  235. #endif /* WDOG_IP_H */