git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4344 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
ca6ab337fe
commit
304e1a7f4f
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -129,6 +129,15 @@
|
|||
#define STM32_USART3_NUMBER USART3_IRQn
|
||||
#define STM32_UART4_NUMBER UART4_IRQn
|
||||
#define STM32_UART5_NUMBER UART5_IRQn
|
||||
|
||||
/*
|
||||
* USB units.
|
||||
*/
|
||||
#define STM32_USB1_HP_HANDLER Vector8C
|
||||
#define STM32_USB1_LP_HANDLER Vector90
|
||||
|
||||
#define STM32_USB1_HP_NUMBER USB_HP_CAN1_TX_IRQn
|
||||
#define STM32_USB1_LP_NUMBER USB_LP_CAN1_RX0_IRQn
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -58,6 +58,15 @@
|
|||
#define STM32_USART1_NUMBER USART1_IRQn
|
||||
#define STM32_USART2_NUMBER USART2_IRQn
|
||||
#define STM32_USART3_NUMBER USART3_IRQn
|
||||
|
||||
/*
|
||||
* USB units.
|
||||
*/
|
||||
#define STM32_USB1_HP_HANDLER Vector8C
|
||||
#define STM32_USB1_LP_HANDLER Vector90
|
||||
|
||||
#define STM32_USB1_HP_NUMBER USB_HP_IRQn
|
||||
#define STM32_USB1_LP_NUMBER USB_LP_IRQn
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
Loading…
Reference in New Issue