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 #if !defined(SIM_TIMER_H_)
40 # define SIM_TIMER_H_ 0
41
42 # include <time.h>
43 # include <sys/types.h>
44 # include <pthread.h>
45
46 # define SIM_NTIMERS 8
47 # define SIM_TMAX 500
48 # define SIM_INITIAL_IPS 500000
49
50 # if !defined(PRIORITY_BELOW_NORMAL)
51 # define PRIORITY_BELOW_NORMAL -1
52 # endif
53 # if !defined(PRIORITY_NORMAL)
54 # define PRIORITY_NORMAL 0
55 # endif
56 # if !defined(PRIORITY_ABOVE_NORMAL)
57 # define PRIORITY_ABOVE_NORMAL 1
58 # endif
59
60 t_bool sim_timer_init (void);
61 void sim_timespec_diff (struct timespec *diff, const struct timespec *min, struct timespec *sub);
62 int32 sim_rtcn_init (int32 time, int32 tmr);
63 int32 sim_rtcn_init_unit (UNIT *uptr, int32 time, int32 tmr);
64 int sim_usleep(useconds_t tusleep);
65 void sim_rtcn_init_all (void);
66 int32 sim_rtcn_calb (uint32 ticksper, int32 tmr);
67 t_stat sim_show_timers (FILE* st, DEVICE *dptr, UNIT* uptr, int32 val, CONST char* desc);
68 t_stat sim_show_clock_queues (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
69 uint32 sim_os_msec (void);
70 void sim_os_sleep (unsigned int sec);
71 uint32 sim_os_ms_sleep (unsigned int msec);
72 uint32 sim_os_ms_sleep_init (void);
73 void sim_start_timer_services (void);
74 void sim_stop_timer_services (void);
75 t_stat sim_timer_change_asynch (void);
76 t_stat sim_timer_activate (UNIT *uptr, int32 interval);
77 t_stat sim_timer_activate_after (UNIT *uptr, uint32 usec_delay);
78 int32 sim_timer_activate_time (UNIT *uptr);
79 t_stat sim_register_clock_unit_tmr (UNIT *uptr, int32 tmr);
80 double sim_timer_inst_per_sec (void);
81 t_stat sim_os_set_thread_priority (int below_normal_above);
82 extern t_bool sim_asynch_timer;
83 extern DEVICE sim_timer_dev;
84 extern UNIT * volatile sim_clock_cosched_queue[SIM_NTIMERS+1];
85 extern const t_bool rtc_avail;
86 #endif