/* Read data or status in control out transation.  */
void USBD_CtrlOutData(uint8_t *buf, uint32_t len)
/* Read data or status in control out transation.  */
void USBD_CtrlOutData(uint8_t *buf, uint32_t len)
{
    uint16_t maxPackSize = g_usbDev.outBuf[USBD_EP_0].maxPackSize;
    if (len)
    {
        g_usbDev.outBuf[USBD_EP_0].pBuf = buf;
        g_usbDev.outBuf[USBD_EP_0].bufLen = len;
        g_usbDev.outBuf[USBD_EP_0].packNum = (len + (maxPackSize - 1)) / maxPackSize;
        len = USB_MIN(g_usbDev.outBuf[0].bufLen, maxPackSize);
        USBD_SetEPTxRxStatus(USBD_EP_0, USBD_EP_STATUS_NAK, USBD_EP_STATUS_VALID);
        g_usbDev.ctrlState = USBD_CTRL_STATE_DATA_OUT;
    }
    else
    {
        g_usbDev.ctrlState = USBD_CTRL_STATE_WAIT_STATUS_OUT;
    }
    USBD_SetEPTxRxStatus(USBD_EP_0, USBD_EP_STATUS_NAK, USBD_EP_STATUS_VALID);
}