From 304e1a7f4fbac7e1ef19cf07744d3dd2abfe3aff Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 24 Jun 2012 07:51:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4344 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/USBv1/usb_lld.c | 18 ++++++++++++------ os/hal/platforms/STM32/USBv1/usb_lld.h | 10 ++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'os/hal/platforms/STM32/USBv1') diff --git a/os/hal/platforms/STM32/USBv1/usb_lld.c b/os/hal/platforms/STM32/USBv1/usb_lld.c index 7bccf4e4d..0b72c3a56 100644 --- a/os/hal/platforms/STM32/USBv1/usb_lld.c +++ b/os/hal/platforms/STM32/USBv1/usb_lld.c @@ -264,24 +264,30 @@ static void usb_packet_write_from_queue(stm32_usb_descriptor_t *udp, /*===========================================================================*/ #if STM32_USB_USE_USB1 || defined(__DOXYGEN__) +#if !defined(STM32_USB1_HP_HANDLER) +#error "STM32_USB1_HP_HANDLER not defined" +#endif /** * @brief USB high priority interrupt handler. * * @isr */ -CH_IRQ_HANDLER(Vector8C) { +CH_IRQ_HANDLER(STM32_USB1_HP_HANDLER) { CH_IRQ_PROLOGUE(); CH_IRQ_EPILOGUE(); } +#if !defined(STM32_USB1_LP_HANDLER) +#error "STM32_USB1_LP_HANDLER not defined" +#endif /** * @brief USB low priority interrupt handler. * * @isr */ -CH_IRQ_HANDLER(Vector90) { +CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) { uint32_t istr; size_t n; USBDriver *usbp = &USBD1; @@ -446,9 +452,9 @@ void usb_lld_start(USBDriver *usbp) { STM32_USB->CNTR = CNTR_FRES; /* Enabling the USB IRQ vectors, this also gives enough time to allow the transceiver power up (1uS).*/ - nvicEnableVector(19, + nvicEnableVector(STM32_USB1_HP_NUMBER, CORTEX_PRIORITY_MASK(STM32_USB_USB1_HP_IRQ_PRIORITY)); - nvicEnableVector(20, + nvicEnableVector(STM32_USB1_LP_NUMBER, CORTEX_PRIORITY_MASK(STM32_USB_USB1_LP_IRQ_PRIORITY)); /* Releases the USB reset.*/ STM32_USB->CNTR = 0; @@ -473,8 +479,8 @@ void usb_lld_stop(USBDriver *usbp) { if (usbp->state == USB_STOP) { #if STM32_USB_USE_USB1 if (&USBD1 == usbp) { - nvicDisableVector(19); - nvicDisableVector(20); + nvicDisableVector(STM32_USB1_HP_NUMBER); + nvicDisableVector(STM32_USB1_LP_NUMBER); STM32_USB->CNTR = CNTR_PDWN | CNTR_FRES; rccDisableUSB(FALSE); } diff --git a/os/hal/platforms/STM32/USBv1/usb_lld.h b/os/hal/platforms/STM32/USBv1/usb_lld.h index f8c2b32f5..82181b2f4 100644 --- a/os/hal/platforms/STM32/USBv1/usb_lld.h +++ b/os/hal/platforms/STM32/USBv1/usb_lld.h @@ -93,6 +93,16 @@ #error "USB driver activated but no USB peripheral assigned" #endif +#if STM32_USB_USE_USB1 && \ + !CORTEX_IS_VALID_KERNEL_PRIORITY(STM32_USB_USB1_HP_IRQ_PRIORITY) +#error "Invalid IRQ priority assigned to USB HP" +#endif + +#if STM32_USB_USE_USB1 && \ + !CORTEX_IS_VALID_KERNEL_PRIORITY(STM32_USB_USB1_LP_IRQ_PRIORITY) +#error "Invalid IRQ priority assigned to USB LP" +#endif + #if STM32_USBCLK != 48000000 #error "the USB driver requires a 48MHz clock" #endif -- cgit v1.2.3