You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.4 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. #include "stm32irq.h"
  2. #include "gins.h"
  3. #include "main.h"
  4. #include "stm32f4xx_it.h"
  5. static stm32_irq_cb_t irqcb[100];
  6. static void callirqcb(stm32irq_type_t type) {
  7. if (irqcb[type] != NULL) {
  8. irqcb[type]();
  9. }
  10. }
  11. void NMI_Handler(void) {
  12. SysMgr_on_NMI_Handler();
  13. while (1) {
  14. }
  15. }
  16. void HardFault_Handler(void) {
  17. SysMgr_on_HardFault_Handler();
  18. while (1) {
  19. }
  20. }
  21. void MemManage_Handler(void) {
  22. SysMgr_on_MemManage_Handler();
  23. while (1) {
  24. }
  25. }
  26. void BusFault_Handler(void) {
  27. SysMgr_on_BusFault_Handler();
  28. while (1) {
  29. }
  30. }
  31. void UsageFault_Handler(void) {
  32. SysMgr_on_UsageFault_Handler();
  33. while (1) {
  34. }
  35. }
  36. void DebugMon_Handler(void) {}
  37. /***********************************************************************************************************************
  38. * IRQ *
  39. ***********************************************************************************************************************/
  40. void DMA1_Stream1_IRQHandler(void) {
  41. if (hdma1_stream1_enable) HAL_DMA_IRQHandler(&hdma1_stream1);
  42. }
  43. void DMA2_Stream2_IRQHandler(void) {
  44. if (hdma2_stream2_enable) HAL_DMA_IRQHandler(&hdma2_stream2);
  45. }
  46. void DMA1_Stream3_IRQHandler(void) {
  47. if (hdma1_stream3_enable) HAL_DMA_IRQHandler(&hdma1_stream3);
  48. }
  49. void CAN1_TX_IRQHandler(void) {
  50. if (hcan1_enable) HAL_CAN_IRQHandler(&hcan1);
  51. }
  52. void CAN1_RX0_IRQHandler(void) {
  53. if (hcan1_enable) HAL_CAN_IRQHandler(&hcan1);
  54. }
  55. void CAN1_RX1_IRQHandler(void) {
  56. if (hcan1_enable) HAL_CAN_IRQHandler(&hcan1);
  57. }
  58. void CAN1_SCE_IRQHandler(void) {
  59. if (hcan1_enable) HAL_CAN_IRQHandler(&hcan1);
  60. }
  61. void TIM1_TRG_COM_TIM11_IRQHandler(void) {
  62. if (htim11_enable) HAL_TIM_IRQHandler(&htim11);
  63. }
  64. void USART1_IRQHandler(void) {
  65. if (huart1_enable) HAL_UART_IRQHandler(&huart1);
  66. }
  67. void TIM6_DAC_IRQHandler(void) {
  68. if (htim6_enable) HAL_TIM_IRQHandler(&htim6);
  69. }
  70. void TIM7_IRQHandler(void) {
  71. if (htim7_enable) HAL_TIM_IRQHandler(&htim7);
  72. }
  73. /***********************************************************************************************************************
  74. * EXT *
  75. ***********************************************************************************************************************/
  76. void stm32irq_reg(stm32irq_type_t type, stm32_irq_cb_t cb) { irqcb[type] = cb; }