drv_epwm_capture.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. /**************************************************************************//**
  2. *
  3. * @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2020-5-4 Philo First version
  10. *
  11. ******************************************************************************/
  12. #include <rtconfig.h>
  13. #if defined(BSP_USING_EPWM_CAPTURE)
  14. #if ((BSP_USING_EPWM0_CAPTURE_CHMSK+BSP_USING_EPWM1_CAPTURE_CHMSK)!=0)
  15. #include <rtdevice.h>
  16. #include "NuMicro.h"
  17. #define EPWM_CH0CH1_POS (0)
  18. #define EPWM_CH2CH3_POS (2)
  19. #define EPWM_CH4CH5_POS (4)
  20. /* Private typedef --------------------------------------------------------------*/
  21. typedef struct nu_capture
  22. {
  23. struct rt_inputcapture_device parent;
  24. EPWM_T *epwm;
  25. uint8_t u8Channel;
  26. IRQn_Type irq;
  27. uint32_t u32CurrentRisingCnt;
  28. uint32_t u32CurrentFallingCnt;
  29. rt_bool_t input_data_level;
  30. } nu_capture_t;
  31. /* Private functions ------------------------------------------------------------*/
  32. static rt_err_t nu_capture_init(struct rt_inputcapture_device *inputcapture);
  33. static rt_err_t nu_capture_open(struct rt_inputcapture_device *inputcapture);
  34. static rt_err_t nu_capture_close(struct rt_inputcapture_device *inputcapture);
  35. static rt_err_t nu_capture_get_pulsewidth(struct rt_inputcapture_device *inputcapture, rt_uint32_t *pulsewidth_us);
  36. /* Public functions -------------------------------------------------------------*/
  37. /* Private variables ------------------------------------------------------------*/
  38. #if (BSP_USING_EPWM0_CAPTURE_CHMSK!=0)
  39. static const char *nu_epwm0_device_name[EPWM_CHANNEL_NUM] = { "epwm0i0", "epwm0i1", "epwm0i2", "epwm0i3", "epwm0i4", "epwm0i5"};
  40. static const IRQn_Type nu_epwm0_irq[EPWM_CHANNEL_NUM / 2] = { EPWM0P0_IRQn, EPWM0P1_IRQn, EPWM0P2_IRQn};
  41. static nu_capture_t nu_epwm0_capture[EPWM_CHANNEL_NUM] = {0};
  42. #endif
  43. #if (BSP_USING_EPWM1_CAPTURE_CHMSK!=0)
  44. static const char *nu_epwm1_device_name[EPWM_CHANNEL_NUM] = {"epwm1i0", "epwm1i1", "epwm1i2", "epwm1i3", "epwm1i4", "epwm1i5", };
  45. static const IRQn_Type nu_epwm1_irq[EPWM_CHANNEL_NUM / 2] = {EPWM1P0_IRQn, EPWM1P1_IRQn, EPWM1P2_IRQn };
  46. static nu_capture_t nu_epwm1_capture[EPWM_CHANNEL_NUM] = {0};
  47. #endif
  48. static struct rt_inputcapture_ops nu_capture_ops =
  49. {
  50. .init = nu_capture_init,
  51. .open = nu_capture_open,
  52. .close = nu_capture_close,
  53. .get_pulsewidth = nu_capture_get_pulsewidth,
  54. };
  55. /* Functions define ------------------------------------------------------------*/
  56. static rt_err_t CalPulseWidth(nu_capture_t *nu_capture)
  57. {
  58. rt_bool_t bWrapAroundFlag = RT_FALSE;
  59. /* Check rising/falling capture counter is overflow or not */
  60. if (EPWM_GetWrapAroundFlag(nu_capture->epwm, nu_capture->u8Channel))
  61. {
  62. EPWM_ClearWrapAroundFlag(nu_capture->epwm, nu_capture->u8Channel);
  63. bWrapAroundFlag = RT_TRUE;
  64. }
  65. /* Read the capture counter value if falling/rising edge */
  66. if (EPWM_GetCaptureIntFlag(nu_capture->epwm, nu_capture->u8Channel) == 1)//Rising edge
  67. {
  68. EPWM_ClearCaptureIntFlag(nu_capture->epwm, nu_capture->u8Channel, EPWM_CAPTURE_INT_RISING_LATCH);
  69. if (bWrapAroundFlag)
  70. {
  71. nu_capture->u32CurrentRisingCnt = 0x10000;
  72. }
  73. nu_capture->u32CurrentRisingCnt += EPWM_GET_CAPTURE_RISING_DATA(nu_capture->epwm, nu_capture->u8Channel);
  74. }
  75. else if (EPWM_GetCaptureIntFlag(nu_capture->epwm, nu_capture->u8Channel) == 2)//Falling edge
  76. {
  77. EPWM_ClearCaptureIntFlag(nu_capture->epwm, nu_capture->u8Channel, EPWM_CAPTURE_INT_FALLING_LATCH);
  78. if (bWrapAroundFlag)
  79. {
  80. nu_capture->u32CurrentFallingCnt = 0x10000;
  81. }
  82. nu_capture->u32CurrentFallingCnt += EPWM_GET_CAPTURE_FALLING_DATA(nu_capture->epwm, nu_capture->u8Channel);
  83. }
  84. else
  85. {
  86. EPWM_ClearCaptureIntFlag(nu_capture->epwm, nu_capture->u8Channel, EPWM_CAPTURE_INT_RISING_LATCH);
  87. EPWM_ClearCaptureIntFlag(nu_capture->epwm, nu_capture->u8Channel, EPWM_CAPTURE_INT_FALLING_LATCH);
  88. return -(RT_ERROR);
  89. }
  90. return RT_EOK;
  91. }
  92. #if (BSP_USING_EPWM0_CAPTURE_CHMSK&(0x3<<EPWM_CH0CH1_POS))
  93. void EPWM0P0_IRQHandler(void)
  94. {
  95. /* enter interrupt */
  96. rt_interrupt_enter();
  97. /* Avoid excessive iteration by monitoring enabled channels */
  98. #if (BSP_USING_EPWM0_CAPTURE_CHMSK&(0x1<<EPWM_CH0CH1_POS))
  99. uint8_t const start = 0 + EPWM_CH0CH1_POS;
  100. #else /* Only channel 1 */
  101. uint8_t const start = 1 + EPWM_CH0CH1_POS;
  102. #endif
  103. #if (BSP_USING_EPWM0_CAPTURE_CHMSK&(0x2<<EPWM_CH0CH1_POS))
  104. uint8_t const end = 2 + EPWM_CH0CH1_POS;
  105. #else /* Only channel 0 */
  106. uint8_t const end = 1 + EPWM_CH0CH1_POS;
  107. #endif
  108. /* 2 channel using same irq */
  109. for (uint8_t i = start; i < end ; i++)
  110. {
  111. if (EPWM_GetCaptureIntFlag(nu_epwm0_capture[i].epwm, nu_epwm0_capture[i].u8Channel) != 0)
  112. {
  113. /* Calculate pulse width */
  114. if (CalPulseWidth(&nu_epwm0_capture[i]) == RT_EOK)
  115. {
  116. rt_hw_inputcapture_isr(&nu_epwm0_capture[i].parent, nu_epwm0_capture[i].input_data_level);
  117. }
  118. }
  119. }
  120. /* leave interrupt */
  121. rt_interrupt_leave();
  122. }
  123. #endif
  124. #if (BSP_USING_EPWM0_CAPTURE_CHMSK&(0x3<<EPWM_CH2CH3_POS))
  125. void EPWM0P1_IRQHandler(void)
  126. {
  127. /* enter interrupt */
  128. rt_interrupt_enter();
  129. /* Avoid excessive iteration by monitoring enabled channels */
  130. #if (BSP_USING_EPWM0_CAPTURE_CHMSK&(0x1<<EPWM_CH2CH3_POS))
  131. uint8_t const start = 0 + EPWM_CH2CH3_POS;
  132. #else /* Only channel 3 */
  133. uint8_t const start = 1 + EPWM_CH2CH3_POS;
  134. #endif
  135. #if (BSP_USING_EPWM0_CAPTURE_CHMSK&(0x2<<EPWM_CH2CH3_POS))
  136. uint8_t const end = 2 + EPWM_CH2CH3_POS;
  137. #else /* Only channel 2 */
  138. uint8_t const end = 1 + EPWM_CH2CH3_POS;
  139. #endif
  140. /* 2 channel using same irq */
  141. for (uint8_t i = start; i < end ; i++)
  142. {
  143. if (EPWM_GetCaptureIntFlag(nu_epwm0_capture[i].epwm, nu_epwm0_capture[i].u8Channel) != 0)
  144. {
  145. /* Calculate pulse width */
  146. if (CalPulseWidth(&nu_epwm0_capture[i]) == RT_EOK)
  147. {
  148. rt_hw_inputcapture_isr(&nu_epwm0_capture[i].parent, nu_epwm0_capture[i].input_data_level);
  149. }
  150. }
  151. }
  152. /* leave interrupt */
  153. rt_interrupt_leave();
  154. }
  155. #endif
  156. #if (BSP_USING_EPWM0_CAPTURE_CHMSK&(0x3<<EPWM_CH4CH5_POS))
  157. void EPWM0P2_IRQHandler(void)
  158. {
  159. /* enter interrupt */
  160. rt_interrupt_enter();
  161. /* Avoid excessive iteration by monitoring enabled channels */
  162. #if (BSP_USING_EPWM0_CAPTURE_CHMSK&(0x1<<EPWM_CH4CH5_POS))
  163. uint8_t const start = 0 + EPWM_CH4CH5_POS;
  164. #else /* Only channel 5 */
  165. uint8_t const start = 1 + EPWM_CH4CH5_POS;
  166. #endif
  167. #if (BSP_USING_EPWM0_CAPTURE_CHMSK&(0x2<<EPWM_CH4CH5_POS))
  168. uint8_t const end = 2 + EPWM_CH4CH5_POS;
  169. #else /* Only channel 4 */
  170. uint8_t const end = 1 + EPWM_CH4CH5_POS;
  171. #endif
  172. /* 2 channel using same irq */
  173. for (uint8_t i = start; i < end ; i++)
  174. {
  175. if (EPWM_GetCaptureIntFlag(nu_epwm0_capture[i].epwm, nu_epwm0_capture[i].u8Channel) != 0)
  176. {
  177. /* Calculate pulse width */
  178. if (CalPulseWidth(&nu_epwm0_capture[i]) == RT_EOK)
  179. {
  180. rt_hw_inputcapture_isr(&nu_epwm0_capture[i].parent, nu_epwm0_capture[i].input_data_level);
  181. }
  182. }
  183. }
  184. /* leave interrupt */
  185. rt_interrupt_leave();
  186. }
  187. #endif
  188. #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x3<<EPWM_CH0CH1_POS))
  189. void EPWM1P0_IRQHandler(void)
  190. {
  191. /* enter interrupt */
  192. rt_interrupt_enter();
  193. /* Avoid excessive iteration by monitoring enabled channels */
  194. #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x1<<EPWM_CH0CH1_POS))
  195. uint8_t const start = 0 + EPWM_CH0CH1_POS;
  196. #else /* Only channel 1 */
  197. uint8_t const start = 1 + EPWM_CH0CH1_POS;
  198. #endif
  199. #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x2<<EPWM_CH0CH1_POS))
  200. uint8_t const end = 2 + EPWM_CH0CH1_POS;
  201. #else /* Only channel 0 */
  202. uint8_t const end = 1 + EPWM_CH0CH1_POS;
  203. #endif
  204. /* 2 channel using same irq */
  205. for (uint8_t i = start; i < end ; i++)
  206. {
  207. if (EPWM_GetCaptureIntFlag(nu_epwm1_capture[i].epwm, nu_epwm1_capture[i].u8Channel) != 0)
  208. {
  209. /* Calculate pulse width */
  210. if (CalPulseWidth(&nu_epwm1_capture[i]) == RT_EOK)
  211. {
  212. rt_hw_inputcapture_isr(&nu_epwm1_capture[i].parent, nu_epwm1_capture[i].input_data_level);
  213. }
  214. }
  215. }
  216. /* leave interrupt */
  217. rt_interrupt_leave();
  218. }
  219. #endif
  220. #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x3<<EPWM_CH2CH3_POS))
  221. void EPWM1P1_IRQHandler(void)
  222. {
  223. /* enter interrupt */
  224. rt_interrupt_enter();
  225. /* Avoid excessive iteration by monitoring enabled channels */
  226. #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x1<<EPWM_CH2CH3_POS))
  227. uint8_t const start = 0 + EPWM_CH2CH3_POS;
  228. #else /* Only channel 3 */
  229. uint8_t const start = 1 + EPWM_CH2CH3_POS;
  230. #endif
  231. #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x2<<EPWM_CH2CH3_POS))
  232. uint8_t const end = 2 + EPWM_CH2CH3_POS;
  233. #else /* Only channel 2 */
  234. uint8_t const end = 1 + EPWM_CH2CH3_POS;
  235. #endif
  236. /* 2 channel using same irq */
  237. for (uint8_t i = start; i < end ; i++)
  238. {
  239. if (EPWM_GetCaptureIntFlag(nu_epwm1_capture[i].epwm, nu_epwm1_capture[i].u8Channel) != 0)
  240. {
  241. /* Calculate pulse width */
  242. if (CalPulseWidth(&nu_epwm1_capture[i]) == RT_EOK)
  243. {
  244. rt_hw_inputcapture_isr(&nu_epwm1_capture[i].parent, nu_epwm1_capture[i].input_data_level);
  245. }
  246. }
  247. }
  248. /* leave interrupt */
  249. rt_interrupt_leave();
  250. }
  251. #endif
  252. #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x3<<EPWM_CH4CH5_POS))
  253. void EPWM1P2_IRQHandler(void)
  254. {
  255. /* enter interrupt */
  256. rt_interrupt_enter();
  257. /* Avoid excessive iteration by monitoring enabled channels */
  258. #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x1<<EPWM_CH4CH5_POS))
  259. uint8_t const start = 0 + EPWM_CH4CH5_POS;
  260. #else /* Only channel 5 */
  261. uint8_t const start = 1 + EPWM_CH4CH5_POS;
  262. #endif
  263. #if (BSP_USING_EPWM1_CAPTURE_CHMSK&(0x2<<EPWM_CH4CH5_POS))
  264. uint8_t const end = 2 + EPWM_CH4CH5_POS;
  265. #else /* Only channel 4 */
  266. uint8_t const end = 1 + EPWM_CH4CH5_POS;
  267. #endif
  268. /* 2 channel using same irq */
  269. for (uint8_t i = start; i < end ; i++)
  270. {
  271. if (EPWM_GetCaptureIntFlag(nu_epwm1_capture[i].epwm, nu_epwm1_capture[i].u8Channel) != 0)
  272. {
  273. /* Calculate pulse width */
  274. if (CalPulseWidth(&nu_epwm1_capture[i]) == RT_EOK)
  275. {
  276. rt_hw_inputcapture_isr(&nu_epwm1_capture[i].parent, nu_epwm1_capture[i].input_data_level);
  277. }
  278. }
  279. }
  280. /* leave interrupt */
  281. rt_interrupt_leave();
  282. }
  283. #endif
  284. static rt_err_t nu_capture_get_pulsewidth(struct rt_inputcapture_device *inputcapture, rt_uint32_t *pulsewidth_us)
  285. {
  286. rt_err_t ret = RT_EOK;
  287. nu_capture_t *nu_capture;
  288. nu_capture = (nu_capture_t *)inputcapture;
  289. if (nu_capture->u32CurrentFallingCnt)
  290. {
  291. *pulsewidth_us = nu_capture->u32CurrentFallingCnt;
  292. nu_capture->input_data_level = RT_FALSE;
  293. nu_capture->u32CurrentFallingCnt = 0;
  294. }
  295. else if (nu_capture->u32CurrentRisingCnt)
  296. {
  297. *pulsewidth_us = nu_capture->u32CurrentRisingCnt;
  298. nu_capture->input_data_level = RT_TRUE;
  299. nu_capture->u32CurrentRisingCnt = 0;
  300. }
  301. else
  302. {
  303. ret = RT_ERROR;
  304. }
  305. return -(ret);
  306. }
  307. static rt_err_t nu_epwm_init(nu_capture_t *nu_capture)
  308. {
  309. rt_err_t ret = RT_ERROR;
  310. static rt_bool_t bEPWM0Inited = RT_FALSE;
  311. static rt_bool_t bEPWM1Inited = RT_FALSE;
  312. if (nu_capture->epwm == EPWM0)
  313. {
  314. if (bEPWM0Inited == RT_FALSE)
  315. {
  316. /* Enable EPWM0 clock */
  317. SYS_UnlockReg();
  318. CLK_EnableModuleClock(EPWM0_MODULE);
  319. CLK_SetModuleClock(EPWM0_MODULE, CLK_CLKSEL2_EPWM0SEL_PLL, 0);
  320. SYS_LockReg();
  321. bEPWM0Inited = RT_TRUE;
  322. }
  323. ret = RT_EOK;
  324. }
  325. else if (nu_capture->epwm == EPWM1)
  326. {
  327. if (bEPWM1Inited == RT_FALSE)
  328. {
  329. /* Enable EPWM1 clock */
  330. SYS_UnlockReg();
  331. CLK_EnableModuleClock(EPWM1_MODULE);
  332. CLK_SetModuleClock(EPWM1_MODULE, CLK_CLKSEL2_EPWM1SEL_PLL, 0);
  333. SYS_LockReg();
  334. bEPWM1Inited = RT_TRUE;
  335. }
  336. ret = RT_EOK;
  337. }
  338. return -(ret);
  339. }
  340. static rt_err_t nu_capture_init(struct rt_inputcapture_device *inputcapture)
  341. {
  342. rt_err_t ret = RT_EOK;
  343. nu_capture_t *nu_capture;
  344. RT_ASSERT(inputcapture != RT_NULL);
  345. nu_capture = (nu_capture_t *) inputcapture;
  346. if (nu_epwm_init(nu_capture) != RT_EOK)
  347. {
  348. rt_kprintf("Failed to initialize EPWM%d.\n", nu_capture->epwm);
  349. ret = RT_ERROR;
  350. }
  351. return -(ret);
  352. }
  353. static rt_err_t nu_capture_open(struct rt_inputcapture_device *inputcapture)
  354. {
  355. rt_err_t ret = RT_EOK;
  356. nu_capture_t *nu_capture;
  357. RT_ASSERT(inputcapture != RT_NULL);
  358. nu_capture = (nu_capture_t *) inputcapture;
  359. /* Set capture time as 1000 nanosecond */
  360. EPWM_ConfigCaptureChannel(nu_capture->epwm, nu_capture->u8Channel, 1000, 0);
  361. /* Enable capture rising/falling edge interrupt */
  362. EPWM_EnableCaptureInt(nu_capture->epwm, nu_capture->u8Channel, EPWM_CAPTURE_INT_FALLING_LATCH | EPWM_CAPTURE_INT_RISING_LATCH);
  363. /* Enable EPWM NVIC interrupt */
  364. NVIC_EnableIRQ(nu_capture->irq);
  365. /* Enable Capture Function for EPWM */
  366. EPWM_EnableCapture(nu_capture->epwm, 0x1 << nu_capture->u8Channel);
  367. /* Enable rising/falling capture reload */
  368. nu_capture->epwm->CAPCTL |= (0x1 << (EPWM_CAPCTL_RCRLDEN0_Pos + nu_capture->u8Channel))
  369. | (0x1 << (EPWM_CAPCTL_FCRLDEN0_Pos + nu_capture->u8Channel));
  370. /* Set counter type as down count */
  371. EPWM_SET_ALIGNED_TYPE(nu_capture->epwm, 0x1 << nu_capture->u8Channel, EPWM_UP_COUNTER);
  372. /* Enable EPWM Timer */
  373. EPWM_Start(nu_capture->epwm, 0x1 << nu_capture->u8Channel);
  374. return ret;
  375. }
  376. static rt_err_t nu_capture_close(struct rt_inputcapture_device *inputcapture)
  377. {
  378. rt_err_t ret = RT_EOK;
  379. nu_capture_t *nu_capture;
  380. RT_ASSERT(inputcapture != RT_NULL);
  381. nu_capture = (nu_capture_t *) inputcapture;
  382. /* Disable capture rising/falling edge interrupt */
  383. EPWM_DisableCaptureInt(nu_capture->epwm, nu_capture->u8Channel, EPWM_CAPTURE_INT_FALLING_LATCH | EPWM_CAPTURE_INT_RISING_LATCH);
  384. /* Disable EPWM NVIC interrupt */
  385. NVIC_DisableIRQ(nu_capture->irq);
  386. /* Enable EPWM Timer */
  387. EPWM_Stop(nu_capture->epwm, 0x1 << nu_capture->u8Channel);
  388. return ret;
  389. }
  390. /* Init and register epwm capture */
  391. int nu_epwm_capture_device_init(void)
  392. {
  393. /* Init EPWM0 6 channel and EPWM1 6 channel */
  394. #if (BSP_USING_EPWM0_CAPTURE_CHMSK!=0)
  395. for (int i = 0; i < EPWM_CHANNEL_NUM; i++)
  396. {
  397. if (BSP_USING_EPWM0_CAPTURE_CHMSK & (0x1 << i))
  398. {
  399. nu_epwm0_capture[i].epwm = EPWM0;
  400. nu_epwm0_capture[i].u8Channel = i;
  401. nu_epwm0_capture[i].irq = nu_epwm0_irq[i / 2];
  402. nu_epwm0_capture[i].u32CurrentRisingCnt = 0;
  403. nu_epwm0_capture[i].u32CurrentFallingCnt = 0;
  404. nu_epwm0_capture[i].parent.ops = &nu_capture_ops;
  405. /* register inputcapture device */
  406. rt_device_inputcapture_register(&nu_epwm0_capture[i].parent, nu_epwm0_device_name[i], &nu_epwm0_capture[i]);
  407. }
  408. }
  409. #endif //#if (BSP_USING_EPWM0_CAPTURE_CHMSK!=0)
  410. #if (BSP_USING_EPWM1_CAPTURE_CHMSK!=0)
  411. for (int i = 0; i < EPWM_CHANNEL_NUM; i++)
  412. {
  413. if (BSP_USING_EPWM1_CAPTURE_CHMSK & (0x1 << i))
  414. {
  415. nu_epwm1_capture[i].epwm = EPWM1;
  416. nu_epwm1_capture[i].u8Channel = i;
  417. nu_epwm1_capture[i].irq = nu_epwm1_irq[i / 2];
  418. nu_epwm1_capture[i].u32CurrentRisingCnt = 0;
  419. nu_epwm1_capture[i].u32CurrentFallingCnt = 0;
  420. nu_epwm1_capture[i].parent.ops = &nu_capture_ops;
  421. /* register inputcapture device */
  422. rt_device_inputcapture_register(&nu_epwm1_capture[i].parent, nu_epwm1_device_name[i], &nu_epwm1_capture[i]);
  423. }
  424. }
  425. #endif //#if (BSP_USING_EPWM1_CAPTURE_CHMSK!=0)
  426. return 0;
  427. }
  428. INIT_DEVICE_EXPORT(nu_epwm_capture_device_init);
  429. #endif //#if ((BSP_USING_EPWM0_CAPTURE_CHMSK+BSP_USING_EPWM1_CAPTURE_CHMSK)!=0)
  430. #endif //#if defined(BSP_USING_EPWM_CAPTURE)