stmfx07: usb: poll DIEPINT before RXFLVL
This is to interrupt for setup sequences on IN packet before checking for OUT packet received. This fixes the problem that usb_control_out stalls because we are not yet in STATUS_OUT phase. Related to #668.
This commit is contained in:
parent
16f3042fa8
commit
973efabddb
@ -262,6 +262,23 @@ void stm32fx07_poll(usbd_device *usbd_dev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There is no global interrupt flag for transmit complete.
|
||||||
|
* The XFRC bit must be checked in each OTG_DIEPINT(x).
|
||||||
|
*/
|
||||||
|
for (i = 0; i < 4; i++) { /* Iterate over endpoints. */
|
||||||
|
if (REBASE(OTG_DIEPINT(i)) & OTG_DIEPINTX_XFRC) {
|
||||||
|
/* Transfer complete. */
|
||||||
|
if (usbd_dev->user_callback_ctr[i]
|
||||||
|
[USB_TRANSACTION_IN]) {
|
||||||
|
usbd_dev->user_callback_ctr[i]
|
||||||
|
[USB_TRANSACTION_IN](usbd_dev, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
REBASE(OTG_DIEPINT(i)) = OTG_DIEPINTX_XFRC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Note: RX and TX handled differently in this device. */
|
/* Note: RX and TX handled differently in this device. */
|
||||||
if (intsts & OTG_GINTSTS_RXFLVL) {
|
if (intsts & OTG_GINTSTS_RXFLVL) {
|
||||||
/* Receive FIFO non-empty. */
|
/* Receive FIFO non-empty. */
|
||||||
@ -304,23 +321,6 @@ void stm32fx07_poll(usbd_device *usbd_dev)
|
|||||||
usbd_dev->rxbcnt = 0;
|
usbd_dev->rxbcnt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* There is no global interrupt flag for transmit complete.
|
|
||||||
* The XFRC bit must be checked in each OTG_DIEPINT(x).
|
|
||||||
*/
|
|
||||||
for (i = 0; i < 4; i++) { /* Iterate over endpoints. */
|
|
||||||
if (REBASE(OTG_DIEPINT(i)) & OTG_DIEPINTX_XFRC) {
|
|
||||||
/* Transfer complete. */
|
|
||||||
if (usbd_dev->user_callback_ctr[i]
|
|
||||||
[USB_TRANSACTION_IN]) {
|
|
||||||
usbd_dev->user_callback_ctr[i]
|
|
||||||
[USB_TRANSACTION_IN](usbd_dev, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
REBASE(OTG_DIEPINT(i)) = OTG_DIEPINTX_XFRC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (intsts & OTG_GINTSTS_USBSUSP) {
|
if (intsts & OTG_GINTSTS_USBSUSP) {
|
||||||
if (usbd_dev->user_callback_suspend) {
|
if (usbd_dev->user_callback_suspend) {
|
||||||
usbd_dev->user_callback_suspend();
|
usbd_dev->user_callback_suspend();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user