/* Reads a register from an external ULPI-connected USB PHY. */
uint8_t USBULPIRegRead(uint32_t ui32Base, uint8_t ui8Reg)
/* Reads a register from an external ULPI-connected USB PHY. */
uint8_t USBULPIRegRead(uint32_t ui32Base, uint8_t ui8Reg)
{
    ASSERT(ui32Base == USB0_BASE);
    HWREGB(ui32Base + USB_O_ULPIREGADDR) = ui8Reg;
    HWREGB(ui32Base + USB_O_ULPIREGCTL) =
        USB_ULPIREGCTL_RDWR | USB_ULPIREGCTL_REGACC;
    while ((HWREGB(ui32Base + USB_O_ULPIREGCTL) & USB_ULPIREGCTL_REGCMPLT) == 0)
    {
    }
    HWREGB(ui32Base + USB_O_ULPIREGCTL) = 0;
    return (HWREGB(ui32Base + USB_O_ULPIREGDATA));
}