interrupts_hc32l13x.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. /******************************************************************************
  2. * Copyright (C) 2019, Xiaohua Semiconductor Co.,Ltd All rights reserved.
  3. *
  4. * This software is owned and published by:
  5. * Xiaohua Semiconductor Co.,Ltd ("XHSC").
  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 XHSC
  11. * components. This software is licensed by XHSC to be adapted only
  12. * for use in systems utilizing XHSC components. XHSC shall not be
  13. * responsible for misuse or illegal use of this software for devices not
  14. * supported herein. XHSC 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. * XHSC 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. * XHSC 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_hc32l13x.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 "ddl.h"
  56. #include "interrupts_hc32l13x.h"
  57. /*******************************************************************************
  58. * IRQ WEAK DEFINE
  59. ******************************************************************************/
  60. __WEAK void SysTick_IRQHandler(void);
  61. __WEAK void PortA_IRQHandler(void);
  62. __WEAK void PortB_IRQHandler(void);
  63. __WEAK void PortC_IRQHandler(void);
  64. __WEAK void PortD_IRQHandler(void);
  65. __WEAK void Dmac_IRQHandler(void);
  66. __WEAK void Tim3_IRQHandler(void);
  67. __WEAK void Uart0_IRQHandler(void);
  68. __WEAK void Uart1_IRQHandler(void);
  69. __WEAK void LpUart0_IRQHandler(void);
  70. __WEAK void LpUart1_IRQHandler(void);
  71. __WEAK void Spi0_IRQHandler(void);
  72. __WEAK void Spi1_IRQHandler(void);
  73. __WEAK void I2c0_IRQHandler(void);
  74. __WEAK void I2c1_IRQHandler(void);
  75. __WEAK void Tim0_IRQHandler(void);
  76. __WEAK void Tim1_IRQHandler(void);
  77. __WEAK void Tim2_IRQHandler(void);
  78. __WEAK void LpTim_IRQHandler(void);
  79. __WEAK void Tim4_IRQHandler(void);
  80. __WEAK void Tim5_IRQHandler(void);
  81. __WEAK void Tim6_IRQHandler(void);
  82. __WEAK void Pca_IRQHandler(void);
  83. __WEAK void Wdt_IRQHandler(void);
  84. __WEAK void Rtc_IRQHandler(void);
  85. __WEAK void Adc_IRQHandler(void);
  86. __WEAK void Dac_IRQHandler(void);
  87. __WEAK void Pcnt_IRQHandler(void);
  88. __WEAK void Vc0_IRQHandler(void);
  89. __WEAK void Vc1_IRQHandler(void);
  90. __WEAK void Lvd_IRQHandler(void);
  91. __WEAK void Lcd_IRQHandler(void);
  92. __WEAK void Flash_IRQHandler(void);
  93. __WEAK void Ram_IRQHandler(void);
  94. __WEAK void ClkTrim_IRQHandler(void);
  95. /**
  96. *******************************************************************************
  97. ** \brief NVIC 中断使能
  98. **
  99. ** \param [in] enIrq 中断号枚举类型
  100. ** \param [in] enLevel 中断优先级枚举类型
  101. ** \param [in] bEn 中断开关
  102. ** \retval Ok 设置成功
  103. ** 其他值 设置失败
  104. ******************************************************************************/
  105. void EnableNvic(IRQn_Type enIrq, en_irq_level_t enLevel, boolean_t bEn)
  106. {
  107. NVIC_ClearPendingIRQ(enIrq);
  108. NVIC_SetPriority(enIrq, enLevel);
  109. if (TRUE == bEn)
  110. {
  111. NVIC_EnableIRQ(enIrq);
  112. }
  113. else
  114. {
  115. NVIC_DisableIRQ(enIrq);
  116. }
  117. }
  118. /**
  119. *******************************************************************************
  120. ** \brief NVIC hardware fault 中断实现
  121. **
  122. **
  123. ** \retval
  124. ******************************************************************************/
  125. void HardFault_Handler(void)
  126. {
  127. volatile int a = 0;
  128. while( 0 == a)
  129. {
  130. ;
  131. }
  132. }
  133. /**
  134. *******************************************************************************
  135. ** \brief NVIC SysTick 中断实现
  136. **
  137. ** \retval
  138. ******************************************************************************/
  139. void SysTick_Handler(void)
  140. {
  141. SysTick_IRQHandler();
  142. }
  143. /**
  144. *******************************************************************************
  145. ** \brief GPIO PortA 中断处理函数
  146. **
  147. ** \retval
  148. ******************************************************************************/
  149. void PORTA_IRQHandler(void)
  150. {
  151. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTA)
  152. PortA_IRQHandler();
  153. #endif
  154. }
  155. /**
  156. *******************************************************************************
  157. ** \brief GPIO PortB 中断处理函数
  158. **
  159. ** \retval
  160. ******************************************************************************/
  161. void PORTB_IRQHandler(void)
  162. {
  163. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTB)
  164. PortB_IRQHandler();
  165. #endif
  166. }
  167. /**
  168. *******************************************************************************
  169. ** \brief GPIO PortC 中断处理函数
  170. **
  171. ** \retval
  172. ******************************************************************************/
  173. void PORTC_IRQHandler(void)
  174. {
  175. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTC)
  176. PortC_IRQHandler();
  177. #endif
  178. }
  179. /**
  180. *******************************************************************************
  181. ** \brief GPIO PortD 中断处理函数
  182. **
  183. ** \retval
  184. ******************************************************************************/
  185. void PORTD_IRQHandler(void)
  186. {
  187. #if (INT_CALLBACK_ON == INT_CALLBACK_PORTD)
  188. PortD_IRQHandler();
  189. #endif
  190. }
  191. /**
  192. *******************************************************************************
  193. ** \brief DMAC 中断处理函数
  194. **
  195. ** \retval
  196. ******************************************************************************/
  197. void DMAC_IRQHandler(void)
  198. {
  199. #if (INT_CALLBACK_ON == INT_CALLBACK_DMAC)
  200. Dmac_IRQHandler();
  201. #endif
  202. }
  203. /**
  204. *******************************************************************************
  205. ** \brief TIM3 中断处理函数
  206. **
  207. ** \retval
  208. ******************************************************************************/
  209. void TIM3_IRQHandler(void)
  210. {
  211. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM3)
  212. Tim3_IRQHandler();
  213. #endif
  214. }
  215. /**
  216. *******************************************************************************
  217. ** \brief UART0 中断处理函数
  218. **
  219. ** \retval
  220. ******************************************************************************/
  221. void UART0_IRQHandler(void)
  222. {
  223. #if (INT_CALLBACK_ON == INT_CALLBACK_UART0)
  224. Uart0_IRQHandler();
  225. #endif
  226. }
  227. /**
  228. *******************************************************************************
  229. ** \brief UART1 中断处理函数
  230. **
  231. ** \retval
  232. ******************************************************************************/
  233. void UART1_IRQHandler(void)
  234. {
  235. #if (INT_CALLBACK_ON == INT_CALLBACK_UART1)
  236. Uart1_IRQHandler();
  237. #endif
  238. }
  239. /**
  240. *******************************************************************************
  241. ** \brief LPUART0 低功耗串口0 中断处理函数
  242. **
  243. ** \retval
  244. ******************************************************************************/
  245. void LPUART0_IRQHandler(void)
  246. {
  247. #if (INT_CALLBACK_ON == INT_CALLBACK_LPUART0)
  248. LpUart0_IRQHandler();
  249. #endif
  250. }
  251. /**
  252. *******************************************************************************
  253. ** \brief LPUART1 低功耗串口1 中断处理函数
  254. **
  255. ** \retval
  256. ******************************************************************************/
  257. void LPUART1_IRQHandler(void)
  258. {
  259. #if (INT_CALLBACK_ON == INT_CALLBACK_LPUART1)
  260. LpUart1_IRQHandler();
  261. #endif
  262. }
  263. /**
  264. *******************************************************************************
  265. ** \brief SPI0 中断处理函数
  266. **
  267. ** \retval
  268. ******************************************************************************/
  269. void SPI0_IRQHandler(void)
  270. {
  271. #if (INT_CALLBACK_ON == INT_CALLBACK_SPI0)
  272. Spi0_IRQHandler();
  273. #endif
  274. }
  275. /**
  276. *******************************************************************************
  277. ** \brief SPI1 中断处理函数
  278. **
  279. ** \retval
  280. ******************************************************************************/
  281. void SPI1_IRQHandler(void)
  282. {
  283. #if (INT_CALLBACK_ON == INT_CALLBACK_SPI1)
  284. Spi1_IRQHandler();
  285. #endif
  286. }
  287. /**
  288. *******************************************************************************
  289. ** \brief I2C0 中断处理函数
  290. **
  291. ** \retval
  292. ******************************************************************************/
  293. void I2C0_IRQHandler(void)
  294. {
  295. #if (INT_CALLBACK_ON == INT_CALLBACK_I2C0)
  296. I2c0_IRQHandler();
  297. #endif
  298. }
  299. /**
  300. *******************************************************************************
  301. ** \brief I2C1 中断处理函数
  302. **
  303. ** \retval
  304. ******************************************************************************/
  305. void I2C1_IRQHandler(void)
  306. {
  307. #if (INT_CALLBACK_ON == INT_CALLBACK_I2C1)
  308. I2c1_IRQHandler();
  309. #endif
  310. }
  311. /**
  312. *******************************************************************************
  313. ** \brief TIM0 中断处理函数
  314. **
  315. ** \retval
  316. ******************************************************************************/
  317. void TIM0_IRQHandler(void)
  318. {
  319. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM0)
  320. Tim0_IRQHandler();
  321. #endif
  322. }
  323. /**
  324. *******************************************************************************
  325. ** \brief TIM1 中断处理函数
  326. **
  327. ** \retval
  328. ******************************************************************************/
  329. void TIM1_IRQHandler(void)
  330. {
  331. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM1)
  332. Tim1_IRQHandler();
  333. #endif
  334. }
  335. /**
  336. *******************************************************************************
  337. ** \brief TIM2 中断处理函数
  338. **
  339. ** \retval
  340. ******************************************************************************/
  341. void TIM2_IRQHandler(void)
  342. {
  343. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM2)
  344. Tim2_IRQHandler();
  345. #endif
  346. }
  347. /**
  348. *******************************************************************************
  349. ** \brief LPTIM 低功耗时钟 中断处理函数
  350. **
  351. ** \retval
  352. ******************************************************************************/
  353. void LPTIM_IRQHandler(void)
  354. {
  355. #if (INT_CALLBACK_ON == INT_CALLBACK_LPTIM)
  356. LpTim_IRQHandler();
  357. #endif
  358. }
  359. /**
  360. *******************************************************************************
  361. ** \brief TIM4 中断处理函数
  362. **
  363. ** \retval
  364. ******************************************************************************/
  365. void TIM4_IRQHandler(void)
  366. {
  367. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM4)
  368. Tim4_IRQHandler();
  369. #endif
  370. }
  371. /**
  372. *******************************************************************************
  373. ** \brief TIM5 中断处理函数
  374. **
  375. ** \retval
  376. ******************************************************************************/
  377. void TIM5_IRQHandler(void)
  378. {
  379. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM5)
  380. Tim5_IRQHandler();
  381. #endif
  382. }
  383. /**
  384. *******************************************************************************
  385. ** \brief TIM6 中断处理函数
  386. **
  387. ** \retval
  388. ******************************************************************************/
  389. void TIM6_IRQHandler(void)
  390. {
  391. #if (INT_CALLBACK_ON == INT_CALLBACK_TIM6)
  392. Tim6_IRQHandler();
  393. #endif
  394. }
  395. /**
  396. *******************************************************************************
  397. ** \brief PCA 中断处理函数
  398. **
  399. ** \retval
  400. ******************************************************************************/
  401. void PCA_IRQHandler(void)
  402. {
  403. #if (INT_CALLBACK_ON == INT_CALLBACK_PCA)
  404. Pca_IRQHandler();
  405. #endif
  406. }
  407. /**
  408. *******************************************************************************
  409. ** \brief WDT 中断处理函数
  410. **
  411. ** \retval
  412. ******************************************************************************/
  413. void WDT_IRQHandler(void)
  414. {
  415. #if (INT_CALLBACK_ON == INT_CALLBACK_WDT)
  416. Wdt_IRQHandler();
  417. #endif
  418. }
  419. /**
  420. *******************************************************************************
  421. ** \brief RTC 中断处理函数
  422. **
  423. ** \retval
  424. ******************************************************************************/
  425. void RTC_IRQHandler(void)
  426. {
  427. #if (INT_CALLBACK_ON == INT_CALLBACK_RTC)
  428. Rtc_IRQHandler();
  429. #endif
  430. }
  431. /**
  432. *******************************************************************************
  433. ** \brief ADC 中断处理函数
  434. **
  435. ** \retval
  436. ******************************************************************************/
  437. void ADC_IRQHandler(void)
  438. {
  439. #if (INT_CALLBACK_ON == INT_CALLBACK_ADC)
  440. Adc_IRQHandler();
  441. #endif
  442. }
  443. /**
  444. *******************************************************************************
  445. ** \brief PCNT 中断处理函数
  446. **
  447. ** \retval
  448. ******************************************************************************/
  449. void PCNT_IRQHandler(void)
  450. {
  451. #if (INT_CALLBACK_ON == INT_CALLBACK_PCNT)
  452. Pcnt_IRQHandler();
  453. #endif
  454. }
  455. /**
  456. *******************************************************************************
  457. ** \brief VC0 中断处理函数
  458. **
  459. ** \retval
  460. ******************************************************************************/
  461. void VC0_IRQHandler(void)
  462. {
  463. #if (INT_CALLBACK_ON == INT_CALLBACK_VC0)
  464. Vc0_IRQHandler();
  465. #endif
  466. }
  467. /**
  468. *******************************************************************************
  469. ** \brief VC1 中断处理函数
  470. **
  471. ** \retval
  472. ******************************************************************************/
  473. void VC1_IRQHandler(void)
  474. {
  475. #if (INT_CALLBACK_ON == INT_CALLBACK_VC1)
  476. Vc1_IRQHandler();
  477. #endif
  478. }
  479. /**
  480. *******************************************************************************
  481. ** \brief LVD 中断处理函数
  482. **
  483. ** \retval
  484. ******************************************************************************/
  485. void LVD_IRQHandler(void)
  486. {
  487. #if (INT_CALLBACK_ON == INT_CALLBACK_LVD)
  488. Lvd_IRQHandler();
  489. #endif
  490. }
  491. /**
  492. *******************************************************************************
  493. ** \brief LCD 中断处理函数
  494. **
  495. ** \retval
  496. ******************************************************************************/
  497. void LCD_IRQHandler(void)
  498. {
  499. #if (INT_CALLBACK_ON == INT_CALLBACK_LCD)
  500. Lcd_IRQHandler();
  501. #endif
  502. }
  503. /**
  504. *******************************************************************************
  505. ** \brief FLASH/RAM 中断处理函数
  506. **
  507. ** \retval
  508. ******************************************************************************/
  509. void FLASH_RAM_IRQHandler(void)
  510. {
  511. #if (INT_CALLBACK_ON == INT_CALLBACK_FLASH)
  512. Flash_IRQHandler();
  513. #endif
  514. #if (INT_CALLBACK_ON == INT_CALLBACK_RAM)
  515. Ram_IRQHandler();
  516. #endif
  517. }
  518. /**
  519. *******************************************************************************
  520. ** \brief CLKTRIM 中断处理函数
  521. **
  522. ** \retval
  523. ******************************************************************************/
  524. void CLKTRIM_IRQHandler(void)
  525. {
  526. #if (INT_CALLBACK_ON == INT_CALLBACK_CLKTRIM)
  527. ClkTrim_IRQHandler();
  528. #endif
  529. }
  530. /******************************************************************************/
  531. /* EOF (not truncated) */
  532. /******************************************************************************/