summaryrefslogtreecommitdiff
path: root/nuttx/arch/sim/src/up_idle.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/arch/sim/src/up_idle.c')
-rw-r--r--nuttx/arch/sim/src/up_idle.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/nuttx/arch/sim/src/up_idle.c b/nuttx/arch/sim/src/up_idle.c
index 84177f106..e83068713 100644
--- a/nuttx/arch/sim/src/up_idle.c
+++ b/nuttx/arch/sim/src/up_idle.c
@@ -39,6 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
+#include <time.h>
#include <nuttx/arch.h>
#include "up_internal.h"
@@ -50,6 +51,21 @@
* Private Data
****************************************************************************/
+#ifdef CONFIG_SIM_X11FB
+static int g_x11refresh = 0;
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#if defined(CONFIG_SIM_WALLTIME) || defined(CONFIG_SIM_X11FB)
+extern int up_hostusleep(unsigned int usec);
+#ifdef CONFIG_SIM_X11FB
+extern void up_x11update(void);
+#endif
+#endif
+
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -86,5 +102,20 @@ void up_idle(void)
#if defined(CONFIG_NET) && defined(linux)
uipdriver_loop();
#endif
+
+ /* Wait a bit so that the sched_process_timer() is called close to the
+ * correct rate.
+ */
+
+#if defined(CONFIG_SIM_WALLTIME) || defined(CONFIG_SIM_X11FB)
+ (void)up_hostusleep(1000000 / CLK_TCK);
+#ifdef CONFIG_SIM_X11FB
+ g_x11refresh += 1000000 / CLK_TCK;
+ if (g_x11refresh > 500000)
+ {
+ up_x11update();
+ }
+#endif
+#endif
}