stm32f10x_it.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. /**
  2. ******************************************************************************
  3. * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_it.c
  4. * @author MCD Application Team
  5. * @version V3.4.0
  6. * @date 10/15/2010
  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 2010 STMicroelectronics</center></h2>
  21. */
  22. /* Includes ------------------------------------------------------------------*/
  23. #include "includes.h"
  24. /** @addtogroup STM32F10x_StdPeriph_Template
  25. * @{
  26. */
  27. /* Private typedef -----------------------------------------------------------*/
  28. /* Private define ------------------------------------------------------------*/
  29. /* Private macro -------------------------------------------------------------*/
  30. /* Private variables ---------------------------------------------------------*/
  31. /* Private function prototypes -----------------------------------------------*/
  32. /* Private functions ---------------------------------------------------------*/
  33. /******************************************************************************/
  34. /* Cortex-M3 Processor Exceptions Handlers */
  35. /******************************************************************************/
  36. /**
  37. * @brief This function handles NMI exception.
  38. * @param None
  39. * @retval None
  40. */
  41. void NMI_Handler(void)
  42. {
  43. }
  44. /**
  45. * @brief This function handles Hard Fault exception.
  46. * @param None
  47. * @retval None
  48. */
  49. void HardFault_Handler(void)
  50. {
  51. /* Go to infinite loop when Hard Fault exception occurs */
  52. while (1)
  53. {
  54. }
  55. }
  56. /**
  57. * @brief This function handles Memory Manage exception.
  58. * @param None
  59. * @retval None
  60. */
  61. void MemManage_Handler(void)
  62. {
  63. /* Go to infinite loop when Memory Manage exception occurs */
  64. while (1)
  65. {
  66. }
  67. }
  68. /**
  69. * @brief This function handles Bus Fault exception.
  70. * @param None
  71. * @retval None
  72. */
  73. void BusFault_Handler(void)
  74. {
  75. /* Go to infinite loop when Bus Fault exception occurs */
  76. while (1)
  77. {
  78. }
  79. }
  80. /**
  81. * @brief This function handles Usage Fault exception.
  82. * @param None
  83. * @retval None
  84. */
  85. void UsageFault_Handler(void)
  86. {
  87. /* Go to infinite loop when Usage Fault exception occurs */
  88. while (1)
  89. {
  90. }
  91. }
  92. /**
  93. * @brief This function handles SVCall exception.
  94. * @param None
  95. * @retval None
  96. */
  97. void SVC_Handler(void)
  98. {
  99. }
  100. /**
  101. * @brief This function handles Debug Monitor exception.
  102. * @param None
  103. * @retval None
  104. */
  105. void DebugMon_Handler(void)
  106. {
  107. }
  108. /**
  109. * @brief This function handles PendSVC exception.
  110. * @param None
  111. * @retval None
  112. */
  113. void PendSV_Handler(void)
  114. {
  115. }
  116. /**
  117. * @brief This function handles SysTick Handler.
  118. * @param None
  119. * @retval None
  120. */
  121. void SysTick_Handler(void)
  122. {
  123. BSP_SysTick();
  124. //TimingDelay_Decrement();
  125. }
  126. /*******************************************************************************
  127. * Function Name : TIM2_IRQHandler
  128. * Description : This function handles TIM2 global interrupt request.
  129. * Input : None
  130. * Output : None
  131. * Return : None
  132. *******************************************************************************/
  133. void TIM2_IRQHandler(void)
  134. {
  135. if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)
  136. {
  137. TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
  138. }
  139. }
  140. /*******************************************************************************
  141. * Function Name : TIM3_IRQHandler
  142. * Description : This function handles TIM3 global interrupt request.
  143. * Input : None
  144. * Output : None
  145. * Return : None
  146. *******************************************************************************/
  147. void TIM3_IRQHandler(void)
  148. {
  149. // Pwm_Int();
  150. TIM3->SR=0;
  151. }
  152. /*******************************************************************************
  153. * Function Name : USART1_IRQHandler
  154. * Description : This function handles USART1 global interrupt request.
  155. * Input : None
  156. * Output : None
  157. * Return : None
  158. *******************************************************************************/
  159. void USART1_IRQHandler(void)
  160. {
  161. MPU_UartInt();
  162. }
  163. /*******************************************************************************
  164. * Function Name : USART2_IRQHandler
  165. * Description : This function handles USART2 global interrupt request.
  166. * Input : None
  167. * Output : None
  168. * Return : None
  169. *******************************************************************************/
  170. void USART2_IRQHandler(void)
  171. {
  172. //Obd_UartInt();
  173. }
  174. /*******************************************************************************
  175. * Function Name : USART3_IRQHandler
  176. * Description : This function handles USART3 global interrupt request.
  177. * Input : None
  178. * Output : None
  179. * Return : None
  180. *******************************************************************************/
  181. void USART3_IRQHandler(void)
  182. {
  183. //GSM_UartInt();
  184. }
  185. /*******************************************************************************
  186. * Function Name : UART4_IRQHandler
  187. * Description : This function handles UART4 global interrupt request.
  188. * Input : None
  189. * Output : None
  190. * Return : None
  191. *******************************************************************************/
  192. void UART4_IRQHandler(void)
  193. {
  194. //GSM_UartInt();
  195. //gps_UartInt();
  196. }
  197. /*******************************************************************************
  198. * Function Name : UART5_IRQHandler
  199. * Description : This function handles UART5 global interrupt request.
  200. * Input : None
  201. * Output : None
  202. * Return : None
  203. *******************************************************************************/
  204. void UART5_IRQHandler(void)
  205. {
  206. }
  207. /*******************************************************************************
  208. * Function Name : EXTI1_IRQHandler
  209. * Description : This function handles External lines 1 interrupt request.
  210. * Input : None
  211. * Output : None
  212. * Return : None
  213. *******************************************************************************/
  214. void EXTI1_IRQHandler(void)
  215. {
  216. if(EXTI_GetITStatus(EXTI_Line1) == SET)
  217. {
  218. if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_1)==0)//PA1 ACC INPUT//
  219. {
  220. }
  221. EXTI_ClearITPendingBit(EXTI_Line1);
  222. }
  223. }
  224. /*******************************************************************************
  225. * Function Name : EXTI15_10_IRQHandler
  226. * Description : This function handles External lines 15 to 10 interrupt request.
  227. * Input : None
  228. * Output : None
  229. * Return : None
  230. *******************************************************************************/
  231. void EXTI9_5_IRQHandler(void)
  232. {
  233. //Trace("555555555555555555555555555555555555555555555555555");
  234. if(EXTI_GetITStatus(EXTI_Line5) == SET) //PB6 SOS Key//
  235. {
  236. EXTI_ClearITPendingBit(EXTI_Line5);
  237. }
  238. }
  239. /*******************************************************************************
  240. * Function Name : EXTI15_10_IRQHandler
  241. * Description : This function handles External lines 15 to 10 interrupt request.
  242. * Input : None
  243. * Output : None
  244. * Return : None
  245. *******************************************************************************/
  246. void EXTI15_10_IRQHandler(void)
  247. {
  248. if(EXTI_GetITStatus(EXTI_Line11) == SET)
  249. {
  250. if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_11)==0)//PA11 CAN1 RX INPUT//
  251. {
  252. }
  253. EXTI_ClearITPendingBit(EXTI_Line11);
  254. }
  255. if(EXTI_GetITStatus(EXTI_Line12) == SET)
  256. {
  257. if (GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_12)==0)//PB12 CAN2 RX INPUT//
  258. {
  259. }
  260. EXTI_ClearITPendingBit(EXTI_Line11);
  261. }
  262. }
  263. /******************************************************************************/
  264. /* STM32F10x Peripherals Interrupt Handlers */
  265. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  266. /* available peripheral interrupt handler's name please refer to the startup */
  267. /* file (startup_stm32f10x_xx.s). */
  268. /******************************************************************************/
  269. /**
  270. * @brief This function handles PPP interrupt request.
  271. * @param None
  272. * @retval None
  273. */
  274. /*void PPP_IRQHandler(void)
  275. {
  276. }*/
  277. /**
  278. * @}
  279. */
  280. /*******************************************************************************
  281. * Function Name : ADC1_2_IRQHandler
  282. * Description : This function handles ADC1 and ADC2 global interrupts requests.
  283. * Input : None
  284. * Output : None
  285. * Return : None
  286. *******************************************************************************/
  287. void ADC1_2_IRQHandler(void)
  288. {
  289. if (ADC_GetITStatus(ADC1, ADC_IT_AWD) != RESET)
  290. {
  291. /* Clear ADC1 AWD pending interrupt bit */
  292. ADC_ClearITPendingBit(ADC1, ADC_IT_AWD);
  293. if(!AdcWtdg.AccOningFg)
  294. {
  295. AdcWtdg.cnt = 0;
  296. AdcWtdg.AccOningFg = TRUE;
  297. GetSysTick((u32 *) &AdcWtdg.time);
  298. }
  299. AdcWtdg.cnt ++;
  300. }
  301. }
  302. #if 0
  303. /*******************************************************************************
  304. * Function Name : RTC_IRQHandler
  305. * Description : This function handles RTC global interrupt request.
  306. * Input : None
  307. * Output : None
  308. * Return : None
  309. *******************************************************************************/
  310. void RTC_IRQHandler(void)
  311. {
  312. if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
  313. {
  314. /* Clear the RTC Second interrupt */
  315. RTC_ClearITPendingBit(RTC_IT_SEC);
  316. RTC_WaitForLastTask();
  317. }
  318. else if (RTC_GetITStatus(RTC_IT_ALR) != RESET)
  319. {
  320. /* Clear the RTC Second interrupt */
  321. RTC_ClearITPendingBit(RTC_IT_ALR);
  322. RTC_WaitForLastTask();
  323. }
  324. }
  325. #endif
  326. void RTCAlarm_IRQHandler(void)
  327. {
  328. EXTI_ClearITPendingBit(EXTI_Line17);
  329. }
  330. #if 0
  331. #if CAN1_RX0_INT_ENABLE //使能RX0中断
  332. //中断服务函数
  333. void CAN1_RX0_IRQHandler(void)
  334. {
  335. CanRxMsg RxMessage;
  336. //int i=0;
  337. CAN_Receive(CAN1, CAN_FIFO0, &RxMessage);
  338. //for(i=0;i<8;i++)
  339. //printf("rxbuf[%d]:%d\r\n",i,RxMessage.Data[i]);
  340. }
  341. #endif
  342. #if CAN2_RX0_INT_ENABLE //使能RX0中断
  343. //中断服务函数
  344. void CAN2_RX0_IRQHandler(void)
  345. {
  346. CanRxMsg RxMessage;
  347. //int i=0;
  348. CAN_Receive(CAN2, CAN_FIFO0, &RxMessage);
  349. //for(i=0;i<8;i++)
  350. //printf("rxbuf[%d]:%d\r\n",i,RxMessage.Data[i]);
  351. }
  352. #endif
  353. #endif
  354. /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/