forked from Imagelibrary/rtems
2008-09-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* clock_driver_simidle.c: New file. This implementation is for BSPs for simulators without a clock tick ISR. It provides a special IDLE task that calls rtems_clock_tick() repeatedly when the application ends up in the IDLE task. This simulates time advancing. It is enough to run many tests but will not result in the correct behavior when you want timeslicing. This is because timeslicing assumes that a tick ISR determines that the currently executing thread must be switched out. Without a clock tick ISR, this will not occur.
This commit is contained in:
@@ -1,3 +1,15 @@
|
|||||||
|
2008-09-24 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
* clock_driver_simidle.c: New file.
|
||||||
|
This implementation is for BSPs for simulators without a clock tick
|
||||||
|
ISR. It provides a special IDLE task that calls rtems_clock_tick()
|
||||||
|
repeatedly when the application ends up in the IDLE task. This
|
||||||
|
simulates time advancing. It is enough to run many tests but
|
||||||
|
will not result in the correct behavior when you want timeslicing.
|
||||||
|
This is because timeslicing assumes that a tick ISR determines
|
||||||
|
that the currently executing thread must be switched out. Without
|
||||||
|
a clock tick ISR, this will not occur.
|
||||||
|
|
||||||
2008-09-23 Joel Sherrill <joel.sherrill@oarcorp.com>
|
2008-09-23 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* bootcard.c, include/bootcard.h: Make letting boot_card() handle work
|
* bootcard.c, include/bootcard.h: Make letting boot_card() handle work
|
||||||
|
|||||||
47
c/src/lib/libbsp/shared/clock_driver_simidle.c
Normal file
47
c/src/lib/libbsp/shared/clock_driver_simidle.c
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Instantiate the clock driver shell.
|
||||||
|
*
|
||||||
|
* Since there is no clock source on the simulator, we fake
|
||||||
|
* it with a special IDLE task.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <rtems.h>
|
||||||
|
|
||||||
|
#define CLOCK_VECTOR 0
|
||||||
|
|
||||||
|
#define Clock_driver_support_at_tick()
|
||||||
|
|
||||||
|
#define Clock_driver_support_install_isr( _new, _old ) \
|
||||||
|
do { _old = 0; } while(0)
|
||||||
|
|
||||||
|
volatile bool clock_driver_enabled;
|
||||||
|
|
||||||
|
#define Clock_driver_support_initialize_hardware() \
|
||||||
|
do { \
|
||||||
|
clock_driver_enabled = true; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define Clock_driver_support_shutdown_hardware() \
|
||||||
|
do { \
|
||||||
|
clock_driver_enabled = false; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#include "clockdrv_shell.c"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
Thread clock_driver_sim_idle_body(
|
||||||
|
uintptr_t ignored
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for( ; ; ) {
|
||||||
|
if ( clock_driver_enabled )
|
||||||
|
rtems_clock_tick();
|
||||||
|
}
|
||||||
|
return 0; /* to avoid warning */
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user