update(port/dwc2): invalid data before start read
Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
@@ -777,6 +777,7 @@ int usbd_ep_set_stall(uint8_t busid, const uint8_t ep)
|
||||
}
|
||||
|
||||
if ((ep_idx == 0) && g_dwc2_udc[busid].user_params.device_dma_enable) {
|
||||
usb_dcache_invalidate((uintptr_t)&g_dwc2_udc[busid].setup, USB_ALIGN_UP(8, CONFIG_USB_ALIGN_SIZE));
|
||||
dwc2_ep0_start_read_setup(busid, (uint8_t *)&g_dwc2_udc[busid].setup);
|
||||
}
|
||||
|
||||
@@ -947,6 +948,7 @@ int usbd_ep_start_read(uint8_t busid, const uint8_t ep, uint8_t *data, uint32_t
|
||||
}
|
||||
|
||||
if (g_dwc2_udc[busid].user_params.device_dma_enable) {
|
||||
usb_dcache_invalidate((uintptr_t)data, USB_ALIGN_UP(data_len, CONFIG_USB_ALIGN_SIZE));
|
||||
USB_OTG_OUTEP(ep_idx)->DOEPDMA = (uint32_t)data;
|
||||
}
|
||||
if (g_dwc2_udc[busid].out_ep[ep_idx].ep_type == USB_ENDPOINT_TYPE_ISOCHRONOUS) {
|
||||
|
||||
@@ -20,7 +20,6 @@ struct dwc2_chan {
|
||||
uint32_t xferlen;
|
||||
uint8_t chidx;
|
||||
bool inuse;
|
||||
bool dir_in;
|
||||
bool do_ssplit;
|
||||
bool do_csplit;
|
||||
uint8_t hub_addr;
|
||||
@@ -317,12 +316,13 @@ static inline void dwc2_chan_transfer(struct usbh_bus *bus, uint8_t ch_num, uint
|
||||
(((uint32_t)pid << 29) & USB_OTG_HCTSIZ_DPID);
|
||||
|
||||
if (!(ep_addr & 0x80)) {
|
||||
chan->dir_in = false;
|
||||
if (buf) {
|
||||
usb_dcache_clean((uintptr_t)buf, USB_ALIGN_UP(size, CONFIG_USB_ALIGN_SIZE));
|
||||
}
|
||||
} else {
|
||||
chan->dir_in = true;
|
||||
if (buf) {
|
||||
usb_dcache_invalidate((uintptr_t)buf, USB_ALIGN_UP(size, CONFIG_USB_ALIGN_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
/* xfer_buff MUST be 32-bits aligned */
|
||||
|
||||
Reference in New Issue
Block a user