Icu.h 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250
  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_H
  25. #define ICU_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 "Mcal.h"
  43. #include "StandardTypes.h"
  44. #include "Icu_Cfg.h"
  45. #include "Icu_Irq.h"
  46. #include "Icu_Types.h"
  47. #include "Icu_Ipw_Types.h"
  48. #if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
  49. #include "EcuM_Externals.h"
  50. #endif
  51. #if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
  52. #include "CDD_Mcl.h"
  53. #endif
  54. /*==================================================================================================
  55. * SOURCE FILE VERSION INFORMATION
  56. ==================================================================================================*/
  57. #define ICU_VENDOR_ID 43
  58. #define ICU_MODULE_ID 122
  59. #define ICU_AR_RELEASE_MAJOR_VERSION 4
  60. #define ICU_AR_RELEASE_MINOR_VERSION 4
  61. #define ICU_AR_RELEASE_REVISION_VERSION 0
  62. #define ICU_SW_MAJOR_VERSION 1
  63. #define ICU_SW_MINOR_VERSION 0
  64. #define ICU_SW_PATCH_VERSION 0
  65. /*==================================================================================================
  66. * FILE VERSION CHECKS
  67. ==================================================================================================*/
  68. /* Check if header file and StandardTypes.h file are of the same Autosar version */
  69. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  70. #if ((ICU_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
  71. (ICU_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
  72. #error "AutoSar Version Numbers of Icu.h and StandardTypes.h are different"
  73. #endif
  74. #if ((ICU_AR_RELEASE_MAJOR_VERSION != MCAL_AR_RELEASE_MAJOR_VERSION) || \
  75. (ICU_AR_RELEASE_MINOR_VERSION != MCAL_AR_RELEASE_MINOR_VERSION))
  76. #error "AutoSar Version Numbers of Icu.h and Mcal.h are different"
  77. #endif
  78. #if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
  79. /* Check Icu_Cfg.c against CDD_Mcl.h file versions */
  80. #if ((ICU_AR_RELEASE_MAJOR_VERSION != CDD_MCL_AR_RELEASE_MAJOR_VERSION_H) || \
  81. (ICU_AR_RELEASE_MINOR_VERSION != CDD_MCL_AR_RELEASE_MINOR_VERSION_H))
  82. #error "AutoSar Version Numbers of Icu.h and CDD_Mcl.h are different"
  83. #endif
  84. #endif
  85. #endif
  86. /* Check if source file and ICU configuration header file are of the same vendor */
  87. #if (ICU_VENDOR_ID != ICU_CFG_VENDOR_ID)
  88. #error "Icu.h and Icu_Cfg.h have different vendor IDs"
  89. #endif
  90. /* Check if header file and ICU configuration header file are of the same Autosar version */
  91. #if ((ICU_AR_RELEASE_MAJOR_VERSION != ICU_CFG_AR_RELEASE_MAJOR_VERSION) || \
  92. (ICU_AR_RELEASE_MINOR_VERSION != ICU_CFG_AR_RELEASE_MINOR_VERSION) || \
  93. (ICU_AR_RELEASE_REVISION_VERSION != ICU_CFG_AR_RELEASE_REVISION_VERSION))
  94. #error "AutoSar Version Numbers of Icu.h and Icu_Cfg.h are different"
  95. #endif
  96. /* Check if header file and ICU configuration header file are of the same software version */
  97. #if ((ICU_SW_MAJOR_VERSION != ICU_CFG_SW_MAJOR_VERSION) || \
  98. (ICU_SW_MINOR_VERSION != ICU_CFG_SW_MINOR_VERSION) || \
  99. (ICU_SW_PATCH_VERSION != ICU_CFG_SW_PATCH_VERSION))
  100. #error "Software Version Numbers of Icu.h and Icu_Cfg.h are different"
  101. #endif
  102. /* Check if source file and ICU types header file are of the same vendor */
  103. #if (ICU_VENDOR_ID != ICU_IRQ_VENDOR_ID)
  104. #error "Icu.h and Icu_Irq.h have different vendor IDs"
  105. #endif
  106. /* Check if header file and ICU types header file are of the same Autosar version */
  107. #if ((ICU_AR_RELEASE_MAJOR_VERSION != ICU_IRQ_AR_RELEASE_MAJOR_VERSION) || \
  108. (ICU_AR_RELEASE_MINOR_VERSION != ICU_IRQ_AR_RELEASE_MINOR_VERSION) || \
  109. (ICU_AR_RELEASE_REVISION_VERSION != ICU_IRQ_AR_RELEASE_REVISION_VERSION))
  110. #error "AutoSar Version Numbers of Icu.h and Icu_Irq.h are different"
  111. #endif
  112. /* Check if header file and ICU types header file are of the same software version */
  113. #if ((ICU_SW_MAJOR_VERSION != ICU_IRQ_SW_MAJOR_VERSION) || \
  114. (ICU_SW_MINOR_VERSION != ICU_IRQ_SW_MINOR_VERSION) || \
  115. (ICU_SW_PATCH_VERSION != ICU_IRQ_SW_PATCH_VERSION))
  116. #error "Software Version Numbers of Icu.h and Icu_Irq.h are different"
  117. #endif
  118. /* Check if source file and ICU types header file are of the same vendor */
  119. #if (ICU_VENDOR_ID != ICU_TYPES_VENDOR_ID)
  120. #error "Icu.h and Icu_Types.h have different vendor IDs"
  121. #endif
  122. /* Check if header file and ICU types header file are of the same Autosar version */
  123. #if ((ICU_AR_RELEASE_MAJOR_VERSION != ICU_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  124. (ICU_AR_RELEASE_MINOR_VERSION != ICU_TYPES_AR_RELEASE_MINOR_VERSION) || \
  125. (ICU_AR_RELEASE_REVISION_VERSION != ICU_TYPES_AR_RELEASE_REVISION_VERSION))
  126. #error "AutoSar Version Numbers of Icu.h and Icu_Types.h are different"
  127. #endif
  128. /* Check if header file and ICU types header file are of the same software version */
  129. #if ((ICU_SW_MAJOR_VERSION != ICU_TYPES_SW_MAJOR_VERSION) || \
  130. (ICU_SW_MINOR_VERSION != ICU_TYPES_SW_MINOR_VERSION) || \
  131. (ICU_SW_PATCH_VERSION != ICU_TYPES_SW_PATCH_VERSION))
  132. #error "Software Version Numbers of Icu.h and Icu_Types.h are different"
  133. #endif
  134. /* Check if source file and ICU types header file are of the same vendor */
  135. #if (ICU_VENDOR_ID != ICU_IPW_TYPES_VENDOR_ID)
  136. #error "Icu.h and Icu_Ipw_Types.h have different vendor IDs"
  137. #endif
  138. /* Check if header file and ICU types header file are of the same Autosar version */
  139. #if ((ICU_AR_RELEASE_MAJOR_VERSION != ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  140. (ICU_AR_RELEASE_MINOR_VERSION != ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION) || \
  141. (ICU_AR_RELEASE_REVISION_VERSION != ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION))
  142. #error "AutoSar Version Numbers of Icu.h and Icu_Ipw_Types.h are different"
  143. #endif
  144. /* Check if header file and ICU types header file are of the same software version */
  145. #if ((ICU_SW_MAJOR_VERSION != ICU_IPW_TYPES_SW_MAJOR_VERSION) || \
  146. (ICU_SW_MINOR_VERSION != ICU_IPW_TYPES_SW_MINOR_VERSION) || \
  147. (ICU_SW_PATCH_VERSION != ICU_IPW_TYPES_SW_PATCH_VERSION))
  148. #error "Software Version Numbers of Icu.h and Icu_Ipw_Types.h are different"
  149. #endif
  150. #if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
  151. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  152. /* Check if header file and EcuM_Cbk.h file are of the same Autosar version */
  153. #if ((ICU_AR_RELEASE_MAJOR_VERSION != ECUM_CBK_AR_RELEASE_MAJOR_VERSION) || \
  154. (ICU_AR_RELEASE_MINOR_VERSION != ECUM_CBK_AR_RELEASE_MINOR_VERSION))
  155. #error "AutoSar Version Numbers of Icu.h and EcuM_Cbk.h are different"
  156. #endif
  157. #endif
  158. #endif /* ICU_REPORT_WAKEUP_SOURCE */
  159. /*==================================================================================================
  160. * CONSTANTS
  161. ==================================================================================================*/
  162. /*==================================================================================================
  163. * DEFINES AND MACROS
  164. ==================================================================================================*/
  165. #if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
  166. /**
  167. * @brief API service used with a value is not in range
  168. * @implements Icu_ErrorCodes_define
  169. * */
  170. #define ICU_E_PARAM_CONFIG ((uint8)0x09)
  171. /**
  172. * @brief API Icu_Init service called with wrong parameter
  173. * @implements Icu_ErrorCodes_define
  174. * */
  175. #define ICU_E_INIT_FAILED ((uint8)0x0D)
  176. /**
  177. * @brief API service used with an invalid channel identifier or channel was not configured for
  178. * the functionality of the calling API
  179. * @implements Icu_ErrorCodes_define
  180. * */
  181. #define ICU_E_PARAM_CHANNEL ((uint8)0x0B)
  182. /**
  183. * @brief API service used with an invalid or not feasible activation
  184. * @implements Icu_ErrorCodes_define
  185. * */
  186. #define ICU_E_PARAM_ACTIVATION ((uint8)0x0C)
  187. /**
  188. * @brief API service used with an invalid application-buffer pointer
  189. * @implements Icu_ErrorCodes_define
  190. * */
  191. #define ICU_E_PARAM_POINTER ((uint8)0x0A)
  192. /**
  193. * @brief API service used with an invalid buffer size
  194. * @implements Icu_ErrorCodes_define
  195. * */
  196. #define ICU_E_PARAM_BUFFER_SIZE ((uint8)0x0E)
  197. #if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_SET_MODE_API == STD_ON))
  198. /**
  199. * @brief API service Icu_SetMode used with an invalid mode
  200. * @implements Icu_ErrorCodes_define
  201. * */
  202. #define ICU_E_PARAM_MODE ((uint8)0x0F)
  203. #endif
  204. /**
  205. * @brief API service used without module initialization
  206. * @implements Icu_ErrorCodes_define
  207. * */
  208. #define ICU_E_UNINIT ((uint8)0x14)
  209. #if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) && (ICU_SET_MODE_API == STD_ON))
  210. /**
  211. * @brief API service Icu_SetMode is called while a running operation
  212. * @implements Icu_ErrorCodes_define
  213. * */
  214. #define ICU_E_BUSY_OPERATION ((uint8)0x16)
  215. #endif
  216. /**
  217. * @brief API Icu_Init service called when the ICU driver and the Hardware
  218. * are already initialized
  219. * @implements Icu_ErrorCodes_define
  220. * */
  221. #define ICU_E_ALREADY_INITIALIZED ((uint8)0x17)
  222. /**
  223. * @brief API Icu_StartTimeStamp is called and the parameter NotifyInterval is invalid (e.g. 0,
  224. * NotifyInterval < 1)
  225. * @implements Icu_ErrorCodes_define
  226. * */
  227. #define ICU_E_PARAM_NOTIFY_INTERVAL ((uint8)0x18)
  228. /**
  229. * @brief API Icu_GetVersionInfo is called and the parameter versioninfo is is invalid
  230. * ( e.g. NULL )
  231. * @implements Icu_ErrorCodes_define
  232. * */
  233. #define ICU_E_PARAM_VINFO ((uint8)0x19)
  234. #if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_DUAL_CLOCK_MODE_API == STD_ON))
  235. /**
  236. * @brief API Icu_SetClockMode service called with wrong parameter
  237. * @implements Icu_ErrorCodes_define
  238. */
  239. #define ICU_E_PARAM_CLOCK_MODE ((uint8)0x7AU)
  240. #endif
  241. #if ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON))
  242. #if (ICU_VALIDATE_PARAMS == STD_ON)
  243. /**
  244. * @brief API Icu_GetEdgeNumbers service called when the Counter rolls over
  245. * @implements Icu_ErrorCodes_define
  246. * */
  247. #define ICU_E_EDGECOUNTING_OVERFLOW ((uint8)0xD0)
  248. #endif
  249. #if (ICU_TIMESTAMP_API == STD_ON)
  250. /**
  251. * @brief API Icu_GetTimestampIndex service called when the Time stamp count overflows
  252. * @implements Icu_ErrorCodes_define
  253. * */
  254. #define ICU_E_TIMESTAMP_OVERFLOW ((uint8)0xD1)
  255. #endif
  256. #if ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF)&&((ICU_GET_TIME_ELAPSED_API== STD_ON) || (ICU_GET_DUTY_CYCLE_VALUES_API== STD_ON)))
  257. /**
  258. * @brief API Icu_GetTimeElapsed service called when the Time elapsed overflows
  259. * @implements Icu_ErrorCodes_define
  260. * */
  261. #define ICU_E_MEASUREMENT_OVERFLOW ((uint8)0xD2)
  262. #endif
  263. #endif
  264. /**
  265. * @brief API Check mode before set up feature for channel
  266. * @implements Icu_ErrorCodes_define
  267. * */
  268. #define ICU_E_FORBIDEN_MODE ((uint8)0xD4)
  269. /**
  270. * @brief API service ID for Icu_Init function
  271. * @details Parameters used when raising an error/exception
  272. * */
  273. #define ICU_INIT_ID ((uint8)0x00)
  274. /**
  275. * @brief API service ID for Icu_DeInit function
  276. * @details Parameters used when raising an error/exception
  277. * */
  278. #define ICU_DEINIT_ID ((uint8)0x01)
  279. #if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) && (ICU_SET_MODE_API == STD_ON))
  280. /**
  281. * @brief API service ID for Icu_SetMode function
  282. * @details Parameters used when raising an error/exception
  283. * */
  284. #define ICU_SETMODE_ID ((uint8)0x02)
  285. #endif
  286. #if (ICU_DISABLE_WAKEUP_API == STD_ON)
  287. #if ((ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON) || (ICU_VALIDATE_PARAMS == STD_ON))
  288. /**
  289. * @brief API service ID for Icu_DisableWakeup function
  290. * @details Parameters used when raising an error/exception
  291. * */
  292. #define ICU_DISABLEWAKEUP_ID ((uint8)0x03)
  293. #endif
  294. #endif
  295. #if (ICU_ENABLE_WAKEUP_API == STD_ON)
  296. #if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) || (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON) || (ICU_VALIDATE_PARAMS == STD_ON))
  297. /**
  298. * @brief API service ID for Icu_EnableWakeup function
  299. * @details Parameters used when raising an error/exception
  300. * */
  301. #define ICU_ENABLEWAKEUP_ID ((uint8)0x04)
  302. #endif
  303. #endif
  304. /**
  305. * @brief API service ID for Icu_SetActivationCondition function
  306. * @details Parameters used when raising an error/exception
  307. * */
  308. #define ICU_SETACTIVATIONCONDITION_ID ((uint8)0x05)
  309. /**
  310. * @brief API service ID for Icu_DisableNotification function
  311. * @details Parameters used when raising an error/exception
  312. * */
  313. #define ICU_DISABLENOTIFICATION_ID ((uint8)0x06)
  314. /**
  315. * @brief API service ID for Icu_EnableNotification function
  316. * @details Parameters used when raising an error/exception
  317. * */
  318. #define ICU_ENABLENOTIFICATION_ID ((uint8)0x07)
  319. #if ((ICU_GET_INPUT_STATE_API == STD_ON) && (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON))
  320. /**
  321. * @brief API service ID for Icu_GetInputState function
  322. * @details Parameters used when raising an error/exception
  323. * */
  324. #define ICU_GETINPUTSTATE_ID ((uint8)0x08)
  325. #endif
  326. /**
  327. * @brief API service ID for Icu_StartTimestamp function
  328. * @details Parameters used when raising an error/exception
  329. * */
  330. #define ICU_STARTTIMESTAMP_ID ((uint8)0x09)
  331. /**
  332. * @brief API service ID for Icu_GetTimestampIndex function
  333. * @details Parameters used when raising an error/exception
  334. * */
  335. #define ICU_GETTIMESTAMPINDEX_ID ((uint8)0x0B)
  336. /**
  337. * @brief API service ID for Icu_ResetEdgeCount function
  338. * @details Parameters used when raising an error/exception
  339. * */
  340. #define ICU_RESETEDGECOUNT_ID ((uint8)0x0C)
  341. /**
  342. * @brief API service ID for Icu_EnableEdgeCount function
  343. * @details Parameters used when raising an error/exception
  344. * */
  345. #define ICU_ENABLEEDGECOUNT_ID ((uint8)0x0D)
  346. /**
  347. * @brief API service ID for Icu_DisableEdgeCount function
  348. * @details Parameters used when raising an error/exception
  349. * */
  350. #define ICU_DISABLEEDGECOUNT_ID ((uint8)0x0E)
  351. /**
  352. * @brief API service ID for Icu_GetEdgeNumbers function
  353. * @details Parameters used when raising an error/exception
  354. * */
  355. #define ICU_GETEDGENUMBERS_ID ((uint8)0x0F)
  356. /**
  357. * @brief API service ID for Icu_GetTimeElapsed function
  358. * @details Parameters used when raising an error/exception
  359. * */
  360. #define ICU_GETTIMEELAPSED_ID ((uint8)0x10)
  361. #if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON))
  362. /**
  363. * @brief API service ID for Icu_GetDutyCycleValues function
  364. * @details Parameters used when raising an error/exception
  365. * */
  366. #define ICU_GETDUTYCYCLEVALUES_ID ((uint8)0x11)
  367. #endif
  368. /**
  369. * @brief API service ID for Icu_GetVersionInfo function
  370. * @details Parameters used when raising an error/exception
  371. * */
  372. #define ICU_GETVERSIONINFO_ID ((uint8)0x12)
  373. /**
  374. * @brief API service ID for Icu_StartSignalMeasurement function
  375. * @details Parameters used when raising an error/exception
  376. * */
  377. #define ICU_STARTSIGNALMEASUREMENT_ID ((uint8)0x13)
  378. /**
  379. * @brief API service ID for Icu_StopSignalMeasurement function
  380. * @details Parameters used when raising an error/exception
  381. * */
  382. #define ICU_STOPSIGNALMEASUREMENT_ID ((uint8)0x14)
  383. #if ((ICU_WAKEUP_FUNCTIONALITY_API == STD_ON) && (ICU_VALIDATE_GLOBAL_CALL == STD_ON))
  384. /**
  385. * @brief API service ID for Icu_CheckWakeup function
  386. * @details Parameters used when raising an error/exception
  387. * */
  388. #define ICU_CHECKWAKEUP_ID ((uint8)0x15)
  389. #endif
  390. /**
  391. * @brief API service ID for Icu_EnableEdgeDetection function
  392. * @details Parameters used when raising an error/exception
  393. * */
  394. #define ICU_ENABLEEDGEDETECTION_ID ((uint8)0x16)
  395. /**
  396. * @brief API service ID for Icu_DisableEdgeDetection function
  397. * @details Parameters used when raising an error/exception
  398. * */
  399. #define ICU_DISABLEEDGEDETECTION_ID ((uint8)0x17)
  400. #if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_DUAL_CLOCK_MODE_API == STD_ON))
  401. /**
  402. * @brief API service ID for Icu_SetClockMode function
  403. * @details Parameters used when raising an error/exception
  404. */
  405. #define ICU_SET_CLOCK_MODE_ID ((uint8)0x7BU)
  406. #endif
  407. #if ((ICU_CAPTURERGISTER_API == STD_ON) && ((ICU_SIGNAL_MEASUREMENT_API == STD_ON) || (ICU_TIMESTAMP_API == STD_ON)))
  408. /**
  409. * @brief API service ID for Icu_GetCaptureRegisterValue function
  410. * @details Parameters used when raising an error/exception
  411. */
  412. #define ICU_GET_CAPTURE_REGISTER_VALUE_ID ((uint8)0x19U)
  413. #endif
  414. #if ((ICU_GET_PULSE_WIDTH_API == STD_ON) && (ICU_SIGNAL_MEASUREMENT_API == STD_ON))
  415. /**
  416. * @brief API service ID for Icu_GetPulseWidth function
  417. * @details Parameters used when raising an error/exception
  418. */
  419. #define ICU_GET_PULSE_WIDTH_ID ((uint8)0x1AU)
  420. #endif
  421. #if (ICU_GET_INPUT_LEVEL_API == STD_ON)
  422. /**
  423. * @brief API service ID for Icu_GetInputLevel function
  424. * @details Parameters used when raising an error/exception
  425. * */
  426. #define ICU_GET_INPUT_LEVEL_ID ((uint8)0x7CU)
  427. #endif /* ICU_GET_INPUT_LEVEL_API */
  428. #endif
  429. #if (ICU_TIMESTAMP_API == STD_ON)
  430. /**
  431. * @brief API service ID for Icu_StopTimestamp function
  432. * @details Parameters used when raising an error/exception
  433. * */
  434. #define ICU_STOPTIMESTAMP_ID ((uint8)0x0A)
  435. /**
  436. * @brief API service Icu_StopTimestamp called on a channel which was not
  437. * started or already stopped
  438. * @implements Icu_ErrorCodes_define
  439. * */
  440. #define ICU_E_NOT_STARTED ((uint8)0x15)
  441. #endif
  442. /*================================================================================================*/
  443. /*==================================================================================================
  444. * ENUMS
  445. ==================================================================================================*/
  446. /*==================================================================================================
  447. * STRUCTURES AND OTHER TYPEDEFS
  448. ==================================================================================================*/
  449. #if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
  450. /** @brief Typedef for Mcl_ChannelType. */
  451. typedef uint8 Mcl_ChannelType;
  452. #endif
  453. /**
  454. * @brief Structure that contains ICU channel configuration.
  455. * @details It contains the information like Icu Channel Mode, Channel Notification function,
  456. * overflow Notification function.
  457. * @implements Icu_ChannelConfigType_struct
  458. * */
  459. typedef struct
  460. {
  461. /** @brief Channel wakeup capability enable. */
  462. boolean Icu_WakeupCapabile;
  463. /** @brief RISING_EDGE, FALLING_EDGE or BOTH_EDGES for EDGE_COUNTER. */
  464. Icu_ActivationType Icu_ActivEdge;
  465. /** @brief EDGE_DETECT, TIME_STAMP, SIGNAL_MEASUREMENT or EDGE_COUNTER. */
  466. Icu_MeasurementModeType Icu_ChannelMode;
  467. /** @brief CIRCULAR_BUFFER or LINEAR_BUFFER for TIME_STAMP, DUTY_CYCLE, HIGH_TIME, LOW_TIME
  468. * or PERIOD_TIME for SIGNAL_MEASUREMENT and RISING_EDGE, FALLING_EDGE or
  469. * BOTH_EDGES for EDGE_COUNTER. */
  470. Icu_MeasurementSubModeType Icu_ChannelProperty;
  471. /** @brief Icu Channel Notification function for TIME_STAMP or EDGE_COUNTER mode. */
  472. Icu_NotifyType Icu_ChannelNotification;
  473. #if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
  474. /** @brief Mcl_DmaChannel Id. */
  475. Mcl_ChannelType Mcl_DmaChannel;
  476. #endif
  477. #if defined(ICU_OVERFLOW_NOTIFICATION_API) && (ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
  478. /** @brief Icu Channel Overflow Notification function. */
  479. Icu_NotifyType Icu_ChOverflowNotification;
  480. #endif /* ICU_OVERFLOW_NOTIFICATION_API */
  481. #if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
  482. Icu_WakeupValueType Icu_Channel_WakeupValue; /**< @brief EcuM wakeup source Id. */
  483. #endif /* ICU_REPORT_WAKEUP_SOURCE == STD_ON */
  484. /** @brief Pointer to the ipw channel pointer configuration */
  485. const Icu_Ipw_ChannelConfigType (*Icu_IpwChannelConfigPtr);
  486. } Icu_ChannelConfigType;
  487. /**
  488. * @brief This type contains initialization data.
  489. * @details he notification functions shall be configurable
  490. * as function pointers within the initialization data structure (Icu_ConfigType).
  491. * This type of the external data structure shall contain the
  492. * initialization data for the ICU driver. It shall contain:
  493. * - Wakeup Module Info (in case the wakeup-capability is true)
  494. * - ICU dependent properties for used HW units
  495. * - Clock source with optional prescaler (if provided by HW)
  496. * @implements Icu_ConfigType_struct
  497. * */
  498. typedef struct
  499. {
  500. /** @brief The number of configured logical channels. */
  501. uint8 nNumChannels;
  502. /** @brief Pointer to the list of Icu configured channels */
  503. const Icu_ChannelConfigType (*Icu_ChannelConfigPtr)[];
  504. /** @brief The number of IP instances configured */
  505. uint8 nNumInstances;
  506. /** @brief Pointer to the list of Icu configured channels */
  507. const Icu_Ipw_IpConfigType (*Icu_IpConfigPtr)[];
  508. /** @brief channel index in each partition map table*/
  509. const uint8 (*Icu_IndexChannelMap)[];
  510. /** @brief Core index*/
  511. uint8 u32CoreId;
  512. } Icu_ConfigType;
  513. /*==================================================================================================
  514. * GLOBAL VARIABLE DECLARATIONS
  515. ==================================================================================================*/
  516. #ifndef ICU_PRECOMPILE_SUPPORT
  517. #define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
  518. #include "Icu_MemMap.h"
  519. ICU_CONFIG_EXT
  520. #define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
  521. #include "Icu_MemMap.h"
  522. #endif /* #ifndef ICU_PRECOMPILE_SUPPORT */
  523. #define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
  524. #include "Icu_MemMap.h"
  525. /**
  526. * @brief Pointer initialized during init with the address of the received configuration structure.
  527. * @details Will be used by all functions to access the configuration data.
  528. **/
  529. extern const Icu_ConfigType *Icu_pCfgPtr[ICU_MAX_PARTITIONS];
  530. /**
  531. * @brief Saves the current Icu mode
  532. **/
  533. extern Icu_ModeType Icu_CurrentMode;
  534. /**
  535. * @brief Stores actual state and configuration of ICU Channels
  536. **/
  537. extern volatile Icu_ChannelStateType Icu_aChannelState[ICU_MAX_CHANNEL];
  538. #if (ICU_TIMESTAMP_API == STD_ON)
  539. /** @brief Pointer to the buffer-array where the timestamp values shall be placed. */
  540. extern Icu_ValueType *Icu_aBuffer[ICU_MAX_CHANNEL];
  541. /**
  542. * @brief Array for saving the size of the external buffer (number of entries)
  543. **/
  544. extern Icu_ValueType Icu_aBufferSize[ICU_MAX_CHANNEL];
  545. /**
  546. * @brief Array for saving Notification interval (number of events).
  547. **/
  548. extern Icu_ValueType Icu_aBufferNotify[ICU_MAX_CHANNEL];
  549. /**
  550. * @brief Array for saving the number of notify counts
  551. **/
  552. extern volatile Icu_ValueType Icu_aNotifyCount[ICU_MAX_CHANNEL];
  553. /**
  554. * @brief Array for saving the time stamp index
  555. **/
  556. extern volatile Icu_IndexType Icu_aBufferIndex[ICU_MAX_CHANNEL];
  557. #endif /* ICU_TIMESTAMP_API */
  558. #define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
  559. #include "Icu_MemMap.h"
  560. /*==================================================================================================
  561. * FUNCTION PROTOTYPES
  562. ==================================================================================================*/
  563. #define ICU_START_SEC_CODE
  564. #include "Icu_MemMap.h"
  565. /**
  566. * @brief This function initializes the driver.
  567. * @details This service is a non reentrant function used for driver initialization.
  568. * The Initialization function shall initialize all relevant registers of the configured
  569. * hardware with the values of the structure referenced by the parameter ConfigPtr.
  570. * If the hardware allows for only one usage of the register, the driver
  571. * module implementing that functionality is responsible for initializing the register.
  572. * The initialization function of this module shall always have a pointer as a parameter,
  573. * even though for Variant PC no configuration set shall be given.
  574. * Instead a NULL pointer shall be passed to the initialization function.
  575. * The Icu module environment shall not call Icu_Init during a running operation (e. g.
  576. * timestamp measurement or edge counting).
  577. *
  578. * @param[in] ConfigPtr Pointer to a selected configuration structure.
  579. *
  580. * @return void
  581. **/
  582. void Icu_Init(const Icu_ConfigType* ConfigPtr);
  583. #if (ICU_DE_INIT_API == STD_ON)
  584. /**
  585. * @brief This function de-initializes the ICU module.
  586. * @details This service is a Non reentrant function used for ICU De-Initialization
  587. * After the call of this service, the state of the peripherals used by configuration shall be
  588. * the same as after power on reset. Values of registers which are not writable are
  589. * excluded.
  590. * This service shall disable all used interrupts and notifications.
  591. * The Icu module environment shall not call Icu_DeInit during a running operation (e. g.
  592. * timestamp measurement or edge counting)
  593. *
  594. * @return void
  595. *
  596. * @api
  597. *
  598. * @pre Icu_Init must be called before.
  599. * @implements Icu_DeInit_Activity
  600. *
  601. **/
  602. void Icu_DeInit(void);
  603. #endif /* ICU_DE_INIT_API */
  604. #if (ICU_SET_MODE_API == STD_ON)
  605. /**
  606. * @brief This function sets the ICU mode.
  607. * @details This service is a non reentrant function used for ICU mode selection.
  608. * This service shall set the operation mode to the given mode parameter.
  609. * This service can be called during running operations. If so, an ongoing operation that
  610. * generates interrupts on a wakeup capable channel like e.g. time stamping or edge counting
  611. * might lead to the ICU module not being able to properly enter sleep mode. This is then a
  612. * system or ECU configuration issue not a problem of this specification.
  613. *
  614. * @param[in] Mode Specifies the operation mode
  615. * @return void
  616. *
  617. * @pre Icu_Init must be called before.
  618. * @implements Icu_SetMode_Activity
  619. *
  620. * @api
  621. *
  622. **/
  623. void Icu_SetMode(Icu_ModeType Mode);
  624. #endif /* ICU_SET_MODE_API */
  625. #if (ICU_DISABLE_WAKEUP_API == STD_ON)
  626. /**
  627. * @brief This function disables the wakeup capability of a single ICU channel.
  628. * @details This service is reentrant function and shall disable the wakeup capability of
  629. * a single ICU channel.This service is only feasible for ICU channels configured
  630. * statically as wakeup capable true.
  631. * The function Icu_DisableWakeup shall be pre compile time configurable On,Off by
  632. * the configuration parameter IcuDisableWakeupApi.
  633. *
  634. * @param[in] Channel Logical number of the ICU channel
  635. *
  636. * @return void
  637. *
  638. * @api
  639. *
  640. * @pre Icu_Init must be called before.
  641. * @implements Icu_DisableWakeup_Activity
  642. *
  643. **/
  644. void Icu_DisableWakeup(Icu_ChannelType Channel);
  645. #endif /* ICU_DISABLE_WAKEUP_API */
  646. #if (ICU_ENABLE_WAKEUP_API == STD_ON)
  647. /**
  648. * @brief This function (re-)enables the wakeup capability of the given ICU channel.
  649. * @details The function is reentrant and re-enable the wake-up capability of a single ICU channel.
  650. *
  651. * @param[in] Channel Logical number of the ICU channel
  652. *
  653. * @return void
  654. *
  655. * @api
  656. *
  657. * @pre Icu_Init must be called before. The channel must be configured as wakeup capable.
  658. * @implements Icu_EnableWakeup_Activity
  659. *
  660. **/
  661. void Icu_EnableWakeup(Icu_ChannelType Channel);
  662. #endif /* ICU_ENABLE_WAKEUP_API */
  663. #if (ICU_WAKEUP_FUNCTIONALITY_API == STD_ON)
  664. /**
  665. * @brief Checks if a wakeup capable ICU channel is the source for a wakeup event.
  666. * @details The function calls the ECU state manager service EcuM_SetWakeupEvent
  667. * in case of a valid ICU channel wakeup event.
  668. *
  669. * @param[in] WakeupSource Information on wakeup source to be checked.
  670. *
  671. * @return void
  672. *
  673. * @api
  674. *
  675. * @pre Icu_Init must be called before. The channel must be configured as wakeup capable.
  676. *
  677. * @implements Icu_CheckWakeup_Activity
  678. *
  679. **/
  680. void Icu_CheckWakeup(EcuM_WakeupSourceType WakeupSource);
  681. #endif /* ICU_WAKEUP_FUNCTIONALITY_API */
  682. /**
  683. * @brief This function sets the activation-edge for the given channel.
  684. * @details This service is reentrant and shall set the activation-edge according to Activation
  685. * parameter for the given channel.
  686. * This service shall support channels which are configured
  687. * for the following Icu_MeasurementMode:
  688. * - ICU_MODE_SIGNAL_EDGE_DETECT
  689. * - ICU_MODE_TIMESTAMP
  690. * - ICU_MODE_EDGE_COUNTER
  691. *
  692. * @param[in] Channel Logical number of the ICU channel
  693. * @param[in] Activation Type of activation.
  694. *
  695. * @return void
  696. *
  697. * @api
  698. *
  699. * @pre Icu_Init must be called before. The channel must be properly configured
  700. * (ICU_MODE_SIGNAL_EDGE_DETECT, ICU_MODE_TIMESTAMP, ICU_MODE_EDGE_COUNTER).
  701. *
  702. * @implements Icu_SetActivationCondition_Activity
  703. *
  704. **/
  705. void Icu_SetActivationCondition(Icu_ChannelType Channel, Icu_ActivationType Activation);
  706. /**
  707. * @brief This function disables the notification of a channel.
  708. *
  709. * @details This function is reentrant and disables the notification of a channel.
  710. * @param[in] Channel Logical number of the ICU channel
  711. *
  712. * @return void
  713. *
  714. * @api
  715. *
  716. * @pre Icu_Init must be called before.
  717. *
  718. * @implements Icu_DisableNotification_Activity
  719. *
  720. **/
  721. void Icu_DisableNotification(Icu_ChannelType Channel);
  722. /**
  723. * @brief This function enables the notification on the given channel.
  724. * @details This function is reentrant and enables the notification on the given channel. The
  725. * notification will be reported only when the channel measurement property is enabled or
  726. * started
  727. *
  728. * @param[in] Channel Logical number of the ICU channel
  729. *
  730. * @return void
  731. *
  732. * @api
  733. *
  734. * @pre Icu_Init must be called before.
  735. *
  736. * @implements Icu_EnableNotification_Activity
  737. *
  738. **/
  739. void Icu_EnableNotification(Icu_ChannelType Channel);
  740. #if (ICU_GET_INPUT_STATE_API == STD_ON)
  741. /**
  742. * @brief This function returns the status of the ICU input.
  743. * @details This service is reentrant shall return the status of the ICU input.
  744. * Only channels which are configured for the following Icu_MeasurementMode shall be
  745. * supported:
  746. * - ICU_MODE_SIGNAL_EDGE_DETECT,
  747. * - ICU_MODE_SIGNAL_MEASUREMENT.
  748. *
  749. * @param[in] Channel Logical number of the ICU channel
  750. *
  751. * @return Icu_InputStateType
  752. * @retval ICU_ACTIVE An activation edge has been detected
  753. * @retval ICU_IDLE No activation edge has been detected since the last call of
  754. * Icu_GetInputState() or Icu_Init().
  755. *
  756. * @api
  757. *
  758. * @pre Icu_Init must be called before.
  759. *
  760. * @implements Icu_GetInputState_Activity
  761. *
  762. **/
  763. Icu_InputStateType Icu_GetInputState(Icu_ChannelType Channel);
  764. #endif /* ICU_GET_INPUT_STATE_API */
  765. #if (STD_ON == ICU_TIMESTAMP_API)
  766. /**
  767. * @brief This function starts the capturing of timer values on the edges.
  768. * @details This function is reentrant and starts the capturing of timer values on the edges
  769. * activated by the service Icu_SetActivationCondition() to an external buffer.
  770. *
  771. * @param[in] Channel Logical number of the ICU channel
  772. * @param[in] BufferPtr Pointer to the buffer-array where the timestamp values shall be
  773. * placed.
  774. * @param[in] BufferSize Size of the external buffer (number of entries)
  775. * @param[in] NotifyInterval Notification interval (number of events).
  776. *
  777. * @return void
  778. *
  779. * @api
  780. *
  781. * @pre Icu_Init must be called before.
  782. */
  783. void Icu_StartTimestamp(Icu_ChannelType Channel, Icu_ValueType* BufferPtr, uint16 BufferSize, uint16 NotifyInterval);
  784. /**
  785. * @brief This function stops the timestamp measurement of the given channel.
  786. * @details This function is reentrant and stops the timestamp measurement of the given channel.
  787. *
  788. * @param[in] Channel Logical number of the ICU channel
  789. *
  790. * @return void
  791. *
  792. * @pre Icu_Init must be called before.
  793. **/
  794. void Icu_StopTimestamp(Icu_ChannelType Channel);
  795. /**
  796. * @brief This function reads the elapsed Signal Low, High or Period Time for the given channel.
  797. * @details This service is reentrant and reads the elapsed Signal Low Time for the given channel
  798. * that is configured in Measurement Mode Signal Measurement, Signal Low Time.
  799. * The elapsed time is measured between a falling edge and the consecutive rising edge of
  800. * the channel.
  801. * This service reads the elapsed Signal High Time for the given channel that is configured
  802. * in Measurement Mode Signal Measurement,Signal High Time.The elapsed time is measured
  803. * between a rising edge and the consecutive falling edge of the channel.
  804. * This service reads the elapsed Signal Period Time for the given channel that is
  805. * configured in Measurement Mode Signal Measurement, Signal Period Time.The elapsed time
  806. * is measured between consecutive rising (or falling) edges of the channel. The period
  807. * start edge is
  808. *
  809. * configurable.
  810. *
  811. * @param[in] Channel Logical number of the ICU channel
  812. *
  813. * @return Icu_ValueType - the elapsed Signal Low Time for the given channel that is configured in
  814. * Measurement Mode Signal Measurement, Signal Low Time
  815. * @pre Icu_Init must be called before. The channel must be configured in Measurement Mode Signal
  816. * Measurement.
  817. */
  818. Icu_IndexType Icu_GetTimestampIndex(Icu_ChannelType Channel);
  819. #endif /* ICU_TIMESTAMP_API */
  820. #if (ICU_EDGE_COUNT_API == STD_ON)
  821. /**
  822. * @brief This function resets the value of the counted edges to zero.
  823. * @details This function is reentrant and resets the value of the counted edges to zero.
  824. *
  825. * @param[in] Channel Logical number of the ICU channel.
  826. *
  827. * @return void
  828. *
  829. * @api
  830. *
  831. * @pre Icu_Init must be called before.
  832. *
  833. * @implements Icu_ResetEdgeCount_Activity
  834. *
  835. **/
  836. void Icu_ResetEdgeCount(Icu_ChannelType Channel);
  837. #endif /* ICU_EDGE_COUNT_API */
  838. #if (ICU_EDGE_COUNT_API == STD_ON)
  839. /**
  840. * @brief This function enables the counting of edges of the given channel.
  841. * @details This service is reentrant and shall enable the counting of edges of the given channel.
  842. * Note: This service doesnot do the real counting itself. This is done by the hardware
  843. * (capture unit). Only the configured edges shall be counted (rising edge, falling edge or
  844. * both edges).
  845. *
  846. * Configuration of the edge is done in Icu_Init or Icu_SetActivationCondition.The
  847. * configured edge can be changed during runtime using Icu_SetActivationCondition.
  848. * Interrupts are not required for edge counting.If interrupts are enabled, the interrupt
  849. * service routine
  850. * will set the overflow flag if more than 0xFFFFFF edges are measured.
  851. *
  852. * @param[in] Channel Logical number of the ICU channel
  853. *
  854. * @return void
  855. *
  856. * @api
  857. *
  858. * @pre Icu_Init must be called before. The given channel must be configured in Measurement Mode
  859. * Edge Counter.
  860. * @implements Icu_EnableEdgeCount_Activity
  861. *
  862. **/
  863. void Icu_EnableEdgeCount(Icu_ChannelType Channel);
  864. #endif /* ICU_EDGE_COUNT_API */
  865. #if (ICU_EDGE_COUNT_API == STD_ON)
  866. /**
  867. * @brief This function disables the counting of edges of the given channel.
  868. * @details This function is reentrant and disables the counting of edges of the given channel.
  869. *
  870. * @param[in] Channel Logical number of the ICU channel
  871. *
  872. * @return void
  873. *
  874. * @api
  875. *
  876. * @pre Icu_Init must be called before.The given channel must be configured in Measurement
  877. * Mode Edge Counter.
  878. *
  879. * @implements Icu_DisableEdgeCount_Activity
  880. *
  881. **/
  882. void Icu_DisableEdgeCount(Icu_ChannelType Channel);
  883. #endif /* ICU_EDGE_COUNT_API */
  884. #if (ICU_EDGE_COUNT_API == STD_ON)
  885. /**
  886. * @brief This function reads the number of counted edges.
  887. * @details This function is reentrant reads the number of counted edges after the last call
  888. * of Icu_ResetEdgeCount().
  889. *
  890. * @param[in] Channel Logical number of the ICU channel
  891. *
  892. * @return Icu_EdgeNumberType - Number of the counted edges.
  893. *
  894. * @api
  895. *
  896. * @pre Icu_Init must be called before. The given channel must be configured in Measurement
  897. * Mode Edge Counter.
  898. *
  899. * @implements Icu_GetEdgeNumbers_Activity
  900. **/
  901. Icu_EdgeNumberType Icu_GetEdgeNumbers(Icu_ChannelType Channel);
  902. #endif /* ICU_EDGE_COUNT_API */
  903. #if (ICU_EDGE_DETECT_API == STD_ON)
  904. /**
  905. * @brief This function enables or re-enables the detection of edges of the given channel.
  906. * @details This function is reentrant enables or re-enables the detection of edges of the given
  907. * channel.
  908. *
  909. * @param[in] Channel Logical number of the ICU channel
  910. *
  911. * @return void
  912. *
  913. * @api
  914. *
  915. * @pre Icu_Init must be called before. The channel must be configured in Measurement Mode Edge
  916. * Counter
  917. *
  918. * @implements Icu_EnableEdgeDetection_Activity
  919. **/
  920. void Icu_EnableEdgeDetection(Icu_ChannelType Channel);
  921. #endif /* ICU_EDGE_DETECT_API */
  922. #if (ICU_EDGE_DETECT_API == STD_ON)
  923. /**
  924. * @brief This function disables the detection of edges of the given channel.
  925. * @details This function is reentrant and disables the detection of edges of the given channel.
  926. *
  927. * @param[in] Channel Logical number of the ICU channel
  928. *
  929. * @return void
  930. *
  931. * @api
  932. *
  933. * @pre Icu_Init must be called before. The channel must be configured in Measurement Mode Edge
  934. * Detection.
  935. *
  936. * @implements Icu_DisableEdgeDetection_Activity
  937. *
  938. **/
  939. void Icu_DisableEdgeDetection(Icu_ChannelType Channel);
  940. #endif /* ICU_EDGE_DETECT_API */
  941. #if (ICU_GET_TIME_ELAPSED_API== STD_ON)
  942. /**
  943. * @brief This function reads the elapsed Signal Low, High or Period Time for the given channel.
  944. * @details This service is reentrant and reads the elapsed Signal Low Time for the given channel
  945. * that is configured in Measurement Mode Signal Measurement, Signal Low Time.
  946. * The elapsed time is measured between a falling edge and the consecutive rising edge of
  947. * the channel.
  948. * This service reads the elapsed Signal High Time for the given channel that is configured
  949. * in Measurement Mode Signal Measurement,Signal High Time.The elapsed time is measured
  950. * between a rising edge and the consecutive falling edge of the channel.
  951. * This service reads the elapsed Signal Period Time for the given channel that is
  952. * configured in Measurement Mode Signal Measurement, Signal Period Time.The elapsed time
  953. * is measured between consecutive rising (or falling) edges of the channel. The period
  954. * start edge is
  955. *
  956. * configurable.
  957. *
  958. * @param[in] Channel Logical number of the ICU channel
  959. *
  960. * @return Icu_ValueType - the elapsed Signal Low Time for the given channel that is configured in
  961. * Measurement Mode Signal Measurement, Signal Low Time
  962. *
  963. * @api
  964. *
  965. * @pre Icu_Init must be called before. The channel must be configured in Measurement Mode Signal
  966. * Measurement.
  967. *
  968. * @implements Icu_GetTimeElapsed_Activity
  969. *
  970. **/
  971. Icu_ValueType Icu_GetTimeElapsed(Icu_ChannelType Channel);
  972. #endif /* ICU_GET_TIME_ELAPSED_API */
  973. #if (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON)
  974. /**
  975. * @brief This function reads the coherent active time and period time for the given ICU Channel.
  976. * @details The function is reentrant and reads the coherent active time and period time for
  977. * the given ICU Channel, if it is configured in Measurement Mode Signal Measurement, Duty
  978. * Cycle Values.
  979. *
  980. * @param[in] Channel Logical number of the ICU channel
  981. * @param[out] DutyCycleValues Pointer to a buffer where the results (high time and period time)
  982. * shall be placed.
  983. *
  984. * @return void
  985. * @pre Icu_Init must be called before. The given channel must be configured in Measurement Mode
  986. * Signal Measurement, Duty Cycle Values.
  987. */
  988. void Icu_GetDutyCycleValues(Icu_ChannelType Channel, Icu_DutyCycleType* DutyCycleValues);
  989. #endif /* ICU_GET_DUTY_CYCLE_VALUES_API */
  990. #if (ICU_SIGNAL_MEASUREMENT_API == STD_ON)
  991. /**
  992. * @brief This function starts the measurement of signals.
  993. * @details This service is reentrant and starts the measurement of signals beginning with the
  994. * configured default start edge which occurs first after the call of this service.
  995. * This service shall only be available in Measurement Mode ICU_MODE_SIGNAL_MEASUREMENT.
  996. * This service shall reset the state for the given channel to ICU_IDLE.
  997. *
  998. * @param[in] Channel Logical number of the ICU channel
  999. *
  1000. * @return void
  1001. *
  1002. * @api
  1003. *
  1004. * @pre Icu_Init must be called before. The channel must be configured in Measurement Mode Signal
  1005. * Measurement.
  1006. *
  1007. * @implements Icu_StartSignalMeasurement_Activity
  1008. *
  1009. **/
  1010. void Icu_StartSignalMeasurement(Icu_ChannelType Channel);
  1011. /**
  1012. * @brief This function stops the measurement of signals of the given channel.
  1013. * @details This function is reentrant and stops the measurement of signals of the given channel.
  1014. *
  1015. * @param[in] Channel - Logical number of the ICU channel
  1016. * @return void
  1017. *
  1018. * @pre Icu_Init must be called before. The channel must be configured in Measurement Mode
  1019. * Signal Measurement.
  1020. */
  1021. void Icu_StopSignalMeasurement(Icu_ChannelType Channel);
  1022. #endif /* ICU_SIGNAL_MEASUREMENT_API */
  1023. #if (ICU_GET_VERSION_INFO_API == STD_ON)
  1024. /**
  1025. * @brief This service returns the version information of this module.
  1026. * @details This service is Non reentrant and returns the version information of this module.
  1027. * The version information includes:
  1028. * - Module Id
  1029. * - Vendor Id
  1030. * - Vendor specific version numbers
  1031. * If source code for caller and callee of this function is available this function should
  1032. * be realized as a macro. The macro should be defined in the modules header file.
  1033. *
  1034. * @param[out] versioninfo Pointer to location to store version info
  1035. *
  1036. * @return void
  1037. *
  1038. * @api
  1039. *
  1040. * @implements Icu_GetVersionInfo_Activity
  1041. **/
  1042. void Icu_GetVersionInfo(Std_VersionInfoType* versioninfo);
  1043. #endif /* ICU_GET_VERSION_INFO_API == STD_ON */
  1044. #if (ICU_DUAL_CLOCK_MODE_API == STD_ON)
  1045. /**
  1046. * @brief This function sets all channels prescalers based on the input mode.
  1047. *
  1048. * @param selectPrescaler Select the used prescaler: prescaler/alternatePresclaer.
  1049. * @return void
  1050. * @pre Icu_Init must be called before.
  1051. */
  1052. void Icu_SetClockMode(Icu_SelectPrescalerType selectPrescaler);
  1053. #endif /* ICU_DUAL_CLOCK_MODE_API == STD_ON */
  1054. #if (ICU_GET_INPUT_LEVEL_API == STD_ON)
  1055. /**
  1056. * @brief This function returns the actual status of PIN.
  1057. *
  1058. * @details This function returns the actual status of PIN.
  1059. *
  1060. * @param[in] Channel Logical number of the ICU channel
  1061. *
  1062. * @return Icu_LevelType
  1063. *
  1064. * @pre Icu_Init must be called before.
  1065. *
  1066. * @implements Icu_GetInputLevel_Activity
  1067. *
  1068. **/
  1069. Icu_LevelType Icu_GetInputLevel(Icu_ChannelType Channel);
  1070. #endif
  1071. #if ((ICU_CAPTURERGISTER_API == STD_ON) && ((ICU_SIGNAL_MEASUREMENT_API == STD_ON) || \
  1072. (ICU_TIMESTAMP_API == STD_ON)))
  1073. /**
  1074. * @brief This function starts the measurement of signals.
  1075. * @details. This service returns the value of Capture register.
  1076. * This API is used to measure the time difference between 2 different timer channels.
  1077. *
  1078. * @param[in] Channel Logical number of the ICU channel
  1079. *
  1080. * @return Icu_ValueType Value of Capture register
  1081. * @api
  1082. * @pre Icu_Init must be called before.
  1083. * @pre The given channel must be configured in SignalMeasurement or in Timestamp mode
  1084. * @implements Icu_GetCaptureRegisterValue_Activity
  1085. *
  1086. **/
  1087. Icu_ValueType Icu_GetCaptureRegisterValue(Icu_ChannelType Channel);
  1088. #endif
  1089. #if ((ICU_GET_PULSE_WIDTH_API == STD_ON) && (ICU_SIGNAL_MEASUREMENT_API == STD_ON))
  1090. /**
  1091. * @brief This function returns the signals High time, Low time and Period without using the
  1092. * channel interrupt.
  1093. * @details This function returns the signals High time, Low time and Period without using the
  1094. * channel interrupt.
  1095. * @param[in] Channel Logical number of the ICU channel
  1096. * @pre Icu_Init must be called before.
  1097. *
  1098. **/
  1099. void Icu_GetPulseWidth(Icu_ChannelType Channel);
  1100. #endif
  1101. #define ICU_STOP_SEC_CODE
  1102. #include "Icu_MemMap.h"
  1103. #ifdef __cplusplus
  1104. }
  1105. #endif
  1106. /** @} */
  1107. #endif /* ICU_H */