Lptmr_Icu_Ip.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : Ftm Lpit Lptmr Port_Ci LpCmp
  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 LPTMR_ICU_IP_H
  25. #define LPTMR_ICU_IP_H
  26. /**
  27. * @file Lptmr_Icu_Ip.h
  28. * @brief Header file of Low Power Timer module.
  29. * @details This file contains signatures for all the functions which are related to Lptmr
  30. * module.
  31. * @addtogroup lptmr_icu_ip LPTMR IPL
  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 "Lptmr_Icu_Ip_Types.h"
  44. #include "Lptmr_Icu_Ip_Cfg.h"
  45. /*==================================================================================================
  46. * SOURCE FILE VERSION INFORMATION
  47. ==================================================================================================*/
  48. #define LPTMR_ICU_IP_VENDOR_ID 43
  49. #define LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION 4
  50. #define LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION 4
  51. #define LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION 0
  52. #define LPTMR_ICU_IP_SW_MAJOR_VERSION 1
  53. #define LPTMR_ICU_IP_SW_MINOR_VERSION 0
  54. #define LPTMR_ICU_IP_SW_PATCH_VERSION 0
  55. /*==================================================================================================
  56. * FILE VERSION CHECKS
  57. ==================================================================================================*/
  58. /* Check if source file and ICU header file are of the same vendor */
  59. #if (LPTMR_ICU_IP_VENDOR_ID != LPTMR_ICU_IP_TYPES_VENDOR_ID)
  60. #error "Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Types.h have different vendor IDs"
  61. #endif
  62. /* Check if source file and ICU header file are of the same AutoSar version */
  63. #if ((LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION != LPTMR_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  64. (LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION != LPTMR_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
  65. (LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION != LPTMR_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
  66. #error "AutoSar Version Numbers of Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Types.h are different"
  67. #endif
  68. /* Check if source file and ICU header file are of the same Software version */
  69. #if ((LPTMR_ICU_IP_SW_MAJOR_VERSION != LPTMR_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
  70. (LPTMR_ICU_IP_SW_MINOR_VERSION != LPTMR_ICU_IP_TYPES_SW_MINOR_VERSION) || \
  71. (LPTMR_ICU_IP_SW_PATCH_VERSION != LPTMR_ICU_IP_TYPES_SW_PATCH_VERSION))
  72. #error "Software Version Numbers of Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Types.h are different"
  73. #endif
  74. /* Check if source file and ICU header file are of the same vendor */
  75. #if (LPTMR_ICU_IP_VENDOR_ID != LPTMR_ICU_IP_CFG_VENDOR_ID)
  76. #error "Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Cfg.h have different vendor IDs"
  77. #endif
  78. /* Check if source file and ICU header file are of the same AutoSar version */
  79. #if ((LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
  80. (LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
  81. (LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
  82. #error "AutoSar Version Numbers of Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Cfg.h are different"
  83. #endif
  84. /* Check if source file and ICU header file are of the same Software version */
  85. #if ((LPTMR_ICU_IP_SW_MAJOR_VERSION != LPTMR_ICU_IP_CFG_SW_MAJOR_VERSION) || \
  86. (LPTMR_ICU_IP_SW_MINOR_VERSION != LPTMR_ICU_IP_CFG_SW_MINOR_VERSION) || \
  87. (LPTMR_ICU_IP_SW_PATCH_VERSION != LPTMR_ICU_IP_CFG_SW_PATCH_VERSION))
  88. #error "Software Version Numbers of Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Cfg.h are different"
  89. #endif
  90. /*===============================================================================================
  91. * DEFINES AND MACROS
  92. ===============================================================================================*/
  93. /*==================================================================================================
  94. * ENUMS
  95. ==================================================================================================*/
  96. #if (defined LPTMR_ICU_CONFIG_EXT)
  97. #define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
  98. #include "Icu_MemMap.h"
  99. /* Macro used to import Lptmr generated configurations. */
  100. LPTMR_ICU_CONFIG_EXT
  101. #define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
  102. #include "Icu_MemMap.h"
  103. #endif /*LPTMR_ICU_CONFIG_EXT */
  104. /*==================================================================================================
  105. * GLOBAL VARIABLES
  106. ==================================================================================================*/
  107. /*==================================================================================================
  108. * FUNCTION PROTOTYPES
  109. ==================================================================================================*/
  110. #define ICU_START_SEC_CODE
  111. #include "Icu_MemMap.h"
  112. /**
  113. * @brief
  114. *
  115. *
  116. * @param[in] instance - Hardware instance of LPTMR used.
  117. * @param[in] param - Configuration of the input capture channel.
  118. * @return void
  119. *
  120. *
  121. */
  122. Lptmr_Icu_Ip_StatusType Lptmr_Icu_Ip_Init(uint8 instance, const Lptmr_Icu_Ip_ConfigType *userConfig);
  123. #if (STD_ON == LPTMR_ICU_DEINIT_API)
  124. /**
  125. * @brief Disables input capture mode and clears LPTMR instance configuration
  126. *
  127. * @param[in] instance - Hardware instance of LPTMR used.
  128. * @param[in] ipConfig - Configuration of the input capture channel.
  129. */
  130. Lptmr_Icu_Ip_StatusType Lptmr_Icu_Ip_Deinit(uint8 instance);
  131. #endif /* LPTMR_ICU_DEINIT_API */
  132. #if (STD_ON == LPTMR_ICU_SET_MODE_API)
  133. /**
  134. * @brief Driver function sets LPTMR hardware channel into SLEEP mode.
  135. *
  136. * @param[in] instance - Hardware instance of LPTMR used.
  137. * @return void
  138. */
  139. void Lptmr_Icu_Ip_SetSleepMode(uint8 instance);
  140. /**
  141. * @brief Driver function sets LPTMR hardware channel into NORMAL mode.
  142. *
  143. * @param[in] instance - Hardware instance of LPTMR used.
  144. * @return void
  145. */
  146. void Lptmr_Icu_Ip_SetNormalMode(uint8 instance);
  147. #endif /* LPTMR_ICU_SET_MODE_API */
  148. /**
  149. * @brief This function enables the requested activation condition(rising, falling or both
  150. * edges) for corresponding LPTMR channels.
  151. *
  152. * @param[in] instance - Hardware instance of LPTMR used.
  153. * @param[in] activation Edge activation type used.
  154. * - LPTMR_ICU_RISING_EDGE : count pulse on Rising Edge
  155. * - LPTMR_ICU_FALLING_EDGE: count pulse on Falling Edge
  156. * @return void
  157. */
  158. void Lptmr_Icu_Ip_SetActivationCondition(uint8 instance, Lptmr_Icu_Ip_EdgeType activation);
  159. #if (STD_ON == LPTMR_ICU_EDGE_DETECT_API)
  160. /**
  161. * @brief LPTMR IP layer function which enable edge detection measure mode for a given instance and channel.
  162. *
  163. * @param[in] instance - Hardware instance of LPTMR used.
  164. * @return void
  165. */
  166. void Lptmr_Icu_Ip_EnableEdgeDetection(uint8 instance);
  167. /**
  168. * @brief LPTMR IP layer function which disable edge detection measure mode for a given instance and channel.
  169. *
  170. * @param[in] instance - Hardware instance of LPTMR used.
  171. * @return void
  172. */
  173. void Lptmr_Icu_Ip_DisableDetection(uint8 instance);
  174. #endif /* LPTMR_ICU_EDGE_DETECT_API */
  175. #if (STD_ON == LPTMR_ICU_EDGE_COUNT_API)
  176. /**
  177. * @brief LPTMR IP layer function which reset edge count measure mode for a given instance and channel.
  178. *
  179. * @param[in] instance - Hardware instance of LPTMR used.
  180. * @return void
  181. */
  182. void Lptmr_Icu_Ip_ResetEdgeCount(uint8 instance);
  183. /**
  184. * @brief LPTMR IP layer function which enable edge count measure mode for a given instance and channel.
  185. *
  186. * @param[in] instance - Hardware instance of LPTMR used.
  187. * @return void
  188. */
  189. void Lptmr_Icu_Ip_EnableEdgeCount(uint8 instance);
  190. /**
  191. * @brief LPTMR IP layer function which disable edge count measure mode for a given instance and channel.
  192. *
  193. * @param[in] instance - Hardware instance of LPTMR used.
  194. * @return Lptmr_Icu_Ip_StatusType
  195. */
  196. Lptmr_Icu_Ip_StatusType Lptmr_Icu_Ip_DisableEdgeCount(uint8 instance);
  197. /**
  198. * @brief LPTMR IP layer function which gets the number of edges for a given instance and channel.
  199. *
  200. * @param[in] instance - Hardware instance of LPTMR used.
  201. * @return uint16
  202. */
  203. uint16 Lptmr_Icu_Ip_GetEdgeNumbers(uint8 instance);
  204. #endif /* LPTMR_ICU_EDGE_COUNT_API */
  205. #if (STD_ON == LPTMR_ICU_GET_INPUT_STATE_API)
  206. /**
  207. * @brief Return input state of the channel.
  208. *
  209. * @param[in] instance - Hardware instance of LPTMR used. ype.
  210. */
  211. boolean Lptmr_Icu_Ip_GetInputState(uint8 instance);
  212. #endif /* LPTMR_ICU_GET_INPUT_STATE_API */
  213. void Lptmr_Icu_Ip_EnableInterrupt(uint8 instance);
  214. void Lptmr_Icu_Ip_DisableInterrupt(uint8 instance);
  215. #define ICU_STOP_SEC_CODE
  216. #include "Icu_MemMap.h"
  217. #ifdef __cplusplus
  218. }
  219. #endif
  220. /** @} */
  221. #endif /* LPTMR_ICU_IP_H */