diff --git a/FreeRTOSConfig.h b/FreeRTOSConfig.h index f5feabd..e7632d9 100644 --- a/FreeRTOSConfig.h +++ b/FreeRTOSConfig.h @@ -126,27 +126,27 @@ to exclude the API function. */ #define INCLUDE_xTaskGetSchedulerState 1 ///* Cortex-M specific definitions. */ -//#ifdef __NVIC_PRIO_BITS -// /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ -// #define configPRIO_BITS __NVIC_PRIO_BITS -//#else -// #define configPRIO_BITS 4 -//#endif -#define configPRIO_BITS __NVIC_PRIO_BITS #if (__CORTEX_M>=3) -/* The lowest interrupt priority that can be used in a call to a "set priority" -function. */ -#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 - -/* The highest interrupt priority that can be used by any interrupt service -routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL -INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER -PRIORITY THAN THIS! (higher priorities are lower numeric values. */ -#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 + // This is for F103+ + + /* The lowest interrupt priority that can be used in a call to a "set priority" + function. */ + #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 + + #define configPRIO_BITS 4 + + /* The highest interrupt priority that can be used by any interrupt service + routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL + INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER + PRIORITY THAN THIS! (higher priorities are lower numeric values. */ + #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 #else -#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 3 -#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 3 + // This is for F072 + #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 3 + #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 3 + + #define configPRIO_BITS 2 #endif /* Interrupt priorities used by the kernel port layer itself. These are generic diff --git a/USB/usbd_conf.c b/USB/usbd_conf.c index 48872d6..a301f29 100644 --- a/USB/usbd_conf.c +++ b/USB/usbd_conf.c @@ -82,8 +82,13 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle) __HAL_RCC_USB_CLK_ENABLE(); /* Peripheral interrupt init */ +#if defined(GEX_PLAT_F103_BLUEPILL) + HAL_NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, 5, 0); + HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn); +#elif defined(GEX_PLAT_F072_DISCOVERY) HAL_NVIC_SetPriority(USB_IRQn, 3, 0); HAL_NVIC_EnableIRQ(USB_IRQn); +#endif /* USER CODE BEGIN USB_MspInit 1 */ /* USER CODE END USB_MspInit 1 */ @@ -101,7 +106,11 @@ void HAL_PCD_MspDeInit(PCD_HandleTypeDef* pcdHandle) __HAL_RCC_USB_CLK_DISABLE(); /* Peripheral interrupt Deinit*/ +#if defined(GEX_PLAT_F103_BLUEPILL) + HAL_NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn); +#elif defined(GEX_PLAT_F072_DISCOVERY) HAL_NVIC_DisableIRQ(USB_IRQn); +#endif /* USER CODE BEGIN USB_MspDeInit 1 */