stm32f10x_it.c 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. /**
  2. ******************************************************************************
  3. * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_it.c
  4. * @author MCD Application Team
  5. * @version V3.5.0
  6. * @date 08-April-2011
  7. * @brief Main Interrupt Service Routines.
  8. * This file provides template for all exceptions handler and
  9. * peripherals interrupt service routine.
  10. ******************************************************************************
  11. * @attention
  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 2011 STMicroelectronics</center></h2>
  21. ******************************************************************************
  22. */
  23. /* Includes ------------------------------------------------------------------*/
  24. #include "stm32f10x_it.h"
  25. #include <board.h>
  26. #include <rtthread.h>
  27. /** @addtogroup Template_Project
  28. * @{
  29. */
  30. /* Private typedef -----------------------------------------------------------*/
  31. /* Private define ------------------------------------------------------------*/
  32. /* Private macro -------------------------------------------------------------*/
  33. /* Private variables ---------------------------------------------------------*/
  34. /* Private function prototypes -----------------------------------------------*/
  35. /* Private functions ---------------------------------------------------------*/
  36. /******************************************************************************/
  37. /* Cortex-M3 Processor Exceptions Handlers */
  38. /******************************************************************************/
  39. /**
  40. * @brief This function handles NMI exception.
  41. * @param None
  42. * @retval None
  43. */
  44. void NMI_Handler(void)
  45. {
  46. }
  47. /**
  48. * @brief This function handles Memory Manage exception.
  49. * @param None
  50. * @retval None
  51. */
  52. void MemManage_Handler(void)
  53. {
  54. /* Go to infinite loop when Memory Manage exception occurs */
  55. while (1)
  56. {
  57. }
  58. }
  59. /**
  60. * @brief This function handles Bus Fault exception.
  61. * @param None
  62. * @retval None
  63. */
  64. void BusFault_Handler(void)
  65. {
  66. /* Go to infinite loop when Bus Fault exception occurs */
  67. while (1)
  68. {
  69. }
  70. }
  71. /**
  72. * @brief This function handles Usage Fault exception.
  73. * @param None
  74. * @retval None
  75. */
  76. void UsageFault_Handler(void)
  77. {
  78. /* Go to infinite loop when Usage Fault exception occurs */
  79. while (1)
  80. {
  81. }
  82. }
  83. /**
  84. * @brief This function handles SVCall exception.
  85. * @param None
  86. * @retval None
  87. */
  88. void SVC_Handler(void)
  89. {
  90. }
  91. /**
  92. * @brief This function handles Debug Monitor exception.
  93. * @param None
  94. * @retval None
  95. */
  96. void DebugMon_Handler(void)
  97. {
  98. }
  99. void SysTick_Handler(void)
  100. {
  101. extern void rt_hw_timer_handler(void);
  102. rt_hw_timer_handler();
  103. }
  104. /******************************************************************************/
  105. /* STM32F10x Peripherals Interrupt Handlers */
  106. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  107. /* available peripheral interrupt handler's name please refer to the startup */
  108. /* file (startup_stm32f10x_xx.s). */
  109. /******************************************************************************/
  110. /*******************************************************************************
  111. * Function Name : DMA1_Channel2_IRQHandler
  112. * Description : This function handles DMA1 Channel 2 interrupt request.
  113. * Input : None
  114. * Output : None
  115. * Return : None
  116. *******************************************************************************/
  117. void DMA1_Channel2_IRQHandler(void)
  118. {
  119. #ifdef RT_USING_UART3
  120. extern struct rt_device uart3_device;
  121. extern void rt_hw_serial_dma_tx_isr(struct rt_device *device);
  122. /* enter interrupt */
  123. rt_interrupt_enter();
  124. if (DMA_GetITStatus(DMA1_IT_TC2))
  125. {
  126. /* transmission complete, invoke serial dma tx isr */
  127. rt_hw_serial_dma_tx_isr(&uart3_device);
  128. }
  129. /* clear DMA flag */
  130. DMA_ClearFlag(DMA1_FLAG_TC2 | DMA1_FLAG_TE2);
  131. /* leave interrupt */
  132. rt_interrupt_leave();
  133. #endif
  134. }
  135. /*******************************************************************************
  136. * Function Name : USART1_IRQHandler
  137. * Description : This function handles USART1 global interrupt request.
  138. * Input : None
  139. * Output : None
  140. * Return : None
  141. *******************************************************************************/
  142. void USART1_IRQHandler(void)
  143. {
  144. #ifdef RT_USING_UART1
  145. extern struct rt_device uart1_device;
  146. extern void rt_hw_serial_isr(struct rt_device *device);
  147. /* enter interrupt */
  148. rt_interrupt_enter();
  149. rt_hw_serial_isr(&uart1_device);
  150. /* leave interrupt */
  151. rt_interrupt_leave();
  152. #endif
  153. }
  154. /*******************************************************************************
  155. * Function Name : USART2_IRQHandler
  156. * Description : This function handles USART2 global interrupt request.
  157. * Input : None
  158. * Output : None
  159. * Return : None
  160. *******************************************************************************/
  161. void USART2_IRQHandler(void)
  162. {
  163. #ifdef RT_USING_UART2
  164. extern struct rt_device uart2_device;
  165. extern void rt_hw_serial_isr(struct rt_device *device);
  166. /* enter interrupt */
  167. rt_interrupt_enter();
  168. rt_hw_serial_isr(&uart2_device);
  169. /* leave interrupt */
  170. rt_interrupt_leave();
  171. #endif
  172. }
  173. /*******************************************************************************
  174. * Function Name : USART3_IRQHandler
  175. * Description : This function handles USART3 global interrupt request.
  176. * Input : None
  177. * Output : None
  178. * Return : None
  179. *******************************************************************************/
  180. void USART3_IRQHandler(void)
  181. {
  182. #ifdef RT_USING_UART3
  183. extern struct rt_device uart3_device;
  184. extern void rt_hw_serial_isr(struct rt_device *device);
  185. /* enter interrupt */
  186. rt_interrupt_enter();
  187. rt_hw_serial_isr(&uart3_device);
  188. /* leave interrupt */
  189. rt_interrupt_leave();
  190. #endif
  191. }
  192. #if defined(RT_USING_DFS) && STM32_USE_SDIO
  193. /*******************************************************************************
  194. * Function Name : SDIO_IRQHandler
  195. * Description : This function handles SDIO global interrupt request.
  196. * Input : None
  197. * Output : None
  198. * Return : None
  199. *******************************************************************************/
  200. void SDIO_IRQHandler(void)
  201. {
  202. extern int SD_ProcessIRQSrc(void);
  203. /* enter interrupt */
  204. rt_interrupt_enter();
  205. /* Process All SDIO Interrupt Sources */
  206. SD_ProcessIRQSrc();
  207. /* leave interrupt */
  208. rt_interrupt_leave();
  209. }
  210. #endif
  211. #ifdef RT_USING_LWIP
  212. #ifdef STM32F10X_CL
  213. /*******************************************************************************
  214. * Function Name : ETH_IRQHandler
  215. * Description : This function handles ETH interrupt request.
  216. * Input : None
  217. * Output : None
  218. * Return : None
  219. *******************************************************************************/
  220. void ETH_IRQHandler(void)
  221. {
  222. extern void rt_hw_stm32_eth_isr(void);
  223. /* enter interrupt */
  224. rt_interrupt_enter();
  225. rt_hw_stm32_eth_isr();
  226. /* leave interrupt */
  227. rt_interrupt_leave();
  228. }
  229. #else
  230. #if (STM32_ETH_IF == 0)
  231. /*******************************************************************************
  232. * Function Name : EXTI0_IRQHandler
  233. * Description : This function handles External interrupt Line 0 request.
  234. * Input : None
  235. * Output : None
  236. * Return : None
  237. *******************************************************************************/
  238. void EXTI2_IRQHandler(void)
  239. {
  240. extern void enc28j60_isr(void);
  241. /* enter interrupt */
  242. rt_interrupt_enter();
  243. enc28j60_isr();
  244. /* Clear the Key Button EXTI line pending bit */
  245. EXTI_ClearITPendingBit(EXTI_Line2);
  246. /* leave interrupt */
  247. rt_interrupt_leave();
  248. }
  249. #endif
  250. #if (STM32_ETH_IF == 1)
  251. /*******************************************************************************
  252. * Function Name : EXTI4_IRQHandler
  253. * Description : This function handles External lines 9 to 5 interrupt request.
  254. * Input : None
  255. * Output : None
  256. * Return : None
  257. *******************************************************************************/
  258. void EXTI4_IRQHandler(void)
  259. {
  260. extern void rt_dm9000_isr(void);
  261. /* enter interrupt */
  262. rt_interrupt_enter();
  263. /* Clear the DM9000A EXTI line pending bit */
  264. EXTI_ClearITPendingBit(EXTI_Line4);
  265. rt_dm9000_isr();
  266. /* leave interrupt */
  267. rt_interrupt_leave();
  268. }
  269. #endif
  270. #endif
  271. #endif /* end of RT_USING_LWIP */
  272. /**
  273. * @}
  274. */
  275. /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/