etm.h 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  1. /******************************************************************************
  2. * @brief header file for ETM.
  3. *
  4. *******************************************************************************
  5. *
  6. * provide APIs for accessing ETM
  7. ******************************************************************************/
  8. #ifndef ETM_H_
  9. #define ETM_H_
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /******************************************************************************
  14. * Includes
  15. ******************************************************************************/
  16. /******************************************************************************
  17. * Constants
  18. ******************************************************************************/
  19. /******************************************************************************
  20. * Macros
  21. ******************************************************************************/
  22. /******************************************************************************
  23. * ETM return status definition
  24. *
  25. *//*! @addtogroup ETM_returnstatus
  26. * @{
  27. *******************************************************************************/
  28. #define ETM_ERR_SUCCESS 0 /*!< return ok */
  29. #define ETM_ERR_INVALID_PARAM 1 /*!< return invalid parameter */
  30. /*! @} End of ETM_returnstatus */
  31. /******************************************************************************
  32. * ETM channel number definition
  33. *
  34. *//*! @addtogroup ETM_channelnumber
  35. * @{
  36. *******************************************************************************/
  37. #define ETM_CHANNEL_CHANNEL0 0 /*!< channel 0 */
  38. #define ETM_CHANNEL_CHANNEL1 1 /*!< channel 1 */
  39. #define ETM_CHANNEL_CHANNEL2 2 /*!< channel 2 */
  40. #define ETM_CHANNEL_CHANNEL3 3 /*!< channel 3 */
  41. #define ETM_CHANNEL_CHANNEL4 4 /*!< channel 4 */
  42. #define ETM_CHANNEL_CHANNEL5 5 /*!< channel 5 */
  43. #define ETM_CHANNELPAIR0 0 /*!< channel pair 0:ch0 & ch1 */
  44. #define ETM_CHANNELPAIR1 2 /*!< channel pair 1:ch2 & ch3 */
  45. #define ETM_CHANNELPAIR2 4 /*!< channel pair 2:ch4 & ch5 */
  46. /*! @} End of ETM_channelnumber */
  47. /******************************************************************************
  48. * ETM pwm mode definition
  49. *
  50. *//*! @addtogroup ETM_pwmmode
  51. * @{
  52. *******************************************************************************/
  53. #define ETM_PWMMODE_EDGEALLIGNED 1 /*!< EPWM */
  54. #define ETM_PWMMODE_CENTERALLIGNED 2 /*!< CPWM */
  55. #define ETM_PWMMODE_COMBINE 3 /*!< Combine PWM */
  56. /*! @} End of ETM_pwmmode */
  57. /******************************************************************************
  58. * ETM init value definition
  59. *
  60. *//*! @addtogroup ETM_initvalue
  61. * @{
  62. *******************************************************************************/
  63. #define ETM_MOD_INIT (20000-1) /*!< MOD inite value */
  64. #define ETM_C0V_INIT 1000 /*!< C0V inite value */
  65. #define ETM_C1V_INIT 1000 /*!< C1V inite value */
  66. #define ETM_C2V_INIT 1000 /*!< C2V inite value */
  67. #define ETM_C3V_INIT 1000 /*!< C3V inite value */
  68. #define ETM_C4V_INIT 1000 /*!< C4V inite value */
  69. #define ETM_C5V_INIT 1000 /*!< C5V inite value */
  70. /*! @} End of ETM_initvalue */
  71. /******************************************************************************
  72. * ETM combine feature definition
  73. *
  74. *//*! @addtogroup ETM_combinefeature
  75. * @{
  76. *******************************************************************************/
  77. #define ETM_COMBINE_FAULTEN_MASK 0x40 /*!< fault enable */
  78. #define ETM_COMBINE_SYNCEN_MASK 0x20 /*!< sync enable */
  79. #define ETM_COMBINE_DTEN_MASK 0x10 /*!< dead ETMe insertion enable */
  80. #define ETM_COMBINE_DECAP_MASK 0x08 /*!< dual capture status */
  81. #define ETM_COMBINE_DECAPEN_MASK 0x04 /*!< dual capture enable */
  82. #define ETM_COMBINE_COMP_MASK 0x02 /*!< complementary enable */
  83. #define ETM_COMBINE_COMBINE_MASK 0x01 /*!< combine enable */
  84. /*! @} End of ETM_combinefeature */
  85. /******************************************************************************
  86. * ETM clock sources definition
  87. *
  88. *//*! @addtogroup ETM_clocksource
  89. * @{
  90. *******************************************************************************/
  91. #define ETM_CLOCK_NOCLOCK 0 /*!< No Clock */
  92. #define ETM_CLOCK_SYSTEMCLOCK 1 /*!< System clock/2 */
  93. #define ETM_CLOCK_FIXEDFREQCLOCK 2 /*!< Fixed Freq Clock */
  94. #define ETM_CLOCK_EXTERNALCLOCK 3 /*!< External Clock */
  95. /* clock prescale */
  96. #define ETM_CLOCK_PS_DIV1 0 /*!< DIV 1 */
  97. #define ETM_CLOCK_PS_DIV2 1 /*!< DIV 2 */
  98. #define ETM_CLOCK_PS_DIV4 2 /*!< DIV 4 */
  99. #define ETM_CLOCK_PS_DIV8 3 /*!< DIV 8 */
  100. #define ETM_CLOCK_PS_DIV16 4 /*!< DIV 16 */
  101. #define ETM_CLOCK_PS_DIV32 5 /*!< DIV 32 */
  102. #define ETM_CLOCK_PS_DIV64 6 /*!< DIV 64 */
  103. #define ETM_CLOCK_PS_DIV128 7 /*!< DIV 128 */
  104. /*! @} End of ETM_clocksource */
  105. /******************************************************************************
  106. * ETM dead ETMe clock prescale definition
  107. *
  108. *//*! @addtogroup ETM_deadETMeprescale
  109. * @{
  110. *******************************************************************************/
  111. /* */
  112. #define ETM_DEADETME_DTPS_DIV1 0 /*!< DIV 1 */
  113. #define ETM_DEADETME_DTPS_DIV4 2 /*!< DIV 4 */
  114. #define ETM_DEADETME_DTPS_DIV16 3 /*!< DIV 16 */
  115. /*! @} End of ETM_deadETMeprescale */
  116. /******************************************************************************
  117. * ETM output mode definition
  118. *
  119. *//*! @addtogroup ETM_outputmode
  120. * @{
  121. *******************************************************************************/
  122. /* output mode */
  123. #define ETM_OUTPUT_TOGGLE 1 /*!< toggle output on match */
  124. #define ETM_OUTPUT_CLEAR 2 /*!< clear output on match */
  125. #define ETM_OUTPUT_SET 3 /*!< set output on match */
  126. /*! @} End of ETM_outputmode */
  127. /******************************************************************************
  128. * ETM input capture edge definition
  129. *
  130. *//*! @addtogroup ETM_inputcaptureedge
  131. * @{
  132. *******************************************************************************/
  133. /* mode edge select*/
  134. #define ETM_INPUTCAPTURE_RISINGEDGE 1 /*!< rising edge */
  135. #define ETM_INPUTCAPTURE_FALLINGEDGE 2 /*!< falling edge */
  136. #define ETM_INPUTCAPTURE_BOTHEDGE 3 /*!< both edge */
  137. #define ETM_INPUTCAPTURE_DUALEDGE_NOEDGE 0 /*!< none */
  138. #define ETM_INPUTCAPTURE_DUALEDGE_RISINGEDGE 1 /*!< rising edge*/
  139. #define ETM_INPUTCAPTURE_DUALEDGE_FALLInGEDGE 2 /*!< falling edge*/
  140. #define ETM_INPUTCAPTURE_DUALEDGE_BOTHEDGE 3 /*!< both edge */
  141. /*! @} End of ETM_inputcaptureedge */
  142. /******************************************************************************
  143. * ETM dual edge capture mode definition
  144. *
  145. *//*! @addtogroup ETM_dualcapturemode
  146. * @{
  147. *******************************************************************************/
  148. #define ETM_INPUTCAPTURE_DUALEDGE_ONESHOT 4 /*!< dual edge one shot mode*/
  149. #define ETM_INPUTCAPTURE_DUALEDGE_CONTINUOUS 5 /*!< dual edge continuouse mode*/
  150. /*! @} End of ETM_dualcapturemode */
  151. /******************************************************************************
  152. * ETM PWM edge definition
  153. *
  154. *//*! @addtogroup ETM_pwmedge
  155. * @{
  156. *******************************************************************************/
  157. #define ETM_PWM_HIGHTRUEPULSE 1 /*!< high true pulses */
  158. #define ETM_PWM_LOWTRUEPULSE 2 /*!< low true pulses */
  159. /*! @} End of ETM_pwmedge */
  160. /******************************************************************************
  161. * ETM sync trigger source definition
  162. *
  163. *//*! @addtogroup ETM_syncsource
  164. * @{
  165. *******************************************************************************/
  166. #define ETM_SYNC_TRIGGER_SOFTWARE 1 /*!< Software synchronization */
  167. #define ETM_SYNC_TRIGGER_TRIGGER2 2 /*!< Tigger2 synchronization, SIM_SOPT[ETMSYNC] */
  168. #define ETM_SYNC_TRIGGER_TRIGGER1 3 /*!< Tigger1 synchronization, ETM0CH0 */
  169. #define ETM_SYNC_TRIGGER_TRIGGER0 4 /*!< Tigger0 synchronization, ACMP0 */
  170. /*! @} End of ETM_syncsource */
  171. /******************************************************************************
  172. * ETM SW output control definition
  173. *
  174. *//*! @addtogroup ETM_swoutputcontrol
  175. * @{
  176. *******************************************************************************/
  177. #define ETM_SWOCTRL_HIGH 1 /*!< software output high */
  178. #define ETM_SWOCTRL_LOW 0 /*!< software output low */
  179. /*! @} End of ETM_swoutputcontrol */
  180. /******************************************************************************
  181. * ETM polarity definition
  182. *
  183. *//*! @addtogroup ETM_polarity
  184. * @{
  185. *******************************************************************************/
  186. #define ETM_POLARITY_HIGHACTIVE 0 /*!< active high */
  187. #define ETM_POLARITY_LOWACTIVE 1 /*!< active low */
  188. /*! @} End of ETM_polarity */
  189. /******************************************************************************
  190. * Types
  191. ******************************************************************************/
  192. /*! @brief ETM_CALLBACK function declaration */
  193. typedef void (*ETM_CallbackPtr)(void);
  194. /*! @} End of ETM_callback */
  195. /******************************************************************************
  196. * ETM configure struct.
  197. *
  198. *//*! @addtogroup ETM_configsturct
  199. * @{
  200. *******************************************************************************/
  201. /*!
  202. * @brief ETM configure struct.
  203. *
  204. */
  205. typedef struct
  206. {
  207. uint8_t clk_source; /*!< clock source */
  208. uint8_t prescaler; /*!< clock prescaler */
  209. uint8_t sc; /*!< status and control */
  210. uint16_t modulo; /*!< counter mod */
  211. uint16_t cnt; /*!< counter value */
  212. uint16_t cntin; /*!< counter inite */
  213. uint8_t mode; /*!< features mode selction */
  214. uint8_t sync; /*!< synchronization */
  215. uint8_t outinit; /*!< initial state for channels output */
  216. uint8_t outmask; /*!< output mask */
  217. uint32_t combine; /*!< function for linked channels */
  218. uint16_t deadETMe; /*!< dead ETMe insertion control */
  219. uint8_t exttrig; /*!< external trigger */
  220. uint8_t pol; /*!< channels polarity */
  221. uint16_t filter; /*!< input filter control */
  222. uint8_t fms; /*!< fault mode status */
  223. uint16_t fltctrl; /*!< fault control */
  224. uint8_t fltpol; /*!< fault input polarity */
  225. uint16_t conf; /*!< ETM configuration */
  226. uint32_t synconf; /*!< synchronization configuration*/
  227. uint8_t invctrl; /*!< inverting control */
  228. uint16_t swoctrl; /*!< software output control */
  229. uint16_t pwmload; /*!< pwm load control */
  230. } ETM_ConfigType, *ETM_ConfigPtr;
  231. /*! @} End of ETM_configsturct */
  232. /******************************************************************************
  233. * ETM channel configure struct.
  234. *
  235. *//*! @addtogroup ETM_chconfigsturct
  236. * @{
  237. *******************************************************************************/
  238. /*!
  239. * @brief ETM channel configure struct.
  240. *
  241. */
  242. typedef struct
  243. {
  244. uint8_t u8CnSC; /*!< ETM channel status and control */
  245. uint16_t u16CnV; /*!< ETM channel value control */
  246. union
  247. {
  248. uint32_t u32dw;
  249. struct
  250. {
  251. uint32_t bMode : 3; /*!< flexETMer mode: GPIO, INPUT_CAPTURE, OUTPUT_COMPARE, EDGE_ALIGNED_PWM, CENTER_ALIGNED_PWM,
  252. * COMBINE_PWM, DUAL_EDGE_CAPTURE
  253. */
  254. uint32_t bEdge : 2; /*!< edge select */
  255. uint32_t bOutCmp : 2; /*!< toggle, clear, set */
  256. uint32_t bPWMPol : 1; /*!< high-true pulse, low-true pulses */
  257. uint32_t bDualCapMode : 1; /*!< dual edge capture mode: one-shot, continuous mode */
  258. uint32_t bCHIE : 1; /*!< enable channel interrupt */
  259. }bits;
  260. }ctrl; /*!< ETM channel feature control */
  261. } ETM_ChParamsType;
  262. /*! @} End of ETM_chconfigsturct */
  263. /******************************************************************************
  264. * Global variables
  265. ******************************************************************************/
  266. /*!
  267. * inline functions
  268. */
  269. /******************************************************************************
  270. * ETM inline functions
  271. *
  272. *//*! @addtogroup ETM_api_list
  273. * @{
  274. *******************************************************************************/
  275. /*****************************************************************************//*!
  276. *
  277. * @brief enable the over flow interrupt.
  278. *
  279. * @param[in] pETM pointer to one of three ETM base register address.
  280. *
  281. * @return none.
  282. *
  283. * @ Pass/ Fail criteria: none.
  284. *
  285. * @see ETM_DisableOverflowInt.
  286. *
  287. *****************************************************************************/
  288. __STATIC_INLINE void ETM_EnableOverflowInt(ETM_Type *pETM)
  289. {
  290. if(pETM->SC & ETM_SC_TOF_MASK)
  291. {
  292. pETM->SC &= ~ETM_SC_TOF_MASK;
  293. }
  294. pETM->SC |= ETM_SC_TOIE_MASK;
  295. }
  296. /*****************************************************************************//*!
  297. *
  298. * @brief disable the over flow interrupt.
  299. *
  300. * @param[in] pETM pointer to one of three ETM base register address.
  301. *
  302. * @return none.
  303. *
  304. * @ Pass/ Fail criteria: none
  305. *
  306. * @see ETM_EnableOverflowInt.
  307. *
  308. *****************************************************************************/
  309. __STATIC_INLINE void ETM_DisableOverflowInt(ETM_Type *pETM)
  310. {
  311. pETM->SC &= ~ETM_SC_TOIE_MASK;
  312. }
  313. /*****************************************************************************//*!
  314. *
  315. * @brief enable the channel interrupt.
  316. *
  317. * @param[in] pETM pointer to one of three ETM base register address.
  318. * @param[in] u8ETM_Channel channel number.
  319. *
  320. * @return none.
  321. *
  322. * @ Pass/ Fail criteria: none.
  323. *
  324. * @see ETM_DisableChannelInt.
  325. *
  326. *****************************************************************************/
  327. __STATIC_INLINE void ETM_EnableChannelInt(ETM_Type *pETM, uint8_t u8ETM_Channel)
  328. {
  329. pETM->CONTROLS[u8ETM_Channel].CnSC |= ETM_CnSC_CHIE_MASK;
  330. }
  331. /*****************************************************************************//*!
  332. *
  333. * @brief disable the channel interrupt.
  334. *
  335. * @param[in] pETM pointer to one of three ETM base register address.
  336. * @param[in] u8ETM_Channel channel number.
  337. *
  338. * @return none.
  339. *
  340. * @ Pass/ Fail criteria: none.
  341. *
  342. * @see ETM_EnableChannelInt.
  343. *
  344. *****************************************************************************/
  345. __STATIC_INLINE void ETM_DisableChannelInt(ETM_Type *pETM, uint8_t u8ETM_Channel)
  346. {
  347. pETM->CONTROLS[u8ETM_Channel].CnSC &= ~ETM_CnSC_CHIE_MASK;
  348. }
  349. /*****************************************************************************//*!
  350. *
  351. * @brief get the over flow flag.
  352. *
  353. * @param[in] pETM pointer to one of three ETM base register address.
  354. *
  355. * @return none.
  356. *
  357. * @ Pass/ Fail criteria: none.
  358. *
  359. * @see ETM_ClrOverFlowFlag.
  360. *
  361. *****************************************************************************/
  362. __STATIC_INLINE uint8_t ETM_GetOverFlowFlag(ETM_Type *pETM)
  363. {
  364. return (pETM->SC & ETM_SC_TOF_MASK);
  365. }
  366. /*****************************************************************************//*!
  367. *
  368. * @brief clear the over flow flag.
  369. *
  370. * @param[in] pETM pointer to one of three ETM base register address.
  371. *
  372. * @return none.
  373. *
  374. * @ Pass/ Fail criteria: none.
  375. *
  376. * @see ETM_GetOverFlowFlag.
  377. *
  378. *****************************************************************************/
  379. __STATIC_INLINE void ETM_ClrOverFlowFlag(ETM_Type *pETM)
  380. {
  381. if(pETM->SC & ETM_SC_TOF_MASK)
  382. {
  383. pETM->SC &= ~ETM_SC_TOF_MASK;
  384. }
  385. }
  386. /*****************************************************************************//*!
  387. *
  388. * @brief get the channel flag.
  389. *
  390. * @param[in] pETM pointer to one of three ETM base register address.
  391. * @param[in] u8ETM_Channel channel number.
  392. *
  393. * @return none.
  394. *
  395. * @ Pass/ Fail criteria: none.
  396. *
  397. * @see ETM_ClrChannelFlag.
  398. *
  399. *****************************************************************************/
  400. __STATIC_INLINE uint8_t ETM_GetChannelFlag(ETM_Type *pETM, uint8_t u8ETM_Channel)
  401. {
  402. return (pETM->CONTROLS[u8ETM_Channel].CnSC & ETM_CnSC_CHF_MASK);
  403. }
  404. /*****************************************************************************//*!
  405. *
  406. * @brief clear the channel flag.
  407. *
  408. * @param[in] pETM pointer to one of three ETM base register address.
  409. *
  410. * @return none.
  411. *
  412. * @ Pass/ Fail criteria: none.
  413. *
  414. * @see ETM_GetChannelFlag.
  415. *
  416. *****************************************************************************/
  417. __STATIC_INLINE void ETM_ClrChannelFlag(ETM_Type *pETM, uint8_t u8ETM_Channel)
  418. {
  419. pETM->CONTROLS[u8ETM_Channel].CnSC &= ~ETM_CnSC_CHF_MASK;
  420. }
  421. /*********************************************************************************//*!
  422. *
  423. * @brief enable the write protection function.Write protected bits cannot be written.
  424. *
  425. * @param[in] pETM pointer to one of three ETM base register address.
  426. *
  427. * @return none.
  428. *
  429. * @ Pass/ Fail criteria: none.
  430. *
  431. * @see ETM_WriteProtectionDisable.
  432. *
  433. *********************************************************************************/
  434. __STATIC_INLINE void ETM_WriteProtectionEnable(ETM_Type *pETM)
  435. {
  436. pETM->FMS |= ETM_FMS_WPEN_MASK;
  437. }
  438. /*********************************************************************************//*!
  439. *
  440. * @brief disable the write protection function.Write protected bits can be written.
  441. *
  442. * @param[in] pETM pointer to one of three ETM base register address.
  443. *
  444. * @return none.
  445. *
  446. * @ Pass/ Fail criteria: none.
  447. *
  448. * @see ETM_WriteProtectionDisable.
  449. *
  450. *********************************************************************************/
  451. __STATIC_INLINE void ETM_WriteProtectionDisable(ETM_Type *pETM)
  452. {
  453. if (pETM->FMS & ETM_FMS_WPEN_MASK)
  454. {
  455. pETM->MODE |= ETM_MODE_WPDIS_MASK;
  456. }
  457. }
  458. /*****************************************************************************//*!
  459. *
  460. * @brief set ETMEN bit to enable ETM-specific register.
  461. *
  462. * @param[in] pETM pointer to one of three ETM base register address.
  463. *
  464. * @return none.
  465. *
  466. * @ Pass/ Fail criteria: none.
  467. *
  468. * @see ETM_SetETMBasic.
  469. *
  470. *****************************************************************************/
  471. __STATIC_INLINE void ETM_SetETMEnhanced(ETM_Type *pETM)
  472. {
  473. if(pETM->MODE & ETM_MODE_WPDIS_MASK) /* if not write protected */
  474. {
  475. pETM->MODE |= ETM_MODE_ETMEN_MASK;
  476. }
  477. else
  478. {
  479. ETM_WriteProtectionDisable(pETM);
  480. pETM->MODE |= ETM_MODE_ETMEN_MASK;
  481. ETM_WriteProtectionEnable(pETM);
  482. }
  483. }
  484. /*****************************************************************************//*!
  485. *
  486. * @brief clear ETMEN bit to disable ETM-specific registers, only TPM-compatible
  487. * registers can be used.
  488. *
  489. * @param[in] pETM pointer to one of three ETM base register address.
  490. *
  491. * @return none.
  492. *
  493. * @ Pass/ Fail criteria: none.
  494. *
  495. * @see ETM_SetETMEnhanced.
  496. *
  497. *****************************************************************************/
  498. __STATIC_INLINE void ETM_SetETMBasic(ETM_Type *pETM)
  499. {
  500. if(pETM->MODE & ETM_MODE_WPDIS_MASK) /* if not write protected */
  501. {
  502. pETM->MODE &= ~ETM_MODE_ETMEN_MASK;
  503. }
  504. else
  505. {
  506. ETM_WriteProtectionDisable(pETM);
  507. pETM->MODE &= ~ETM_MODE_ETMEN_MASK;
  508. ETM_WriteProtectionEnable(pETM);
  509. }
  510. }
  511. /*****************************************************************************//*!
  512. *
  513. * @brief set the ETM mod value.
  514. *
  515. * @param[in] pETM pointer to one of three ETM base register address.
  516. * @param[in] u16ModValue the mod value required to set.
  517. *
  518. * @return none.
  519. *
  520. * @ Pass/ Fail criteria: none.
  521. *
  522. * @see ETM_SetChannelValue.
  523. *
  524. *****************************************************************************/
  525. __STATIC_INLINE void ETM_SetModValue(ETM_Type *pETM, uint16_t u16ModValue)
  526. {
  527. pETM->CNT = 0;
  528. pETM->MOD = u16ModValue;
  529. if(ETM2 == pETM)
  530. {
  531. if(pETM->MODE & ETM_MODE_ETMEN_MASK)
  532. {
  533. pETM->PWMLOAD |= ETM_PWMLOAD_LDOK_MASK;
  534. }
  535. else
  536. {
  537. }
  538. }
  539. else
  540. {
  541. }
  542. }
  543. /*****************************************************************************//*!
  544. *
  545. * @brief set the ETM channel value.
  546. *
  547. * @param[in] pETM pointer to one of three ETM base register address.
  548. * @param[in] u16ChannelValue the CnV value required to set.
  549. * @param[in] u8ETM_Channel ETM channel number.
  550. *
  551. * @return none.
  552. *
  553. * @ Pass/ Fail criteria: none.
  554. *
  555. * @see ETM_SetModValue.
  556. *
  557. *****************************************************************************/
  558. __STATIC_INLINE void ETM_SetChannelValue(ETM_Type *pETM, uint8_t u8ETM_Channel, uint16_t u16ChannelValue)
  559. {
  560. pETM->CONTROLS[u8ETM_Channel].CnV = u16ChannelValue;
  561. if(ETM2 == pETM)
  562. {
  563. if(pETM->MODE & ETM_MODE_ETMEN_MASK)
  564. {
  565. if(u8ETM_Channel < 2)
  566. {
  567. pETM->COMBINE |= ETM_COMBINE_SYNCEN0_MASK; /* enable the sync function */
  568. }
  569. else if (u8ETM_Channel < 4)
  570. {
  571. pETM->COMBINE |= ETM_COMBINE_SYNCEN1_MASK;
  572. }
  573. else
  574. {
  575. pETM->COMBINE |= ETM_COMBINE_SYNCEN2_MASK;
  576. }
  577. pETM->PWMLOAD |= ETM_PWMLOAD_LDOK_MASK;
  578. }
  579. else
  580. {
  581. }
  582. }
  583. else
  584. {
  585. }
  586. }
  587. /*****************************************************************************//*!
  588. *
  589. * @brief set the ETM channel value.
  590. *
  591. * @param[in] pETM pointer to one of three ETM base register address.
  592. * @param[in] u16CounterValue the CNTIN value required to set.
  593. *
  594. * @return none.
  595. *
  596. * @ Pass/ Fail criteria: none
  597. *
  598. * @see ETM_SetModValue.
  599. *
  600. *****************************************************************************/
  601. __STATIC_INLINE void ETM_SetCounterInitValue(ETM_Type *pETM, uint16_t u16CounterValue)
  602. {
  603. pETM->CNTIN = u16CounterValue;
  604. if(pETM->MODE & ETM_MODE_ETMEN_MASK)
  605. {
  606. pETM->PWMLOAD |= ETM_PWMLOAD_LDOK_MASK;
  607. }
  608. else
  609. {
  610. }
  611. }
  612. /*****************************************************************************//*!
  613. *
  614. * @brief set the channel output mask value, ETM2 used only.
  615. *
  616. * @param[in] pETM pointer to one of three ETM base register address.
  617. * @param[in] u16ChMask the CNTIN value required to set.
  618. *
  619. * @return none.
  620. *
  621. * @ Pass/ Fail criteria: none
  622. *
  623. * @see ETM_UnMaskChannels.
  624. *
  625. *****************************************************************************/
  626. __STATIC_INLINE void ETM_MaskChannels(ETM_Type *pETM, uint16_t u16ChMask)
  627. {
  628. pETM->OUTMASK |= u16ChMask;
  629. }
  630. /*****************************************************************************//*!
  631. *
  632. * @brief clear the channel output mask value, ETM2 used only.
  633. *
  634. * @param[in] pETM pointer to one of three ETM base register address.
  635. * @param[in] u16ChMask the CNTIN value required to set.
  636. *
  637. * @return none.
  638. *
  639. * @ Pass/ Fail criteria: none
  640. *
  641. * @see ETM_MaskChannels.
  642. *
  643. *****************************************************************************/
  644. __STATIC_INLINE void ETM_UnMaskChannels(ETM_Type *pETM, uint16_t u16ChMask)
  645. {
  646. pETM->OUTMASK &= ~u16ChMask;
  647. }
  648. /*********************************************************************************//*!
  649. *
  650. * @brief set ETM channels polarity.
  651. *
  652. * @param[in] pETM pointer to one of three ETM base register address.
  653. * @param[in] u8ChsPolValue the channels value need to be set.
  654. *
  655. * @return none.
  656. *
  657. * @ Pass/ Fail criteria: none.
  658. *
  659. * @see ETM_GetChannelsPolarity.
  660. *
  661. *********************************************************************************/
  662. __STATIC_INLINE void ETM_SetChannelsPolarity(ETM_Type *pETM, uint8_t u8ChsPolValue)
  663. {
  664. pETM->POL = u8ChsPolValue;
  665. }
  666. /*********************************************************************************//*!
  667. *
  668. * @brief get ETM channels polarity.
  669. *
  670. * @param[in] pETM pointer to one of three ETM base register address.
  671. *
  672. * @return uint8_t the channels polarity.
  673. *
  674. * @ Pass/ Fail criteria: none.
  675. *
  676. * @see ETM_SetChannelsPolarity.
  677. *
  678. *********************************************************************************/
  679. __STATIC_INLINE uint8_t ETM_GetChannelsPolarity(ETM_Type *pETM)
  680. {
  681. return (pETM->POL);
  682. }
  683. /*********************************************************************************//*!
  684. *
  685. * @brief select the enhanced SYNC mode.
  686. *
  687. * @param[in] pETM pointer to one of three ETM base register address.
  688. *
  689. * @return none.
  690. *
  691. * @ Pass/ Fail criteria: none.
  692. *
  693. * @see ETM_DisableEnhancedSYNCMode.
  694. *
  695. *********************************************************************************/
  696. __STATIC_INLINE void ETM_EnableEnhancedSYNCMode(ETM_Type *pETM)
  697. {
  698. pETM->SYNCONF |= ETM_SYNCONF_SYNCMODE_MASK; /* recommend enhanced sync mode */
  699. }
  700. /*********************************************************************************//*!
  701. *
  702. * @brief select the legacy SYNC mode.
  703. *
  704. * @param[in] pETM pointer to one of three ETM base register address.
  705. *
  706. * @return none.
  707. *
  708. * @ Pass/ Fail criteria: none.
  709. *
  710. * @see ETM_EnableEnhancedSYNCMode.
  711. *
  712. *********************************************************************************/
  713. __STATIC_INLINE void ETM_DisableEnhancedSYNCMode(ETM_Type *pETM)
  714. {
  715. pETM->SYNCONF &= ~ETM_SYNCONF_SYNCMODE_MASK; /* recommend enhanced sync mode */
  716. }
  717. /*********************************************************************************//*!
  718. *
  719. * @brief set the external trigger source.
  720. *
  721. * @param[in] pETM pointer to one of three ETM base register address.
  722. * @param[in] u8TirggerSource initial trigger or CHn(0~5)trigger
  723. *
  724. * @return none.
  725. *
  726. * @ Pass/ Fail criteria: none.
  727. *
  728. * @see ETM_GetExternalTriggerFlag.
  729. *
  730. *********************************************************************************/
  731. __STATIC_INLINE void ETM_SetExternalTrigger(ETM_Type *pETM, uint8_t u8TirggerSource)
  732. {
  733. pETM->EXTTRIG = u8TirggerSource;
  734. }
  735. /*********************************************************************************//*!
  736. *
  737. * @brief get the external trigger flag.
  738. *
  739. * @param[in] pETM pointer to one of three ETM base register address.
  740. *
  741. * @return ex trigger flag.
  742. *
  743. * @ Pass/ Fail criteria: none.
  744. *
  745. * @see ETM_SetExternalTrigger.
  746. *
  747. *********************************************************************************/
  748. __STATIC_INLINE uint8_t ETM_GetExternalTriggerFlag(ETM_Type *pETM)
  749. {
  750. return (pETM->EXTTRIG & ETM_EXTTRIG_TRIGF_MASK);
  751. }
  752. /*********************************************************************************//*!
  753. *
  754. * @brief set LDOK bit.
  755. *
  756. * @param[in] pETM pointer to one of three ETM base register address.
  757. *
  758. * @return none.
  759. *
  760. * @ Pass/ Fail criteria: none.
  761. *
  762. * @see ETM_SetLoadMatchChannel.
  763. *
  764. *********************************************************************************/
  765. __STATIC_INLINE void ETM_SetLoadEnable(ETM_Type *pETM)
  766. {
  767. pETM->PWMLOAD |= ETM_PWMLOAD_LDOK_MASK;
  768. }
  769. /*********************************************************************************//*!
  770. *
  771. * @brief set the channel in the matching process.
  772. *
  773. * @param[in] pETM pointer to one of three ETM base register address.
  774. * @param[in] u8Matchchannel the channel in the matching process.
  775. *
  776. * @return none.
  777. *
  778. * @ Pass/ Fail criteria: none.
  779. *
  780. * @see ETM_SetLoadEnable.
  781. *
  782. *********************************************************************************/
  783. __STATIC_INLINE void ETM_SetLoadMatchChannel(ETM_Type *pETM, uint8_t u8Matchchannel)
  784. {
  785. pETM->PWMLOAD |= u8Matchchannel;
  786. }
  787. /*********************************************************************************//*!
  788. *
  789. * @brief disable the channel input capture filter.
  790. *
  791. * @param[in] pETM pointer to one of three ETM base register address.
  792. * @param[in] u8ETM_Channel the channel number: 0~3.
  793. *
  794. * @return none.
  795. *
  796. * @ Pass/ Fail criteria: none.
  797. *
  798. * @see ETM_InputCaptureFilterSet.
  799. *
  800. *********************************************************************************/
  801. __STATIC_INLINE void ETM_InputCaptureFilterClr(ETM_Type *pETM, uint8_t u8ETM_Channel)
  802. {
  803. pETM->FILTER &= ~(0x000F << (u8ETM_Channel << 2));
  804. }
  805. /*********************************************************************************//*!
  806. *
  807. * @brief set the channel input capture filter value.
  808. *
  809. * @param[in] pETM pointer to one of three ETM base register address.
  810. * @param[in] u8ETM_Channel the channel number: 0~3.
  811. * @param[in] u8FilterValue fliter cycles:1~15, 0: disable channel filter.
  812. *
  813. * @return none.
  814. *
  815. * @ Pass/ Fail criteria: none.
  816. *
  817. * @see ETM_InputCaptureFilterClr.
  818. *
  819. *********************************************************************************/
  820. __STATIC_INLINE void ETM_InputCaptureFilterSet(ETM_Type *pETM, uint8_t u8ETM_Channel, uint8_t u8FilterValue)
  821. {
  822. if (u8FilterValue)
  823. {
  824. pETM->FILTER |= (u8FilterValue << (u8ETM_Channel << 2));
  825. }
  826. else
  827. {
  828. ETM_InputCaptureFilterClr(pETM, u8ETM_Channel);
  829. }
  830. }
  831. /*********************************************************************************//*!
  832. *
  833. * @brief enable the fault input pin.
  834. *
  835. * @param[in] pETM pointer to one of three ETM base register address.
  836. * @param[in] u8FaultPin the fault input channel number: 0~3.
  837. *
  838. * @return none.
  839. *
  840. * @ Pass/ Fail criteria: none.
  841. *
  842. * @see ETM_FaultPinDisable.
  843. *
  844. *********************************************************************************/
  845. __STATIC_INLINE void ETM_FaultPinEnable(ETM_Type *pETM, uint8_t u8FaultPin)
  846. {
  847. if (pETM->MODE & ETM_MODE_WPDIS_MASK) /* if not protected */
  848. {
  849. pETM->FLTCTRL |= (1 << u8FaultPin);
  850. }
  851. else /* if protected */
  852. {
  853. ETM_WriteProtectionDisable(pETM);
  854. pETM->FLTCTRL |= (1 << u8FaultPin);
  855. ETM_WriteProtectionEnable(pETM);
  856. }
  857. }
  858. /*********************************************************************************//*!
  859. *
  860. * @brief disable the fault input pin.
  861. *
  862. * @param[in] pETM pointer to one of three ETM base register address.
  863. * @param[in] u8FaultPin the fault input channel number: 0~3.
  864. *
  865. * @return none.
  866. *
  867. * @ Pass/ Fail criteria: none.
  868. *
  869. * @see ETM_FaultPinEnable.
  870. *
  871. *********************************************************************************/
  872. __STATIC_INLINE void ETM_FaultPinDisable(ETM_Type *pETM, uint8_t u8FaultPin)
  873. {
  874. if (pETM->MODE & ETM_MODE_WPDIS_MASK) /* if not protected */
  875. {
  876. pETM->FLTCTRL &= ~(1 << u8FaultPin);
  877. }
  878. else /* if protected */
  879. {
  880. ETM_WriteProtectionDisable(pETM);
  881. pETM->FLTCTRL &= ~(1 << u8FaultPin);
  882. ETM_WriteProtectionEnable(pETM);
  883. }
  884. }
  885. /*********************************************************************************//*!
  886. *
  887. * @brief enable the fault pin filter.
  888. *
  889. * @param[in] pETM pointer to one of three ETM base register address.
  890. * @param[in] u8FaultPin the fault input channel number: 0~3.
  891. *
  892. * @return none.
  893. *
  894. * @ Pass/ Fail criteria: none.
  895. *
  896. * @see ETM_FaultPinFilterDisable.
  897. *
  898. *********************************************************************************/
  899. __STATIC_INLINE void ETM_FaultPinFilterEnable(ETM_Type *pETM, uint8_t u8FaultPin)
  900. {
  901. if (pETM->MODE & ETM_MODE_WPDIS_MASK) /* if not protected */
  902. {
  903. pETM->FLTCTRL |= (0x10 << u8FaultPin);
  904. }
  905. else /* if protected */
  906. {
  907. ETM_WriteProtectionDisable(pETM);
  908. pETM->FLTCTRL |= (0x10 << u8FaultPin);
  909. ETM_WriteProtectionEnable(pETM);
  910. }
  911. }
  912. /*********************************************************************************//*!
  913. *
  914. * @brief disable the fault pin filter.
  915. *
  916. * @param[in] pETM pointer to one of three ETM base register address.
  917. * @param[in] u8FaultPin the fault input channel number: 0~3.
  918. *
  919. * @return none.
  920. *
  921. * @ Pass/ Fail criteria: none.
  922. *
  923. * @see ETM_FaultPinFilterDisable.
  924. *
  925. *********************************************************************************/
  926. __STATIC_INLINE void ETM_FaultPinFilterDisable(ETM_Type *pETM, uint8_t u8FaultPin)
  927. {
  928. if (pETM->MODE & ETM_MODE_WPDIS_MASK) /* if not protected */
  929. {
  930. pETM->FLTCTRL &= ~(0x10 << u8FaultPin);
  931. }
  932. else /* if protected */
  933. {
  934. ETM_WriteProtectionDisable(pETM);
  935. pETM->FLTCTRL &= ~(0x10 << u8FaultPin);
  936. ETM_WriteProtectionEnable(pETM);
  937. }
  938. }
  939. /*********************************************************************************//*!
  940. *
  941. * @brief disable all the fault pins filter together.
  942. *
  943. * @param[in] pETM pointer to one of three ETM base register address.
  944. *
  945. * @return none.
  946. *
  947. * @ Pass/ Fail criteria: none.
  948. *
  949. * @see ETM_FaultPinFilterSet.
  950. *
  951. *********************************************************************************/
  952. __STATIC_INLINE void ETM_FaultPinFilterCDisableAll(ETM_Type *pETM)
  953. {
  954. pETM->FLTCTRL &= ~ETM_FLTCTRL_FFVAL_MASK;
  955. }
  956. /*********************************************************************************//*!
  957. *
  958. * @brief set the fault filter value. All channels share the same filter value.
  959. *
  960. * @param[in] pETM pointer to one of three ETM base register address.
  961. * @param[in] u8FilterValue the fault input filter value: 1~15, 0 disable the filter.
  962. *
  963. * @return none.
  964. *
  965. * @ Pass/ Fail criteria: none.
  966. *
  967. * @see ETM_FaultPinFilterCDisableAll.
  968. *
  969. *********************************************************************************/
  970. __STATIC_INLINE void ETM_FaultPinFilterSet(ETM_Type *pETM, uint8_t u8FilterValue)
  971. {
  972. if (u8FilterValue)
  973. {
  974. pETM->FLTCTRL |= ETM_FLTCTRL_FFVAL(u8FilterValue);
  975. }
  976. else
  977. {
  978. ETM_FaultPinFilterCDisableAll(pETM);
  979. }
  980. }
  981. /*********************************************************************************//*!
  982. *
  983. * @brief get the logic OR of all the fault detection flags
  984. *
  985. * @param[in] pETM pointer to one of three ETM base register address.
  986. *
  987. * @return none.
  988. *
  989. * @ Pass/ Fail criteria: none.
  990. *
  991. * @see ETM_GetFaultDetectionFlag.
  992. *
  993. *********************************************************************************/
  994. __STATIC_INLINE uint8_t ETM_GetFaultDetectionLogicORFlag(ETM_Type *pETM)
  995. {
  996. return (pETM->FMS & ETM_FMS_FAULTF_MASK);
  997. }
  998. /*********************************************************************************//*!
  999. *
  1000. * @brief get the fault detection flag
  1001. *
  1002. * @param[in] pETM pointer to one of three ETM base register address.
  1003. * @param[in] u8FaultPin fault input pin number: 0~3.
  1004. *
  1005. * @return none.
  1006. *
  1007. * @ Pass/ Fail criteria: none.
  1008. *
  1009. * @see ETM_GetFaultDetectionLogicORFlag.
  1010. *
  1011. *********************************************************************************/
  1012. __STATIC_INLINE uint8_t ETM_GetFaultDetectionFlag(ETM_Type *pETM, uint8_t u8FaultPin)
  1013. {
  1014. return (pETM->FMS & (1 << u8FaultPin));
  1015. }
  1016. /*********************************************************************************//*!
  1017. *
  1018. * @brief get the logic OR value of the fault inputs
  1019. *
  1020. * @param[in] pETM pointer to one of three ETM base register address.
  1021. *
  1022. * @return none.
  1023. *
  1024. * @ Pass/ Fail criteria: none.
  1025. *
  1026. *********************************************************************************/
  1027. __STATIC_INLINE uint8_t ETM_GetFaultInputsLogicORValue(ETM_Type *pETM)
  1028. {
  1029. return (pETM->FMS & ETM_FMS_FAULTIN_MASK);
  1030. }
  1031. /*! @} End of ETM_api_list */
  1032. /******************************************************************************
  1033. * Global functions
  1034. ******************************************************************************/
  1035. void ETM_ClockSet(ETM_Type *pETM, uint8_t u8ClockSource, uint8_t u8ClockPrescale);
  1036. void ETM_PWMInit(ETM_Type *pETM, uint8_t u8PWMModeSelect, uint8_t u8PWMEdgeSelect);
  1037. void ETM_InputCaptureInit(ETM_Type *pETM, uint8_t u8ETM_Channel, uint8_t u8CaptureMode);
  1038. void ETM_DualEdgeCaptureInit(ETM_Type *pETM, uint8_t u8ChannelPair, uint8_t u8CaptureMode,
  1039. uint8_t u8Channel_N_Edge, uint8_t u8Channel_Np1_Edge);
  1040. void ETM_OutputCompareInit(ETM_Type *pETM, uint8_t u8ETM_Channel, uint8_t u8CompareMode);
  1041. void ETM_SoftwareSync(ETM_Type *pETM);
  1042. void ETM_HardwareSync(ETM_Type *pETM, uint8_t u8TriggerN);
  1043. void ETM_HardwareSyncCombine(ETM_Type *pETM, uint8_t u8TriggerMask);
  1044. void ETM_GenerateTrig2(ETM_Type *pETM);
  1045. void ETM_PWMDeadETMeSet(ETM_Type *pETM, uint8_t u8PrescalerValue, uint8_t u8DeadETMeValue);
  1046. void ETM_OutputMaskSet(ETM_Type *pETM, uint8_t u8ETM_Channel);
  1047. void ETM_SWOutputControlSet(ETM_Type *pETM, uint8_t u8ETM_Channel, uint8_t u8ChannelValue);
  1048. void ETM_SetDebugModeBehavior(ETM_Type *pETM, uint8_t u8DebugMode);
  1049. void ETM_SetTOFFrequency(ETM_Type *pETM, uint8_t u8TOFNUM);
  1050. void ETM_PolaritySet(ETM_Type *pETM, uint8_t u8ETM_Channel, uint8_t u8ActiveValue);
  1051. void ETM_InvertChannel(ETM_Type *pETM, uint8_t u8ChannelPair);
  1052. void ETM_Init(ETM_Type *pETM, ETM_ConfigType *pConfig);
  1053. void ETM_DeInit(ETM_Type *pETM);
  1054. void ETM_ChannelInit(ETM_Type *pETM, uint8_t u8ETM_Channel, ETM_ChParamsType *pETM_ChParams);
  1055. void ETM_SetDutyCycleCombine(ETM_Type *pETM, uint8_t u8ETM_Channel, uint8_t u8DutyCycle);
  1056. void ETM_SetCallback(ETM_Type *pETM, ETM_CallbackPtr pfnCallback);
  1057. void ETM_SyncConfigActivate(ETM_Type *pETM, uint32_t u32ConfigValue);
  1058. void ETM_SyncConfigDeactivate(ETM_Type * pETM, uint32_t u32ConfigValue);
  1059. uint8_t ETM_GetFaultDetectionLogicORFlag(ETM_Type *pETM);
  1060. uint8_t ETM_GetFaultDetectionFlag(ETM_Type *pETM, uint8_t u8FaultPin);
  1061. uint8_t ETM_GetFaultInputsLogicORValue(ETM_Type *pETM);
  1062. void ETM_WriteProtectionEnable(ETM_Type *pETM);
  1063. void ETM_WriteProtectionDisable(ETM_Type *pETM);
  1064. void ETM_FaultPinFilterCDisableAll(ETM_Type *pETM);
  1065. void ETM_FaultPinFilterSet(ETM_Type *pETM, uint8_t u8FilterValue);
  1066. void ETM_FaultPinFilterDisable(ETM_Type *pETM, uint8_t u8FaultPin);
  1067. void ETM_FaultPinFilterEnable(ETM_Type *pETM, uint8_t u8FaultPin);
  1068. void ETM_FaultPinEnable(ETM_Type *pETM, uint8_t u8FaultPin);
  1069. void ETM_FaultPinDisable(ETM_Type *pETM, uint8_t u8FaultPin);
  1070. void ETM_InputCaptureFilterClr(ETM_Type *pETM, uint8_t u8ETM_Channel);
  1071. void ETM_InputCaptureFilterSet(ETM_Type *pETM, uint8_t u8ETM_Channel, uint8_t u8FilterValue);
  1072. void ETM_SetLoadMatchChannel(ETM_Type *pETM, uint8_t u8Matchchannel);
  1073. void ETM_SetLoadEnable(ETM_Type *pETM);
  1074. uint8_t ETM_GetExternalTriggerFlag(ETM_Type *pETM);
  1075. void ETM_DisableEnhancedSYNCMode(ETM_Type *pETM);
  1076. void ETM_EnableEnhancedSYNCMode(ETM_Type *pETM);
  1077. uint8_t ETM_GetChannelsPolarity(ETM_Type *pETM);
  1078. void ETM_SetChannelsPolarity(ETM_Type *pETM, uint8_t u8ChsPolValue);
  1079. void ETM_UnMaskChannels(ETM_Type *pETM, uint16_t u16ChMask);
  1080. void ETM_MaskChannels(ETM_Type *pETM, uint16_t u16ChMask);
  1081. void ETM_SetCounterInitValue(ETM_Type *pETM, uint16_t u16CounterValue);
  1082. void ETM_SetChannelValue(ETM_Type *pETM, uint8_t u8ETM_Channel, uint16_t u16ChannelValue);
  1083. void ETM_SetModValue(ETM_Type *pETM, uint16_t u16ModValue);
  1084. void ETM_SetETMBasic(ETM_Type *pETM);
  1085. void ETM_SetETMEnhanced(ETM_Type *pETM);
  1086. void ETM_ClrChannelFlag(ETM_Type *pETM, uint8_t u8ETM_Channel);
  1087. uint8_t ETM_GetChannelFlag(ETM_Type *pETM, uint8_t u8ETM_Channel);
  1088. void ETM_ClrOverFlowFlag(ETM_Type *pETM);
  1089. uint8_t ETM_GetOverFlowFlag(ETM_Type *pETM);
  1090. void ETM_DisableChannelInt(ETM_Type *pETM, uint8_t u8ETM_Channel);
  1091. void ETM_EnableChannelInt(ETM_Type *pETM, uint8_t u8ETM_Channel);
  1092. void ETM_DisableOverflowInt(ETM_Type *pETM);
  1093. void ETM_EnableOverflowInt(ETM_Type *pETM);
  1094. #ifdef __cplusplus
  1095. }
  1096. #endif
  1097. #endif /* ETM_H_ */