gd32f30x_it.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /*!
  2. \file gd32f3x0_it.c
  3. \brief interrupt service routines
  4. */
  5. /*
  6. Copyright (C) 2017 GigaDevice
  7. 2017-06-06, V1.0.0, firmware for GD32F3x0
  8. */
  9. #include "gd32f30x_it.h"
  10. #include "can_driver.h"
  11. extern uint8_t data;
  12. /*!
  13. \brief this function handles NMI exception
  14. \param[in] none
  15. \param[out] none
  16. \retval none
  17. */
  18. void NMI_Handler(void)
  19. {
  20. }
  21. /*!
  22. \brief this function handles HardFault exception
  23. \param[in] none
  24. \param[out] none
  25. \retval none
  26. */
  27. void HardFault_Handler(void)
  28. {
  29. /* if Hard Fault exception occurs, go to infinite loop */
  30. while (1);
  31. }
  32. /*!
  33. \brief this function handles MemManage exception
  34. \param[in] none
  35. \param[out] none
  36. \retval none
  37. */
  38. void MemManage_Handler(void)
  39. {
  40. /* if Memory Manage exception occurs, go to infinite loop */
  41. while (1);
  42. }
  43. /*!
  44. \brief this function handles BusFault exception
  45. \param[in] none
  46. \param[out] none
  47. \retval none
  48. */
  49. void BusFault_Handler(void)
  50. {
  51. /* if Bus Fault exception occurs, go to infinite loop */
  52. while (1);
  53. }
  54. /*!
  55. \brief this function handles UsageFault exception
  56. \param[in] none
  57. \param[out] none
  58. \retval none
  59. */
  60. void UsageFault_Handler(void)
  61. {
  62. /* if Usage Fault exception occurs, go to infinite loop */
  63. while (1);
  64. }
  65. /*!
  66. \brief this function handles SVC exception
  67. \param[in] none
  68. \param[out] none
  69. \retval none
  70. */
  71. void SVC_Handler(void)
  72. {
  73. }
  74. /*!
  75. \brief this function handles DebugMon exception
  76. \param[in] none
  77. \param[out] none
  78. \retval none
  79. */
  80. void DebugMon_Handler(void)
  81. {
  82. }
  83. /*!
  84. \brief this function handles PendSV exception
  85. \param[in] none
  86. \param[out] none
  87. \retval none
  88. */
  89. void PendSV_Handler(void)
  90. {
  91. }
  92. /*!
  93. \brief this function handles SysTick exception
  94. \param[in] none
  95. \param[out] none
  96. \retval none
  97. */
  98. void SysTick_Handler(void)
  99. {
  100. /* Add your code below */
  101. }
  102. /*!
  103. \brief
  104. \param[in] none
  105. \param[out] none
  106. \retval none
  107. */
  108. void ADC0_1_IRQHandler(void)
  109. {
  110. }
  111. /*!
  112. \brief
  113. \param[in] none
  114. \param[out] none
  115. \retval none
  116. */
  117. void TIMER0_UP_TIMER9_IRQHandler(void)
  118. {
  119. }
  120. /*!
  121. \brief
  122. \param[in] none
  123. \param[out] none
  124. \retval none
  125. */
  126. void TIMER1_IRQHandler(void)
  127. {
  128. }
  129. /*!
  130. \brief
  131. \param[in] none
  132. \param[out] none
  133. \retval none
  134. */
  135. void TIMER3_IRQHandler(void)
  136. {
  137. }
  138. /*!
  139. \brief
  140. \param[in] none
  141. \param[out] none
  142. \retval none
  143. */
  144. void TIMER5_IRQHandler(void)
  145. {
  146. }
  147. /*!
  148. \brief
  149. \param[in] none
  150. \param[out] none
  151. \retval none
  152. */
  153. void USART0_IRQHandler(void)
  154. {
  155. }
  156. /*!
  157. \brief
  158. \param[in] none
  159. \param[out] none
  160. \retval none
  161. */
  162. void DMA1_Channel2_IRQHandler(void)
  163. {
  164. }
  165. /*!
  166. \brief
  167. \param[in] none
  168. \param[out] none
  169. \retval none
  170. */
  171. UWORD uwCnts = 0;
  172. void CAN0_RX0_IRQHandler(void)
  173. {
  174. can_message_receive(CAN0, CAN_FIFO0, pRxMsg);
  175. if((pRxMsg->rx_ff != CAN_FF_STANDARD) || (pRxMsg->rx_dlen == 0))
  176. {
  177. can_interrupt_enable(CAN0, CAN_INT_RFF0);
  178. return;
  179. }
  180. switch (pRxMsg->rx_sfid)
  181. {
  182. case ID_PBU_BC:
  183. case ID_PBU_TO_MC: //接收PBU数据
  184. {
  185. CAN_RxBuf_Struct_PBU.ucBufID = pRxMsg->rx_sfid;
  186. CAN_Rx_ISR(&CAN_RxBuf_Struct_PBU, pRxMsg->rx_dlen);
  187. break;
  188. }
  189. case ID_BMS_BC:
  190. case ID_BMS_TO_MC: //接收BMS数据
  191. {
  192. CAN_RxBuf_Struct_BMS.ucBufID = pRxMsg->rx_sfid;
  193. CAN_Rx_ISR(&CAN_RxBuf_Struct_BMS, pRxMsg->rx_dlen);
  194. break;
  195. }
  196. case ID_HMI_BC:
  197. case ID_HMI_TO_MC: //接收HMI数据
  198. {
  199. CAN_RxBuf_Struct_HMI.ucBufID = pRxMsg->rx_sfid;
  200. CAN_Rx_ISR(&CAN_RxBuf_Struct_HMI, pRxMsg->rx_dlen);
  201. break;
  202. }
  203. case ID_CDL_BC:
  204. case ID_CDL_TO_MC: // case ID_CDL_TO_MC_TE://接收CDL数据
  205. {
  206. CAN_RxBuf_Struct_CDL.ucBufID = pRxMsg->rx_sfid;
  207. CAN_Rx_ISR(&CAN_RxBuf_Struct_CDL, pRxMsg->rx_dlen);
  208. break;
  209. }
  210. default:
  211. break;
  212. }
  213. can_interrupt_enable(CAN0, CAN_INT_RFF0);
  214. }
  215. void CAN0_RX1_IRQHandler(void)
  216. {
  217. }