stm32f10x_it.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. /**
  2. ******************************************************************************
  3. * @file Project/Template/stm32f10x_it.c
  4. * @author MCD Application Team
  5. * @version V3.1.0
  6. * @date 06/19/2009
  7. * @brief Main Interrupt Service Routines.
  8. * This file provides template for all exceptions handler and
  9. * peripherals interrupt service routine.
  10. ******************************************************************************
  11. * @copy
  12. *
  13. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  14. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  15. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  16. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  17. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  18. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  19. *
  20. * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
  21. */
  22. /* Includes ------------------------------------------------------------------*/
  23. #include "stm32f10x_it.h"
  24. #include <board.h>
  25. #include <rtthread.h>
  26. /** @addtogroup Template_Project
  27. * @{
  28. */
  29. /* Private typedef -----------------------------------------------------------*/
  30. /* Private define ------------------------------------------------------------*/
  31. /* Private macro -------------------------------------------------------------*/
  32. /* Private variables ---------------------------------------------------------*/
  33. /* Private function prototypes -----------------------------------------------*/
  34. /* Private functions ---------------------------------------------------------*/
  35. /******************************************************************************/
  36. /* Cortex-M3 Processor Exceptions Handlers */
  37. /******************************************************************************/
  38. /**
  39. * @brief This function handles NMI exception.
  40. * @param None
  41. * @retval None
  42. */
  43. void NMI_Handler(void)
  44. {
  45. }
  46. /**
  47. * @brief This function handles Hard Fault exception.
  48. * @param None
  49. * @retval None
  50. */
  51. void HardFault_Handler(void)
  52. {
  53. /* Go to infinite loop when Hard Fault exception occurs */
  54. while (1)
  55. {
  56. }
  57. }
  58. /**
  59. * @brief This function handles Memory Manage exception.
  60. * @param None
  61. * @retval None
  62. */
  63. void MemManage_Handler(void)
  64. {
  65. /* Go to infinite loop when Memory Manage exception occurs */
  66. while (1)
  67. {
  68. }
  69. }
  70. /**
  71. * @brief This function handles Bus Fault exception.
  72. * @param None
  73. * @retval None
  74. */
  75. void BusFault_Handler(void)
  76. {
  77. /* Go to infinite loop when Bus Fault exception occurs */
  78. while (1)
  79. {
  80. }
  81. }
  82. /**
  83. * @brief This function handles Usage Fault exception.
  84. * @param None
  85. * @retval None
  86. */
  87. void UsageFault_Handler(void)
  88. {
  89. /* Go to infinite loop when Usage Fault exception occurs */
  90. while (1)
  91. {
  92. }
  93. }
  94. /**
  95. * @brief This function handles SVCall exception.
  96. * @param None
  97. * @retval None
  98. */
  99. void SVC_Handler(void)
  100. {
  101. }
  102. /**
  103. * @brief This function handles Debug Monitor exception.
  104. * @param None
  105. * @retval None
  106. */
  107. void DebugMon_Handler(void)
  108. {
  109. }
  110. /******************************************************************************/
  111. /* STM32F10x Peripherals Interrupt Handlers */
  112. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  113. /* available peripheral interrupt handler's name please refer to the startup */
  114. /* file (startup_stm32f10x_xx.s). */
  115. /******************************************************************************/
  116. /*******************************************************************************
  117. * Function Name : DMA1_Channel2_IRQHandler
  118. * Description : This function handles DMA1 Channel 2 interrupt request.
  119. * Input : None
  120. * Output : None
  121. * Return : None
  122. *******************************************************************************/
  123. void DMA1_Channel2_IRQHandler(void)
  124. {
  125. #ifdef RT_USING_UART3
  126. extern struct rt_device uart3_device;
  127. extern void rt_hw_serial_dma_tx_isr(struct rt_device *device);
  128. /* enter interrupt */
  129. rt_interrupt_enter();
  130. if (DMA_GetITStatus(DMA1_IT_TC2))
  131. {
  132. /* transmission complete, invoke serial dma tx isr */
  133. rt_hw_serial_dma_tx_isr(&uart3_device);
  134. }
  135. /* clear DMA flag */
  136. DMA_ClearFlag(DMA1_FLAG_TC2 | DMA1_FLAG_TE2);
  137. /* leave interrupt */
  138. rt_interrupt_leave();
  139. #endif
  140. }
  141. /*******************************************************************************
  142. * Function Name : DMA1_Channel6_IRQHandler
  143. * Description : This function handles DMA1 Channel 6 interrupt request.
  144. * Input : None
  145. * Output : None
  146. * Return : None
  147. *******************************************************************************/
  148. void DMA1_Channel6_IRQHandler(void)
  149. {
  150. #ifdef RT_USING_UART2
  151. extern struct rt_device uart2_device;
  152. extern void rt_hw_serial_dma_rx_isr(struct rt_device *device);
  153. /* enter interrupt */
  154. rt_interrupt_enter();
  155. /* clear DMA flag */
  156. DMA_ClearFlag(DMA1_FLAG_TC6 | DMA1_FLAG_TE6);
  157. rt_hw_serial_dma_rx_isr(&uart2_device);
  158. /* leave interrupt */
  159. rt_interrupt_leave();
  160. #endif
  161. }
  162. /*******************************************************************************
  163. * Function Name : USART1_IRQHandler
  164. * Description : This function handles USART1 global interrupt request.
  165. * Input : None
  166. * Output : None
  167. * Return : None
  168. *******************************************************************************/
  169. void USART1_IRQHandler(void)
  170. {
  171. #ifdef RT_USING_UART1
  172. extern struct rt_device uart1_device;
  173. extern void rt_hw_serial_isr(struct rt_device *device);
  174. /* enter interrupt */
  175. rt_interrupt_enter();
  176. rt_hw_serial_isr(&uart1_device);
  177. /* leave interrupt */
  178. rt_interrupt_leave();
  179. #endif
  180. }
  181. /*******************************************************************************
  182. * Function Name : USART2_IRQHandler
  183. * Description : This function handles USART2 global interrupt request.
  184. * Input : None
  185. * Output : None
  186. * Return : None
  187. *******************************************************************************/
  188. void USART2_IRQHandler(void)
  189. {
  190. #ifdef RT_USING_UART2
  191. extern struct rt_device uart2_device;
  192. extern void rt_hw_serial_isr(struct rt_device *device);
  193. /* enter interrupt */
  194. rt_interrupt_enter();
  195. rt_hw_serial_isr(&uart2_device);
  196. /* leave interrupt */
  197. rt_interrupt_leave();
  198. #endif
  199. }
  200. /*******************************************************************************
  201. * Function Name : USART3_IRQHandler
  202. * Description : This function handles USART3 global interrupt request.
  203. * Input : None
  204. * Output : None
  205. * Return : None
  206. *******************************************************************************/
  207. void USART3_IRQHandler(void)
  208. {
  209. #ifdef RT_USING_UART3
  210. extern struct rt_device uart3_device;
  211. extern void rt_hw_serial_isr(struct rt_device *device);
  212. /* enter interrupt */
  213. rt_interrupt_enter();
  214. rt_hw_serial_isr(&uart3_device);
  215. /* leave interrupt */
  216. rt_interrupt_leave();
  217. #endif
  218. }
  219. #if defined(RT_USING_DFS) && STM32_USE_SDIO
  220. /*******************************************************************************
  221. * Function Name : SDIO_IRQHandler
  222. * Description : This function handles SDIO global interrupt request.
  223. * Input : None
  224. * Output : None
  225. * Return : None
  226. *******************************************************************************/
  227. void SDIO_IRQHandler(void)
  228. {
  229. extern int SD_ProcessIRQSrc(void);
  230. /* enter interrupt */
  231. rt_interrupt_enter();
  232. /* Process All SDIO Interrupt Sources */
  233. SD_ProcessIRQSrc();
  234. /* leave interrupt */
  235. rt_interrupt_leave();
  236. }
  237. #endif
  238. #ifdef RT_USING_LWIP
  239. #ifdef STM32F10X_CL
  240. /*******************************************************************************
  241. * Function Name : ETH_IRQHandler
  242. * Description : This function handles ETH interrupt request.
  243. * Input : None
  244. * Output : None
  245. * Return : None
  246. *******************************************************************************/
  247. void ETH_IRQHandler(void)
  248. {
  249. extern void rt_hw_stm32_eth_isr(void);
  250. /* enter interrupt */
  251. rt_interrupt_enter();
  252. rt_hw_stm32_eth_isr();
  253. /* leave interrupt */
  254. rt_interrupt_leave();
  255. }
  256. #else
  257. #if (STM32_ETH_IF == 0)
  258. /*******************************************************************************
  259. * Function Name : EXTI0_IRQHandler
  260. * Description : This function handles External interrupt Line 0 request.
  261. * Input : None
  262. * Output : None
  263. * Return : None
  264. *******************************************************************************/
  265. void EXTI0_IRQHandler(void)
  266. {
  267. extern void enc28j60_isr(void);
  268. /* enter interrupt */
  269. rt_interrupt_enter();
  270. enc28j60_isr();
  271. /* Clear the Key Button EXTI line pending bit */
  272. EXTI_ClearITPendingBit(EXTI_Line0);
  273. /* leave interrupt */
  274. rt_interrupt_leave();
  275. }
  276. #endif
  277. #if (STM32_ETH_IF == 1)
  278. /*******************************************************************************
  279. * Function Name : EXTI9_5_IRQHandler
  280. * Description : This function handles External lines 9 to 5 interrupt request.
  281. * Input : None
  282. * Output : None
  283. * Return : None
  284. *******************************************************************************/
  285. void EXTI9_5_IRQHandler(void)
  286. {
  287. extern void rt_dm9000_isr(void);
  288. /* enter interrupt */
  289. rt_interrupt_enter();
  290. rt_dm9000_isr();
  291. /* Clear the Key Button EXTI line pending bit */
  292. EXTI_ClearITPendingBit(EXTI_Line7);
  293. /* leave interrupt */
  294. rt_interrupt_leave();
  295. }
  296. #endif
  297. #endif
  298. #endif /* end of RT_USING_LWIP */
  299. /**
  300. * @}
  301. */
  302. /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/