stm32g4xx_it.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file stm32g4xx_it.c
  5. * @brief Interrupt Service Routines.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2025 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* USER CODE END Header */
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "main.h"
  21. #include "stm32g4xx_it.h"
  22. #include "FreeRTOS.h"
  23. #include "task.h"
  24. /* Private includes ----------------------------------------------------------*/
  25. /* USER CODE BEGIN Includes */
  26. /* USER CODE END Includes */
  27. /* Private typedef -----------------------------------------------------------*/
  28. /* USER CODE BEGIN TD */
  29. /* USER CODE END TD */
  30. /* Private define ------------------------------------------------------------*/
  31. /* USER CODE BEGIN PD */
  32. /* USER CODE END PD */
  33. /* Private macro -------------------------------------------------------------*/
  34. /* USER CODE BEGIN PM */
  35. /* USER CODE END PM */
  36. /* Private variables ---------------------------------------------------------*/
  37. /* USER CODE BEGIN PV */
  38. /* USER CODE END PV */
  39. /* Private function prototypes -----------------------------------------------*/
  40. /* USER CODE BEGIN PFP */
  41. /* USER CODE END PFP */
  42. /* Private user code ---------------------------------------------------------*/
  43. /* USER CODE BEGIN 0 */
  44. /* USER CODE END 0 */
  45. /* External variables --------------------------------------------------------*/
  46. //extern PCD_HandleTypeDef hpcd_USB_FS;
  47. /* USER CODE BEGIN EV */
  48. /* USER CODE END EV */
  49. /******************************************************************************/
  50. /* Cortex-M4 Processor Interruption and Exception Handlers */
  51. /******************************************************************************/
  52. /**
  53. * @brief This function handles Non maskable interrupt.
  54. */
  55. void NMI_Handler(void)
  56. {
  57. /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
  58. /* USER CODE END NonMaskableInt_IRQn 0 */
  59. /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
  60. while (1)
  61. {
  62. }
  63. /* USER CODE END NonMaskableInt_IRQn 1 */
  64. }
  65. /**
  66. * @brief This function handles Hard fault interrupt.
  67. */
  68. void HardFault_Handler(void)
  69. {
  70. /* USER CODE BEGIN HardFault_IRQn 0 */
  71. /* USER CODE END HardFault_IRQn 0 */
  72. while (1)
  73. {
  74. /* USER CODE BEGIN W1_HardFault_IRQn 0 */
  75. /* USER CODE END W1_HardFault_IRQn 0 */
  76. }
  77. }
  78. /**
  79. * @brief This function handles Memory management fault.
  80. */
  81. void MemManage_Handler(void)
  82. {
  83. /* USER CODE BEGIN MemoryManagement_IRQn 0 */
  84. /* USER CODE END MemoryManagement_IRQn 0 */
  85. while (1)
  86. {
  87. /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
  88. /* USER CODE END W1_MemoryManagement_IRQn 0 */
  89. }
  90. }
  91. /**
  92. * @brief This function handles Prefetch fault, memory access fault.
  93. */
  94. void BusFault_Handler(void)
  95. {
  96. /* USER CODE BEGIN BusFault_IRQn 0 */
  97. /* USER CODE END BusFault_IRQn 0 */
  98. while (1)
  99. {
  100. /* USER CODE BEGIN W1_BusFault_IRQn 0 */
  101. /* USER CODE END W1_BusFault_IRQn 0 */
  102. }
  103. }
  104. /**
  105. * @brief This function handles Undefined instruction or illegal state.
  106. */
  107. void UsageFault_Handler(void)
  108. {
  109. /* USER CODE BEGIN UsageFault_IRQn 0 */
  110. /* USER CODE END UsageFault_IRQn 0 */
  111. while (1)
  112. {
  113. /* USER CODE BEGIN W1_UsageFault_IRQn 0 */
  114. /* USER CODE END W1_UsageFault_IRQn 0 */
  115. }
  116. }
  117. /**
  118. * @brief This function handles Debug monitor.
  119. */
  120. void DebugMon_Handler(void)
  121. {
  122. /* USER CODE BEGIN DebugMonitor_IRQn 0 */
  123. /* USER CODE END DebugMonitor_IRQn 0 */
  124. /* USER CODE BEGIN DebugMonitor_IRQn 1 */
  125. /* USER CODE END DebugMonitor_IRQn 1 */
  126. }
  127. /**
  128. * @brief This function handles System tick timer.
  129. */
  130. void SysTick_Handler(void)
  131. {
  132. /* USER CODE BEGIN SysTick_IRQn 0 */
  133. /* USER CODE END SysTick_IRQn 0 */
  134. HAL_IncTick();
  135. #if (INCLUDE_xTaskGetSchedulerState == 1 )
  136. if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
  137. {
  138. #endif /* INCLUDE_xTaskGetSchedulerState */
  139. xPortSysTickHandler();
  140. #if (INCLUDE_xTaskGetSchedulerState == 1 )
  141. }
  142. #endif /* INCLUDE_xTaskGetSchedulerState */
  143. /* USER CODE BEGIN SysTick_IRQn 1 */
  144. /* USER CODE END SysTick_IRQn 1 */
  145. }
  146. /******************************************************************************/
  147. /* STM32G4xx Peripheral Interrupt Handlers */
  148. /* Add here the Interrupt Handlers for the used peripherals. */
  149. /* For the available peripheral interrupt handler names, */
  150. /* please refer to the startup file (startup_stm32g4xx.s). */
  151. /******************************************************************************/
  152. /**
  153. * @brief This function handles USB low priority interrupt remap.
  154. */
  155. void USB_LP_IRQHandler(void)
  156. {
  157. /* USER CODE BEGIN USB_LP_IRQn 0 */
  158. /* USER CODE END USB_LP_IRQn 0 */
  159. //HAL_PCD_IRQHandler(&hpcd_USB_FS);
  160. /* USER CODE BEGIN USB_LP_IRQn 1 */
  161. /* USER CODE END USB_LP_IRQn 1 */
  162. }
  163. /* USER CODE BEGIN 1 */
  164. /* USER CODE END 1 */