Adc.h 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : ADC
  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 ADC_H
  25. #define ADC_H
  26. /**
  27. * @file Adc.h
  28. * @implements Adc.h_Artifact
  29. * @addtogroup adc_driver
  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 "Mcal.h"
  42. #include "Adc_Cfg.h"
  43. #include "Adc_Types.h"
  44. /*==================================================================================================
  45. * SOURCE FILE VERSION INFORMATION
  46. ==================================================================================================*/
  47. #define ADC_VENDOR_ID 43
  48. #define ADC_MODULE_ID 123
  49. #define ADC_AR_RELEASE_MAJOR_VERSION 4
  50. #define ADC_AR_RELEASE_MINOR_VERSION 4
  51. #define ADC_AR_RELEASE_REVISION_VERSION 0
  52. #define ADC_SW_MAJOR_VERSION 1
  53. #define ADC_SW_MINOR_VERSION 0
  54. #define ADC_SW_PATCH_VERSION 0
  55. /*==================================================================================================
  56. * FILE VERSION CHECKS
  57. ==================================================================================================*/
  58. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  59. /* Check if source file and Mcal header file are of the same AutoSar version */
  60. #if ((ADC_AR_RELEASE_MAJOR_VERSION != MCAL_AR_RELEASE_MAJOR_VERSION) || \
  61. (ADC_AR_RELEASE_MINOR_VERSION != MCAL_AR_RELEASE_MINOR_VERSION) \
  62. )
  63. #error "AutoSar Version Numbers of Adc.h and Mcal.h are different"
  64. #endif
  65. #endif
  66. /* Check if source file and ADC configuration header file are of the same vendor */
  67. #if (ADC_VENDOR_ID != ADC_VENDOR_ID_CFG)
  68. #error "Adc.h and Adc_Cfg.h have different vendor ids"
  69. #endif
  70. /* Check if source file and ADC configuration header file are of the same Autosar version */
  71. #if ((ADC_AR_RELEASE_MAJOR_VERSION != ADC_AR_RELEASE_MAJOR_VERSION_CFG) || \
  72. (ADC_AR_RELEASE_MINOR_VERSION != ADC_AR_RELEASE_MINOR_VERSION_CFG) || \
  73. (ADC_AR_RELEASE_REVISION_VERSION != ADC_AR_RELEASE_REVISION_VERSION_CFG) \
  74. )
  75. #error "AutoSar Version Numbers of Adc.h and Adc_Cfg.h are different"
  76. #endif
  77. /* Check if source file and ADC configuration header file are of the same software version */
  78. #if ((ADC_SW_MAJOR_VERSION != ADC_SW_MAJOR_VERSION_CFG) || \
  79. (ADC_SW_MINOR_VERSION != ADC_SW_MINOR_VERSION_CFG) || \
  80. (ADC_SW_PATCH_VERSION != ADC_SW_PATCH_VERSION_CFG) \
  81. )
  82. #error "Software Version Numbers of Adc.h and Adc_Cfg.h are different"
  83. #endif
  84. /* Check if source file and Adc Types header file are of the same vendor */
  85. #if (ADC_VENDOR_ID != ADC_VENDOR_ID_TYPES_H)
  86. #error "Adc.h and Adc_Types.h have different vendor ids"
  87. #endif
  88. /* Check if source file and Adc Types header file are of the same Autosar version */
  89. #if ((ADC_AR_RELEASE_MAJOR_VERSION != ADC_AR_RELEASE_MAJOR_VERSION_TYPES_H) || \
  90. (ADC_AR_RELEASE_MINOR_VERSION != ADC_AR_RELEASE_MINOR_VERSION_TYPES_H) || \
  91. (ADC_AR_RELEASE_REVISION_VERSION != ADC_AR_RELEASE_REVISION_VERSION_TYPES_H) \
  92. )
  93. #error "AutoSar Version Numbers of Adc.h and Adc_Types.h are different"
  94. #endif
  95. /* Check if source file and Adc Types header file are of the same software version */
  96. #if ((ADC_SW_MAJOR_VERSION != ADC_SW_MAJOR_VERSION_TYPES_H) || \
  97. (ADC_SW_MINOR_VERSION != ADC_SW_MINOR_VERSION_TYPES_H) || \
  98. (ADC_SW_PATCH_VERSION != ADC_SW_PATCH_VERSION_TYPES_H) \
  99. )
  100. #error "Software Version Numbers of Adc.h and Adc_Types.h are different"
  101. #endif
  102. /*==================================================================================================
  103. * CONSTANTS
  104. ==================================================================================================*/
  105. /*==================================================================================================
  106. * DEFINES AND MACROS
  107. ==================================================================================================*/
  108. /**
  109. * Development errors.
  110. * The following errors shall be detectable by the ADC module depending on its
  111. * configuration (development / production mode).
  112. *
  113. * All error codes
  114. *
  115. */
  116. /**
  117. * @brief API service used without Adc module initialization.
  118. * */
  119. #define ADC_E_UNINIT ((uint8)0x0AU)
  120. /**
  121. * @brief Adc module is busy with a running operation.
  122. * */
  123. #define ADC_E_BUSY ((uint8)0x0BU)
  124. /**
  125. * @brief Adc module is in idle state.
  126. * */
  127. #define ADC_E_IDLE ((uint8)0x0CU)
  128. /**
  129. * @brief The ADC module is already initialized.
  130. * */
  131. #define ADC_E_ALREADY_INITIALIZED ((uint8)0x0DU)
  132. /**
  133. * @brief The ADC module is not properly configured.
  134. * */
  135. #define ADC_E_PARAM_CONFIG ((uint8)0x0EU)
  136. /**
  137. * @brief API service is called using an invalid pointer (e.g. the pointer should not be NULL).
  138. * */
  139. #define ADC_E_PARAM_POINTER ((uint8)0x14U)
  140. /**
  141. * @brief API service used with an invalid ADC group.
  142. * */
  143. #define ADC_E_PARAM_GROUP ((uint8)0x15U)
  144. /**
  145. * @brief API service used with an invalid ADC Conversion Mode.
  146. * */
  147. #define ADC_E_WRONG_CONV_MODE ((uint8)0x16U)
  148. /**
  149. * @brief API service used with an invalid ADC Trigger Source.
  150. * */
  151. #define ADC_E_WRONG_TRIGG_SRC ((uint8)0x17U)
  152. /**
  153. * @brief Check the notification capability of a group.
  154. * */
  155. #define ADC_E_NOTIF_CAPABILITY ((uint8)0x18U)
  156. /**
  157. * @brief API service used without initializing the buffer.
  158. * */
  159. #define ADC_E_BUFFER_UNINIT ((uint8)0x19U)
  160. #if (ADC_POWER_STATE_SUPPORTED == STD_ON)
  161. /**
  162. * @brief One or more ADC group/channel not in IDLE state.
  163. * */
  164. #define ADC_E_NOT_DISENGAGED ((uint8)0x1AU)
  165. /**
  166. * @brief Unsupported power state request.
  167. * */
  168. #define ADC_E_POWER_STATE_NOT_SUPPORTED ((uint8)0x1BU)
  169. /**
  170. * @brief Requested power state can not be reached directly.
  171. * */
  172. #define ADC_E_TRANSITION_NOT_POSSIBLE ((uint8)0x1CU)
  173. /**
  174. * @brief ADC not prepared for target power state.
  175. * */
  176. #define ADC_E_PERIPHERAL_NOT_PREPARED ((uint8)0x1DU)
  177. #endif /* (ADC_POWER_STATE_SUPPORTED == STD_ON) */
  178. /**
  179. * @brief The Adc_StartGroupConversion and Adc_EnableHardwareTrigger services can not queue
  180. another conversion (queue is full)
  181. */
  182. #define ADC_E_QUEUE_FULL ((uint8)0x20U)
  183. #if (ADC_SET_HW_UNIT_POWER_MODE_API == STD_ON)
  184. /**
  185. * @brief An error occurred when the Adc_SetHwUnitPowerMode services is used.
  186. * */
  187. #define ADC_E_SET_HW_UNIT_POWER_MODE ((uint8)0x21U)
  188. #endif
  189. #if (ADC_ENABLE_CTUTRIG_NONAUTO_API == STD_ON)
  190. /**
  191. * @brief Wrong trigger source to be used for the group.
  192. * */
  193. #define ADC_E_PARAM_TRIGGER ((uint8)0x22U)
  194. #endif
  195. #if (ADC_ENABLE_CH_DISABLE_CH_NONAUTO_API == STD_ON)
  196. /**
  197. * @brief Adc_EnableChannel or Adc_DisableChannel services called with a wrong channel.
  198. * */
  199. #define ADC_E_WRONG_ENABLE_CH_DISABLE_CH_GROUP ((uint8)0x23U)
  200. /**
  201. * @brief Adc_EnableChannel or Adc_DisableChannel services called with a wrong channel identifier (ID).
  202. * */
  203. #define ADC_E_WRONG_ENABLE_CH_DISABLE_CH_ID ((uint8)0x24U)
  204. #endif
  205. #if (ADC_ENABLE_CONFIGURE_THRESHOLD_NONAUTO_API == STD_ON)
  206. /**
  207. * @brief Adc_ConfigureThreshold service is called using wrong values.
  208. * */
  209. #define ADC_E_WRONG_CONF_THRHLD_VALUE ((uint8)0x25U)
  210. #endif
  211. /**
  212. * @brief API service called using a wrong ADC unit.
  213. * */
  214. #define ADC_E_PARAM_UNIT ((uint8)0x26U)
  215. #if (ADC_CTU_CONTROL_MODE_EXTRA_APIS == STD_ON)
  216. /**
  217. * @brief API service called using a wrong CTU trigger.
  218. * */
  219. #define ADC_E_WRONG_CTU_TRIGGER ((uint8)0x28U)
  220. /**
  221. * @brief API service called using a wrong CTU CLCR trigger.
  222. * */
  223. #define ADC_E_WRONG_CTU_CLCR_TRIGGER ((uint8)0x29U)
  224. #endif
  225. #if (ADC_DUAL_CLOCK_MODE == STD_ON)
  226. /**
  227. * @brief Adc_SetClockMode service called using an invalid clock mode.
  228. * */
  229. #define ADC_E_INVALID_CLOCK_MODE ((uint8)0x29U)
  230. #endif
  231. #if (ADC_SETCHANNEL_API == STD_ON)
  232. /**
  233. * @brief Adc_SetChannel service called using an invalid channel list.
  234. * */
  235. #define ADC_E_PARAM_CHANNEL ((uint8)0x2AU)
  236. #endif
  237. /**
  238. * @brief An error occurred if the timeout counter variable has expired when checking status flags.
  239. * */
  240. #define ADC_E_TIMEOUT ((uint8)0x2BU)
  241. #if (ADC_ENABLE_CTU_CONTROL_MODE_API == STD_ON)
  242. /**
  243. * @brief Error when a function which works only in CTU Control Mode is called when CTU control mode is disabled.
  244. * */
  245. #define ADC_E_CONTROL_MODE_DISABLED ((uint8)0x30U)
  246. #endif /* (ADC_ENABLE_CTU_CONTROL_MODE_API == STD_ON) */
  247. #define ADC_E_BUFFER_UNINIT_LIST ((uint32)0x00000001U)
  248. #define ADC_E_WRONG_TRIGG_SRC_LIST ((uint32)0x00000002U)
  249. #define ADC_E_QUEUE_FULL_LIST ((uint32)0x00000004U)
  250. #define ADC_E_WRONG_CONV_MODE_LIST ((uint32)0x00000008U)
  251. #if (ADC_ENABLE_CH_DISABLE_CH_NONAUTO_API == STD_ON)
  252. #define ADC_E_WRONG_ENABLE_CH_DISABLE_CH_GROUP_LIST ((uint32)0x00000010U)
  253. #define ADC_E_WRONG_ENABLE_CH_DISABLE_CH_ID_LIST ((uint32)0x00000020U)
  254. #endif /* (ADC_ENABLE_CH_DISABLE_CH_NONAUTO_API == STD_ON) */
  255. /**
  256. All AUTOSAR API's service IDs
  257. */
  258. /**
  259. * @brief API service ID for Adc_Init function
  260. * */
  261. #define ADC_INIT_ID 0x00U
  262. /**
  263. * @brief API service ID for Adc_DeInit function
  264. * */
  265. #define ADC_DEINIT_ID 0x01U
  266. /**
  267. * @brief API service ID for Adc_StartGroupConversion function
  268. * */
  269. #define ADC_STARTGROUPCONVERSION_ID 0x02U
  270. /**
  271. * @brief API service ID for Adc_StopGroupConversion function
  272. * */
  273. #define ADC_STOPGROUPCONVERSION_ID 0x03U
  274. /**
  275. * @brief API service ID for Adc_ReadGroup function
  276. * */
  277. #define ADC_VALUEREADGROUP_ID 0x04U
  278. /**
  279. * @brief API service ID for Adc_EnableHardwareTrigger function
  280. * */
  281. #define ADC_ENABLEHARDWARETRIGGER_ID 0x05U
  282. /**
  283. * @brief API service ID for Adc_DisableHardwareTrigger function
  284. * */
  285. #define ADC_DISABLEHARDWARETRIGGER_ID 0x06U
  286. /**
  287. * @brief API service ID for Adc_EnableGroupNotification function
  288. * */
  289. #define ADC_ENABLEGROUPNOTIFICATION_ID 0x07U
  290. /**
  291. * @brief API service ID for Adc_DisableGroupNotification function
  292. * */
  293. #define ADC_DISABLEGROUPNOTIFICATION_ID 0x08U
  294. /**
  295. * @brief API service ID for Adc_GetGroupStatus function
  296. * */
  297. #define ADC_GETGROUPSTATUS_ID 0x09U
  298. /**
  299. * @brief API service ID for Adc_GetVersionInfo function
  300. * */
  301. #define ADC_GETVERSIONINFO_ID 0x0AU
  302. /**
  303. * @brief API service ID for Adc_GetStreamLastPointer function
  304. * */
  305. #define ADC_GETSTREAMLASTPOINTER_ID 0x0BU
  306. /**
  307. * @brief API service ID for Adc_SetupResultBuffer function
  308. * */
  309. #define ADC_SETUPRESULTBUFFER_ID 0x0CU
  310. #if (ADC_POWER_STATE_SUPPORTED == STD_ON)
  311. /**
  312. * @brief API service ID for Adc_SetPowerState function
  313. * */
  314. #define ADC_SETPOWERSTATE_ID 0x10U
  315. /**
  316. * @brief API service ID for Adc_GetCurrentPowerState function
  317. * */
  318. #define ADC_GETCURRENTPOWERSTATE_ID 0x11U
  319. /**
  320. * @brief API service ID for Adc_GetTargetPowerState function
  321. * */
  322. #define ADC_GETTARGETPOWERSTATE_ID 0x12U
  323. /**
  324. * @brief API service ID for Adc_PreparePowerState function
  325. * */
  326. #define ADC_PREPAREPOWERSTATE_ID 0x13U
  327. #endif /* (ADC_POWER_STATE_SUPPORTED == STD_ON) */
  328. /**
  329. * All Autosar Extension API's service IDs
  330. ** NOTE: Parameters used when raising an error/exception
  331. */
  332. #if (ADC_ENABLE_CTUTRIG_NONAUTO_API == STD_ON)
  333. /**
  334. * @brief API service ID for Adc_HwResultReadGroup function
  335. * */
  336. #define ADC_HWRESULTREADGROUP_ID 0x20U
  337. /**
  338. * @brief API service ID for Adc_EnableCTUTrigge function
  339. * */
  340. #define ADC_ENABLECTUTRIGGER_ID 0x21U
  341. /**
  342. * @brief API service ID for Adc_DisableCTUTrigger function
  343. * */
  344. #define ADC_DISABLECTUTRIGGER_ID 0x22U
  345. #endif
  346. #if (ADC_SET_HW_UNIT_POWER_MODE_API == STD_ON)
  347. /**
  348. * @brief API service ID for Adc_SetHwUnitPowerMode function
  349. * */
  350. #define ADC_SET_HW_UNIT_POWER_MODE_ID 0x23U
  351. #if (ADC_BCTU_AVAILABLE == STD_ON)
  352. /**
  353. * @brief API service ID for Adc_CtuSetPowerMode function
  354. * */
  355. #define ADC_CTU_SET_POWER_MODE_ID 0x24U
  356. #endif /* (ADC_BCTU_AVAILABLE == STD_ON) */
  357. #endif /* (ADC_SET_HW_UNIT_POWER_MODE_API == STD_ON) */
  358. #if (ADC_DUAL_CLOCK_MODE == STD_ON)
  359. /**
  360. * @brief API service ID for Adc_SetClockMode function
  361. * */
  362. #define ADC_SETCLOCKMODE_ID 0x25U
  363. #endif
  364. #if (ADC_ENABLE_CH_DISABLE_CH_NONAUTO_API == STD_ON)
  365. /**
  366. * @brief API service ID for Adc_EnableChannel function
  367. * */
  368. #define ADC_ENABLE_CHANNEL_ID 0x26U
  369. /**
  370. * @brief API service ID for Adc_DisableChannel function
  371. * */
  372. #define ADC_DISABLE_CHANNEL_ID 0x27U
  373. #endif
  374. #if (ADC_GET_INJECTED_CONVERSION_STATUS_API == STD_ON)
  375. /**
  376. * @brief API service ID for Adc_GetInjectedConversionStatus function
  377. * */
  378. #define ADC_GETINJECTEDCONVERSIONSTATUS_ID 0x28U
  379. #endif
  380. #if (ADC_CALIBRATION == STD_ON)
  381. /**
  382. * @brief API service ID for Adc_Calibrate function
  383. * */
  384. #define ADC_CALIBRATE_ID 0x29U
  385. #endif
  386. #if (ADC_SELF_TEST == STD_ON)
  387. #define ADC_SELFTEST_ID 0x2AU
  388. #endif
  389. #if (ADC_ENABLE_CONFIGURE_THRESHOLD_NONAUTO_API == STD_ON)
  390. /**
  391. * @brief API service ID for Adc_ConfigureThreshold function
  392. * */
  393. #define ADC_CONFIGURE_THRESHOLD_ID 0x2BU
  394. #endif
  395. #if (ADC_CTU_CONTROL_MODE_EXTRA_APIS == STD_ON)
  396. /**
  397. * @brief API service ID for Adc_CtuWriteTriggerEnableMask function
  398. * */
  399. #define CTU_SET_WRITE_TRIG_EN_MASK_ID (0x2CU)
  400. /**
  401. * @brief API service ID for Adc_CtuSetTriggerEnable function
  402. * */
  403. #define CTU_SET_TRIGGER_ENABLE_ID (0x2DU)
  404. /**
  405. * @brief API service ID for Adc_CtuSetTriggerAdcCmdAddress function
  406. * */
  407. #define CTU_SET_TRIGGER_ADC_CMD_ADDRESS_ID (0x2EU)
  408. /**
  409. * @brief API service ID for Adc_CtuSetTriggerCompare function
  410. * */
  411. #define CTU_SET_TRIGGER_COMPARE_ID (0x2FU)
  412. #endif
  413. #if (ADC_SETCHANNEL_API == STD_ON)
  414. /**
  415. * @brief API service ID for Adc_SetChannel function
  416. * */
  417. #define ADC_SETCHANNEL_ID (0x30U)
  418. #endif
  419. #if (ADC_ENABLE_CTU_CONTROL_MODE_API == STD_ON)
  420. /**
  421. * @brief API service ID for Adc_EnableCtuControlMode function
  422. * */
  423. #define ADC_ENABLE_CTU_CONTROL_MODE_ID (0x32U)
  424. /**
  425. * @brief API service ID for Adc_DisableCtuControlMode function
  426. * */
  427. #define ADC_DISABLE_CTU_CONTROL_MODE_ID (0x33U)
  428. #define ADC_CTU_ENABLE_HW_TRIGGER_ID (0x34U)
  429. #define ADC_CTU_DISABLE_HW_TRIGGER_ID (0x35U)
  430. #define ADC_CTU_START_CONVERSION_ID (0x36U)
  431. #define ADC_CTU_READ_CONV_DATA_ID (0x37U)
  432. #define ADC_CTU_READ_CONV_RESULT_ID (0x38U)
  433. #define ADC_CTU_READ_FIFO_DATA_ID (0x39U)
  434. #define ADC_CTU_READ_FIFO_RESULT_ID (0x3AU)
  435. #define ADC_CTU_SET_FIFO_WATERMARK_ID (0x3BU)
  436. #define ADC_CTU_ENABLE_NOTIFICATION_ID (0x3CU)
  437. #define ADC_CTU_DISABLE_NOTIFICATION_ID (0x3DU)
  438. #define ADC_CTU_SET_LIST_POINTER_ID (0x3EU)
  439. #define ADC_CTU_SET_LIST_ID (0x3FU)
  440. #define ADC_CTU_STOP_LOOP_CONVERSION_ID (0x40U)
  441. #define ADC_CTU_MASTER_RELOAD_ID (0x41U)
  442. #endif /* (ADC_ENABLE_CTU_CONTROL_MODE_API == STD_ON) */
  443. #if (ADC_ENABLE_READ_RAW_DATA_API == STD_ON)
  444. #define ADC_ENABLE_READ_RAW_DATA_ID (0x42U)
  445. #endif /* (ADC_ENABLE_READ_RAW_DATA_API == STD_ON) */
  446. #ifdef ADC_WDG_SUPPORTED
  447. #define ADC_ENABLEWDGNOTIFICATION_ID (0x43U)
  448. #define ADC_DISABLEWDGNOTIFICATION_ID (0x44U)
  449. #endif /* ADC_WDG_SUPPORTED */
  450. #if (ADC_ENABLE_TEMPSENSE_API == STD_ON)
  451. #define ADC_TEMPSENSE_CALCULATE_TEMP_ID (0x4AU)
  452. #define ADC_TEMPSENSE_GET_TEMP_ID (0x4BU)
  453. #endif /* (ADC_ENABLE_TEMPSENSE_API == STD_ON) */
  454. /**
  455. * @brief Mask used to verify the DATA registers content.
  456. */
  457. #if (ADC_ENABLE_LIMIT_CHECK == STD_ON)
  458. #define ADC_DATA_MASK_U16 (0xFFFFU)
  459. #endif /* (ADC_ENABLE_LIMIT_CHECK == STD_ON) */
  460. /*==================================================================================================
  461. * ENUMS
  462. ==================================================================================================*/
  463. /*==================================================================================================
  464. STRUCTURES AND OTHER TYPEDEFS
  465. ==================================================================================================*/
  466. /*==================================================================================================
  467. GLOBAL VARIABLE DECLARATIONS
  468. ==================================================================================================*/
  469. #define ADC_START_SEC_VAR_CLEARED_UNSPECIFIED
  470. #include "Adc_MemMap.h"
  471. /**
  472. * @brief Used to point the configuration structure.
  473. */
  474. extern const Adc_ConfigType * Adc_pCfgPtr[ADC_MAX_PARTITIONS];
  475. #if (ADC_DUAL_CLOCK_MODE == STD_ON)
  476. #if (ADC_SET_ADC_CONV_TIME_ONCE == STD_OFF)
  477. /**
  478. * @brief Clock mode in use
  479. */
  480. extern Adc_SelectPrescalerType Adc_eClockMode[ADC_MAX_PARTITIONS];
  481. #endif /*if (ADC_SET_ADC_CONV_TIME_ONCE == STD_OFF)*/
  482. #endif /*if (ADC_DUAL_CLOCK_MODE == STD_ON)*/
  483. extern Adc_GroupStatusType Adc_aGroupStatus[ADC_MAX_GROUPS];
  484. extern Adc_UnitStatusType Adc_aUnitStatus[ADC_MAX_HW_UNITS];
  485. #if (ADC_SETCHANNEL_API == STD_ON)
  486. extern Adc_RuntimeGroupChannelType Adc_aRuntimeGroupChannel[ADC_MAX_GROUPS];
  487. #endif /*(ADC_SETCHANNEL_API == STD_ON)*/
  488. #define ADC_STOP_SEC_VAR_CLEARED_UNSPECIFIED
  489. #include "Adc_MemMap.h"
  490. #if (ADC_PRECOMPILE_SUPPORT == STD_ON)
  491. #define ADC_START_SEC_CONFIG_DATA_UNSPECIFIED
  492. #include "Adc_MemMap.h"
  493. extern const Adc_ConfigType * const Adc_ConfigVariantPredefined[ADC_MAX_PARTITIONS];
  494. #define ADC_STOP_SEC_CONFIG_DATA_UNSPECIFIED
  495. #include "Adc_MemMap.h"
  496. #else
  497. #define ADC_START_SEC_CONST_UNSPECIFIED
  498. #include "Adc_MemMap.h"
  499. ADC_CONFIG_EXT
  500. #define ADC_STOP_SEC_CONST_UNSPECIFIED
  501. #include "Adc_MemMap.h"
  502. #endif /* (ADC_PRECOMPILE_SUPPORT == STD_ON) */
  503. /*==================================================================================================
  504. FUNCTION PROTOTYPES
  505. ==================================================================================================*/
  506. #define ADC_START_SEC_CODE
  507. #include "Adc_MemMap.h"
  508. /**
  509. * @brief Initializes the ADC hardware unit and the driver.
  510. * @details This function will initialize both the ADC HW unit and the driver structures.
  511. *
  512. * @param[in] pConfigPtr Pointer to configuration set in Variant PB
  513. * (Variant PC requires a NULL_PTR).
  514. * @return void
  515. *
  516. * @implements Adc_Init_Activity
  517. */
  518. void Adc_Init
  519. (
  520. const Adc_ConfigType * ConfigPtr
  521. );
  522. /**
  523. * @brief Initializes the group specific ADC result buffer pointer as
  524. * configured to point to the pDataBufferPtr address which is
  525. * passed as parameter.
  526. * @details Initializes ADC driver with the group specific result buffer
  527. * start address where the conversion results will be stored.
  528. * The application has to ensure that the application buffer,
  529. * where pDataBufferPtr points to, can hold all the conversion
  530. * results of the specified group. The initialization with
  531. * Adc_SetupResultBuffer is required after reset, before a group
  532. * conversion can be started.
  533. *
  534. * @param[in] Group Numeric ID of requested ADC channel group.
  535. * @param[in] pDataBufferPtr Pointer to result data buffer
  536. *
  537. * @return Std_ReturnType Standard return type.
  538. * E_OK: Result buffer pointer initialized correctly.
  539. * E_NOT_OK: Operation failed or development error
  540. * occurred.
  541. *
  542. * @implements Adc_SetupResultBuffer_Activity
  543. */
  544. Std_ReturnType Adc_SetupResultBuffer
  545. (
  546. Adc_GroupType Group,
  547. Adc_ValueGroupType * const DataBufferPtr
  548. );
  549. #if (ADC_DEINIT_API == STD_ON)
  550. /**
  551. * @brief Returns all ADC HW Units to a state comparable to their
  552. * power on reset state.
  553. * @details Returns all ADC HW Units to a state comparable to their
  554. * power on reset state, and de-initialize the ADC MCAL driver.
  555. *
  556. * @return void
  557. *
  558. * @implements Adc_DeInit_Activity
  559. */
  560. void Adc_DeInit(void);
  561. #endif /* ADC_DEINIT_API == STD_ON */
  562. #if (ADC_ENABLE_START_STOP_GROUP_API == STD_ON)
  563. /**
  564. * @brief Starts the conversion of all channels of
  565. * the requested ADC Channel group.
  566. * @details This function will start the SW conversion of all channels
  567. * of the requested ADC channel group.
  568. *
  569. * @param[in] Group Numeric ID of requested ADC channel group.
  570. * @return void
  571. *
  572. * @implements Adc_StartGroupConversion_Activity
  573. */
  574. void Adc_StartGroupConversion
  575. (
  576. Adc_GroupType Group
  577. );
  578. /**
  579. * @brief Stops the conversion of all channels of the requested ADC
  580. * Channel group.
  581. * @details This function will stop the SW conversion of all channels
  582. * of the requested ADC channel group.
  583. *
  584. * @param[in] Group Numeric ID of requested ADC channel group.
  585. * @return void
  586. *
  587. * @implements Adc_StopGroupConversion_Activity
  588. */
  589. void Adc_StopGroupConversion
  590. (
  591. Adc_GroupType Group
  592. );
  593. #endif /* ADC_ENABLE_START_STOP_GROUP_API == STD_ON */
  594. #if (ADC_READ_GROUP_API == STD_ON)
  595. /**
  596. * @brief Reads the group conversion results.
  597. * @details Reads the group conversion results of the last completed
  598. * conversion round of the requested group and stores the
  599. * channel values starting at the pDataBufferPtr address.
  600. * The group channel values are stored in ascending channel
  601. * number order (in contrast to the storage layout of the
  602. * result buffer if streaming access is configured).
  603. *
  604. * @param[in] Group Numeric ID of requested ADC Channel group.
  605. * @param[in] pDataBufferPtr ADC results of all channels of the selected group
  606. * are stored in the data buffer addressed with the pointer.
  607. * @return Std_ReturnType Standard return type.
  608. * E_OK: results are available and written to the
  609. * data buffer.
  610. * E_NOT_OK: no results are available or development
  611. * error occurred.
  612. *
  613. * @implements Adc_ReadGroup_Activity
  614. */
  615. Std_ReturnType Adc_ReadGroup
  616. (
  617. Adc_GroupType Group,
  618. Adc_ValueGroupType * DataBufferPtr
  619. );
  620. #endif /* ADC_READ_GROUP_API == STD_ON */
  621. #if (ADC_ENABLE_READ_RAW_DATA_API == STD_ON)
  622. /**
  623. * @brief Read the raw result data from an ADC unit.
  624. * @details Read the raw result data from an ADC unit.
  625. * Intended for reading ADC results directly from ADC registers
  626. * and can eliminate surplus interrupts if there are more triggered
  627. * measurements than FIFO length.
  628. * Measured values remain in ADC result registers(user must ensure
  629. * that they are not overwritten).
  630. *
  631. * @param[in] Unit Adc unit used. Recommended to use generated define for Adc Logical Unit Id.
  632. * @param[in] ChansArray List of channels for which results to be read
  633. * @param[in] NumItems Number of results to read
  634. * @param[out] DataBufferPtr Destination pointer in which the results will be written
  635. *
  636. * @return void
  637. *
  638. * @implements Adc_ReadRawData_Activity
  639. */
  640. void Adc_ReadRawData
  641. (
  642. Adc_HwUnitType Unit,
  643. const Adc_ChannelType * const ChansArray,
  644. uint8 NumItems,
  645. Adc_ValueGroupType * const DataBufferPtr
  646. );
  647. #endif /* (ADC_ENABLE_READ_RAW_DATA_API == STD_ON) */
  648. #if (ADC_HW_TRIGGER_API == STD_ON)
  649. /**
  650. * @brief Enables the hardware trigger for the requested ADC Channel group.
  651. * @details This function will enable the HW trigger source for the requested
  652. * ADC channel group. This function does set the CTU register for all
  653. * platform that have the CTU Hw Unit.
  654. *
  655. * @param[in] Group Numeric ID of requested ADC channel group.
  656. * @return void
  657. *
  658. * @implements Adc_EnableHardwareTrigger_Activity
  659. */
  660. void Adc_EnableHardwareTrigger
  661. (
  662. Adc_GroupType Group
  663. );
  664. /**
  665. * @brief Disables the hardware trigger for the requested ADC Channel group.
  666. * @details This function will disable the HW trigger source for the requested
  667. * ADC channel group.
  668. *
  669. * @param[in] Group Numeric ID of requested ADC channel group.
  670. * @return void
  671. *
  672. * @implements Adc_DisableHardwareTrigger_Activity
  673. */
  674. void Adc_DisableHardwareTrigger
  675. (
  676. Adc_GroupType Group
  677. );
  678. #endif /* ADC_HW_TRIGGER_API == STD_ON */
  679. #if (ADC_GRP_NOTIF_CAPABILITY == STD_ON)
  680. /**
  681. * @brief Enables the notification mechanism for the requested ADC
  682. * channel group.
  683. * @details This function will enable the notification mechanism only for
  684. * the requested ADC channel group.
  685. *
  686. * @param[in] Group Numeric ID of requested ADC channel group.
  687. * @return void
  688. *
  689. * @implements Adc_EnableGroupNotification_Activity
  690. */
  691. void Adc_EnableGroupNotification
  692. (
  693. Adc_GroupType Group
  694. );
  695. /**
  696. * @brief Disables the notification mechanism for the requested ADC
  697. * channel group.
  698. * @details This function will disable the notification mechanism only for
  699. * the requested ADC channel group.
  700. *
  701. * @param[in] Group Numeric ID of requested ADC channel group.
  702. * @return void
  703. *
  704. * @implements Adc_DisableGroupNotification_Activity
  705. */
  706. void Adc_DisableGroupNotification
  707. (
  708. Adc_GroupType Group
  709. );
  710. #endif /* ADC_GRP_NOTIF_CAPABILITY == STD_ON */
  711. /**
  712. * @brief Returns the conversion status of the requested ADC Channel group.
  713. * @details This function will return the conversion status of the requested
  714. * ADC channel group.
  715. *
  716. * @param[in] Group Numeric ID of requested ADC channel group.
  717. * @return Adc_StatusType Conversion status for the requested group.
  718. * ADC_IDLE in case of errors.
  719. * conversion status in case of no errors.
  720. *
  721. * @implements Adc_GetGroupStatus_Activity
  722. */
  723. Adc_StatusType Adc_GetGroupStatus
  724. (
  725. Adc_GroupType Group
  726. );
  727. /**
  728. * @brief Returns the number of valid samples per channel.
  729. * @details Returns the number of valid samples per channel, stored in
  730. * the result buffer. Reads a pointer, pointing to a position
  731. * in the group result buffer. With the pointer position, the
  732. * results of all group channels of the last completed conversion
  733. * round can be accessed. With the pointer and the return value,
  734. * all valid group conversion results can be accessed (the user
  735. * has to take the layout of the result buffer into account).
  736. *
  737. * @param[in] Group Numeric ID of requested ADC channel group.
  738. * @param[out] PtrToSamplePtr Pointer to result buffer pointer.
  739. *
  740. * @return Adc_StreamNumSampleType Number of valid samples per channel.
  741. * 0 in case of errors.
  742. * >0 Number of valid samples per channel.
  743. *
  744. * @implements Adc_GetStreamLastPointer_Activity
  745. */
  746. Adc_StreamNumSampleType Adc_GetStreamLastPointer
  747. (
  748. Adc_GroupType Group,
  749. Adc_ValueGroupType ** PtrToSamplePtr
  750. );
  751. #if (ADC_VERSION_INFO_API == STD_ON)
  752. /**
  753. * @brief Returns the version information of this module.
  754. * @details Returns the version information of this module.
  755. *
  756. * @param[out] pVersionInfo Pointer to where to store the version
  757. * information of this module.
  758. * structure in case of no errors.
  759. *
  760. * @implements Adc_GetVersionInfo_Activity
  761. */
  762. void Adc_GetVersionInfo
  763. (
  764. Std_VersionInfoType * versioninfo
  765. );
  766. #endif /* ADC_VERSION_INFO_API == STD_ON */
  767. #if (ADC_SET_HW_UNIT_POWER_MODE_API == STD_ON)
  768. /**
  769. * @brief Set the ADC mode either to powerdown or normal.
  770. * @details Set the ADC either to powerdown or normal mode.
  771. *
  772. * @param[in] Unit Adc unit used. Recommended to use generated define for Adc Logical Unit Id
  773. * @param[in] SetPowerMode Power mode to set: normal or powerdown.
  774. *
  775. * @return Std_ReturnType Standard return type.
  776. * E_OK: Transition successful.
  777. * E_NOT_OK: Transition unsuccessful.
  778. *
  779. * @implements Adc_SetHwUnitPowerMode_Activity
  780. */
  781. Std_ReturnType Adc_SetHwUnitPowerMode
  782. (
  783. Adc_HwUnitType Unit,
  784. Adc_SetPowerModeType SetPowerMode
  785. );
  786. #if (ADC_BCTU_AVAILABLE == STD_ON)
  787. /**
  788. * @brief Function to set BCTU/CTU power mode.
  789. *
  790. * @details Set BCTU/CTU power mode.
  791. *
  792. * @param[in] CtuUnit Bctu/Ctu hardware unit. Recommended to use generated define for Bctu/Ctu Logical Unit Id.
  793. * @param[in] State Power state to be set
  794. *
  795. * @return Std_ReturnType Standard return type.
  796. * E_OK: Transition successful.
  797. * E_NOT_OK: Transition unsuccessful.
  798. *
  799. * @implements Adc_CtuSetPowerMode_Activity
  800. */
  801. Std_ReturnType Adc_CtuSetPowerMode
  802. (
  803. Adc_HwUnitType CtuUnit,
  804. Adc_PowerStateType State
  805. );
  806. #endif /* (ADC_BCTU_AVAILABLE == STD_ON) */
  807. #endif /* (ADC_SET_HW_UNIT_POWER_MODE_API == STD_ON) */
  808. #if (ADC_ENABLE_CTUTRIG_NONAUTO_API == STD_ON)
  809. /**
  810. * @brief Enable the TriggerSource for group selected by Group parameter.
  811. * @details This Autosar Extension API is used to enable any one of the configured
  812. * TriggerSource of the Group. When this Autosar Extension API is used to
  813. * enable the trigger source the CTU interrupt will be disabled by the driver.
  814. * So user has to call the Autosar Extension API Adc_HwResultReadGroup to read
  815. * the converted result from the ADC hardware register.
  816. *
  817. * @param[in] Group Index of group.
  818. * @param[in] TriggerSource Trigger source to be used for the group.
  819. * (Configuration file should contain it for that group).
  820. * @return void
  821. *
  822. * @implements Adc_EnableCTUTrigger_Activity
  823. */
  824. void Adc_EnableCTUTrigger
  825. (
  826. Adc_GroupType Group,
  827. Adc_HwTriggerTimerType TriggerSource
  828. );
  829. /**
  830. * @brief Disable the TriggerSource for group selected by Group parameter.
  831. * @details This Autosar Extension API is used to disable the already enabled
  832. * TriggerSource of the Group.
  833. *
  834. * @param[in] Group Index of group.
  835. * @param[in] TriggerSource Trigger source to be disabled for the group.
  836. * (Configuration file should contain it for that group).
  837. * @return void
  838. *
  839. * @implements Adc_DisableCTUTrigger_Activity
  840. */
  841. void Adc_DisableCTUTrigger
  842. (
  843. Adc_GroupType Group,
  844. Adc_HwTriggerTimerType TriggerSource
  845. );
  846. /**
  847. * @brief Read the result of the hardware triggered groups conversion result.
  848. * @details This Autosar Extension API is used to read the result of the hardware
  849. * triggered groups conversion result from the ADC hardware register
  850. * in this case the CTU interrupt will be disabled for the group.
  851. * The VALID bit CDR register will be cleared automatically when we read the results
  852. * from the channel data register. If the user calls Autosar Extension function
  853. * Adc_HwResultReadGroup() once again before the next conversion takes place, the
  854. * Adc_HwResultReadGroup() returns E_NOT_OK.
  855. *
  856. * @param[in] Group Index of group.
  857. * @param[in] DataPtr Pointer to a buffer which will be filled by the
  858. * conversion results.
  859. * @return Std_ReturnType Standard return type.
  860. * E_OK: results are available and written to the
  861. * data buffer.
  862. * E_NOT_OK: no results are available or development
  863. * error occurred.
  864. *
  865. * @implements Adc_HwResultReadGroup_Activity
  866. */
  867. Std_ReturnType Adc_HwResultReadGroup
  868. (
  869. Adc_GroupType Group,
  870. Adc_ValueGroupType * DataPtr
  871. );
  872. #endif /* ADC_ENABLE_CTUTRIG_NONAUTO_API == STD_ON */
  873. #if (ADC_ENABLE_CH_DISABLE_CH_NONAUTO_API == STD_ON)
  874. /**
  875. * @brief Enable an individual channel configured in SW-triggered (non-injected) ADC Group at initialization
  876. * @details Enable an individual channel configured in SW-triggered (non-injected) ADC Group at initialization
  877. * Use generated symbolic channel name defines (e.g. AdcChannel_0_0), because function assumes ChannelId to be in following format:
  878. * Logical channel id on bits until position defined by ADC_CHANNEL_SYMBOLIC_NAME_SHIFT_HW_UNIT_ID_U16, and for the rest the Logical Unit Id
  879. * The driver will not update the values in result buffers corresponding to disabled channels, keeping in the buffer the last results from when the channel was enabled.
  880. *
  881. * @param[in] Adc_GroupType Group logical ID or group symbolic name
  882. * @param[in] Adc_ChannelType Symbolic name of channel
  883. *
  884. * @return void.
  885. *
  886. * @implements Adc_EnableChannel_Activity
  887. */
  888. void Adc_EnableChannel
  889. (
  890. Adc_GroupType Group,
  891. Adc_ChannelType Channel
  892. );
  893. /**
  894. * @brief Disable an individual channel configured in SW-triggered (non-injected) ADC Group at initialization
  895. * @details Disable an individual channel configured in SW-triggered (non-injected) ADC Group at initialization
  896. * Use generated symbolic channel name defines (e.g. AdcChannel_0_0), because function assumes ChannelId to be in following format:
  897. * Logical channel id on bits until position defined by ADC_CHANNEL_SYMBOLIC_NAME_SHIFT_HW_UNIT_ID_U16, and for the rest the Logical Unit Id
  898. * The driver will not update the values in result buffers corresponding to disabled channels, keeping in the buffer the last results from when the channel was enabled.
  899. *
  900. * @param[in] Adc_GroupType Group logical ID or group symbolic name
  901. * @param[in] Adc_ChannelType Symbolic name of channel
  902. *
  903. * @return void.
  904. *
  905. * @implements Adc_DisableChannel_Activity
  906. */
  907. void Adc_DisableChannel
  908. (
  909. Adc_GroupType Group,
  910. Adc_ChannelType Channel
  911. );
  912. #endif /* ADC_ENABLE_CH_DISABLE_CH_NONAUTO_API == STD_ON */
  913. #if (ADC_GET_INJECTED_CONVERSION_STATUS_API == STD_ON)
  914. /**
  915. * @brief Get the injected conversions status.
  916. * @details This function checks if an injected conversion (HW,SW) is ongoing
  917. *
  918. * @param[in] Unit Adc unit used. Recommended to use generated define for Adc Logical Unit Id
  919. *
  920. * @return Adc_StatusType Status of the ADC HW unit.
  921. * ADC_IDLE: SW,HW Injection or Hardware Trigger group are idle.
  922. * ADC_BUSY: SW,HW Injection or Hardware Trigger is in progress.
  923. *
  924. * @implements Adc_GetInjectedConversionStatus_Activity
  925. */
  926. Adc_StatusType Adc_GetInjectedConversionStatus
  927. (
  928. Adc_HwUnitType Unit
  929. );
  930. #endif /* ADC_GET_INJECTED_CONVERSION_STATUS_API == STD_ON */
  931. #if (ADC_CALIBRATION == STD_ON)
  932. /**
  933. * @brief Executes high accuracy calibration of a ADC HW unit.
  934. * @details This function calibrates the ADC HW unit and updates calibration related registers
  935. *
  936. * @param[in] Unit Adc unit used. Recommended to use generated define for Adc Logical Unit Id
  937. * @param[in] pStatus Status of the ADC HW unit calibration and
  938. * list of failed and passed tests.
  939. *
  940. * @return void
  941. *
  942. * @implements Adc_Calibrate_Activity
  943. */
  944. void Adc_Calibrate
  945. (
  946. Adc_HwUnitType Unit,
  947. Adc_CalibrationStatusType * pStatus
  948. );
  949. #endif /* (ADC_CALIBRATION == STD_ON) */
  950. #if (ADC_SELF_TEST == STD_ON)
  951. /**
  952. * @brief Executes hardware Self Test of a ADC HW unit.
  953. * @details This function checks if the ADC HW unit is functioning correctly
  954. *
  955. * @param[in] Unit Adc unit used. Recommended to use generated define for Adc Logical Unit Id
  956. *
  957. * @return Std_ReturnType. Status of the ADC HW unit Self Test.
  958. *
  959. * @implements Adc_SelfTest_Activity
  960. */
  961. Std_ReturnType Adc_SelfTest
  962. (
  963. Adc_HwUnitType Unit
  964. );
  965. #endif /* (ADC_SELF_TEST == STD_ON) */
  966. #if (ADC_ENABLE_CONFIGURE_THRESHOLD_NONAUTO_API == STD_ON)
  967. /**
  968. * @brief Function to reconfigure High and Low thresholds for a given threshold control index.
  969. * @details This function is used to reconfigure High and Low thresholds for a given threshold control index.
  970. * Use generated symbolic name defines of threshold register (e.g. AdcThresholdControl_0_0), because function assumes ThresholdControlIndex to be in following format:
  971. * Logical threshold id on bits until position defined by ADC_THRESHOLD_SYMBOLIC_NAME_SHIFT_HW_UNIT_ID_U16, and for the rest the Logical Unit Id
  972. *
  973. * @param[in] ThresholdControlIndex Symbolic name of threshold control
  974. * @param[in] LowValue Low threshold value of the threshold control
  975. * @param[in] HighValue High threshold value of the threshold control
  976. *
  977. * @return void
  978. *
  979. * @implements Adc_ConfigureThreshold_Activity
  980. */
  981. void Adc_ConfigureThreshold
  982. (
  983. Adc_ThresholdControlIndexType ThresholdControlIndex,
  984. Adc_WdgThresholdValueType LowValue,
  985. Adc_WdgThresholdValueType HighValue
  986. );
  987. #endif /* ADC_ENABLE_CONFIGURE_THRESHOLD_NONAUTO_API == STD_ON */
  988. #ifdef ADC_WDG_SUPPORTED
  989. /**
  990. * @brief Enable notification of a channel that has watchdog functionality configured at initialization
  991. * @details Enable notification of a channel that has watchdog functionality configured at initialization
  992. * Use generated symbolic channel name defines (e.g. AdcChannel_0_0), because function assumes ChannelId to be in following format:
  993. * Logical channel id on bits until position defined by ADC_CHANNEL_SYMBOLIC_NAME_SHIFT_HW_UNIT_ID_U16, and for the rest the Logical Unit Id
  994. *
  995. * @param[in] Adc_ChannelType Symbolic name of channel
  996. *
  997. * @return void.
  998. *
  999. * @implements Adc_EnableWdgNotification_Activity
  1000. */
  1001. void Adc_EnableWdgNotification
  1002. (
  1003. Adc_ChannelType ChannelId
  1004. );
  1005. /**
  1006. * @brief Disable notification of a channel that has watchdog functionality configured at initialization
  1007. * @details Disable notification of a channel that has watchdog functionality configured at initialization
  1008. * Use generated symbolic channel name defines (e.g. AdcChannel_0_0), because function assumes ChannelId to be in following format:
  1009. * Logical channel id on bits until position defined by ADC_CHANNEL_SYMBOLIC_NAME_SHIFT_HW_UNIT_ID_U16, and for the rest the Logical Unit Id
  1010. *
  1011. * @param[in] Adc_ChannelType Symbolic name of channel
  1012. *
  1013. * @return void.
  1014. *
  1015. * @implements Adc_DisableWdgNotification_Activity
  1016. */
  1017. void Adc_DisableWdgNotification
  1018. (
  1019. Adc_ChannelType ChannelId
  1020. );
  1021. #endif /* ADC_WDG_SUPPORTED */
  1022. #if (ADC_DUAL_CLOCK_MODE == STD_ON)
  1023. /**
  1024. * @brief Set the ADC clock prescaler if available and modify the conversion timings.
  1025. * @details This function sets the ADC clock prescaler (Analog clock frequency selector)
  1026. *
  1027. * @param[in] Prescaler Normal or Alternate mode.
  1028. *
  1029. * @return Std_ReturnType Standard return type.
  1030. * E_OK: In case of successful settings.
  1031. * E_NOT_OK: In case of unsuccessful settings.
  1032. *
  1033. * @implements Adc_SetClockMode_Activity
  1034. */
  1035. Std_ReturnType Adc_SetClockMode
  1036. (
  1037. Adc_SelectPrescalerType Prescaler
  1038. );
  1039. #endif /* (ADC_DUAL_CLOCK_MODE == STD_ON) */
  1040. #if (ADC_CTU_CONTROL_MODE_EXTRA_APIS == STD_ON)
  1041. /**
  1042. * @brief Function to set the trigger handler control registers of the CTU IPL.
  1043. *
  1044. * @details Full configurability of CTU THCR1 & THCR2 registers of the CTU IPL.
  1045. * This function has in input the CTU trigger (0...7) and the mask (8 bit)
  1046. * to enable the External Trigger and Timer output for that Trigger, without considering
  1047. * the ADC command output enable.
  1048. * See from the RM the THCR1 and THCR2 registers for the right Thcr_value to use.
  1049. *
  1050. * @note The function Service ID[hex]: 0x35.
  1051. *
  1052. * @param[in] Trigger Index of the trigger: 0...7.
  1053. * @param[in] ThcrValue THCRx mask value (only with bits for Ext. Trigger and Timer) for the selected input trigger.
  1054. *
  1055. * @return Std_ReturnType E_OK or E_NOT_OK.
  1056. * E_OK In case of successful settings.
  1057. * E_NOT_OK In case of unsuccessful settings.
  1058. *
  1059. * @implements Adc_CtuWriteTriggerEnableMask_Activity
  1060. */
  1061. Std_ReturnType Adc_CtuWriteTriggerEnableMask
  1062. (
  1063. uint8 u8Trigger,
  1064. uint8 u8ThcrValue
  1065. );
  1066. /**
  1067. * @brief Function to set or clear the bit Tx_E of the trigger handler control registers of the CTU IPL.
  1068. *
  1069. * @details Full configurability of CTU THCR1 & THCR2 registers of the CTU IPL.
  1070. * This function has in input the CTU trigger (0...7) and a Boolean to set to clear the right trigger bit.
  1071. * See from the RM the THCR1 and THCR2 registers for the right API use.
  1072. *
  1073. * @param[in] u8Trigger Index of the trigger: 0...7.
  1074. * @param[in] bEnable if True, the bit Tx_E shall be set to 1, 0 otherwise
  1075. *
  1076. * @note The function Service ID[hex]: 0x36.
  1077. *
  1078. * @return Std_ReturnType E_OK or E_NOT_OK.
  1079. * E_OK In case of successful settings.
  1080. * E_NOT_OK In case of unsuccessful settings.
  1081. *
  1082. * @implements Adc_CtuSetTriggerEnable_Activity
  1083. */
  1084. Std_ReturnType Adc_CtuSetTriggerEnable
  1085. (
  1086. uint8 u8Trigger,
  1087. boolean bEnable
  1088. );
  1089. /**
  1090. * @brief Function to set the cmd list handler control registers of the CTU IPL.
  1091. *
  1092. * @details Full configurability of CLCR1 & CLCR2 registers of the CTU IPL.
  1093. * This function has in input the CTU trigger (0...7) and the position of the first
  1094. * command in the command list.
  1095. * See from the RM the CLCR1 and CLCR2 registers for the right API use.
  1096. *
  1097. * @param[in] u8Trigger Index of the trigger: 0...7.
  1098. * @param[in] u8ClcrValue Position of the first command
  1099. *
  1100. * @note The function Service ID[hex]: 0x37.
  1101. *
  1102. * @return Std_ReturnType E_OK or E_NOT_OK.
  1103. * E_OK In case of successful settings.
  1104. * E_NOT_OK In case of unsuccessful settings.
  1105. *
  1106. * @implements Adc_CtuSetTriggerAdcCmdAddress_Activity
  1107. */
  1108. Std_ReturnType Adc_CtuSetTriggerAdcCmdAddress
  1109. (
  1110. uint8 u8Trigger,
  1111. uint8 u8ClcrValue
  1112. );
  1113. /**
  1114. * @brief Function to set the trigger compare registers of the CTU IPL.
  1115. *
  1116. * @details Full configurability of CTU TxCR registers of the CTU IPL.
  1117. * This function has in input the CTU trigger (0...7) and the comparator value
  1118. * See from the RM the TxCR trigger compare registers for the right compare_value to use.
  1119. *
  1120. * @note The function Service ID[hex]: 0x38.
  1121. *
  1122. * @param[in] u8Trigger Index of the trigger: 0...7.
  1123. * @param[in] u16CompareValue value to set in the register TxCR.
  1124. *
  1125. * @return Std_ReturnType E_OK or E_NOT_OK.
  1126. * E_OK In case of successful settings.
  1127. * E_NOT_OK In case of unsuccessful settings.
  1128. *
  1129. * @implements Adc_CtuSetTriggerCompare_Activity
  1130. */
  1131. Std_ReturnType Adc_CtuSetTriggerCompare
  1132. (
  1133. uint8 u8Trigger,
  1134. uint16 u16CompareValue
  1135. );
  1136. #endif /* (ADC_CTU_CONTROL_MODE_EXTRA_APIS == STD_ON) */
  1137. #if (ADC_SETCHANNEL_API == STD_ON)
  1138. /**
  1139. * @brief Function to dynamic handling of ADC channels list for Adc channel group.
  1140. *
  1141. * @details Dynamic handling of ADC channels list.
  1142. * This function to dynamic handling of ADC channels list for Adc channel group.
  1143. * @param[in] Group Group Id.
  1144. * @param[in] Channel Pointer to array of channels to be reconfigured for the group. Channel value is logical channel ID.
  1145. * @param[in] Delays Pointer to array of delay value associated with array of channels to be reconfigured.
  1146. * @param[in] ChannelUpdateMask Bitmask selecting which channels to be reconfigured.
  1147. * @param[in] NumberOfChannel Number of channels in channels array.
  1148. *
  1149. * @note For platforms supporting delays:
  1150. * Delays:
  1151. * - If NULL_PTR: channel delay values are not reconfigured.
  1152. * - If group has configured only 1 delay: pointer to new delay value.
  1153. * - If group has configured delay for each channel: array with new delay values - number of elements must be NumberOfChannel.
  1154. * ChannelUpdateMask:
  1155. * - Bitmask example: 0b0110 only reconfigures channels from positions 1 and 2.
  1156. * - This bit mask can be used only if number of group channels are not greater than number of SC1 registers
  1157. * - Last bit of this mask must be set for having interrupt if NumberOfChannel is different than number of configured channels.
  1158. *
  1159. * @implements Adc_SetChannel_Activity
  1160. */
  1161. void Adc_SetChannel
  1162. (
  1163. const Adc_GroupType Group,
  1164. const Adc_GroupDefType * Channel,
  1165. #if (ADC_DELAY_AVAILABLE == STD_ON)
  1166. const uint16 * Delays,
  1167. const uint32 ChannelUpdateMask,
  1168. #endif /* (ADC_DELAY_AVAILABLE == STD_ON) */
  1169. const Adc_ChannelIndexType NumberOfChannel
  1170. );
  1171. #endif /* ADC_SETCHANNEL_API == STD_ON */
  1172. #if (ADC_POWER_STATE_SUPPORTED == STD_ON)
  1173. /**
  1174. * @brief Enters the already prepared power state.
  1175. * @details This API configures the Adc module so that it enters the already prepared power
  1176. * state, chosen between a predefined set of configured ones.
  1177. *
  1178. * @param[out] Result Pointer to a variable to store the result of this function
  1179. *
  1180. * @return Std_ReturnType Standard return type.
  1181. * E_OK: Power Mode changed.
  1182. * E_NOT_OK: Request rejected.
  1183. *
  1184. * @implements Adc_SetPowerState_Activity
  1185. */
  1186. Std_ReturnType Adc_SetPowerState
  1187. (
  1188. Adc_PowerStateRequestResultType * Result
  1189. );
  1190. /**
  1191. * @brief Get the current power state of the ADC HW unit.
  1192. * @details This API returns the current power state of the ADC HW unit.
  1193. *
  1194. * @param[out] CurrentPowerState The current power mode of the ADC HW Unit is returned in this parameter
  1195. * @param[out] Result Pointer to a variable to store the result of this function
  1196. *
  1197. * @return Std_ReturnType Standard return type.
  1198. * E_OK: Mode could be read.
  1199. * E_NOT_OK: Service is rejected.
  1200. *
  1201. * @implements Adc_GetCurrentPowerState_Activity
  1202. */
  1203. Std_ReturnType Adc_GetCurrentPowerState
  1204. (
  1205. Adc_PowerStateType * CurrentPowerState,
  1206. Adc_PowerStateRequestResultType * Result
  1207. );
  1208. /**
  1209. * @brief Get the target power state of the ADC HW unit.
  1210. * @details This API returns the target power state of the ADC HW unit.
  1211. *
  1212. * @param[out] TargetPowerState The Target power mode of the ADC HW Unit is returned in this parameter.
  1213. * @param[out] Result Pointer to a variable to store the result of this function.
  1214. *
  1215. * @return Std_ReturnType Standard return type.
  1216. * E_OK: Mode could be read.
  1217. * E_NOT_OK: Service is rejected.
  1218. *
  1219. * @implements Adc_GetTargetPowerState_Activity
  1220. */
  1221. Std_ReturnType Adc_GetTargetPowerState
  1222. (
  1223. Adc_PowerStateType * TargetPowerState,
  1224. Adc_PowerStateRequestResultType * Result
  1225. );
  1226. /**
  1227. * @brief Starts the needed process to allow the ADC HW module to enter the requested power state.
  1228. * @details This API starts the needed process to allow the ADC HW module to enter the requested power state.
  1229. *
  1230. * @param[in] PowerState The target power state intended to be attained.
  1231. * @param[out] Result Pointer to a variable to store the result of this function.
  1232. *
  1233. * @return Std_ReturnType Standard return type.
  1234. * E_OK: Mode could be read.
  1235. * E_NOT_OK: Service is rejected.
  1236. *
  1237. * @implements Adc_PreparePowerState_Activity
  1238. */
  1239. Std_ReturnType Adc_PreparePowerState
  1240. (
  1241. Adc_PowerStateType PowerState,
  1242. Adc_PowerStateRequestResultType * Result
  1243. );
  1244. #if (ADC_POWER_STATE_ASYNCH_MODE_SUPPORTED == STD_ON)
  1245. /**
  1246. * @brief Cyclically called and supervises the power state transitions.
  1247. * @details This API is cyclically called and supervises the power state transitions, checking for the readiness of the module and issuing the callbacks.
  1248. *
  1249. * @param[in] none
  1250. * @param[out] none
  1251. *
  1252. * @return void
  1253. */
  1254. void Adc_Main_PowerTransitionManager(void);
  1255. #endif /* (ADC_POWER_STATE_ASYNCH_MODE_SUPPORTED == STD_ON) */
  1256. #endif /* (ADC_POWER_STATE_SUPPORTED == STD_ON) */
  1257. #if (ADC_ENABLE_CTU_CONTROL_MODE_API == STD_ON)
  1258. /**
  1259. * @brief Function to enable CTU control mode for an ADC unit.
  1260. *
  1261. * @details Enable CTU control mode for an ADC unit.
  1262. * This function to enable CTU control mode for Adc. When a unit works in CTU control mode,
  1263. * no other conversions shall run in parallel(Adc). The only conversions occurring shall be
  1264. * the ones defined in the CTU configuration.
  1265. *
  1266. * @param[in] Unit Adc unit used. Recommended to use generated define for Adc Logical Unit Id
  1267. *
  1268. * @return void
  1269. *
  1270. * @implements Adc_EnableCtuControlMode_Activity
  1271. */
  1272. void Adc_EnableCtuControlMode
  1273. (
  1274. Adc_HwUnitType Unit
  1275. );
  1276. /**
  1277. * @brief Function to disable CTU control mode for an ADC unit.
  1278. *
  1279. * @details Disable CTU control mode for an ADC unit.
  1280. * This function to disable CTU control mode for Adc. The other Adc conversions can run in
  1281. * software trigger normal mode, software trigger injected mode or hardware trigger mode.
  1282. *
  1283. * @param[in] Unit Adc unit used. Recommended to use generated define for Adc Logical Unit Id
  1284. *
  1285. * @return void
  1286. *
  1287. * @implements Adc_DisableCtuControlMode_Activity
  1288. */
  1289. void Adc_DisableCtuControlMode
  1290. (
  1291. Adc_HwUnitType Unit
  1292. );
  1293. /**
  1294. * @brief Function to enable CTU hardware trigger.
  1295. *
  1296. * @details Enable CTU hardware trigger.
  1297. *
  1298. * @param[in] TrigSource Trigger source.
  1299. *
  1300. * @return void
  1301. *
  1302. * @implements Adc_CtuEnableHwTrigger_Activity
  1303. */
  1304. void Adc_CtuEnableHwTrigger
  1305. (
  1306. Adc_CtuTrigSrcType TrigSource
  1307. );
  1308. /**
  1309. * @brief Function to disable CTU hardware trigger.
  1310. *
  1311. * @details Disable CTU hardware trigger.
  1312. *
  1313. * @param[in] TrigSource Trigger source.
  1314. *
  1315. * @return void
  1316. *
  1317. * @implements Adc_CtuDisableHwTrigger_Activity
  1318. */
  1319. void Adc_CtuDisableHwTrigger
  1320. (
  1321. Adc_CtuTrigSrcType TrigSource
  1322. );
  1323. /**
  1324. * @brief Function to start CTU conversion.
  1325. *
  1326. * @details Start CTU conversion.
  1327. *
  1328. * @param[in] TrigSource Trigger source.
  1329. *
  1330. * @return void
  1331. *
  1332. * @implements Adc_CtuStartConversion_Activity
  1333. */
  1334. void Adc_CtuStartConversion
  1335. (
  1336. Adc_CtuTrigSrcType TrigSource
  1337. );
  1338. #if (ADC_CTU_AVAILABLE == STD_ON)
  1339. /**
  1340. * @brief Issue a software master reload signal for CTU.
  1341. *
  1342. * @details Issue a software master reload signal for CTU in CTU Control Mode.
  1343. *
  1344. * @param[in] CtuUnit CTU hardware unit. Recommended to use generated define for Ctu Logical Unit Id
  1345. *
  1346. * @return void
  1347. *
  1348. * @implements Adc_CtuMasterReload_Activity
  1349. */
  1350. void Adc_CtuMasterReload
  1351. (
  1352. Adc_HwUnitType CtuUnit
  1353. );
  1354. #endif /* (ADC_CTU_AVAILABLE == STD_ON) */
  1355. #if (ADC_BCTU_AVAILABLE == STD_ON)
  1356. /**
  1357. * @brief Function to read BCTU conversion data.
  1358. *
  1359. * @details Read CTU conversion data.
  1360. *
  1361. * @param[in] AdcUnit Adc HW unit. Recommended to use generated define for Adc Logical Unit Id.
  1362. *
  1363. * @return Adc_ValueGroupType Conversion result.
  1364. *
  1365. * @implements Adc_CtuReadConvData_Activity
  1366. */
  1367. Adc_ValueGroupType Adc_CtuReadConvData
  1368. (
  1369. Adc_HwUnitType AdcUnit
  1370. );
  1371. /**
  1372. * @brief Function to read BCTU conversion result.
  1373. *
  1374. * @details Read BCTU conversion result.
  1375. *
  1376. * @param[in] AdcUnit Adc HW unit. Recommended to use generated define for Adc Logical Unit Id.
  1377. * @param[out] pResult Adc result structure.
  1378. *
  1379. * @return void
  1380. *
  1381. * @implements Adc_CtuReadConvResult_Activity
  1382. */
  1383. void Adc_CtuReadConvResult
  1384. (
  1385. Adc_HwUnitType AdcUnit,
  1386. Adc_CtuResultType * pResult
  1387. );
  1388. /**
  1389. * @brief Function to stop CTU loop conversion.
  1390. *
  1391. * @details Stop CTU loop conversions.
  1392. *
  1393. * @param[in] TrigSource Trigger source of conversions to be stopped.
  1394. *
  1395. * @return void
  1396. *
  1397. * @implements Adc_CtuStopLoopConversions_Activity
  1398. */
  1399. void Adc_CtuStopLoopConversions
  1400. (
  1401. Adc_CtuTrigSrcType TrigSource
  1402. );
  1403. #endif /* (ADC_BCTU_AVAILABLE == STD_ON) */
  1404. /**
  1405. * @brief Function to read CTU conversion data from FIFO.
  1406. *
  1407. * @details Read CTU conversion data from FIFO.
  1408. *
  1409. * @param[in] FifoIdx CTU FIFO index.
  1410. * @param[out] pu16Data Pointer to pre-allocated result array.
  1411. * @param[in] u8DataLength Max amount of results to be read.
  1412. *
  1413. * @return void
  1414. *
  1415. * @implements Adc_CtuReadFifoData_Activity
  1416. */
  1417. void Adc_CtuReadFifoData
  1418. (
  1419. Adc_CtuFifoIdxType FifoIdx,
  1420. uint16 * pu16Data,
  1421. uint8 u8DataLength
  1422. );
  1423. /**
  1424. * @brief Function to read CTU conversion results from FIFO.
  1425. *
  1426. * @details Read CTU conversion results from FIFO.
  1427. *
  1428. * @param[in] FifoIdx CTU FIFO index.
  1429. * @param[out] pResult Pointer to pre-allocated result array.
  1430. * @param[in] u8ResultLength Max amount of results to be read.
  1431. *
  1432. * @return void
  1433. *
  1434. * @implements Adc_CtuReadFifoResult_Activity
  1435. */
  1436. void Adc_CtuReadFifoResult
  1437. (
  1438. Adc_CtuFifoIdxType FifoIdx,
  1439. Adc_CtuFifoResultType * pResult,
  1440. uint8 u8ResultLength
  1441. );
  1442. /**
  1443. * @brief Function to set CTU FIFO watermark.
  1444. *
  1445. * @details Set CTU FIFO watermark.
  1446. *
  1447. * @param[in] FifoIdx FIFO index.
  1448. * @param[in] u8Watermark Watermark value.
  1449. *
  1450. * @return void
  1451. *
  1452. * @implements Adc_CtuSetFifoWatermark_Activity
  1453. */
  1454. void Adc_CtuSetFifoWatermark
  1455. (
  1456. Adc_CtuFifoIdxType FifoIdx,
  1457. uint8 u8Watermark
  1458. );
  1459. /**
  1460. * @brief Function to enable CTU notification.
  1461. *
  1462. * @details Enable CTU notification.
  1463. *
  1464. * @param[in] Notification Notification to be enabled.
  1465. *
  1466. * @return void
  1467. *
  1468. * @implements Adc_CtuEnableNotification_Activity
  1469. */
  1470. void Adc_CtuEnableNotification
  1471. (
  1472. Adc_CtuNotificationType Notification
  1473. );
  1474. /**
  1475. * @brief Function to disable CTU notification.
  1476. *
  1477. * @details Disable CTU notification.
  1478. *
  1479. * @param[in] Notification Notification to be disabled.
  1480. *
  1481. * @return void
  1482. *
  1483. * @implements Adc_CtuDisableNotification_Activity
  1484. */
  1485. void Adc_CtuDisableNotification
  1486. (
  1487. Adc_CtuNotificationType Notification
  1488. );
  1489. /**
  1490. * @brief Function to set CTU list.
  1491. *
  1492. * @details Reconfigure the CTU list of conversions in CTU Control Mode.
  1493. *
  1494. * @param[in] ListItemsArray Pointer to list items array to be set.
  1495. * @param[in] NumItems Number of items in the array.
  1496. * @param[in] ListStartPosition Start position of the list.
  1497. *
  1498. * @return void
  1499. *
  1500. * @implements Adc_CtuSetList_Activity
  1501. */
  1502. void Adc_CtuSetList
  1503. (
  1504. const Adc_CtuListItemType * const ListItemsArray,
  1505. const uint8 NumItems,
  1506. const uint8 ListStartPosition
  1507. );
  1508. /**
  1509. * @brief Reconfigure the list pointer of a triggered CTU source.
  1510. *
  1511. * @details Reconfigure the list pointer of a trigger source in CTU Control Mode.
  1512. *
  1513. * @param[in] TrigSource Source trigger index.
  1514. * @param[in] ListPtr Position of the first channel of the command list.
  1515. *
  1516. * @return void
  1517. *
  1518. * @implements Adc_CtuSetListPointer_Activity
  1519. */
  1520. void Adc_CtuSetListPointer
  1521. (
  1522. Adc_CtuTrigSrcType TrigSource,
  1523. Adc_CtuListPtrType ListPtr
  1524. );
  1525. #endif /* ADC_ENABLE_CTU_CONTROL_MODE_API == STD_ON */
  1526. #if (ADC_ENABLE_TEMPSENSE_API == STD_ON)
  1527. /**
  1528. * @brief Function to calculate temperature on chip from provided data.
  1529. *
  1530. * @details Calculates temperature on chip from provided data.
  1531. *
  1532. * @param[in] Unit Adc unit used. Recommended to use generated define for Adc Logical Unit Id.
  1533. * @param[in] TempSenseConvData Data measured on the ADC internal channel for TempSense.
  1534. * (1 bit for the sign, 11 bits for the integer part and 4 bits for the decimal part)
  1535. *
  1536. * @return uint16 Temperature value on chip.in degrees C, expressed in fixed point format.
  1537. *
  1538. * @implements Adc_TempSenseCalculateTemp_Activity
  1539. */
  1540. uint16 Adc_TempSenseCalculateTemp
  1541. (
  1542. Adc_HwUnitType Unit,
  1543. const uint16 TempSenseAdcConvData
  1544. );
  1545. /**
  1546. * @brief Function to get the temperature on chip directly.
  1547. *
  1548. * @details This function starts a normal software conversion with one-shot mode on tempsense
  1549. * channel and calculates the temperature on chip from the data conversion
  1550. * The function is synchronous: waits until the ADC conversion completes or timeout occurs
  1551. *
  1552. * @param[in] Unit Adc unit used. Recommended to use generated define for Adc Logical Unit Id.
  1553. * @param[out] TempSenseVal Temperature value on chip in degrees C, expressed in fixed point format.
  1554. * (1 bit for the sign, 11 bits for the integer part and 4 bits for the decimal part)
  1555. *
  1556. * @return Std_ReturnType Standard return type.
  1557. * E_OK: temperature read successful
  1558. * E_NOT_OK: operation failed
  1559. * @implements Adc_TempSenseGetTemp_Activity
  1560. */
  1561. Std_ReturnType Adc_TempSenseGetTemp
  1562. (
  1563. Adc_HwUnitType Unit,
  1564. uint16 * const TempSenseVal
  1565. );
  1566. /**
  1567. * @brief Set the Tempsense mode either to powerdown or normal.
  1568. * @details Set the Tempsense mode either to powerdown or normal.
  1569. *
  1570. * @param[in] SetPowerMode Power mode to set: normal or powerdown.
  1571. *
  1572. * @return Std_ReturnType Successful/Unsuccessful transition.
  1573. *
  1574. * @implements Adc_TempSenseSetPowerMode_Activity
  1575. */
  1576. Std_ReturnType Adc_TempSenseSetPowerMode
  1577. (
  1578. Adc_SetPowerModeType SetPowerMode
  1579. );
  1580. #endif /* (ADC_ENABLE_TEMPSENSE_API == STD_ON) */
  1581. #define ADC_STOP_SEC_CODE
  1582. #include "Adc_MemMap.h"
  1583. #ifdef __cplusplus
  1584. }
  1585. #endif
  1586. /** @} */
  1587. #endif /* ADC_H */