/* Read a buffer of data to a selected endpoint.  */
void USBD_ReadDataFromEP(USBD_EP_T ep, uint8_t *rBuf, uint32_t rLen)
/* Read a buffer of data to a selected endpoint.  */
void USBD_ReadDataFromEP(USBD_EP_T ep, uint8_t *rBuf, uint32_t rLen)
{
    uint32_t i;
    uint32_t *addrEP;
    uint32_t tmp;
    rLen = (rLen + 1) >> 1;
    addrEP = (uint32_t *)((uint32_t)USBD_ReadEPRxAddr(ep));
    addrEP = (uint32_t *)(((uint32_t)addrEP << 1) + USBD_PMA_ADDR);
    for(i = 0; i < rLen; i++)
    {
        tmp = *addrEP++;
        *rBuf++ = tmp & 0XFF;
        *rBuf++ = (tmp >> 8) & 0xff;
    }
}