stm32f10x_it.c 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. // // definition in boarc.c
  102. //}
  103. /******************************************************************************/
  104. /* STM32F10x Peripherals Interrupt Handlers */
  105. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  106. /* available peripheral interrupt handler's name please refer to the startup */
  107. /* file (startup_stm32f10x_xx.s). */
  108. /******************************************************************************/
  109. /*******************************************************************************
  110. * Function Name : DMA1_Channel2_IRQHandler
  111. * Description : This function handles DMA1 Channel 2 interrupt request.
  112. * Input : None
  113. * Output : None
  114. * Return : None
  115. *******************************************************************************/
  116. void DMA1_Channel2_IRQHandler(void)
  117. {
  118. #ifdef RT_USING_UART3
  119. extern struct rt_device uart3_device;
  120. extern void rt_hw_serial_dma_tx_isr(struct rt_device *device);
  121. /* enter interrupt */
  122. rt_interrupt_enter();
  123. if (DMA_GetITStatus(DMA1_IT_TC2))
  124. {
  125. /* transmission complete, invoke serial dma tx isr */
  126. rt_hw_serial_dma_tx_isr(&uart3_device);
  127. }
  128. /* clear DMA flag */
  129. DMA_ClearFlag(DMA1_FLAG_TC2 | DMA1_FLAG_TE2);
  130. /* leave interrupt */
  131. rt_interrupt_leave();
  132. #endif
  133. }
  134. /*******************************************************************************
  135. * Function Name : USART1_IRQHandler
  136. * Description : This function handles USART1 global interrupt request.
  137. * Input : None
  138. * Output : None
  139. * Return : None
  140. *******************************************************************************/
  141. void USART1_IRQHandler(void)
  142. {
  143. #ifdef RT_USING_UART1
  144. extern struct rt_device uart1_device;
  145. extern void rt_hw_serial_isr(struct rt_device *device);
  146. /* enter interrupt */
  147. rt_interrupt_enter();
  148. rt_hw_serial_isr(&uart1_device);
  149. /* leave interrupt */
  150. rt_interrupt_leave();
  151. #endif
  152. }
  153. /*******************************************************************************
  154. * Function Name : USART2_IRQHandler
  155. * Description : This function handles USART2 global interrupt request.
  156. * Input : None
  157. * Output : None
  158. * Return : None
  159. *******************************************************************************/
  160. void USART2_IRQHandler(void)
  161. {
  162. #ifdef RT_USING_UART2
  163. extern struct rt_device uart2_device;
  164. extern void rt_hw_serial_isr(struct rt_device *device);
  165. /* enter interrupt */
  166. rt_interrupt_enter();
  167. rt_hw_serial_isr(&uart2_device);
  168. /* leave interrupt */
  169. rt_interrupt_leave();
  170. #endif
  171. }
  172. /*******************************************************************************
  173. * Function Name : USART3_IRQHandler
  174. * Description : This function handles USART3 global interrupt request.
  175. * Input : None
  176. * Output : None
  177. * Return : None
  178. *******************************************************************************/
  179. void USART3_IRQHandler(void)
  180. {
  181. #ifdef RT_USING_UART3
  182. extern struct rt_device uart3_device;
  183. extern void rt_hw_serial_isr(struct rt_device *device);
  184. /* enter interrupt */
  185. rt_interrupt_enter();
  186. rt_hw_serial_isr(&uart3_device);
  187. /* leave interrupt */
  188. rt_interrupt_leave();
  189. #endif
  190. }
  191. #ifdef RT_USING_LWIP
  192. /*******************************************************************************
  193. * Function Name : EXTI4_IRQHandler
  194. * Description : This function handles External lines 9 to 5 interrupt request.
  195. * Input : None
  196. * Output : None
  197. * Return : None
  198. *******************************************************************************/
  199. void EXTI4_IRQHandler(void)
  200. {
  201. extern void rt_dm9000_isr(void);
  202. /* enter interrupt */
  203. rt_interrupt_enter();
  204. /* Clear the DM9000A EXTI line pending bit */
  205. EXTI_ClearITPendingBit(EXTI_Line4);
  206. rt_dm9000_isr();
  207. /* leave interrupt */
  208. rt_interrupt_leave();
  209. }
  210. #endif /* RT_USING_LWIP */
  211. /**
  212. * @}
  213. */
  214. /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/