diff options
| author | sakimisu <[email protected]> | 2023-06-28 21:11:38 +0800 |
|---|---|---|
| committer | sakimisu <[email protected]> | 2023-06-28 21:11:38 +0800 |
| commit | 8253f074ce4a4572aaf29283c8df218d1670622d (patch) | |
| tree | e5fc1fae57e7b82dfd35e63949f717adfe8faa38 | |
| parent | 8a93ca4bce5d77e98e2fe98338c9accb50737c75 (diff) | |
implment musb usbh_kill_urb
| -rw-r--r-- | port/musb/usb_hc_musb.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c index 51887883..26a284be 100644 --- a/port/musb/usb_hc_musb.c +++ b/port/musb/usb_hc_musb.c @@ -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) { + 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; } @@ -704,6 +719,20 @@ errout_timeout: 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; } |
