bsps/xnandpsu: Don't rely on usleep for polling

When polling hardware registers in high performance situations, don't
rely on usleep or other standard sleep functions since they will
necessarily rely on kernel ticks to be woken up. This can easily cause
an immense reduction in throughput.
This commit is contained in:
Kinsey Moore
2023-09-19 14:23:06 -05:00
committed by Joel Sherrill
parent 5a21b1d133
commit 2b5526aa5e

View File

@@ -814,6 +814,21 @@ void XNandPsu_DisableEccMode(XNandPsu *InstancePtr)
InstancePtr->EccMode = XNANDPSU_NONE;
}
#ifdef __rtems__
#include <rtems/rtems/clock.h>
static void udelay( void )
{
uint64_t time = rtems_clock_get_uptime_nanoseconds() + 1000;
while (1) {
uint64_t newtime = rtems_clock_get_uptime_nanoseconds();
if (newtime > time) {
break;
}
}
}
#define usleep(x) udelay()
#endif
/*****************************************************************************/
/**
*