|
|
@@ -322,15 +322,15 @@ static int dwc2_chan_alloc(struct usbh_bus *bus)
|
|
|
size_t flags;
|
|
|
int chidx;
|
|
|
|
|
|
+ flags = usb_osal_enter_critical_section();
|
|
|
for (chidx = 0; chidx < CONFIG_USBHOST_PIPE_NUM; chidx++) {
|
|
|
if (!g_dwc2_hcd[bus->hcd.hcd_id].chan_pool[chidx].inuse) {
|
|
|
- flags = usb_osal_enter_critical_section();
|
|
|
g_dwc2_hcd[bus->hcd.hcd_id].chan_pool[chidx].inuse = true;
|
|
|
usb_osal_leave_critical_section(flags);
|
|
|
return chidx;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ usb_osal_leave_critical_section(flags);
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
@@ -736,11 +736,8 @@ int usbh_submit_urb(struct usbh_urb *urb)
|
|
|
return -USB_ERR_BUSY;
|
|
|
}
|
|
|
|
|
|
- flags = usb_osal_enter_critical_section();
|
|
|
-
|
|
|
chidx = dwc2_chan_alloc(bus);
|
|
|
if (chidx == -1) {
|
|
|
- usb_osal_leave_critical_section(flags);
|
|
|
return -USB_ERR_NOMEM;
|
|
|
}
|
|
|
|
|
|
@@ -763,6 +760,8 @@ int usbh_submit_urb(struct usbh_urb *urb)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ flags = usb_osal_enter_critical_section();
|
|
|
+
|
|
|
chan = &g_dwc2_hcd[bus->hcd.hcd_id].chan_pool[chidx];
|
|
|
chan->chidx = chidx;
|
|
|
chan->urb = urb;
|