/* Read USB Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer Return Value: Number of bytes read  */
uint32_t USB_ReadEP(uint32_t EPNum, uint8_t *pData)
/* Read USB Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer Return Value: Number of bytes read  */
uint32_t USB_ReadEP(uint32_t EPNum, uint8_t *pData)
{
    cnt = USB_RXPLEN;
  } while ((cnt & PKT_DV) == 0);
  cnt &= PKT_LNGTH_MASK;
  for (n = 0; n < (cnt + 3) / 4; n++) {
    *((uint32_t __attribute__((packed)) *)pData) = USB_RXDATA;
    pData += 4;
  }
  USB_CTRL = 0;
  if ((EPNum & 0x80) != 0x04) {
    WrCmdEP(EPNum, CMD_CLR_BUF);
  }
  return (cnt);
}