/* send a data packet to the USB device  */
usbh_status usbh_data_send(usb_core_driver *udev, uint8_t *buf, uint8_t pp_num, uint16_t len)
/* send a data packet to the USB device  */
usbh_status usbh_data_send(usb_core_driver *udev, uint8_t *buf, uint8_t pp_num, uint16_t len)
{
    usb_pipe *pp = &udev->host.pipe[pp_num];
    pp->xfer_buf = buf;
    pp->xfer_len = len;
    switch (pp->ep.type) {
    case USB_EPTYPE_CTRL:
        if (0U == len) {
            pp->data_toggle_out = 1U;
        }
        pp->DPID = PIPE_DPID[pp->data_toggle_out];
        break;
    case USB_EPTYPE_INTR:
        pp->DPID = PIPE_DPID[pp->data_toggle_out];
        pp->data_toggle_out ^= 1U;
        break;
    case USB_EPTYPE_BULK:
        pp->DPID = PIPE_DPID[pp->data_toggle_out];
        break;
    case USB_EPTYPE_ISOC:
        pp->DPID = PIPE_DPID[0];
        break;
    default:
        break;
    }
    usbh_request_submit (udev, pp_num);
    return USBH_OK;
}