1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #12269 from bergzand/pr/nrfusb/fix_control_write

nrfusb: Fix data stage handling of control writes
This commit is contained in:
Martine Lenders 2019-09-25 18:08:08 +02:00 committed by GitHub
commit 57edabce96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -498,18 +498,13 @@ static int _ep0_ready(usbdev_ep_t *ep, size_t len)
}
else {
/* USB_EP_DIR_OUT */
if (len == 0) {
if (usbdev->sstate == NRFUSB_SETUP_READ) {
usbdev->device->TASKS_EP0STATUS = 1;
usbdev->sstate = NRFUSB_SETUP_ACKOUT;
usbdev->usbdev.epcb(_get_ep_out(usbdev, 0), USBDEV_EVENT_ESR);
}
else if (usbdev->sstate == NRFUSB_SETUP_READY) {
return 0;
}
if (usbdev->sstate == NRFUSB_SETUP_READ) {
usbdev->device->TASKS_EP0STATUS = 1;
usbdev->sstate = NRFUSB_SETUP_ACKOUT;
usbdev->usbdev.epcb(_get_ep_out(usbdev, 0), USBDEV_EVENT_ESR);
}
else {
usbdev->device->TASKS_STARTEPOUT[ep->num] = 1;
else if (usbdev->sstate == NRFUSB_SETUP_WRITE) {
usbdev->device->TASKS_EP0RCVOUT = 1;
}
}
return len;
@ -577,6 +572,11 @@ static signed _ep0_esr(usbdev_ep_t *ep)
event = 0;
}
}
else if (usbdev->device->EVENTS_EP0DATADONE) {
usbdev->device->EVENTS_EP0DATADONE = 0;
_ep_dma_out(ep);
event = USBDEV_EVENT_TR_COMPLETE;
}
}
else {
if (usbdev->sstate == NRFUSB_SETUP_ACKIN) {
@ -649,8 +649,14 @@ void isr_usbd(void)
}
if (usbdev->device->EVENTS_EP0DATADONE &&
(usbdev->device->INTEN & USBD_INTEN_EP0DATADONE_Msk)) {
usbdev->usbdev.epcb(_get_ep_in(usbdev, 0), USBDEV_EVENT_ESR);
_ep_disable_irq(_get_ep_in(usbdev, 0));
if (usbdev->sstate == NRFUSB_SETUP_READ) {
usbdev->usbdev.epcb(_get_ep_in(usbdev, 0), USBDEV_EVENT_ESR);
_ep_disable_irq(_get_ep_in(usbdev, 0));
}
if (usbdev->sstate == NRFUSB_SETUP_WRITE) {
usbdev->usbdev.epcb(_get_ep_out(usbdev, 0), USBDEV_EVENT_ESR);
_ep_disable_irq(_get_ep_in(usbdev, 0));
}
}
if (usbdev->device->EVENTS_EPDATA && usbdev->device->EPDATASTATUS) {
usbdev->device->EVENTS_EPDATA = 0;