blob: 09544115a4811b820fde87e5da49f892d2388afe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*
* Instantiate the clock driver shell.
*
* Since there is no clock source on the simulator, we fake
* it with a special IDLE task.
*/
#include <rtems.h>
#include <rtems/score/percpu.h>
#include <rtems/score/threaddispatch.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)
#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
#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
* interrupt work but is enough for many tests.
*/
void *clock_driver_sim_idle_body(
uintptr_t ignored
)
{
for( ; ; ) {
if ( clock_driver_enabled ) {
_Thread_Disable_dispatch();
_ISR_Nest_level++;
rtems_clock_tick();
_ISR_Nest_level--;
_Thread_Enable_dispatch();
BSP_CLOCK_DRIVER_DELAY();
}
}
return 0; /* to avoid warning */
}
|