forked from Imagelibrary/rtems
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:
committed by
Joel Sherrill
parent
5a21b1d133
commit
2b5526aa5e
@@ -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
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user