hdl_interrupt.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. /***************************************************************************//**
  2. * @file hdl_interrupt.c
  3. * @brief Interrupt handler of RT-Thread RTOS for EFM32
  4. * COPYRIGHT (C) 2011, RT-Thread Development Team
  5. * @author onelife
  6. * @version 0.4 beta
  7. *******************************************************************************
  8. * @section License
  9. * The license and distribution terms for this file may be found in the file
  10. * LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
  11. *******************************************************************************
  12. * @section Change Logs
  13. * Date Author Notes
  14. * 2010-12-29 onelife Initial creation for EFM32
  15. * 2011-07-12 onelife Disable interrupts in GPIO handler
  16. * 2011-12-09 onelife Add giant gecko support
  17. * 2011-12-09 onelife Add UART module support
  18. * 2011-12-09 onelife Add LEUART module support
  19. ******************************************************************************/
  20. /* Includes ------------------------------------------------------------------*/
  21. #include "board.h"
  22. #include "hdl_interrupt.h"
  23. /***************************************************************************//**
  24. * @addtogroup efm32
  25. * @{
  26. ******************************************************************************/
  27. /* Private typedef -----------------------------------------------------------*/
  28. /* Private define ------------------------------------------------------------*/
  29. /* Private macro -------------------------------------------------------------*/
  30. #ifdef RT_IRQHDL_DEBUG
  31. #define hdl_debug(format,args...) rt_kprintf(format, ##args)
  32. #else
  33. #define hdl_debug(format,args...)
  34. #endif
  35. /* Private variables ---------------------------------------------------------*/
  36. efm32_irq_hook_t dmaCbTable[DMA_CHAN_COUNT * 2] = {RT_NULL};
  37. efm32_irq_hook_t timerCbTable[TIMER_COUNT] = {RT_NULL};
  38. efm32_irq_hook_t rtcCbTable[RTC_COUNT] = {RT_NULL};
  39. efm32_irq_hook_t gpioCbTable[16] = {RT_NULL};
  40. efm32_irq_hook_t acmpCbTable[ACMP_COUNT] = {RT_NULL};
  41. efm32_irq_hook_t usartCbTable[USART_COUNT * 2 + UART_COUNT * 2] = {RT_NULL};
  42. efm32_irq_hook_t leuartCbTable[LEUART_COUNT] = {RT_NULL};
  43. efm32_irq_hook_t iicCbTable[I2C_COUNT] = {RT_NULL};
  44. /* Private function prototypes -----------------------------------------------*/
  45. /* Private functions ---------------------------------------------------------*/
  46. /***************************************************************************//**
  47. * @brief
  48. * NMI exception handler
  49. *
  50. * @details
  51. *
  52. * @note
  53. ******************************************************************************/
  54. void NMI_Handler(void)
  55. {
  56. hdl_debug("[NMI_Handler: NOP]\n");
  57. }
  58. /***************************************************************************//**
  59. * @brief
  60. * Memory manage exception handler
  61. *
  62. * @details
  63. *
  64. * @note
  65. ******************************************************************************/
  66. void MemManage_Handler(void)
  67. {
  68. hdl_debug("[MemManage_Handler: infinite loop]\n");
  69. while (1);
  70. }
  71. /***************************************************************************//**
  72. * @brief
  73. * Bus fault exception handler
  74. *
  75. * @details
  76. *
  77. * @note
  78. ******************************************************************************/
  79. void BusFault_Handler(void)
  80. {
  81. hdl_debug("[BusFault_Handler: infinite loop]\n");
  82. while (1);
  83. }
  84. /***************************************************************************//**
  85. * @brief
  86. * Usage fault exception handler
  87. *
  88. * @details
  89. *
  90. * @note
  91. ******************************************************************************/
  92. void UsageFault_Handler(void)
  93. {
  94. hdl_debug("[UsageFault_Handler: infinite loop]\n");
  95. while (1);
  96. }
  97. /***************************************************************************//**
  98. * @brief
  99. * Supervisor call exception handler
  100. *
  101. * @details
  102. *
  103. * @note
  104. ******************************************************************************/
  105. void SVC_Handler(void)
  106. {
  107. hdl_debug("[SVC_Handler: NOP]\n");
  108. }
  109. /***************************************************************************//**
  110. * @brief
  111. * Debug monitor exception handler
  112. *
  113. * @details
  114. *
  115. * @note
  116. ******************************************************************************/
  117. void DebugMon_Handler(void)
  118. {
  119. hdl_debug("[DebugMon_Handler: NOP]\n");
  120. }
  121. /***************************************************************************//**
  122. * @brief
  123. * System tick timer interrupt handler
  124. *
  125. * @details
  126. *
  127. * @note
  128. *
  129. ******************************************************************************/
  130. void SysTick_Handler(void)
  131. {
  132. /* enter interrupt */
  133. rt_interrupt_enter();
  134. rt_tick_increase();
  135. /* leave interrupt */
  136. rt_interrupt_leave();
  137. }
  138. /*******************************************************************************
  139. * STM32F10x Peripherals Interrupt Handlers
  140. * Add here the Interrupt Handler for the used peripheral(s) (PPP), for the
  141. * available peripheral interrupt handler's name please refer to the startup
  142. * file (startup_stm32f10x_xx.s).
  143. /******************************************************************************/
  144. /***************************************************************************//**
  145. * @brief
  146. * Common DMA interrupt handler
  147. *
  148. * @details
  149. *
  150. * @note
  151. *
  152. ******************************************************************************/
  153. void DMA_IRQHandler_All(unsigned int channel, bool primary, void *user)
  154. {
  155. /* enter interrupt */
  156. rt_interrupt_enter();
  157. /* invoke callback function */
  158. if (dmaCbTable[channel].cbFunc != RT_NULL)
  159. {
  160. (dmaCbTable[channel].cbFunc)(dmaCbTable[channel].userPtr);
  161. }
  162. /* leave interrupt */
  163. rt_interrupt_leave();
  164. }
  165. /***************************************************************************//**
  166. * @brief
  167. * Common Timer1 interrupt handler
  168. *
  169. * @details
  170. * This function handles Timer1 counter overflow interrupt request
  171. *
  172. * @note
  173. *
  174. ******************************************************************************/
  175. void TIMER1_IRQHandler(void)
  176. {
  177. if (TIMER1->IF & TIMER_IF_OF)
  178. {
  179. /* invoke callback function */
  180. if (timerCbTable[1].cbFunc != RT_NULL)
  181. {
  182. (timerCbTable[1].cbFunc)(timerCbTable[1].userPtr);
  183. }
  184. /* clear interrupt */
  185. BITBAND_Peripheral(&(TIMER1->IFC), _TIMER_IF_OF_SHIFT, 0x1UL);
  186. }
  187. }
  188. /***************************************************************************//**
  189. * @brief
  190. * Common Timer2 interrupt handler
  191. *
  192. * @details
  193. * This function handles Timer2 counter overflow interrupt request
  194. *
  195. * @note
  196. *
  197. ******************************************************************************/
  198. void TIMER2_IRQHandler(void)
  199. {
  200. if (TIMER2->IF & TIMER_IF_OF)
  201. {
  202. /* invoke callback function */
  203. if (timerCbTable[2].cbFunc != RT_NULL)
  204. {
  205. (timerCbTable[2].cbFunc)(timerCbTable[2].userPtr);
  206. }
  207. /* clear interrupt */
  208. BITBAND_Peripheral(&(TIMER2->IFC), _TIMER_IF_OF_SHIFT, 0x1UL);
  209. }
  210. }
  211. /***************************************************************************//**
  212. * @brief
  213. * Common RTC interrupt handler
  214. *
  215. * @details
  216. * This function handles RTC counter overflow interrupt request
  217. *
  218. * @note
  219. *
  220. ******************************************************************************/
  221. void RTC_IRQHandler(void)
  222. {
  223. /* enter interrupt */
  224. rt_interrupt_enter();
  225. if (RTC->IF & RTC_IF_OF)
  226. {
  227. /* invoke callback function */
  228. if (rtcCbTable[0].cbFunc != RT_NULL)
  229. {
  230. (rtcCbTable[0].cbFunc)(rtcCbTable[0].userPtr);
  231. }
  232. }
  233. /* leave interrupt */
  234. rt_interrupt_leave();
  235. }
  236. /***************************************************************************//**
  237. * @brief
  238. * Common even number GPIO interrupt handler
  239. *
  240. * @details
  241. *
  242. * @note
  243. *
  244. ******************************************************************************/
  245. void GPIO_EVEN_IRQHandler(void)
  246. {
  247. rt_uint16_t flag, n;
  248. rt_base_t level;
  249. /* Disable interrupt */
  250. level = rt_hw_interrupt_disable();
  251. /* Enter ISR */
  252. rt_interrupt_enter();
  253. /* invoke callback function */
  254. flag = (rt_uint16_t)(GPIO->IF & 0xFFFF);
  255. for ( n = 0; flag > 0; flag = flag >> 2, n = n + 2)
  256. {
  257. if ((flag & 0x0001) && (gpioCbTable[n].cbFunc != RT_NULL))
  258. {
  259. (gpioCbTable[n].cbFunc)(gpioCbTable[n].userPtr);
  260. }
  261. }
  262. /* clear interrupt */
  263. GPIO->IFC = 0x5555UL;
  264. /* Leave ISR */
  265. rt_interrupt_leave();
  266. /* Enable interrupt */
  267. rt_hw_interrupt_enable(level);
  268. }
  269. /***************************************************************************//**
  270. * @brief
  271. * Common odd number GPIO interrupt handler
  272. *
  273. * @details
  274. *
  275. * @note
  276. *
  277. ******************************************************************************/
  278. void GPIO_ODD_IRQHandler(void)
  279. {
  280. rt_uint16_t flag, n;
  281. rt_base_t level;
  282. /* Disable interrupt */
  283. level = rt_hw_interrupt_disable();
  284. /* Enter ISR */
  285. rt_interrupt_enter();
  286. /* invoke callback function */
  287. flag = (rt_uint16_t)(GPIO->IF & 0xFFFF) >> 1;
  288. for ( n = 1; flag > 0; flag = flag >> 2, n = n + 2)
  289. {
  290. if ((flag & 0x0001) && (gpioCbTable[n].cbFunc != RT_NULL))
  291. {
  292. (gpioCbTable[n].cbFunc)(gpioCbTable[n].userPtr);
  293. }
  294. }
  295. /* clear interrupt */
  296. GPIO->IFC = 0xAAAAUL;
  297. /* Leave ISR */
  298. rt_interrupt_leave();
  299. /* Enable interrupt */
  300. rt_hw_interrupt_enable(level);
  301. }
  302. /***************************************************************************//**
  303. * @brief
  304. * Common ACMP interrupt handler
  305. *
  306. * @details
  307. * This function handles ACMP edge trigger interrupt request
  308. *
  309. * @note
  310. *
  311. ******************************************************************************/
  312. void ACMP0_IRQHandler(void)
  313. {
  314. /* enter interrupt */
  315. rt_interrupt_enter();
  316. if (ACMP0->IF & ACMP_IF_EDGE)
  317. {
  318. /* invoke callback function */
  319. if (acmpCbTable[0].cbFunc != RT_NULL)
  320. {
  321. (acmpCbTable[0].cbFunc)(acmpCbTable[0].userPtr);
  322. }
  323. /* clear interrupt */
  324. BITBAND_Peripheral(&(ACMP0->IFC), _ACMP_IF_EDGE_SHIFT, 0x1UL);
  325. }
  326. if (ACMP1->IF & ACMP_IF_EDGE)
  327. {
  328. /* invoke callback function */
  329. if (acmpCbTable[1].cbFunc != RT_NULL)
  330. {
  331. (acmpCbTable[1].cbFunc)(acmpCbTable[1].userPtr);
  332. }
  333. /* clear interrupt */
  334. BITBAND_Peripheral(&(ACMP1->IFC), _ACMP_IF_EDGE_SHIFT, 0x1UL);
  335. }
  336. /* leave interrupt */
  337. rt_interrupt_leave();
  338. }
  339. /***************************************************************************//**
  340. * @brief
  341. * Common USART0 TX interrupt handler
  342. *
  343. * @details
  344. * This function handles USART0 TX complete interrupt request
  345. *
  346. * @note
  347. *
  348. ******************************************************************************/
  349. void USART0_TX_IRQHandler(void)
  350. {
  351. /* enter interrupt */
  352. rt_interrupt_enter();
  353. if (USART0->IF & USART_IF_TXC)
  354. {
  355. /* invoke callback function */
  356. if (usartCbTable[0].cbFunc != RT_NULL)
  357. {
  358. (usartCbTable[0].cbFunc)(usartCbTable[0].userPtr);
  359. }
  360. /* clear interrupt */
  361. BITBAND_Peripheral(&(USART0->IFC), _USART_IF_TXC_SHIFT, 0x1UL);
  362. }
  363. /* leave interrupt */
  364. rt_interrupt_leave();
  365. }
  366. /***************************************************************************//**
  367. * @brief
  368. * Common USART0 RX interrupt handler
  369. *
  370. * @details
  371. * This function handles USART0 RX data valid interrupt request
  372. *
  373. * @note
  374. *
  375. ******************************************************************************/
  376. void USART0_RX_IRQHandler(void)
  377. {
  378. if (USART0->IF & USART_IF_RXDATAV)
  379. {
  380. /* invoke callback function */
  381. if (usartCbTable[1].cbFunc != RT_NULL)
  382. {
  383. (usartCbTable[1].cbFunc)(usartCbTable[1].userPtr);
  384. }
  385. }
  386. }
  387. /***************************************************************************//**
  388. * @brief
  389. * Common USART1 TX interrupt handler
  390. *
  391. * @details
  392. * This function handles USART1 TX complete interrupt request
  393. *
  394. * @note
  395. *
  396. ******************************************************************************/
  397. void USART1_TX_IRQHandler(void)
  398. {
  399. /* enter interrupt */
  400. rt_interrupt_enter();
  401. if (USART1->IF & USART_IF_TXC)
  402. {
  403. /* invoke callback function */
  404. if (usartCbTable[2].cbFunc != RT_NULL)
  405. {
  406. (usartCbTable[2].cbFunc)(usartCbTable[2].userPtr);
  407. }
  408. /* clear interrupt */
  409. BITBAND_Peripheral(&(USART1->IFC), _USART_IF_TXC_SHIFT, 0x1UL);
  410. }
  411. /* leave interrupt */
  412. rt_interrupt_leave();
  413. }
  414. /***************************************************************************//**
  415. * @brief
  416. * Common USART1 RX interrupt handler
  417. *
  418. * @details
  419. * This function handles USART1 RX data valid interrupt request
  420. *
  421. * @note
  422. *
  423. ******************************************************************************/
  424. void USART1_RX_IRQHandler(void)
  425. {
  426. if (USART1->IF & USART_IF_RXDATAV)
  427. {
  428. /* invoke callback function */
  429. if (usartCbTable[3].cbFunc != RT_NULL)
  430. {
  431. (usartCbTable[3].cbFunc)(usartCbTable[3].userPtr);
  432. }
  433. }
  434. }
  435. /***************************************************************************//**
  436. * @brief
  437. * Common USART2 TX interrupt handler
  438. *
  439. * @details
  440. * This function handles USART2 TX complete interrupt request
  441. *
  442. * @note
  443. *
  444. ******************************************************************************/
  445. void USART2_TX_IRQHandler(void)
  446. {
  447. /* enter interrupt */
  448. rt_interrupt_enter();
  449. if (USART2->IF & USART_IF_TXC)
  450. {
  451. /* invoke callback function */
  452. if (usartCbTable[4].cbFunc != RT_NULL)
  453. {
  454. (usartCbTable[4].cbFunc)(usartCbTable[4].userPtr);
  455. }
  456. /* clear interrupt */
  457. BITBAND_Peripheral(&(USART2->IFC), _USART_IF_TXC_SHIFT, 0x1UL);
  458. }
  459. /* leave interrupt */
  460. rt_interrupt_leave();
  461. }
  462. /***************************************************************************//**
  463. * @brief
  464. * Common USART2 RX interrupt handler
  465. *
  466. * @details
  467. * This function handles USART2 RX data valid interrupt request
  468. *
  469. * @note
  470. *
  471. ******************************************************************************/
  472. void USART2_RX_IRQHandler(void)
  473. {
  474. if (USART2->IF & USART_IF_RXDATAV)
  475. {
  476. /* invoke callback function */
  477. if (usartCbTable[5].cbFunc != RT_NULL)
  478. {
  479. (usartCbTable[5].cbFunc)(usartCbTable[5].userPtr);
  480. }
  481. }
  482. }
  483. /***************************************************************************//**
  484. * @brief
  485. * Common UART0 TX interrupt handler
  486. *
  487. * @details
  488. * This function handles UART0 TX complete interrupt request
  489. *
  490. * @note
  491. *
  492. ******************************************************************************/
  493. void UART0_TX_IRQHandler(void)
  494. {
  495. /* enter interrupt */
  496. rt_interrupt_enter();
  497. if (UART0->IF & UART_IF_TXC)
  498. {
  499. /* invoke callback function */
  500. if (usartCbTable[USART_COUNT * 2].cbFunc != RT_NULL)
  501. {
  502. (usartCbTable[USART_COUNT * 2].cbFunc)(usartCbTable[USART_COUNT * 2].userPtr);
  503. }
  504. /* clear interrupt */
  505. BITBAND_Peripheral(&(UART0->IFC), _UART_IF_TXC_SHIFT, 0x1UL);
  506. }
  507. /* leave interrupt */
  508. rt_interrupt_leave();
  509. }
  510. /***************************************************************************//**
  511. * @brief
  512. * Common UART0 RX interrupt handler
  513. *
  514. * @details
  515. * This function handles UART0 RX data valid interrupt request
  516. *
  517. * @note
  518. *
  519. ******************************************************************************/
  520. void UART0_RX_IRQHandler(void)
  521. {
  522. if (UART0->IF & UART_IF_RXDATAV)
  523. {
  524. /* invoke callback function */
  525. if (usartCbTable[USART_COUNT * 2 + 1].cbFunc != RT_NULL)
  526. {
  527. (usartCbTable[USART_COUNT * 2 + 1].cbFunc)(usartCbTable[USART_COUNT * 2 + 1].userPtr);
  528. }
  529. }
  530. }
  531. #if defined(EFM32_GIANT_FAMILY)
  532. /***************************************************************************//**
  533. * @brief
  534. * Common UART1 TX interrupt handler
  535. *
  536. * @details
  537. * This function handles UART1 TX complete interrupt request
  538. *
  539. * @note
  540. *
  541. ******************************************************************************/
  542. void UART1_TX_IRQHandler(void)
  543. {
  544. /* enter interrupt */
  545. rt_interrupt_enter();
  546. if (UART1->IF & UART_IF_TXC)
  547. {
  548. /* invoke callback function */
  549. if (usartCbTable[USART_COUNT * 2 + 2].cbFunc != RT_NULL)
  550. {
  551. (usartCbTable[USART_COUNT * 2 + 2].cbFunc)(usartCbTable[USART_COUNT * 2 + 2].userPtr);
  552. }
  553. /* clear interrupt */
  554. BITBAND_Peripheral(&(UART1->IFC), _UART_IF_TXC_SHIFT, 0x1UL);
  555. }
  556. /* leave interrupt */
  557. rt_interrupt_leave();
  558. }
  559. /***************************************************************************//**
  560. * @brief
  561. * Common UART1 RX interrupt handler
  562. *
  563. * @details
  564. * This function handles UART1 RX data valid interrupt request
  565. *
  566. * @note
  567. *
  568. ******************************************************************************/
  569. void UART1_RX_IRQHandler(void)
  570. {
  571. if (UART1->IF & UART_IF_RXDATAV)
  572. {
  573. /* invoke callback function */
  574. if (usartCbTable[USART_COUNT * 2 + 3].cbFunc != RT_NULL)
  575. {
  576. (usartCbTable[USART_COUNT * 2 + 3].cbFunc)(usartCbTable[USART_COUNT * 2 + 3].userPtr);
  577. }
  578. }
  579. }
  580. #endif
  581. /***************************************************************************//**
  582. * @brief
  583. * Common LEUART0 interrupt handler
  584. *
  585. * @details
  586. * This function handles LEUART0 interrupt request
  587. *
  588. * @note
  589. *
  590. ******************************************************************************/
  591. void LEUART0_IRQHandler(void)
  592. {
  593. if (LEUART0->IF & LEUART_IF_RXDATAV)
  594. {
  595. /* invoke callback function */
  596. if (leuartCbTable[0].cbFunc != RT_NULL)
  597. {
  598. (leuartCbTable[0].cbFunc)(leuartCbTable[0].userPtr);
  599. }
  600. }
  601. }
  602. /***************************************************************************//**
  603. * @brief
  604. * Common LEUART1 interrupt handler
  605. *
  606. * @details
  607. * This function handles LEUART1 interrupt request
  608. *
  609. * @note
  610. *
  611. ******************************************************************************/
  612. void LEUART1_IRQHandler(void)
  613. {
  614. if (LEUART1->IF & LEUART_IF_RXDATAV)
  615. {
  616. /* invoke callback function */
  617. if (leuartCbTable[1].cbFunc != RT_NULL)
  618. {
  619. (leuartCbTable[1].cbFunc)(leuartCbTable[1].userPtr);
  620. }
  621. }
  622. }
  623. /***************************************************************************//**
  624. * @brief
  625. * Common IIC0 interrupt handler
  626. *
  627. * @details
  628. * This function handles IIC0 slave mode interrupt requests
  629. *
  630. * @note
  631. *
  632. ******************************************************************************/
  633. void I2C0_IRQHandler(void)
  634. {
  635. if ((I2C0->IF & I2C_IF_ADDR) || \
  636. (I2C0->IF & I2C_IF_RXDATAV) || \
  637. (I2C0->IF & I2C_IF_SSTOP))
  638. {
  639. /* invoke callback function */
  640. if (iicCbTable[0].cbFunc != RT_NULL)
  641. {
  642. (iicCbTable[0].cbFunc)(iicCbTable[0].userPtr);
  643. }
  644. }
  645. I2C_IntClear(I2C0, I2C_IFC_ADDR | I2C_IFC_SSTOP);
  646. }
  647. /***************************************************************************//**
  648. * @brief
  649. * EFM32 common interrupt handlers register function
  650. *
  651. * @details
  652. *
  653. * @note
  654. *
  655. ******************************************************************************/
  656. void efm32_irq_hook_register(efm32_irq_hook_init_t *hook)
  657. {
  658. switch (hook->type)
  659. {
  660. case efm32_irq_type_dma:
  661. dmaCbTable[hook->unit].cbFunc = hook->cbFunc;
  662. dmaCbTable[hook->unit].userPtr = hook->userPtr;
  663. break;
  664. case efm32_irq_type_rtc:
  665. rtcCbTable[hook->unit].cbFunc = hook->cbFunc;
  666. rtcCbTable[hook->unit].userPtr = hook->userPtr;
  667. break;
  668. case efm32_irq_type_timer:
  669. timerCbTable[hook->unit].cbFunc = hook->cbFunc;
  670. timerCbTable[hook->unit].userPtr = hook->userPtr;
  671. break;
  672. case efm32_irq_type_gpio:
  673. gpioCbTable[hook->unit].cbFunc = hook->cbFunc;
  674. gpioCbTable[hook->unit].userPtr = hook->userPtr;
  675. break;
  676. case efm32_irq_type_acmp:
  677. acmpCbTable[hook->unit].cbFunc = hook->cbFunc;
  678. acmpCbTable[hook->unit].userPtr = hook->userPtr;
  679. break;
  680. case efm32_irq_type_usart:
  681. usartCbTable[hook->unit].cbFunc = hook->cbFunc;
  682. usartCbTable[hook->unit].userPtr = hook->userPtr;
  683. break;
  684. case efm32_irq_type_leuart:
  685. leuartCbTable[hook->unit].cbFunc = hook->cbFunc;
  686. leuartCbTable[hook->unit].userPtr = hook->userPtr;
  687. break;
  688. case efm32_irq_type_iic:
  689. iicCbTable[hook->unit].cbFunc = hook->cbFunc;
  690. iicCbTable[hook->unit].userPtr = hook->userPtr;
  691. break;
  692. default:
  693. break;
  694. }
  695. hdl_debug("Hook Registered: type: %s, unit: %x, cbFunc: %x, userPtr: %x\n", \
  696. hook->type, hook->unit, hook->cbFunc, hook->userPtr);
  697. }
  698. /***************************************************************************//**
  699. * @}
  700. ******************************************************************************/