summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJerzy Kasenberg <[email protected]>2020-07-31 16:04:10 +0200
committerJerzy Kasenberg <[email protected]>2020-08-04 09:32:41 +0200
commite9aa36a6e8991335d72666058f9c135c3331d238 (patch)
treed6c2beb2f018dc9e5ec572a3c373ab80cde83638 /src
parent22100b252fc2eb8f51ed407949645653c4880fd9 (diff)
Fix synopsys odd/even frame bit for IN ISO endpoints
For ISO endpoint driver has to specify when data is to be transmitted (odd or even frame). Currently code was not updating this bit resulting in data being sent every other frame. If interval was 1ms full data packed was sent every 2ms, and ZLP was sent in between.
Diffstat (limited to 'src')
-rw-r--r--src/portable/st/synopsys/dcd_synopsys.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c
index 03c33c598..283fefd01 100644
--- a/src/portable/st/synopsys/dcd_synopsys.c
+++ b/src/portable/st/synopsys/dcd_synopsys.c
@@ -365,6 +365,13 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c
((total_bytes << USB_OTG_DIEPTSIZ_XFRSIZ_Pos) & USB_OTG_DIEPTSIZ_XFRSIZ_Msk);
in_ep[epnum].DIEPCTL |= USB_OTG_DIEPCTL_EPENA | USB_OTG_DIEPCTL_CNAK;
+ // For ISO endpoint set correct odd/even bit for next frame.
+ if ((in_ep[epnum].DIEPCTL & USB_OTG_DIEPCTL_EPTYP) == USB_OTG_DIEPCTL_EPTYP_0)
+ {
+ // Take odd/even bit from frame counter.
+ uint32_t const odd_frame_now = (dev->DSTS & (1u << USB_OTG_DSTS_FNSOF_Pos));
+ in_ep[epnum].DIEPCTL |= (odd_frame_now ? USB_OTG_DIEPCTL_SD0PID_SEVNFRM_Msk : USB_OTG_DIEPCTL_SODDFRM_Msk);
+ }
// Enable fifo empty interrupt only if there are something to put in the fifo.
if(total_bytes != 0) {
dev->DIEPEMPMSK |= (1 << epnum);