/* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written  */
uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt)
/* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written  */
uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt)
{
    uint32_t i;
    EPNum &= 0x7f;
    for (i = 0; i < cnt; i++) {
        Ep[EP_IN_IDX(EPNum)].buf[i] = pData[i];
    }
    USBD_PrimeEp(EPNum | 0x80, cnt);
    return (cnt);
}