source: rtems/c/src/lib/libbsp/shared/clock_driver_simidle.c @ 8df1f408

4.115
Last change on this file since 8df1f408 was 0c3edbf, checked in by Sebastian Huber <sebastian.huber@…>, on 07/25/13 at 08:46:15

Include missing <rtems/score/threaddispatch.h>

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  Instantiate the clock driver shell.
3 *
4 *  Since there is no clock source on the simulator, we fake
5 *  it with a special IDLE task.
6 */
7
8#include <rtems.h>
9#include <rtems/score/percpu.h>
10#include <rtems/score/threaddispatch.h>
11
12#define CLOCK_VECTOR 0
13
14#define Clock_driver_support_at_tick()
15
16#define Clock_driver_support_install_isr( _new, _old ) \
17  do { _old = 0; } while(0)
18
19volatile bool clock_driver_enabled;
20
21#define Clock_driver_support_initialize_hardware() \
22  do { \
23    clock_driver_enabled = true; \
24  } while (0)
25
26#define Clock_driver_support_shutdown_hardware() \
27  do { \
28    clock_driver_enabled = false; \
29  } while (0)
30
31#include "clockdrv_shell.h"
32
33/*
34 *  Since there is no interrupt on this simulator, let's just
35 *  fake time passing.  This will not let preemption from an
36 *  interrupt work but is enough for many tests.
37 */
38Thread clock_driver_sim_idle_body(
39  uintptr_t   ignored
40)
41{
42  for( ; ; ) {
43    if ( clock_driver_enabled ) {
44      _Thread_Disable_dispatch();
45      _ISR_Nest_level++;
46        rtems_clock_tick();
47      _ISR_Nest_level--;
48      _Thread_Enable_dispatch();
49    }
50  }
51  return 0;   /* to avoid warning */
52}
Note: See TracBrowser for help on using the repository browser.