stm32f10x_it.c 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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 <rtthread.h>
  25. /** @addtogroup Template_Project
  26. * @{
  27. */
  28. /* Private typedef -----------------------------------------------------------*/
  29. /* Private define ------------------------------------------------------------*/
  30. /* Private macro -------------------------------------------------------------*/
  31. /* Private variables ---------------------------------------------------------*/
  32. /* Private function prototypes -----------------------------------------------*/
  33. /* Private functions ---------------------------------------------------------*/
  34. /******************************************************************************/
  35. /* Cortex-M3 Processor Exceptions Handlers */
  36. /******************************************************************************/
  37. /**
  38. * @brief This function handles NMI exception.
  39. * @param None
  40. * @retval None
  41. */
  42. void NMI_Handler(void)
  43. {
  44. }
  45. /**
  46. * @brief This function handles Hard Fault exception.
  47. * @param None
  48. * @retval None
  49. */
  50. void HardFault_Handler(void)
  51. {
  52. /* Go to infinite loop when Hard Fault exception occurs */
  53. while (1)
  54. {
  55. }
  56. }
  57. /**
  58. * @brief This function handles Memory Manage exception.
  59. * @param None
  60. * @retval None
  61. */
  62. void MemManage_Handler(void)
  63. {
  64. /* Go to infinite loop when Memory Manage exception occurs */
  65. while (1)
  66. {
  67. }
  68. }
  69. /**
  70. * @brief This function handles Bus Fault exception.
  71. * @param None
  72. * @retval None
  73. */
  74. void BusFault_Handler(void)
  75. {
  76. /* Go to infinite loop when Bus Fault exception occurs */
  77. while (1)
  78. {
  79. }
  80. }
  81. /**
  82. * @brief This function handles Usage Fault exception.
  83. * @param None
  84. * @retval None
  85. */
  86. void UsageFault_Handler(void)
  87. {
  88. /* Go to infinite loop when Usage Fault exception occurs */
  89. while (1)
  90. {
  91. }
  92. }
  93. /**
  94. * @brief This function handles SVCall exception.
  95. * @param None
  96. * @retval None
  97. */
  98. void SVC_Handler(void)
  99. {
  100. }
  101. /**
  102. * @brief This function handles Debug Monitor exception.
  103. * @param None
  104. * @retval None
  105. */
  106. void DebugMon_Handler(void)
  107. {
  108. }
  109. /******************************************************************************/
  110. /* STM32F10x Peripherals Interrupt Handlers */
  111. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  112. /* available peripheral interrupt handler's name please refer to the startup */
  113. /* file (startup_stm32f10x_xx.s). */
  114. /******************************************************************************/
  115. /*******************************************************************************
  116. * Function Name : DMA1_Channel2_IRQHandler
  117. * Description : This function handles DMA1 Channel 2 interrupt request.
  118. * Input : None
  119. * Output : None
  120. * Return : None
  121. *******************************************************************************/
  122. void DMA1_Channel2_IRQHandler(void)
  123. {
  124. #ifdef RT_USING_UART3
  125. extern struct rt_device uart3_device;
  126. extern void rt_hw_serial_dma_tx_isr(struct rt_device *device);
  127. /* enter interrupt */
  128. rt_interrupt_enter();
  129. if (DMA_GetITStatus(DMA1_IT_TC2))
  130. {
  131. /* transmission complete, invoke serial dma tx isr */
  132. rt_hw_serial_dma_tx_isr(&uart3_device);
  133. }
  134. /* clear DMA flag */
  135. DMA_ClearFlag(DMA1_FLAG_TC2 | DMA1_FLAG_TE2);
  136. /* leave interrupt */
  137. rt_interrupt_leave();
  138. #endif
  139. }
  140. /*******************************************************************************
  141. * Function Name : DMA1_Channel6_IRQHandler
  142. * Description : This function handles DMA1 Channel 6 interrupt request.
  143. * Input : None
  144. * Output : None
  145. * Return : None
  146. *******************************************************************************/
  147. void DMA1_Channel6_IRQHandler(void)
  148. {
  149. #ifdef RT_USING_UART2
  150. extern struct rt_device uart2_device;
  151. extern void rt_hw_serial_dma_rx_isr(struct rt_device *device);
  152. /* enter interrupt */
  153. rt_interrupt_enter();
  154. /* clear DMA flag */
  155. DMA_ClearFlag(DMA1_FLAG_TC6 | DMA1_FLAG_TE6);
  156. rt_hw_serial_dma_rx_isr(&uart2_device);
  157. /* leave interrupt */
  158. rt_interrupt_leave();
  159. #endif
  160. }
  161. /*******************************************************************************
  162. * Function Name : USART1_IRQHandler
  163. * Description : This function handles USART1 global interrupt request.
  164. * Input : None
  165. * Output : None
  166. * Return : None
  167. *******************************************************************************/
  168. void USART1_IRQHandler(void)
  169. {
  170. #ifdef RT_USING_UART1
  171. extern struct rt_device uart1_device;
  172. extern void rt_hw_serial_isr(struct rt_device *device);
  173. /* enter interrupt */
  174. rt_interrupt_enter();
  175. rt_hw_serial_isr(&uart1_device);
  176. /* leave interrupt */
  177. rt_interrupt_leave();
  178. #endif
  179. }
  180. /*******************************************************************************
  181. * Function Name : USART2_IRQHandler
  182. * Description : This function handles USART2 global interrupt request.
  183. * Input : None
  184. * Output : None
  185. * Return : None
  186. *******************************************************************************/
  187. void USART2_IRQHandler(void)
  188. {
  189. #ifdef RT_USING_UART2
  190. extern struct rt_device uart2_device;
  191. extern void rt_hw_serial_isr(struct rt_device *device);
  192. /* enter interrupt */
  193. rt_interrupt_enter();
  194. rt_hw_serial_isr(&uart2_device);
  195. /* leave interrupt */
  196. rt_interrupt_leave();
  197. #endif
  198. }
  199. /*******************************************************************************
  200. * Function Name : USART3_IRQHandler
  201. * Description : This function handles USART3 global interrupt request.
  202. * Input : None
  203. * Output : None
  204. * Return : None
  205. *******************************************************************************/
  206. void USART3_IRQHandler(void)
  207. {
  208. #ifdef RT_USING_UART3
  209. extern struct rt_device uart3_device;
  210. extern void rt_hw_serial_isr(struct rt_device *device);
  211. /* enter interrupt */
  212. rt_interrupt_enter();
  213. rt_hw_serial_isr(&uart3_device);
  214. /* leave interrupt */
  215. rt_interrupt_leave();
  216. #endif
  217. }
  218. /**
  219. * @}
  220. */
  221. /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/