Icu_Types.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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 ICU_TYPES_H
  25. #define ICU_TYPES_H
  26. /**
  27. * @file
  28. *
  29. * @addtogroup icu Icu Driver
  30. * @{
  31. */
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. /*==================================================================================================
  37. * INCLUDE FILES
  38. * 1) system and project includes
  39. * 2) needed interfaces from external units
  40. * 3) internal and external interfaces from this unit
  41. ==================================================================================================*/
  42. #include "StandardTypes.h"
  43. #include "Icu_Cfg.h"
  44. /*==================================================================================================
  45. * SOURCE FILE VERSION INFORMATION
  46. ==================================================================================================*/
  47. #define ICU_TYPES_VENDOR_ID 43
  48. #define ICU_TYPES_AR_RELEASE_MAJOR_VERSION 4
  49. #define ICU_TYPES_AR_RELEASE_MINOR_VERSION 4
  50. #define ICU_TYPES_AR_RELEASE_REVISION_VERSION 0
  51. #define ICU_TYPES_SW_MAJOR_VERSION 1
  52. #define ICU_TYPES_SW_MINOR_VERSION 0
  53. #define ICU_TYPES_SW_PATCH_VERSION 0
  54. /*==================================================================================================
  55. * FILE VERSION CHECKS
  56. ==================================================================================================*/
  57. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  58. #if ((ICU_TYPES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
  59. (ICU_TYPES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
  60. #error "AutoSar Version Numbers of Icu_Types.h and StandardTypes.h are different"
  61. #endif
  62. #endif
  63. /* Check if source file and ICU header file are of the same vendor */
  64. #if (ICU_TYPES_VENDOR_ID != ICU_CFG_VENDOR_ID)
  65. #error "Icu_Types.h and Icu_Cfg.h have different vendor IDs"
  66. #endif
  67. /* Check if source file and ICU header file are of the same AutoSar version */
  68. #if ((ICU_TYPES_AR_RELEASE_MAJOR_VERSION != ICU_CFG_AR_RELEASE_MAJOR_VERSION) || \
  69. (ICU_TYPES_AR_RELEASE_MINOR_VERSION != ICU_CFG_AR_RELEASE_MINOR_VERSION) || \
  70. (ICU_TYPES_AR_RELEASE_REVISION_VERSION != ICU_CFG_AR_RELEASE_REVISION_VERSION))
  71. #error "AutoSar Version Numbers of Icu_Types.h and Icu_Cfg.h are different"
  72. #endif
  73. /* Check if source file and ICU header file are of the same Software version */
  74. #if ((ICU_TYPES_SW_MAJOR_VERSION != ICU_CFG_SW_MAJOR_VERSION) || \
  75. (ICU_TYPES_SW_MINOR_VERSION != ICU_CFG_SW_MINOR_VERSION) || \
  76. (ICU_TYPES_SW_PATCH_VERSION != ICU_CFG_SW_PATCH_VERSION))
  77. #error "Software Version Numbers of Icu_Types.h and Icu_Cfg.h are different"
  78. #endif
  79. /*==================================================================================================
  80. * CONSTANTS
  81. ==================================================================================================*/
  82. /*==================================================================================================
  83. * DEFINES AND MACROS
  84. ==================================================================================================*/
  85. /*==================================================================================================
  86. * ENUMS
  87. ==================================================================================================*/
  88. /**
  89. * @brief Allow enabling or disabling of all interrupts which are not required for the ECU wakeup
  90. * @implements Icu_ModeType_enum
  91. */
  92. typedef enum
  93. {
  94. ICU_MODE_NORMAL = 0U, /**< @brief Normal operation, all used interrupts are enabled
  95. * according to the notification requests. */
  96. ICU_MODE_SLEEP /**< @brief Reduced power operation. In sleep mode only those
  97. * notifications are available which are configured as wakeup
  98. * capable. */
  99. } Icu_ModeType;
  100. #if (ICU_GET_INPUT_STATE_API == STD_ON)
  101. /**
  102. * @brief Input state of an ICU channel.
  103. * @implements Icu_InputStateType_enum
  104. */
  105. typedef enum
  106. {
  107. ICU_IDLE = 0U, /**< @brief No activation edge has been detected since the last call of
  108. * Icu_GetInputState() or Icu_Init(). */
  109. ICU_ACTIVE /**< @brief An activation edge has been detected. */
  110. } Icu_InputStateType;
  111. #endif
  112. /**
  113. * @brief Definition of the measurement mode type.
  114. * @implements Icu_MeasurementModeType_enum
  115. */
  116. typedef enum
  117. {
  118. ICU_MODE_SIGNAL_EDGE_DETECT = 0x01U, /**< @brief Mode for detecting edges */
  119. ICU_MODE_SIGNAL_MEASUREMENT = 0x02U, /**< @brief Mode for measuring different times between
  120. * various configurable edges */
  121. ICU_MODE_TIMESTAMP = 0x04U, /**< @brief Mode for capturing timer values on
  122. * configurable edges */
  123. ICU_MODE_EDGE_COUNTER = 0x08U /**< @brief Mode for counting edges on configurable
  124. * edges*/
  125. } Icu_MeasurementModeType;
  126. #if ((ICU_GET_TIME_ELAPSED_API == STD_ON) || (ICU_SIGNAL_MEASUREMENT_API == STD_ON))
  127. /**
  128. * @brief Definition of the measurement property type.
  129. * @implements Icu_SignalMeasurementPropertyType_enum
  130. */
  131. typedef enum
  132. {
  133. ICU_LOW_TIME = 0x01U, /**< @brief The channel is configured for reading the
  134. * elapsed Signal Low Time. */
  135. ICU_HIGH_TIME = 0x02U, /**< @brief The channel is configured for reading the
  136. * elapsed Signal High Time. */
  137. ICU_PERIOD_TIME = 0x04U, /**< @brief The channel is configured for reading the
  138. * elapsed Signal Period Time. */
  139. ICU_DUTY_CYCLE = 0x08U /**< @brief The channel is configured to read values which
  140. * are needed for calculating the duty cycle
  141. * (coherent Active and Period Time). */
  142. } Icu_SignalMeasurementPropertyType;
  143. #endif
  144. /**
  145. * @brief Definition of the timestamp measurement property type.
  146. * @implements Icu_TimestampBufferType_enum
  147. */
  148. typedef enum
  149. {
  150. ICU_LINEAR_BUFFER = 0U, /**< @brief The buffer will just be filled once. */
  151. ICU_CIRCULAR_BUFFER /**< @brief After reaching the end of the buffer, the driver
  152. * restarts at the beginning of the buffer. */
  153. } Icu_TimestampBufferType;
  154. /** @brief Definition of the type of activation of an ICU channel.
  155. * @implements Icu_ActivationType_enum
  156. */
  157. typedef enum
  158. {
  159. ICU_RISING_EDGE = 1U, /**< @brief An appropriate action shall be executed when a rising
  160. * edge occurs on the ICU input signal */
  161. ICU_FALLING_EDGE = 2U, /**< @brief An appropriate action shall be executed when a falling
  162. * edge occurs on the ICU input signal. */
  163. ICU_BOTH_EDGES = 3U /**< @brief An appropriate action shall be executed when either a
  164. * rising or falling edge occur on the ICU input signal. */
  165. } Icu_ActivationType;
  166. #if (ICU_GET_INPUT_LEVEL_API == STD_ON)
  167. /**
  168. * @brief Return the status of the pin.
  169. * @details Enumeration of to check the status of pin.
  170. */
  171. typedef enum
  172. {
  173. /** @brief Default Input PIN Status */
  174. ICU_LEVEL_LOW = 0x0U,
  175. /** @brief As Icu_GetInputState do not give the Actual PIN status user can call the Non Autosar API
  176. Icu_GetInputLevel to get the Actual status of PIN*/
  177. ICU_LEVEL_HIGH = 0x1U
  178. } Icu_LevelType;
  179. #endif /* ICU_GET_INPUT_LEVEL_API */
  180. #if (ICU_DUAL_CLOCK_MODE_API == STD_ON)
  181. /**
  182. * @brief Definition of prescaler type.
  183. *
  184. */
  185. typedef enum
  186. {
  187. ICU_NORMAL_CLOCK_MODE = 0x0U, /**< @brief Default channel prescaler. */
  188. ICU_ALTERNATE_CLOCK_MODE = 0x1U /**< @brief Alternate channel prescaler mode */
  189. } Icu_SelectPrescalerType;
  190. #endif /* ICU_DUAL_CLOCK_MODE_API */
  191. /*==================================================================================================
  192. * STRUCTURES AND OTHER TYPEDEFS
  193. ==================================================================================================*/
  194. /** @brief ICU Channel state type. */
  195. typedef uint8 Icu_ChannelStateType;
  196. /** @brief This gives the numeric ID (hardware channel number) of an ICU channel
  197. * @implements Icu_ChannelType_typedef
  198. */
  199. typedef uint16 Icu_ChannelType;
  200. /** @brief Type for saving the timer register width value.
  201. * @implements Icu_ValueType_typedef
  202. */
  203. typedef Icu_TimerRegisterWidthType Icu_ValueType;
  204. /**
  205. * @brief Type for saving the ICU Hardware specific index
  206. * @implements Icu_IndexType_typedef
  207. */
  208. typedef Icu_HwSpecificIndexType Icu_IndexType;
  209. /** @brief Type for saving hardware specific edge number
  210. * @implements Icu_EdgeNumberType_typedef
  211. */
  212. typedef Icu_HwSpecificEdgeNumberType Icu_EdgeNumberType;
  213. #if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
  214. /**
  215. * @brief Type for saving the Wakeup value
  216. */
  217. typedef uint32 Icu_WakeupValueType;
  218. #endif
  219. /**
  220. * @brief Type for saving the ICU measurement submode type
  221. *
  222. */
  223. typedef uint16 Icu_MeasurementSubModeType;
  224. /** @brief The notification functions shall have no parameters and no return value.
  225. * @implements Icu_NotifyType_typedef
  226. */
  227. typedef void (*Icu_NotifyType)(void);
  228. #if (ICU_GET_DUTY_CYCLE_VALUES_API== STD_ON)
  229. /**
  230. * @brief Structure that contains ICU Duty cycle parameters. It contains the values needed for
  231. * calculating duty cycles i.e Period time value and active time value.
  232. * @implements Icu_DutyCycleType_struct
  233. */
  234. typedef struct
  235. {
  236. Icu_ValueType ActiveTime; /**< @brief Low or High time value. */
  237. Icu_ValueType PeriodTime; /**< @brief Period time value. */
  238. } Icu_DutyCycleType;
  239. #endif
  240. /*==================================================================================================
  241. * GLOBAL VARIABLE DECLARATIONS
  242. ==================================================================================================*/
  243. /*==================================================================================================
  244. * FUNCTION PROTOTYPES
  245. ==================================================================================================*/
  246. #ifdef __cplusplus
  247. }
  248. #endif
  249. /** @} */
  250. #endif /* ICU_TYPES_H */