/* If the HCD hasn't registered a disable() function, this sets the endpoint's maxpacket size to 0 to prevent further submissions.  */
void usb_disable_endpoint(struct usb_host_virt_dev *dev, unsigned int epaddr)
/* If the HCD hasn't registered a disable() function, this sets the endpoint's maxpacket size to 0 to prevent further submissions.  */
void usb_disable_endpoint(struct usb_host_virt_dev *dev, unsigned int epaddr)
{
    unsigned int epnum = epaddr & USB_ENDPOINT_NUMBER_MASK;
    struct usb_host_virt_endpoint *ep;
    if (!dev)
    {
        hal_log_err("PANIC : usb disable ep: input dev == NULL");
        return;
    }
    if (usb_endpoint_out(epaddr))
    {
        ep = dev->ep_out[epnum];
        dev->ep_out[epnum] = NULL;
    }
    else
    {
        ep = dev->ep_in[epnum];
        dev->ep_in[epnum] = NULL;
    }
    if (ep == NULL)
    {
        __wrn("WARNING : usb disable ep: ep == NULL");
        return;
    }
    hcd_ops_endpoint_disable(dev, ep);
}