/* Reads a packet whose byte number is len from the Rx FIFO.  */
void usb_rdpkt(LL_USB_TypeDef *USBx, uint8_t *dest, uint16_t len)
/* Reads a packet whose byte number is len from the Rx FIFO.  */
void usb_rdpkt(LL_USB_TypeDef *USBx, uint8_t *dest, uint16_t len)
{
    uint32_t u32Tmp;
    __IO uint32_t u32Count32b;
    __IO uint32_t u32pAddr;
    __IO uint32_t *fifo = USBx->DFIFO[0];
    u32Count32b = (len + 3UL);
    u32Count32b = u32Count32b >> 2U;
    u32pAddr = 0UL;
    u32Tmp = 0UL;
    while (u32Tmp < u32Count32b) {
        *(uint32_t *)dest = READ_REG32(*fifo);
        u32pAddr = (uint32_t)dest;
        dest = (uint8_t *)(u32pAddr + 4U);
        u32Tmp++;
    }
}