diff options
author | Kinsey Moore <kinsey.moore@oarcorp.com> | 2023-09-19 14:23:06 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2023-09-26 09:02:48 -0500 |
commit | 2b5526aa5eed47703e8cd525e7348207bf24e2fb (patch) | |
tree | 81ea3f6c70e04ac09122a0278d0a5d55e7d48f35 /bsps/shared/dev/nand/xnandpsu.c | |
parent | validation: Compatibility for other RTEMS versions (diff) | |
download | rtems-2b5526aa5eed47703e8cd525e7348207bf24e2fb.tar.bz2 |
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.
Diffstat (limited to '')
-rw-r--r-- | bsps/shared/dev/nand/xnandpsu.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bsps/shared/dev/nand/xnandpsu.c b/bsps/shared/dev/nand/xnandpsu.c index 85e6ba8532..9e9f8959cf 100644 --- a/bsps/shared/dev/nand/xnandpsu.c +++ b/bsps/shared/dev/nand/xnandpsu.c @@ -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 + /*****************************************************************************/ /** * |