stm32f4xx_it.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /**
  2. ******************************************************************************
  3. * @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.c
  4. * @author MCD Application Team
  5. * @version V1.5.0
  6. * @date 06-March-2015
  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. * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
  14. *
  15. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  16. * You may not use this file except in compliance with the License.
  17. * You may obtain a copy of the License at:
  18. *
  19. * http://www.st.com/software_license_agreement_liberty_v2
  20. *
  21. * Unless required by applicable law or agreed to in writing, software
  22. * distributed under the License is distributed on an "AS IS" BASIS,
  23. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  24. * See the License for the specific language governing permissions and
  25. * limitations under the License.
  26. *
  27. ******************************************************************************
  28. */
  29. /* Includes ------------------------------------------------------------------*/
  30. #include "stm32f4xx.h"
  31. #include "stm32f4xx_it.h"
  32. #include "includes.h"
  33. #include "netconf.h"
  34. #include "stm32f4x7_eth.h"
  35. extern OS_EVENT *p_semaphore;
  36. extern OS_EVENT *g_enet_rx_sem;
  37. /** @addtogroup Template_Project
  38. * @{
  39. */
  40. /* Private typedef -----------------------------------------------------------*/
  41. /* Private define ------------------------------------------------------------*/
  42. /* Private macro -------------------------------------------------------------*/
  43. /* Private variables ---------------------------------------------------------*/
  44. /* Private function prototypes -----------------------------------------------*/
  45. /* Private functions ---------------------------------------------------------*/
  46. /******************************************************************************/
  47. /* Cortex-M4 Processor Exceptions Handlers */
  48. /******************************************************************************/
  49. /**
  50. * @brief This function handles NMI exception.
  51. * @param None
  52. * @retval None
  53. */
  54. void NMI_Handler(void)
  55. {
  56. }
  57. /**
  58. * @brief This function handles Hard Fault exception.
  59. * @param None
  60. * @retval None
  61. */
  62. void HardFault_Handler(void)
  63. {
  64. /* Go to infinite loop when Hard Fault exception occurs */
  65. while (1)
  66. {
  67. }
  68. }
  69. /**
  70. * @brief This function handles Memory Manage exception.
  71. * @param None
  72. * @retval None
  73. */
  74. void MemManage_Handler(void)
  75. {
  76. /* Go to infinite loop when Memory Manage exception occurs */
  77. while (1)
  78. {
  79. }
  80. }
  81. /**
  82. * @brief This function handles Bus Fault exception.
  83. * @param None
  84. * @retval None
  85. */
  86. void BusFault_Handler(void)
  87. {
  88. /* Go to infinite loop when Bus Fault exception occurs */
  89. while (1)
  90. {
  91. }
  92. }
  93. /**
  94. * @brief This function handles Usage Fault exception.
  95. * @param None
  96. * @retval None
  97. */
  98. void UsageFault_Handler(void)
  99. {
  100. /* Go to infinite loop when Usage Fault exception occurs */
  101. while (1)
  102. {
  103. }
  104. }
  105. /**
  106. * @brief This function handles SVCall exception.
  107. * @param None
  108. * @retval None
  109. */
  110. void SVC_Handler(void)
  111. {
  112. }
  113. /**
  114. * @brief This function handles Debug Monitor exception.
  115. * @param None
  116. * @retval None
  117. */
  118. void DebugMon_Handler(void)
  119. {
  120. }
  121. /**
  122. * @brief This function handles PendSVC exception.
  123. * @param None
  124. * @retval None
  125. */
  126. // void PendSV_Handler(void)
  127. // {
  128. // }
  129. /**
  130. * @brief This function handles SysTick Handler.
  131. * @param None
  132. * @retval None
  133. */
  134. // void SysTick_Handler(void)
  135. // {
  136. // // TimingDelay_Decrement();
  137. // }
  138. /******************************************************************************/
  139. /* STM32F4xx Peripherals Interrupt Handlers */
  140. /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
  141. /* available peripheral interrupt handler's name please refer to the startup */
  142. /* file (startup_stm32f4xx.s). */
  143. /******************************************************************************/
  144. /**
  145. * @brief This function handles PPP interrupt request.
  146. * @param None
  147. * @retval None
  148. */
  149. /*void PPP_IRQHandler(void)
  150. {
  151. }*/
  152. /**
  153. * @}
  154. */
  155. #ifdef USE_ENET_INTERRUPT
  156. /*!
  157. \brief this function handles ethernet interrupt request
  158. \param[in] none
  159. \param[out] none
  160. \retval none
  161. */
  162. void ETH_IRQHandler(void)
  163. {
  164. // uint32_t reval;
  165. // if(SET == enet_interrupt_flag_get(ENET_DMA_INT_FLAG_RS))
  166. // {
  167. // OSSemPost(g_rx_semaphore);
  168. // }
  169. // /* clear the enet DMA Rx interrupt pending bits */
  170. // enet_interrupt_flag_clear(ENET_DMA_INT_FLAG_RS_CLR);
  171. // enet_interrupt_flag_clear(ENET_DMA_INT_FLAG_NI_CLR);
  172. OSIntEnter();
  173. /* frame received */
  174. if (SET == ETH_GetDMAFlagStatus(ETH_DMA_FLAG_R))
  175. {
  176. /* clear the enet DMA Rx interrupt pending bits */
  177. ETH_DMAClearFlag(ETH_DMA_FLAG_R);
  178. ETH_DMAClearFlag(ETH_DMA_FLAG_T);
  179. /* give the semaphore to wakeup LwIP task */
  180. OSSemPost(g_enet_rx_sem);
  181. }
  182. OSIntExit();
  183. }
  184. #endif /* USE_ENET_INTERRUPT */
  185. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/