Lpit_Icu_Ip.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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 LPIT_ICU_IP_H
  25. #define LPIT_ICU_IP_H
  26. /**
  27. * @file Lpit_Icu_Ip.h
  28. * @brief Header file of LPIT module.
  29. * @details This file contains signatures for all the functions which are related to LPIT
  30. * module.
  31. * @addtogroup lpit_icu_ip LPIT 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 "Lpit_Icu_Ip_Types.h"
  44. #include "Lpit_Icu_Ip_Cfg.h"
  45. /*==================================================================================================
  46. * SOURCE FILE VERSION INFORMATION
  47. ==================================================================================================*/
  48. #define LPIT_ICU_IP_VENDOR_ID 43
  49. #define LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION 4
  50. #define LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION 4
  51. #define LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION 0
  52. #define LPIT_ICU_IP_SW_MAJOR_VERSION 1
  53. #define LPIT_ICU_IP_SW_MINOR_VERSION 0
  54. #define LPIT_ICU_IP_SW_PATCH_VERSION 0
  55. /*==================================================================================================
  56. * FILE VERSION CHECKS
  57. ==================================================================================================*/
  58. /* Check if header file and Lpit_Icu_Ip_Types.h header file are of the same vendor */
  59. #if (LPIT_ICU_IP_VENDOR_ID != LPIT_ICU_IP_TYPES_VENDOR_ID)
  60. #error "Lpit_Icu_Ip.h and Lpit_Icu_Ip_Types.h have different vendor IDs"
  61. #endif
  62. /* Check if header file and Lpit_Icu_Ip_Types.h header file are of the same AUTOSAR version */
  63. #if ((LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION != LPIT_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  64. (LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION != LPIT_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
  65. (LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
  66. #error "AutoSar Version Numbers of Lpit_Icu_Ip.h and Lpit_Icu_Ip_Types.h are different"
  67. #endif
  68. /* Check if header file and Lpit_Icu_Ip_Types.h header file are of the same software version */
  69. #if ((LPIT_ICU_IP_SW_MAJOR_VERSION != LPIT_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
  70. (LPIT_ICU_IP_SW_MINOR_VERSION != LPIT_ICU_IP_TYPES_SW_MINOR_VERSION) || \
  71. (LPIT_ICU_IP_SW_PATCH_VERSION != LPIT_ICU_IP_TYPES_SW_PATCH_VERSION))
  72. #error "Software Version Numbers of Lpit_Icu_Ip.h and Lpit_Icu_Ip_Types.h are different"
  73. #endif
  74. /* Check if header file and ICU Lpit_Icu_Ip_Cfg.h header file are of the same vendor */
  75. #if (LPIT_ICU_IP_VENDOR_ID != LPIT_ICU_IP_CFG_VENDOR_ID)
  76. #error "Lpit_Icu_Ip.h and Lpit_Icu_Ip_Cfg.h have different vendor IDs"
  77. #endif
  78. /* Check if header file and ICU Lpit_Icu_Ip_Cfg.h header file are of the same AutoSar version */
  79. #if ((LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION != LPIT_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
  80. (LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION != LPIT_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
  81. (LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
  82. #error "AutoSar Version Numbers of Lpit_Icu_Ip.h and Lpit_Icu_Ip_Cfg.h are different"
  83. #endif
  84. /* Check if header file and ICU Lpit_Icu_Ip_Cfg.h header file are of the same Software version */
  85. #if ((LPIT_ICU_IP_SW_MAJOR_VERSION != LPIT_ICU_IP_CFG_SW_MAJOR_VERSION) || \
  86. (LPIT_ICU_IP_SW_MINOR_VERSION != LPIT_ICU_IP_CFG_SW_MINOR_VERSION) || \
  87. (LPIT_ICU_IP_SW_PATCH_VERSION != LPIT_ICU_IP_CFG_SW_PATCH_VERSION))
  88. #error "Software Version Numbers of Lpit_Icu_Ip.h and Lpit_Icu_Ip_Cfg.h are different"
  89. #endif
  90. /*==================================================================================================
  91. * GLOBAL VARIABLES
  92. ==================================================================================================*/
  93. #if (defined LPIT_ICU_CONFIG_EXT)
  94. #define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
  95. #include "Icu_MemMap.h"
  96. /* Macro used to import LPIT generated configurations. */
  97. LPIT_ICU_CONFIG_EXT
  98. #define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
  99. #include "Icu_MemMap.h"
  100. #endif /* LPIT_ICU_CONFIG_EXT */
  101. #define ICU_START_SEC_CONST_UNSPECIFIED
  102. #include "Icu_MemMap.h"
  103. /* Table of base addresses for LPIT instances. */
  104. extern LPIT_Type* const lpitBase[];
  105. #define ICU_STOP_SEC_CONST_UNSPECIFIED
  106. #include "Icu_MemMap.h"
  107. /*==================================================================================================
  108. * FUNCTION PROTOTYPES
  109. ==================================================================================================*/
  110. #define ICU_START_SEC_CODE
  111. #include "Icu_MemMap.h"
  112. /**
  113. * @brief LPIT driver initialization function for LPIT module.
  114. * @details This function is called separately for each LPIT instace and will do the following:
  115. * - enables the LPIT module
  116. * - configures the debug mode (enabled or disabled)
  117. * - disable the IRQ correpsonding to the LPIT channel
  118. * - clears the (pending) interrupt flag corresponding to LPIT channel
  119. * - enable channel interrupts
  120. * - Set Trigger Input Capture Mode
  121. *
  122. * @param[in] instance - hardware instance to be configured
  123. * @param[in] userConfig - configuration of the instance that will be intialized
  124. * @return Lpit_Icu_Ip_StatusType
  125. */
  126. Lpit_Icu_Ip_StatusType Lpit_Icu_Ip_Init (uint8 instance, const Lpit_Icu_Ip_ConfigType * userConfig);
  127. #if (LPIT_ICU_DEINIT_API == STD_ON)
  128. /**
  129. * @brief LPIT driver deinitialization function for LPIT module.
  130. * @details This function is called separately for each LPIT instace and will do the following:
  131. * - disables the LPIT channel
  132. * - disables the debug mode
  133. * - disables IRQ corresponding to LPit channel
  134. * - clears the (pending) interrupt flag corresponding to LPIT channel
  135. *
  136. * @param[in] instance - hardware instance of the module
  137. * @return Lpit_Icu_Ip_StatusType
  138. */
  139. Lpit_Icu_Ip_StatusType Lpit_Icu_Ip_Deinit(uint8 instance);
  140. #endif /* LPIT_ICU_DEINIT_API */
  141. /**
  142. * @brief LPIT driver function that enables interrupts on a LPIT channel.
  143. * @details This function enables LPIT channel interrupt.
  144. *
  145. * @param[in] instance - hardware instance of the module
  146. * @param[in] hwChannel - channel instance of the module
  147. */
  148. void Lpit_Icu_Ip_EnableInterrupt(uint8 instance, uint8 hwChannel);
  149. /**
  150. * @brief LPIT driver function that disables interrupts on a LPIT channel.
  151. * @details This function disables LPIT channel interrupt.
  152. *
  153. * @param[in] instance - hardware instance of the module
  154. * @param[in] hwChannel - channel instance of the module
  155. */
  156. void Lpit_Icu_Ip_DisableInterrupt(uint8 instance, uint8 hwChannel);
  157. #if (LPIT_ICU_EDGE_DETECT_API == STD_ON)
  158. /**
  159. * @brief LPIT IP layer function that enables edge detection measure mode for a given module and channel.
  160. *
  161. * @param[in] instance - hardware instance of the module
  162. * @param[in] hwChannel - channel instance of the module
  163. */
  164. void Lpit_Icu_Ip_EnableEdgeDetection(uint8 instance, uint8 hwChannel);
  165. #endif /* LPIT_ICU_EDGE_DETECT_API */
  166. #if ((LPIT_ICU_EDGE_DETECT_API == STD_ON) || (LPIT_ICU_TIMESTAMP_API == STD_ON))
  167. /**
  168. * @brief LPIT IP layer function that disable all measure modes for a given module and channel.
  169. *
  170. * @param[in] instance - hardware instance of the module
  171. * @param[in] hwChannel - channel instance of the module
  172. */
  173. void Lpit_Icu_Ip_DisableDetectionMode(uint8 instance, uint8 hwChannel);
  174. #endif /* (LPIT_ICU_EDGE_DETECT_API == STD_ON) || (LPIT_ICU_TIMESTAMP_API == STD_ON) */
  175. #if (LPIT_ICU_GET_INPUT_STATE_API == STD_ON)
  176. /**
  177. * @brief
  178. *
  179. * @param instance module instance number
  180. * @param hwChannel channel number
  181. * @return boolean
  182. */
  183. boolean Lpit_Icu_Ip_GetInputState(uint8 instance, uint8 hwChannel);
  184. #endif /* LPIT_ICU_GET_INPUT_STATE_API */
  185. #if (STD_ON == LPIT_ICU_TIMESTAMP_API)
  186. /**
  187. * @brief
  188. *
  189. * @param instance LPIT module on which the current channel is located.
  190. * @param hwChannel LPIT hardware channel used.
  191. * @param bufferPtr
  192. * @param bufferSize
  193. * @param notifyInterval
  194. */
  195. void Lpit_Icu_Ip_StartTimestamp(uint8 instance,
  196. uint8 hwChannel,
  197. uint16 *bufferPtr,
  198. uint16 bufferSize,
  199. uint16 notifyInterval);
  200. #endif /* STD_ON == LPIT_ICU_TIMESTAMP_API */
  201. /**
  202. * @brief Driver function Enable Notification for timestamp.
  203. *
  204. * @param[in] instance Hardware instance of FTM used.
  205. * @param[in] hwChannel Hardware channel of FTM used.
  206. * @return void
  207. */
  208. void Lpit_Icu_Ip_EnableNotification(uint8 instance, uint8 hwChannel);
  209. /**
  210. * @brief Driver function Disable Notification for timestamp.
  211. *
  212. * @param[in] instance Hardware instance of FTM used.
  213. * @param[in] hwChannel Hardware channel of FTM used.
  214. * @return void
  215. */
  216. void Lpit_Icu_Ip_DisableNotification(uint8 instance, uint8 hwChannel);
  217. /**
  218. * @brief Get timestamp index for timestamp mode.
  219. *
  220. * @param[in] instance Hardware instance of FTM used.
  221. * @param[in] hwChannel Hardware channel of FTM used.
  222. * @return uint16
  223. */
  224. uint16 Lpit_Icu_Ip_GetTimestampIndex(uint8 instance, uint8 channel);
  225. #define ICU_STOP_SEC_CODE
  226. #include "Icu_MemMap.h"
  227. #if defined(__cplusplus)
  228. }
  229. #endif
  230. /** @} */
  231. #endif /* LPIT_ICU_IP_H */