implment musb usbh_kill_urb
This commit is contained in:
@@ -630,6 +630,21 @@ int usbh_pipe_alloc(usbh_pipe_t *pipe, const struct usbh_endpoint_cfg *ep_cfg)
|
|||||||
|
|
||||||
int usbh_pipe_free(usbh_pipe_t pipe)
|
int usbh_pipe_free(usbh_pipe_t pipe)
|
||||||
{
|
{
|
||||||
|
struct musb_pipe *ppipe;
|
||||||
|
struct usbh_urb *urb;
|
||||||
|
|
||||||
|
ppipe = (struct musb_pipe *)pipe;
|
||||||
|
|
||||||
|
if (!ppipe) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
urb = ppipe->urb;
|
||||||
|
|
||||||
|
if (urb) {
|
||||||
|
usbh_kill_urb(urb);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -704,6 +719,20 @@ errout_timeout:
|
|||||||
|
|
||||||
int usbh_kill_urb(struct usbh_urb *urb)
|
int usbh_kill_urb(struct usbh_urb *urb)
|
||||||
{
|
{
|
||||||
|
struct musb_pipe *pipe;
|
||||||
|
|
||||||
|
pipe = urb->pipe;
|
||||||
|
|
||||||
|
if (!urb || !pipe) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pipe->waiter) {
|
||||||
|
pipe->waiter = false;
|
||||||
|
urb->errorcode = -ESHUTDOWN;
|
||||||
|
usb_osal_sem_give(pipe->waitsem);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user