238a7d3727671b8a3dd9fe9b5eca430da1074f7d
[ipfw.git] / dummynet2 / include / sys / systm.h
1 #ifndef _SYS_SYSTM_H_
2 #define _SYS_SYSTM_H_
3
4 #ifndef _WIN32  /* this is the linux version */
5 /* callout support, in <sys/callout.h> on FreeBSD */
6 /*
7  * callout support on linux module is done using timers
8  */
9 #include <linux/timer.h>
10 #ifdef LINUX_24
11 #include <linux/sched.h>        /* jiffies definition is here in 2.4 */
12 #endif
13 #define callout timer_list
14 static __inline int
15 callout_reset(struct callout *co, int ticks, void (*fn)(void *), void *arg)
16 {
17         co->expires = jiffies + ticks;
18         co->function = (void (*)(unsigned long))fn;
19         co->data = (unsigned long)arg;
20         add_timer(co);
21         return 0;
22 }
23
24 #define callout_init(co, safe)  init_timer(co)
25 #define callout_drain(co)       del_timer(co)
26 #define callout_stop(co)        del_timer(co)
27
28 #define CALLOUT_ACTIVE          0x0002 /* callout is currently active */
29 #define CALLOUT_MPSAFE          0x0008 /* callout handler is mp safe */
30
31 #else /* _WIN32 */
32
33 /* This is the windows part for callout support */
34 struct callout {
35         int dummy;
36 };
37 static __inline int
38 callout_reset(struct callout *co, int ticks, void (*fn)(void *), void *arg)
39 {
40         return 0;
41 }
42
43 #define callout_init(co, safe)
44 #define callout_drain(co)
45 #define callout_stop(co)
46 #endif /* !_WIN32 */
47
48
49 #if 0
50 /* add out timer to the kernel global timer list */
51 NTSTATUS 
52   IoInitializeTimer(
53     IN PDEVICE_OBJECT  DeviceObject,
54     IN PIO_TIMER_ROUTINE  TimerRoutine,
55     IN PVOID  Context
56     );
57
58 /* see differences :
59 IoInitializeDpcRequest
60         http://dsrg.mff.cuni.cz/~ceres/sch/osy/text/ch04s01s01.php
61         example http://www.beyondlogic.org/interrupts/winnt_isr_dpc.htm
62 KeInitializeDpc  IRQL: Any level
63 IoInitializeTimer IRQL: Passive level
64 KeInitializeTimer */
65 VOID 
66   KeInitializeDpc(
67     IN PRKDPC  Dpc,
68     IN PKDEFERRED_ROUTINE  DeferredRoutine,
69     IN PVOID  DeferredContext
70     );
71 #endif /* commented out */ 
72
73 #endif /* _SYS_SYSTM_H_ */