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