Merge remote-tracking branch 'upstream/master' into uac2
Conflicts: src/device/usbd.c src/device/usbd.h src/portable/st/synopsys/dcd_synopsys.c
This commit is contained in:
@@ -305,6 +305,7 @@ static void set_EP0_max_pkt_size()
|
||||
}
|
||||
|
||||
// Set turn-around timeout according to link speed
|
||||
extern uint32_t SystemCoreClock;
|
||||
static void set_turnaround(USB_OTG_GlobalTypeDef * usb_otg, tusb_speed_t speed)
|
||||
{
|
||||
usb_otg->GUSBCFG &= ~USB_OTG_GUSBCFG_TRDT;
|
||||
@@ -317,7 +318,6 @@ static void set_turnaround(USB_OTG_GlobalTypeDef * usb_otg, tusb_speed_t speed)
|
||||
else
|
||||
{
|
||||
// Turnaround timeout depends on the MCU clock
|
||||
extern uint32_t SystemCoreClock;
|
||||
uint32_t turnaround;
|
||||
|
||||
if ( SystemCoreClock >= 32000000U )
|
||||
@@ -439,6 +439,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);
|
||||
@@ -527,6 +534,8 @@ void dcd_init (uint8_t rhport)
|
||||
|
||||
// Enable global interrupt
|
||||
usb_otg->GAHBCFG |= USB_OTG_GAHBCFG_GINT;
|
||||
|
||||
dcd_connect(rhport);
|
||||
}
|
||||
|
||||
void dcd_int_enable (uint8_t rhport)
|
||||
@@ -588,13 +597,13 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
|
||||
|
||||
TU_ASSERT(epnum < EP_MAX);
|
||||
|
||||
if (desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS)
|
||||
if (desc_edpt->bmAttributes.xfer == TUSB_XFER_ISOCHRONOUS)
|
||||
{
|
||||
TU_ASSERT(desc_edpt->wMaxPacketSize.size <= (get_speed(rhport) == TUSB_SPEED_HIGH ? 512 : 64));
|
||||
TU_ASSERT(desc_edpt->wMaxPacketSize.size <= (get_speed(rhport) == TUSB_SPEED_HIGH ? 1024 : 1023));
|
||||
}
|
||||
else
|
||||
{
|
||||
TU_ASSERT(desc_edpt->wMaxPacketSize.size <= (get_speed(rhport) == TUSB_SPEED_HIGH ? 1024 : 1023));
|
||||
TU_ASSERT(desc_edpt->wMaxPacketSize.size <= (get_speed(rhport) == TUSB_SPEED_HIGH ? 512 : 64));
|
||||
}
|
||||
|
||||
xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir);
|
||||
@@ -771,7 +780,7 @@ void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr)
|
||||
}
|
||||
|
||||
// Flush the FIFO, and wait until we have confirmed it cleared.
|
||||
usb_otg->GRSTCTL |= ((epnum - 1) << USB_OTG_GRSTCTL_TXFNUM_Pos);
|
||||
usb_otg->GRSTCTL |= (epnum << USB_OTG_GRSTCTL_TXFNUM_Pos);
|
||||
usb_otg->GRSTCTL |= USB_OTG_GRSTCTL_TXFFLSH;
|
||||
while((usb_otg->GRSTCTL & USB_OTG_GRSTCTL_TXFFLSH_Msk) != 0);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user