stm32f4xx_it.c 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_it.c
  4. * @brief Interrupt Service Routines.
  5. ******************************************************************************
  6. *
  7. * COPYRIGHT(c) 2018 STMicroelectronics
  8. *
  9. * Redistribution and use in source and binary forms, with or without modification,
  10. * are permitted provided that the following conditions are met:
  11. * 1. Redistributions of source code must retain the above copyright notice,
  12. * this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright notice,
  14. * this list of conditions and the following disclaimer in the documentation
  15. * and/or other materials provided with the distribution.
  16. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  17. * may be used to endorse or promote products derived from this software
  18. * without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  24. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  26. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  27. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. *
  31. ******************************************************************************
  32. */
  33. /* Includes ------------------------------------------------------------------*/
  34. #include "stm32f4xx_hal.h"
  35. #include "stm32f4xx.h"
  36. #include "stm32f4xx_it.h"
  37. /* USER CODE BEGIN 0 */
  38. #include "bexus_sysclock.h"
  39. uint32_t systicklast=0;
  40. /* USER CODE END 0 */
  41. /* External variables --------------------------------------------------------*/
  42. extern ETH_HandleTypeDef heth;
  43. extern DMA_HandleTypeDef hdma_adc1;
  44. extern DMA_HandleTypeDef hdma_adc3;
  45. extern ADC_HandleTypeDef hadc1;
  46. extern ADC_HandleTypeDef hadc3;
  47. extern DMA_HandleTypeDef hdma_sdio;
  48. extern SD_HandleTypeDef hsd;
  49. extern TIM_HandleTypeDef htim6;
  50. extern DMA_HandleTypeDef hdma_usart2_rx;
  51. extern DMA_HandleTypeDef hdma_usart2_tx;
  52. extern DMA_HandleTypeDef hdma_usart3_rx;
  53. extern DMA_HandleTypeDef hdma_usart3_tx;
  54. extern UART_HandleTypeDef huart3;
  55. extern UART_HandleTypeDef huart6;
  56. extern TIM_HandleTypeDef htim1;
  57. /******************************************************************************/
  58. /* Cortex-M4 Processor Interruption and Exception Handlers */
  59. /******************************************************************************/
  60. /**
  61. * @brief This function handles System service call via SWI instruction.
  62. */
  63. void SVC_Handler(void)
  64. {
  65. /* USER CODE BEGIN SVCall_IRQn 0 */
  66. /* USER CODE END SVCall_IRQn 0 */
  67. /* USER CODE BEGIN SVCall_IRQn 1 */
  68. /* USER CODE END SVCall_IRQn 1 */
  69. }
  70. /**
  71. * @brief This function handles Pendable request for system service.
  72. */
  73. void PendSV_Handler(void)
  74. {
  75. /* USER CODE BEGIN PendSV_IRQn 0 */
  76. /* USER CODE END PendSV_IRQn 0 */
  77. /* USER CODE BEGIN PendSV_IRQn 1 */
  78. /* USER CODE END PendSV_IRQn 1 */
  79. }
  80. /**
  81. * @brief This function handles System tick timer.
  82. */
  83. void SysTick_Handler(void)
  84. {
  85. /* USER CODE BEGIN SysTick_IRQn 0 */
  86. /* USER CODE END SysTick_IRQn 0 */
  87. HAL_SYSTICK_IRQHandler();
  88. /* USER CODE BEGIN SysTick_IRQn 1 */
  89. sysTickCounter++;
  90. lastCoreClock = DWT->CYCCNT;
  91. /* USER CODE END SysTick_IRQn 1 */
  92. }
  93. /******************************************************************************/
  94. /* STM32F4xx Peripheral Interrupt Handlers */
  95. /* Add here the Interrupt Handlers for the used peripherals. */
  96. /* For the available peripheral interrupt handler names, */
  97. /* please refer to the startup file (startup_stm32f4xx.s). */
  98. /******************************************************************************/
  99. /**
  100. * @brief This function handles DMA1 stream1 global interrupt.
  101. */
  102. void DMA1_Stream1_IRQHandler(void)
  103. {
  104. /* USER CODE BEGIN DMA1_Stream1_IRQn 0 */
  105. /* USER CODE END DMA1_Stream1_IRQn 0 */
  106. HAL_DMA_IRQHandler(&hdma_usart3_rx);
  107. /* USER CODE BEGIN DMA1_Stream1_IRQn 1 */
  108. /* USER CODE END DMA1_Stream1_IRQn 1 */
  109. }
  110. /**
  111. * @brief This function handles DMA1 stream3 global interrupt.
  112. */
  113. void DMA1_Stream3_IRQHandler(void)
  114. {
  115. /* USER CODE BEGIN DMA1_Stream3_IRQn 0 */
  116. /* USER CODE END DMA1_Stream3_IRQn 0 */
  117. HAL_DMA_IRQHandler(&hdma_usart3_tx);
  118. /* USER CODE BEGIN DMA1_Stream3_IRQn 1 */
  119. /* USER CODE END DMA1_Stream3_IRQn 1 */
  120. }
  121. /**
  122. * @brief This function handles DMA1 stream5 global interrupt.
  123. */
  124. void DMA1_Stream5_IRQHandler(void)
  125. {
  126. /* USER CODE BEGIN DMA1_Stream5_IRQn 0 */
  127. /* USER CODE END DMA1_Stream5_IRQn 0 */
  128. HAL_DMA_IRQHandler(&hdma_usart2_rx);
  129. /* USER CODE BEGIN DMA1_Stream5_IRQn 1 */
  130. /* USER CODE END DMA1_Stream5_IRQn 1 */
  131. }
  132. /**
  133. * @brief This function handles DMA1 stream6 global interrupt.
  134. */
  135. void DMA1_Stream6_IRQHandler(void)
  136. {
  137. /* USER CODE BEGIN DMA1_Stream6_IRQn 0 */
  138. /* USER CODE END DMA1_Stream6_IRQn 0 */
  139. HAL_DMA_IRQHandler(&hdma_usart2_tx);
  140. /* USER CODE BEGIN DMA1_Stream6_IRQn 1 */
  141. /* USER CODE END DMA1_Stream6_IRQn 1 */
  142. }
  143. /**
  144. * @brief This function handles ADC1, ADC2 and ADC3 global interrupts.
  145. */
  146. void ADC_IRQHandler(void)
  147. {
  148. /* USER CODE BEGIN ADC_IRQn 0 */
  149. /* USER CODE END ADC_IRQn 0 */
  150. HAL_ADC_IRQHandler(&hadc1);
  151. HAL_ADC_IRQHandler(&hadc3);
  152. /* USER CODE BEGIN ADC_IRQn 1 */
  153. /* USER CODE END ADC_IRQn 1 */
  154. }
  155. /**
  156. * @brief This function handles TIM1 update interrupt and TIM10 global interrupt.
  157. */
  158. void TIM1_UP_TIM10_IRQHandler(void)
  159. {
  160. /* USER CODE BEGIN TIM1_UP_TIM10_IRQn 0 */
  161. /* USER CODE END TIM1_UP_TIM10_IRQn 0 */
  162. HAL_TIM_IRQHandler(&htim1);
  163. /* USER CODE BEGIN TIM1_UP_TIM10_IRQn 1 */
  164. /* USER CODE END TIM1_UP_TIM10_IRQn 1 */
  165. }
  166. /**
  167. * @brief This function handles USART3 global interrupt.
  168. */
  169. void USART3_IRQHandler(void)
  170. {
  171. /* USER CODE BEGIN USART3_IRQn 0 */
  172. /* USER CODE END USART3_IRQn 0 */
  173. HAL_UART_IRQHandler(&huart3);
  174. /* USER CODE BEGIN USART3_IRQn 1 */
  175. /* USER CODE END USART3_IRQn 1 */
  176. }
  177. /**
  178. * @brief This function handles SDIO global interrupt.
  179. */
  180. void SDIO_IRQHandler(void)
  181. {
  182. /* USER CODE BEGIN SDIO_IRQn 0 */
  183. /* USER CODE END SDIO_IRQn 0 */
  184. HAL_SD_IRQHandler(&hsd);
  185. /* USER CODE BEGIN SDIO_IRQn 1 */
  186. /* USER CODE END SDIO_IRQn 1 */
  187. }
  188. /**
  189. * @brief This function handles TIM6 global interrupt, DAC1 and DAC2 underrun error interrupts.
  190. */
  191. void TIM6_DAC_IRQHandler(void)
  192. {
  193. /* USER CODE BEGIN TIM6_DAC_IRQn 0 */
  194. /* USER CODE END TIM6_DAC_IRQn 0 */
  195. HAL_TIM_IRQHandler(&htim6);
  196. /* USER CODE BEGIN TIM6_DAC_IRQn 1 */
  197. sysTickCounter++;
  198. /* USER CODE END TIM6_DAC_IRQn 1 */
  199. }
  200. /**
  201. * @brief This function handles DMA2 stream0 global interrupt.
  202. */
  203. void DMA2_Stream0_IRQHandler(void)
  204. {
  205. /* USER CODE BEGIN DMA2_Stream0_IRQn 0 */
  206. /* USER CODE END DMA2_Stream0_IRQn 0 */
  207. HAL_DMA_IRQHandler(&hdma_adc3);
  208. /* USER CODE BEGIN DMA2_Stream0_IRQn 1 */
  209. /* USER CODE END DMA2_Stream0_IRQn 1 */
  210. }
  211. /**
  212. * @brief This function handles DMA2 stream3 global interrupt.
  213. */
  214. void DMA2_Stream3_IRQHandler(void)
  215. {
  216. /* USER CODE BEGIN DMA2_Stream3_IRQn 0 */
  217. /* USER CODE END DMA2_Stream3_IRQn 0 */
  218. HAL_DMA_IRQHandler(&hdma_sdio);
  219. /* USER CODE BEGIN DMA2_Stream3_IRQn 1 */
  220. /* USER CODE END DMA2_Stream3_IRQn 1 */
  221. }
  222. /**
  223. * @brief This function handles DMA2 stream4 global interrupt.
  224. */
  225. void DMA2_Stream4_IRQHandler(void)
  226. {
  227. /* USER CODE BEGIN DMA2_Stream4_IRQn 0 */
  228. /* USER CODE END DMA2_Stream4_IRQn 0 */
  229. HAL_DMA_IRQHandler(&hdma_adc1);
  230. /* USER CODE BEGIN DMA2_Stream4_IRQn 1 */
  231. /* USER CODE END DMA2_Stream4_IRQn 1 */
  232. }
  233. /**
  234. * @brief This function handles Ethernet global interrupt.
  235. */
  236. void ETH_IRQHandler(void)
  237. {
  238. /* USER CODE BEGIN ETH_IRQn 0 */
  239. /* USER CODE END ETH_IRQn 0 */
  240. HAL_ETH_IRQHandler(&heth);
  241. /* USER CODE BEGIN ETH_IRQn 1 */
  242. /* USER CODE END ETH_IRQn 1 */
  243. }
  244. /**
  245. * @brief This function handles USART6 global interrupt.
  246. */
  247. void USART6_IRQHandler(void)
  248. {
  249. /* USER CODE BEGIN USART6_IRQn 0 */
  250. /* USER CODE END USART6_IRQn 0 */
  251. HAL_UART_IRQHandler(&huart6);
  252. /* USER CODE BEGIN USART6_IRQn 1 */
  253. /* USER CODE END USART6_IRQn 1 */
  254. }
  255. /* USER CODE BEGIN 1 */
  256. /* USER CODE END 1 */
  257. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/