/* Stalls the CPU for the number of microseconds specified by MicroSeconds. */
UINTN EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)
/* Stalls the CPU for the number of microseconds specified by MicroSeconds. */
UINTN EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)
{
  UINT64  TimerTicks64;
  UINT64  SystemCounterVal;
  TimerTicks64 = DivU64x32 (
                   MULT_U64_X_N (
                     MicroSeconds,
                     GetPlatformTimerFreq ()
                     ),
                   1000000U
                   );
  SystemCounterVal = ArmGenericTimerGetSystemCount ();
  TimerTicks64 += SystemCounterVal;
  while (SystemCounterVal < TimerTicks64) {
    SystemCounterVal = ArmGenericTimerGetSystemCount ();
  }
  return MicroSeconds;
}