From d3c08afd75a9bbb8533b6dda3faa9087914affb7 Mon Sep 17 00:00:00 2001 From: liruncong <14903456@qq.com> Date: Sun, 2 Sep 2018 22:39:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=9D=E7=95=99=E7=9B=AE=E5=89=8D?= =?UTF-8?q?=E6=9C=AA=E7=94=A8=E5=88=B0=E7=9A=84rt=5Fusbd=5Fep=5Funassign?= =?UTF-8?q?=E5=87=BD=E6=95=B0,=E6=9A=82=E6=97=B6=E7=A7=BB=E9=99=A4static?= =?UTF-8?q?=E5=B1=9E=E6=80=A7,=E6=B6=88=E9=99=A4=E8=AD=A6=E5=91=8A.=202.?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E4=B8=80=E5=A4=84=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E6=8B=AC=E5=8F=B7=E9=97=AE=E9=A2=98.=20armcl?= =?UTF-8?q?ang=E6=9C=89=E8=AD=A6=E5=91=8A=E5=8F=91=E5=87=BA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/usb/usbdevice/core/core.c | 14 ++++++++++++++ components/drivers/usb/usbhost/core/hub.c | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/components/drivers/usb/usbdevice/core/core.c b/components/drivers/usb/usbdevice/core/core.c index 4a4f370f16..1900673976 100644 --- a/components/drivers/usb/usbdevice/core/core.c +++ b/components/drivers/usb/usbdevice/core/core.c @@ -36,6 +36,7 @@ static rt_list_t device_list; static rt_size_t rt_usbd_ep_write(udevice_t device, uep_t ep, void *buffer, rt_size_t size); static rt_size_t rt_usbd_ep_read_prepare(udevice_t device, uep_t ep, void *buffer, rt_size_t size); static rt_err_t rt_usbd_ep_assign(udevice_t device, uep_t ep); +rt_err_t rt_usbd_ep_unassign(udevice_t device, uep_t ep); /** * This function will handle get_device_descriptor bRequest. @@ -1864,6 +1865,19 @@ static rt_err_t rt_usbd_ep_assign(udevice_t device, uep_t ep) return -RT_ERROR; } +rt_err_t rt_usbd_ep_unassign(udevice_t device, uep_t ep) +{ + RT_ASSERT(device != RT_NULL); + RT_ASSERT(device->dcd != RT_NULL); + RT_ASSERT(device->dcd->ep_pool != RT_NULL); + RT_ASSERT(ep != RT_NULL); + RT_ASSERT(ep->ep_desc != RT_NULL); + + ep->id->status = ID_UNASSIGNED; + + return RT_EOK; +} + rt_err_t rt_usbd_ep0_setup_handler(udcd_t dcd, struct urequest* setup) { struct udev_msg msg; diff --git a/components/drivers/usb/usbhost/core/hub.c b/components/drivers/usb/usbhost/core/hub.c index 1f1c986350..29b465d1b7 100644 --- a/components/drivers/usb/usbhost/core/hub.c +++ b/components/drivers/usb/usbhost/core/hub.c @@ -413,7 +413,7 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub) RT_DEBUG_LOG(RT_DEBUG_USB, ("port %d status 0x%x\n", i + 1, pstatus)); /* check port status change */ - if ((pstatus & PORT_CCSC)) + if (pstatus & PORT_CCSC) { /* clear port status change feature */ rt_usbh_hub_clear_port_feature(hub, i + 1, PORT_FEAT_C_CONNECTION);