[rtems commit] clock_driver_simidle.c: Add BSP_CLOCK_DRIVER_DELAY
Joel Sherril
joel at rtems.org
Sun Jan 4 19:45:21 UTC 2015
Module: rtems
Branch: master
Commit: 1ae7baf2d8d056430e5643eae5c9d776e26ef355
Changeset: http://git.rtems.org/rtems/commit/?id=1ae7baf2d8d056430e5643eae5c9d776e26ef355
Author: Joel Sherrill <joel.sherrill at oarcorp.com>
Date: Sun Dec 14 16:02:42 2014 -0600
clock_driver_simidle.c: Add BSP_CLOCK_DRIVER_DELAY
This allows the BSP to define an optional spin delay which is
useful for making time appear to pass at a rate closer to
wall time. On the Edison, this was used with a polled console
driver to slow polling to a reasonable rate and make time
pass reasonably close to correctly even with no clock tick
support.
---
c/src/lib/libbsp/shared/clock_driver_simidle.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/c/src/lib/libbsp/shared/clock_driver_simidle.c b/c/src/lib/libbsp/shared/clock_driver_simidle.c
index cfb9df5..0f94b1e 100644
--- a/c/src/lib/libbsp/shared/clock_driver_simidle.c
+++ b/c/src/lib/libbsp/shared/clock_driver_simidle.c
@@ -31,6 +31,15 @@ volatile bool clock_driver_enabled;
#include "clockdrv_shell.h"
/*
+ * If this is defined, then the BSP has defined a delay of some sort so
+ * time passage appears somewhat correctly. Otherwise, it runs extremely
+ * fast with no delays.
+ */
+#ifndef BSP_CLOCK_DRIVER_DELAY
+#define BSP_CLOCK_DRIVER_DELAY()
+#endif
+
+/*
* Since there is no interrupt on this simulator, let's just
* fake time passing. This will not let preemption from an
* interrupt work but is enough for many tests.
@@ -46,6 +55,7 @@ Thread clock_driver_sim_idle_body(
rtems_clock_tick();
_ISR_Nest_level--;
_Thread_Enable_dispatch();
+ BSP_CLOCK_DRIVER_DELAY();
}
}
return 0; /* to avoid warning */
More information about the vc
mailing list