From a07c450808f389d7cac39cc0b08bd1272b30ee2c Mon Sep 17 00:00:00 2001 From: Spencer Moss Date: Sun, 13 Aug 2017 16:39:00 +0800 Subject: [PATCH 1/2] [bsp] fix CAN IRQ for stm32 none connectivity line devices --- bsp/stm32f10x/drivers/bxcan.h | 5 +++-- bsp/stm32f10x/drivers/stm32f10x_it.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bsp/stm32f10x/drivers/bxcan.h b/bsp/stm32f10x/drivers/bxcan.h index d2bdc4821f..5e6cad087c 100644 --- a/bsp/stm32f10x/drivers/bxcan.h +++ b/bsp/stm32f10x/drivers/bxcan.h @@ -47,8 +47,9 @@ #define CAN_TXMAILBOX_1 ((uint8_t)0x01) #define CAN_TXMAILBOX_2 ((uint8_t)0x02) - - #define CAN_MODE_MASK ((uint32_t) 0x00000003) +void CAN1_RX0_IRQHandler(void); +void CAN1_TX_IRQHandler(void); + #endif /*BXCAN_H_*/ diff --git a/bsp/stm32f10x/drivers/stm32f10x_it.c b/bsp/stm32f10x/drivers/stm32f10x_it.c index bf5cf55565..218b1a7532 100644 --- a/bsp/stm32f10x/drivers/stm32f10x_it.c +++ b/bsp/stm32f10x/drivers/stm32f10x_it.c @@ -25,6 +25,7 @@ #include "stm32f10x_it.h" #include #include +#include "bxcan.h" /** @addtogroup Template_Project * @{ @@ -144,6 +145,20 @@ void EXTI4_IRQHandler(void) } #endif /* RT_USING_LWIP */ +#if (defined (RT_USING_CAN)) && !(defined (STM32F10X_CL)) +/* CAN and USB IRQ for stm32 none connectivity line devices + * change to USB IRQ, if you want to use USB + */ +void USB_LP_CAN1_RX0_IRQHandler(void) +{ + CAN1_RX0_IRQHandler(); +} +void USB_HP_CAN1_TX_IRQHandler(void) +{ + CAN1_TX_IRQHandler(); +} +#endif + /** * @} */ From b60712c29c0871eeae0192c0ac2f21e0f52f50f1 Mon Sep 17 00:00:00 2001 From: Spencer Moss Date: Mon, 14 Aug 2017 00:36:18 +0800 Subject: [PATCH 2/2] [bsp] change macro so that CAN IRQ do not interfere USB IRQ in stm32f10x --- bsp/stm32f10x/drivers/stm32f10x_it.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bsp/stm32f10x/drivers/stm32f10x_it.c b/bsp/stm32f10x/drivers/stm32f10x_it.c index 218b1a7532..4f89e8a68d 100644 --- a/bsp/stm32f10x/drivers/stm32f10x_it.c +++ b/bsp/stm32f10x/drivers/stm32f10x_it.c @@ -145,20 +145,24 @@ void EXTI4_IRQHandler(void) } #endif /* RT_USING_LWIP */ -#if (defined (RT_USING_CAN)) && !(defined (STM32F10X_CL)) +#ifndef STM32F10X_CL /* CAN and USB IRQ for stm32 none connectivity line devices - * change to USB IRQ, if you want to use USB */ void USB_LP_CAN1_RX0_IRQHandler(void) { +#ifdef RT_USING_CAN CAN1_RX0_IRQHandler(); +#endif } void USB_HP_CAN1_TX_IRQHandler(void) { +#ifdef RT_USING_CAN CAN1_TX_IRQHandler(); +#endif } #endif + /** * @} */