xref: /haiku/headers/private/kernel/timer.h (revision 220d04022750f40f8bac8f01fa551211e28d04f2)
1 /*
2 ** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS License.
4 */
5 #ifndef _KERNEL_TIMER_H
6 #define _KERNEL_TIMER_H
7 
8 
9 #include <KernelExport.h>
10 
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 struct kernel_args;
17 
18 #define B_TIMER_REAL_TIME_BASE			0x2000
19 	// For an absolute timer the given time is interpreted as a real-time, not
20 	// as a system time. Note that setting the real-time clock will cause the
21 	// timer to be updated -- it will expire according to the new clock.
22 	// Relative timers are unaffected by this flag.
23 #define B_TIMER_USE_TIMER_STRUCT_TIMES	0x4000
24 	// For add_timer(): Use the timer::schedule_time (absolute time) and
25 	// timer::period values instead of the period parameter.
26 #define B_TIMER_FLAGS	\
27 	(B_TIMER_USE_TIMER_STRUCT_TIMES | B_TIMER_REAL_TIME_BASE)
28 
29 /* Timer info structure */
30 struct timer_info {
31 	const char *name;
32 	int (*get_priority)(void);
33 	status_t (*set_hardware_timer)(bigtime_t timeout);
34 	status_t (*clear_hardware_timer)(void);
35 	status_t (*init)(struct kernel_args *args);
36 };
37 
38 typedef struct timer_info timer_info;
39 
40 
41 /* kernel functions */
42 status_t timer_init(struct kernel_args *);
43 void timer_init_post_rtc(void);
44 void timer_real_time_clock_changed();
45 int32 timer_interrupt(void);
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
51 #endif	/* _KERNEL_TIMER_H */
52