mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/usbdev_synopsys_dwc2: Set even/odd flag on isochronous transfers
This commit is contained in:
parent
7b2db7bf2b
commit
242f9b524a
@ -1338,7 +1338,14 @@ static int _usbdev_ep_xmit(usbdev_ep_t *ep, uint8_t *buf, size_t len)
|
||||
_device_regs(conf)->DAINTMSK |= 1 << ep->num;
|
||||
_device_regs(conf)->DIEPEMPMSK |= 1 << ep->num;
|
||||
|
||||
uint32_t eonum = 0;
|
||||
if (ep->type == USB_EP_TYPE_ISOCHRONOUS) {
|
||||
bool odd_frame = _device_regs(conf)->DSTS & (1 << 8);
|
||||
eonum = !odd_frame ? USB_OTG_DIEPCTL_SD0PID_SEVNFRM : USB_OTG_DIEPCTL_SODDFRM;
|
||||
}
|
||||
|
||||
_in_regs(conf, ep->num)->DIEPCTL |= USB_OTG_DIEPCTL_CNAK |
|
||||
eonum |
|
||||
USB_OTG_DIEPCTL_EPENA;
|
||||
|
||||
if (len > 0 && !_uses_dma(conf)) {
|
||||
@ -1355,11 +1362,17 @@ static int _usbdev_ep_xmit(usbdev_ep_t *ep, uint8_t *buf, size_t len)
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
/* Abort when the endpoint is not active, prevents hangs,
|
||||
* could be an assert in the future maybe */
|
||||
if (!(_out_regs(conf, ep->num)->DOEPCTL & USB_OTG_DOEPCTL_USBAEP)) {
|
||||
return -1;
|
||||
}
|
||||
uint32_t eonum = 0;
|
||||
if (ep->type == USB_EP_TYPE_ISOCHRONOUS) {
|
||||
bool odd_frame = _device_regs(conf)->DSTS & (1 << 8);
|
||||
eonum = odd_frame ? USB_OTG_DOEPCTL_SD0PID_SEVNFRM : USB_OTG_DOEPCTL_SODDFRM;
|
||||
}
|
||||
|
||||
if (_uses_dma(conf)) {
|
||||
_out_regs(conf, ep->num)->DOEPDMA = (uint32_t)(intptr_t)buf;
|
||||
@ -1382,6 +1395,7 @@ static int _usbdev_ep_xmit(usbdev_ep_t *ep, uint8_t *buf, size_t len)
|
||||
_out_regs(conf, ep->num)->DOEPTSIZ = doeptsiz;
|
||||
_out_regs(conf, ep->num)->DOEPCTL |= USB_OTG_DOEPCTL_CNAK |
|
||||
USB_OTG_DOEPCTL_EPENA |
|
||||
eonum |
|
||||
_type_to_reg(ep->type);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user