interrupts_hc32l19x.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. /******************************************************************************
  2. * Copyright (C) 2019, Huada Semiconductor Co.,Ltd All rights reserved.
  3. *
  4. * This software is owned and published by:
  5. * Huada Semiconductor Co.,Ltd ("HDSC").
  6. *
  7. * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
  8. * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
  9. *
  10. * This software contains source code for use with HDSC
  11. * components. This software is licensed by HDSC to be adapted only
  12. * for use in systems utilizing HDSC components. HDSC shall not be
  13. * responsible for misuse or illegal use of this software for devices not
  14. * supported herein. HDSC is providing this software "AS IS" and will
  15. * not be responsible for issues arising from incorrect user implementation
  16. * of the software.
  17. *
  18. * Disclaimer:
  19. * HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
  20. * REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
  21. * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
  22. * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
  23. * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
  24. * WARRANTY OF NONINFRINGEMENT.
  25. * HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
  26. * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
  27. * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
  28. * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
  29. * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
  30. * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
  31. * SAVINGS OR PROFITS,
  32. * EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  33. * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
  34. * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
  35. * FROM, THE SOFTWARE.
  36. *
  37. * This software may be replicated in part or whole for the licensed use,
  38. * with the restriction that this Disclaimer and Copyright notice must be
  39. * included with each copy of this software, whether used in part or whole,
  40. * at all times.
  41. */
  42. /******************************************************************************/
  43. /** \file interrupts_hc32l136.c
  44. **
  45. ** Interrupt management
  46. ** @link Driver Group Some description @endlink
  47. **
  48. ** - 2018-04-15 1.0 Lux First version.
  49. **
  50. **
  51. ******************************************************************************/
  52. /*******************************************************************************
  53. * Include files
  54. ******************************************************************************/
  55. #include "hc32l196_ddl.h"
  56. #include "interrupts_hc32l19x.h"
  57. /*******************************************************************************
  58. * IRQ WEAK DEFINE
  59. ******************************************************************************/
  60. __WEAK void SysTick_IRQHandler(void);
  61. __WEAK void PortA_IRQHandler(void)
  62. {
  63. }
  64. __WEAK void PortB_IRQHandler(void)
  65. {
  66. }
  67. __WEAK void PortC_IRQHandler(void)
  68. {
  69. }
  70. __WEAK void PortD_IRQHandler(void)
  71. {
  72. }
  73. __WEAK void PortE_IRQHandler(void)
  74. {
  75. }
  76. __WEAK void PortF_IRQHandler(void)
  77. {
  78. }
  79. __WEAK void Dmac_IRQHandler(void)
  80. {
  81. }
  82. __WEAK void Tim3_IRQHandler(void)
  83. {
  84. }
  85. __WEAK void Uart0_IRQHandler(void)
  86. {
  87. }
  88. __WEAK void Uart1_IRQHandler(void)
  89. {
  90. }
  91. __WEAK void Uart2_IRQHandler(void)
  92. {
  93. }
  94. __WEAK void Uart3_IRQHandler(void)
  95. {
  96. }
  97. __WEAK void LpUart0_IRQHandler(void)
  98. {
  99. }
  100. __WEAK void LpUart1_IRQHandler(void)
  101. {
  102. }
  103. __WEAK void Spi0_IRQHandler(void)
  104. {
  105. }
  106. __WEAK void Spi1_IRQHandler(void)
  107. {
  108. }
  109. __WEAK void I2c0_IRQHandler(void)
  110. {
  111. }
  112. __WEAK void I2c1_IRQHandler(void)
  113. {
  114. }
  115. __WEAK void Tim0_IRQHandler(void)
  116. {
  117. }
  118. __WEAK void Tim1_IRQHandler(void)
  119. {
  120. }
  121. __WEAK void Tim2_IRQHandler(void)
  122. {
  123. }
  124. __WEAK void LpTim0_IRQHandler(void)
  125. {
  126. }
  127. __WEAK void LpTim1_IRQHandler(void)
  128. {
  129. }
  130. __WEAK void Tim4_IRQHandler(void)
  131. {
  132. }
  133. __WEAK void Tim5_IRQHandler(void)
  134. {
  135. }
  136. __WEAK void Tim6_IRQHandler(void)
  137. {
  138. }
  139. __WEAK void Pca_IRQHandler(void)
  140. {
  141. }
  142. __WEAK void Wdt_IRQHandler(void)
  143. {
  144. }
  145. __WEAK void Rtc_IRQHandler(void)
  146. {
  147. }
  148. __WEAK void Adc_IRQHandler(void)
  149. {
  150. }
  151. __WEAK void Dac_IRQHandler(void)
  152. {
  153. }
  154. __WEAK void Pcnt_IRQHandler(void)
  155. {
  156. }
  157. __WEAK void Vc0_IRQHandler(void)
  158. {
  159. }
  160. __WEAK void Vc1_IRQHandler(void)
  161. {
  162. }
  163. __WEAK void Vc2_IRQHandler(void)
  164. {
  165. }
  166. __WEAK void Lvd_IRQHandler(void)
  167. {
  168. }
  169. __WEAK void Lcd_IRQHandler(void)
  170. {
  171. }
  172. __WEAK void Flash_IRQHandler(void)
  173. {
  174. }
  175. __WEAK void Ram_IRQHandler(void)
  176. {
  177. }
  178. __WEAK void ClkTrim_IRQHandler(void)
  179. {
  180. }
  181. /**
  182. *******************************************************************************
  183. ** \brief NVIC 中断使能
  184. **
  185. ** \param [in] enIrq 中断号枚举类型
  186. ** \param [in] enLevel 中断优先级枚举类型
  187. ** \param [in] bEn 中断开关
  188. ** \retval Ok 设置成功
  189. ** 其他值 设置失败
  190. ******************************************************************************/
  191. void EnableNvic(IRQn_Type enIrq, en_irq_level_t enLevel, boolean_t bEn)
  192. {
  193. NVIC_ClearPendingIRQ(enIrq);
  194. NVIC_SetPriority(enIrq, enLevel);
  195. if (TRUE == bEn)
  196. {
  197. NVIC_EnableIRQ(enIrq);
  198. }
  199. else
  200. {
  201. NVIC_DisableIRQ(enIrq);
  202. }
  203. }
  204. /**
  205. *******************************************************************************
  206. ** \brief NVIC hardware fault 中断实现
  207. **
  208. **
  209. ** \retval
  210. ******************************************************************************/
  211. //void HardFault_Handler(void)
  212. //{
  213. // volatile int a = 0;
  214. // while( 0 == a)
  215. // {
  216. // ;
  217. // }
  218. //
  219. //}
  220. /**
  221. *******************************************************************************
  222. ** \brief NVIC SysTick 中断实现
  223. **
  224. ** \retval
  225. ******************************************************************************/
  226. //void SysTick_Handler(void)
  227. //{
  228. // SysTick_IRQHandler();
  229. //}
  230. /**
  231. *******************************************************************************
  232. ** \brief GPIO PortA 中断处理函数
  233. **
  234. ** \retval
  235. ******************************************************************************/
  236. void PORTA_IRQHandler(void)
  237. {
  238. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTA)
  239. PortA_IRQHandler();
  240. #endif
  241. }
  242. /**
  243. *******************************************************************************
  244. ** \brief GPIO PortB 中断处理函数
  245. **
  246. ** \retval
  247. ******************************************************************************/
  248. void PORTB_IRQHandler(void)
  249. {
  250. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTB)
  251. PortB_IRQHandler();
  252. #endif
  253. }
  254. /**
  255. *******************************************************************************
  256. ** \brief GPIO PortC/E 中断处理函数
  257. **
  258. ** \retval
  259. ******************************************************************************/
  260. void PORTC_E_IRQHandler(void)
  261. {
  262. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTC)
  263. PortC_IRQHandler();
  264. #endif
  265. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTE)
  266. PortE_IRQHandler();
  267. #endif
  268. }
  269. /**
  270. *******************************************************************************
  271. ** \brief GPIO PortD/F 中断处理函数
  272. **
  273. ** \retval
  274. ******************************************************************************/
  275. void PORTD_F_IRQHandler(void)
  276. {
  277. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTD)
  278. PortD_IRQHandler();
  279. #endif
  280. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTF)
  281. PortF_IRQHandler();
  282. #endif
  283. }
  284. /**
  285. *******************************************************************************
  286. ** \brief DMAC 中断处理函数
  287. **
  288. ** \retval
  289. ******************************************************************************/
  290. void DMAC_IRQHandler(void)
  291. {
  292. #if (INT_CALLBACK_ON == INT_CALLBACK_DMAC)
  293. Dmac_IRQHandler();
  294. #endif
  295. }
  296. /**
  297. *******************************************************************************
  298. ** \brief TIM3 中断处理函数
  299. **
  300. ** \retval
  301. ******************************************************************************/
  302. void TIM3_IRQHandler(void)
  303. {
  304. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM3)
  305. Tim3_IRQHandler();
  306. #endif
  307. }
  308. /**
  309. *******************************************************************************
  310. ** \brief UART0/2 中断处理函数
  311. **
  312. ** \retval
  313. ******************************************************************************/
  314. void UART0_2_IRQHandler(void)
  315. {
  316. #if (INT_CALLBACK_ON == INT_CALLBACK_UART0)
  317. Uart0_IRQHandler();
  318. #endif
  319. #if (INT_CALLBACK_ON == INT_CALLBACK_UART2)
  320. Uart2_IRQHandler();
  321. #endif
  322. }
  323. /**
  324. *******************************************************************************
  325. ** \brief UART1/3 中断处理函数
  326. **
  327. ** \retval
  328. ******************************************************************************/
  329. void UART1_3_IRQHandler(void)
  330. {
  331. #if (INT_CALLBACK_ON == INT_CALLBACK_UART1)
  332. Uart1_IRQHandler();
  333. #endif
  334. #if (INT_CALLBACK_ON == INT_CALLBACK_UART3)
  335. Uart3_IRQHandler();
  336. #endif
  337. }
  338. /**
  339. *******************************************************************************
  340. ** \brief LPUART0 低功耗串口0 中断处理函数
  341. **
  342. ** \retval
  343. ******************************************************************************/
  344. void LPUART0_IRQHandler(void)
  345. {
  346. #if (INT_CALLBACK_ON == INT_CALLBACK_LPUART0)
  347. LpUart0_IRQHandler();
  348. #endif
  349. }
  350. /**
  351. *******************************************************************************
  352. ** \brief LPUART1 低功耗串口1 中断处理函数
  353. **
  354. ** \retval
  355. ******************************************************************************/
  356. void LPUART1_IRQHandler(void)
  357. {
  358. #if (INT_CALLBACK_ON == INT_CALLBACK_LPUART1)
  359. LpUart1_IRQHandler();
  360. #endif
  361. }
  362. /**
  363. *******************************************************************************
  364. ** \brief SPI0 中断处理函数
  365. **
  366. ** \retval
  367. ******************************************************************************/
  368. void SPI0_IRQHandler(void)
  369. {
  370. #if (INT_CALLBACK_ON == INT_CALLBACK_SPI0)
  371. Spi0_IRQHandler();
  372. #endif
  373. }
  374. /**
  375. *******************************************************************************
  376. ** \brief SPI1 中断处理函数
  377. **
  378. ** \retval
  379. ******************************************************************************/
  380. void SPI1_IRQHandler(void)
  381. {
  382. #if (INT_CALLBACK_ON == INT_CALLBACK_SPI1)
  383. Spi1_IRQHandler();
  384. #endif
  385. }
  386. /**
  387. *******************************************************************************
  388. ** \brief I2C0 中断处理函数
  389. **
  390. ** \retval
  391. ******************************************************************************/
  392. void I2C0_IRQHandler(void)
  393. {
  394. #if (INT_CALLBACK_ON == INT_CALLBACK_I2C0)
  395. I2c0_IRQHandler();
  396. #endif
  397. }
  398. /**
  399. *******************************************************************************
  400. ** \brief I2C1 中断处理函数
  401. **
  402. ** \retval
  403. ******************************************************************************/
  404. void I2C1_IRQHandler(void)
  405. {
  406. #if (INT_CALLBACK_ON == INT_CALLBACK_I2C1)
  407. I2c1_IRQHandler();
  408. #endif
  409. }
  410. /**
  411. *******************************************************************************
  412. ** \brief TIM0 中断处理函数
  413. **
  414. ** \retval
  415. ******************************************************************************/
  416. void TIM0_IRQHandler(void)
  417. {
  418. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM0)
  419. Tim0_IRQHandler();
  420. #endif
  421. }
  422. /**
  423. *******************************************************************************
  424. ** \brief TIM1 中断处理函数
  425. **
  426. ** \retval
  427. ******************************************************************************/
  428. void TIM1_IRQHandler(void)
  429. {
  430. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM1)
  431. Tim1_IRQHandler();
  432. #endif
  433. }
  434. /**
  435. *******************************************************************************
  436. ** \brief TIM2 中断处理函数
  437. **
  438. ** \retval
  439. ******************************************************************************/
  440. void TIM2_IRQHandler(void)
  441. {
  442. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM2)
  443. Tim2_IRQHandler();
  444. #endif
  445. }
  446. /**
  447. *******************************************************************************
  448. ** \brief LPTIM0/1 低功耗时钟 中断处理函数
  449. **
  450. ** \retval
  451. ******************************************************************************/
  452. void LPTIM0_1_IRQHandler(void)
  453. {
  454. #if (INT_CALLBACK_ON == INT_CALLBACK_LPTIM0)
  455. LpTim0_IRQHandler();
  456. #endif
  457. #if (INT_CALLBACK_ON == INT_CALLBACK_LPTIM1)
  458. LpTim1_IRQHandler();
  459. #endif
  460. }
  461. /**
  462. *******************************************************************************
  463. ** \brief TIM4 中断处理函数
  464. **
  465. ** \retval
  466. ******************************************************************************/
  467. void TIM4_IRQHandler(void)
  468. {
  469. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM4)
  470. Tim4_IRQHandler();
  471. #endif
  472. }
  473. /**
  474. *******************************************************************************
  475. ** \brief TIM5 中断处理函数
  476. **
  477. ** \retval
  478. ******************************************************************************/
  479. void TIM5_IRQHandler(void)
  480. {
  481. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM5)
  482. Tim5_IRQHandler();
  483. #endif
  484. }
  485. /**
  486. *******************************************************************************
  487. ** \brief TIM6 中断处理函数
  488. **
  489. ** \retval
  490. ******************************************************************************/
  491. void TIM6_IRQHandler(void)
  492. {
  493. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM6)
  494. Tim6_IRQHandler();
  495. #endif
  496. }
  497. /**
  498. *******************************************************************************
  499. ** \brief PCA 中断处理函数
  500. **
  501. ** \retval
  502. ******************************************************************************/
  503. void PCA_IRQHandler(void)
  504. {
  505. #if (INT_CALLBACK_ON == INT_CALLBACK_PCA)
  506. Pca_IRQHandler();
  507. #endif
  508. }
  509. /**
  510. *******************************************************************************
  511. ** \brief WDT 中断处理函数
  512. **
  513. ** \retval
  514. ******************************************************************************/
  515. void WDT_IRQHandler(void)
  516. {
  517. #if (INT_CALLBACK_ON == INT_CALLBACK_WDT)
  518. Wdt_IRQHandler();
  519. #endif
  520. }
  521. /**
  522. *******************************************************************************
  523. ** \brief RTC 中断处理函数
  524. **
  525. ** \retval
  526. ******************************************************************************/
  527. void RTC_IRQHandler(void)
  528. {
  529. #if (INT_CALLBACK_ON == INT_CALLBACK_RTC)
  530. Rtc_IRQHandler();
  531. #endif
  532. }
  533. /**
  534. *******************************************************************************
  535. ** \brief ADC/DAC 中断处理函数
  536. **
  537. ** \retval
  538. ******************************************************************************/
  539. void ADC_DAC_IRQHandler(void)
  540. {
  541. #if (INT_CALLBACK_ON == INT_CALLBACK_ADC)
  542. Adc_IRQHandler();
  543. #endif
  544. #if (INT_CALLBACK_ON == INT_CALLBACK_DAC)
  545. Dac_IRQHandler();
  546. #endif
  547. }
  548. /**
  549. *******************************************************************************
  550. ** \brief PCNT 中断处理函数
  551. **
  552. ** \retval
  553. ******************************************************************************/
  554. void PCNT_IRQHandler(void)
  555. {
  556. #if (INT_CALLBACK_ON == INT_CALLBACK_PCNT)
  557. Pcnt_IRQHandler();
  558. #endif
  559. }
  560. /**
  561. *******************************************************************************
  562. ** \brief VC0 中断处理函数
  563. **
  564. ** \retval
  565. ******************************************************************************/
  566. void VC0_IRQHandler(void)
  567. {
  568. #if (INT_CALLBACK_ON == INT_CALLBACK_VC0)
  569. Vc0_IRQHandler();
  570. #endif
  571. }
  572. /**
  573. *******************************************************************************
  574. ** \brief VC1/2 中断处理函数
  575. **
  576. ** \retval
  577. ******************************************************************************/
  578. void VC1_2_IRQHandler(void)
  579. {
  580. #if (INT_CALLBACK_ON == INT_CALLBACK_VC1)
  581. Vc1_IRQHandler();
  582. #endif
  583. #if (INT_CALLBACK_ON == INT_CALLBACK_VC2)
  584. Vc2_IRQHandler();
  585. #endif
  586. }
  587. /**
  588. *******************************************************************************
  589. ** \brief LVD 中断处理函数
  590. **
  591. ** \retval
  592. ******************************************************************************/
  593. void LVD_IRQHandler(void)
  594. {
  595. #if (INT_CALLBACK_ON == INT_CALLBACK_LVD)
  596. Lvd_IRQHandler();
  597. #endif
  598. }
  599. /**
  600. *******************************************************************************
  601. ** \brief LCD 中断处理函数
  602. **
  603. ** \retval
  604. ******************************************************************************/
  605. void LCD_IRQHandler(void)
  606. {
  607. #if (INT_CALLBACK_ON == INT_CALLBACK_LCD)
  608. Lcd_IRQHandler();
  609. #endif
  610. }
  611. /**
  612. *******************************************************************************
  613. ** \brief FLASH/RAM 中断处理函数
  614. **
  615. ** \retval
  616. ******************************************************************************/
  617. void FLASH_RAM_IRQHandler(void)
  618. {
  619. #if (INT_CALLBACK_ON == INT_CALLBACK_FLASH)
  620. Flash_IRQHandler();
  621. #endif
  622. #if (INT_CALLBACK_ON == INT_CALLBACK_RAM)
  623. Ram_IRQHandler();
  624. #endif
  625. }
  626. /**
  627. *******************************************************************************
  628. ** \brief CLKTRIM 中断处理函数
  629. **
  630. ** \retval
  631. ******************************************************************************/
  632. void CLKTRIM_IRQHandler(void)
  633. {
  634. #if (INT_CALLBACK_ON == INT_CALLBACK_CLKTRIM)
  635. ClkTrim_IRQHandler();
  636. #endif
  637. }
  638. /******************************************************************************/
  639. /* EOF (not truncated) */
  640. /******************************************************************************/