forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -30,6 +30,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
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user