aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/USBv1
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-24 07:51:31 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-24 07:51:31 +0000
commit304e1a7f4fbac7e1ef19cf07744d3dd2abfe3aff (patch)
tree7b5c8e88698f773903be6556ea5a70d8629ff9f0 /os/hal/platforms/STM32/USBv1
parentca6ab337feffdc0d6fddc492a91e55ebf197d4f5 (diff)
downloadChibiOS-304e1a7f4fbac7e1ef19cf07744d3dd2abfe3aff.tar.gz
ChibiOS-304e1a7f4fbac7e1ef19cf07744d3dd2abfe3aff.tar.bz2
ChibiOS-304e1a7f4fbac7e1ef19cf07744d3dd2abfe3aff.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4344 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/USBv1')
-rw-r--r--os/hal/platforms/STM32/USBv1/usb_lld.c18
-rw-r--r--os/hal/platforms/STM32/USBv1/usb_lld.h10
2 files changed, 22 insertions, 6 deletions
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