Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:04

0001 /*
0002  *  Instantiate the clock driver shell.
0003  *
0004  *  Since there is no clock source on the simulator, we fake
0005  *  it with a special IDLE task.
0006  */
0007 
0008 #include <rtems.h>
0009 #include <rtems/score/percpu.h>
0010 #include <rtems/score/threaddispatch.h>
0011 
0012 #define CLOCK_VECTOR 0
0013 
0014 #define Clock_driver_support_initialize_hardware() \
0015   do { } while (0)
0016 
0017 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
0018 
0019 #include "clockimpl.h"
0020 
0021 /*
0022  * If this is defined, then the BSP has defined a delay of some sort so
0023  * time passage appears somewhat correctly. Otherwise, it runs extremely
0024  * fast with no delays.
0025  */
0026 #ifndef BSP_CLOCK_DRIVER_DELAY
0027 #define BSP_CLOCK_DRIVER_DELAY()
0028 #endif
0029 
0030 /*
0031  *  Since there is no interrupt on this simulator, let's just
0032  *  fake time passing.  This will not let preemption from an
0033  *  interrupt work but is enough for many tests.
0034  */
0035 void *clock_driver_sim_idle_body(
0036   uintptr_t   ignored
0037 )
0038 {
0039   for( ; ; ) {
0040     Per_CPU_Control *cpu = _Thread_Dispatch_disable();
0041     _ISR_Nest_level++;
0042     rtems_clock_tick();
0043     _ISR_Nest_level--;
0044     _Thread_Dispatch_enable( cpu );
0045     BSP_CLOCK_DRIVER_DELAY();
0046   }
0047   return 0;   /* to avoid warning */
0048 }