mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-22 15:40:06 +00:00
sync synopsis fix for esp32s2
This commit is contained in:
parent
8d18d6077b
commit
00fcf829a1
@ -276,6 +276,7 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const *desc_edpt)
|
||||
desc_edpt->bmAttributes.xfer << USB_D_EPTYPE1_S |
|
||||
(desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? (1 << USB_DI_SETD0PID1_S) : 0) |
|
||||
desc_edpt->wMaxPacketSize.size << 0;
|
||||
|
||||
USB0.daintmsk |= (1 << (0 + epnum));
|
||||
|
||||
// Both TXFD and TXSA are in unit of 32-bit words.
|
||||
@ -297,7 +298,7 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to
|
||||
uint8_t const epnum = tu_edpt_number(ep_addr);
|
||||
uint8_t const dir = tu_edpt_dir(ep_addr);
|
||||
|
||||
xfer_ctl_t *xfer = XFER_CTL_BASE(epnum, dir);
|
||||
xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir);
|
||||
xfer->buffer = buffer;
|
||||
xfer->total_len = total_bytes;
|
||||
xfer->queued_len = 0;
|
||||
@ -321,7 +322,11 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to
|
||||
// A full IN transfer (multiple packets, possibly) triggers XFRC.
|
||||
USB0.in_ep_reg[epnum].dieptsiz = (num_packets << USB_D_PKTCNT0_S) | total_bytes;
|
||||
USB0.in_ep_reg[epnum].diepctl |= USB_D_EPENA1_M | USB_D_CNAK1_M; // Enable | CNAK
|
||||
|
||||
// Enable fifo empty interrupt only if there are something to put in the fifo.
|
||||
if(total_bytes != 0) {
|
||||
USB0.dtknqr4_fifoemptymsk |= (1 << epnum);
|
||||
}
|
||||
} else {
|
||||
// Each complete packet for OUT xfers triggers XFRC.
|
||||
USB0.out_ep_reg[epnum].doeptsiz |= USB_PKTCNT0_M | ((xfer->max_size & USB_XFERSIZE0_V) << USB_XFERSIZE0_S);
|
||||
@ -617,7 +622,6 @@ static void handle_epin_ints(void)
|
||||
if (USB0.in_ep_reg[n].diepint & USB_D_XFERCOMPL0_M) {
|
||||
ESP_EARLY_LOGV(TAG, "TUSB IRQ - IN XFER complete!");
|
||||
USB0.in_ep_reg[n].diepint = USB_D_XFERCOMPL0_M;
|
||||
USB0.dtknqr4_fifoemptymsk &= ~(1 << n); // Turn off TXFE b/c xfer inactive.
|
||||
dcd_event_xfer_complete(0, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true);
|
||||
}
|
||||
|
||||
@ -626,6 +630,12 @@ static void handle_epin_ints(void)
|
||||
ESP_EARLY_LOGV(TAG, "TUSB IRQ - IN XFER FIFO empty!");
|
||||
USB0.in_ep_reg[n].diepint = USB_D_TXFEMP0_M;
|
||||
transmit_packet(xfer, &USB0.in_ep_reg[n], n);
|
||||
|
||||
// Turn off TXFE if all bytes are written.
|
||||
if (xfer->queued_len == xfer->total_len)
|
||||
{
|
||||
USB0.dtknqr4_fifoemptymsk &= ~(1 << n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user