summaryrefslogtreecommitdiff
path: root/bsps
diff options
context:
space:
mode:
authorKinsey Moore <kinsey.moore@oarcorp.com>2023-09-19 14:23:06 -0500
committerJoel Sherrill <joel@rtems.org>2023-09-26 09:02:48 -0500
commit2b5526aa5eed47703e8cd525e7348207bf24e2fb (patch)
tree81ea3f6c70e04ac09122a0278d0a5d55e7d48f35 /bsps
parent5a21b1d1331c9cfb5ffcb0903ff751981757285e (diff)
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 'bsps')
-rw-r--r--bsps/shared/dev/nand/xnandpsu.c15
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
+
/*****************************************************************************/
/**
*