4.104.115
Last change
on this file since ac7af4a was
0846740,
checked in by Joel Sherrill <joel.sherrill@…>, on 10/13/08 at 17:06:33
|
2008-10-13 Joel Sherrill <joel.sherrill@…>
- clock_driver_simidle.c: Ensure ISR nest level and Thread Dispatch
disable level are in the same state they would be in a true ISR. This
ensures that all of the clock tick handling is as similar as possible
in this limited environment.
|
-
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 | * $Id$ |
---|
8 | */ |
---|
9 | |
---|
10 | #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ |
---|
11 | #include <rtems.h> |
---|
12 | #include <rtems/score/thread.h> |
---|
13 | |
---|
14 | #define CLOCK_VECTOR 0 |
---|
15 | |
---|
16 | #define Clock_driver_support_at_tick() |
---|
17 | |
---|
18 | #define Clock_driver_support_install_isr( _new, _old ) \ |
---|
19 | do { _old = 0; } while(0) |
---|
20 | |
---|
21 | volatile bool clock_driver_enabled; |
---|
22 | |
---|
23 | #define Clock_driver_support_initialize_hardware() \ |
---|
24 | do { \ |
---|
25 | clock_driver_enabled = true; \ |
---|
26 | } while (0) |
---|
27 | |
---|
28 | #define Clock_driver_support_shutdown_hardware() \ |
---|
29 | do { \ |
---|
30 | clock_driver_enabled = false; \ |
---|
31 | } while (0) |
---|
32 | |
---|
33 | #include "clockdrv_shell.h" |
---|
34 | |
---|
35 | /* |
---|
36 | * Since there is no interrupt on this simulator, let's just |
---|
37 | * fake time passing. This will not let preemption from an |
---|
38 | * interrupt work but is enough for many tests. |
---|
39 | */ |
---|
40 | Thread clock_driver_sim_idle_body( |
---|
41 | uintptr_t ignored |
---|
42 | ) |
---|
43 | { |
---|
44 | for( ; ; ) { |
---|
45 | if ( clock_driver_enabled ) { |
---|
46 | _Thread_Disable_dispatch(); |
---|
47 | _ISR_Nest_level++; |
---|
48 | rtems_clock_tick(); |
---|
49 | _ISR_Nest_level--; |
---|
50 | _Thread_Enable_dispatch(); |
---|
51 | } |
---|
52 | } |
---|
53 | return 0; /* to avoid warning */ |
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.