Rev 1731 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1731 | Rev 1780 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | #include <arch/types.h> |
38 | #include <arch/types.h> |
39 | #include <typedefs.h> |
39 | #include <typedefs.h> |
40 | #include <synch/spinlock.h> |
40 | #include <synch/spinlock.h> |
41 | #include <adt/list.h> |
41 | #include <adt/list.h> |
42 | 42 | ||
43 | #define us2ticks(us) ((__u64)(((__u32) (us)/(1000000/HZ)))) |
43 | #define us2ticks(us) ((uint64_t)(((uint32_t) (us)/(1000000/HZ)))) |
44 | 44 | ||
45 | typedef void (* timeout_handler_t)(void *arg); |
45 | typedef void (* timeout_handler_t)(void *arg); |
46 | 46 | ||
47 | struct timeout { |
47 | struct timeout { |
48 | SPINLOCK_DECLARE(lock); |
48 | SPINLOCK_DECLARE(lock); |
49 | 49 | ||
50 | link_t link; /**< Link to the list of active timeouts on THE->cpu */ |
50 | link_t link; /**< Link to the list of active timeouts on THE->cpu */ |
51 | 51 | ||
52 | __u64 ticks; /**< Timeout will be activated in this amount of clock() ticks. */ |
52 | uint64_t ticks; /**< Timeout will be activated in this amount of clock() ticks. */ |
53 | 53 | ||
54 | timeout_handler_t handler; /**< Function that will be called on timeout activation. */ |
54 | timeout_handler_t handler; /**< Function that will be called on timeout activation. */ |
55 | void *arg; /**< Argument to be passed to handler() function. */ |
55 | void *arg; /**< Argument to be passed to handler() function. */ |
56 | 56 | ||
57 | cpu_t *cpu; /**< On which processor is this timeout registered. */ |
57 | cpu_t *cpu; /**< On which processor is this timeout registered. */ |
58 | }; |
58 | }; |
59 | 59 | ||
60 | extern void timeout_init(void); |
60 | extern void timeout_init(void); |
61 | extern void timeout_initialize(timeout_t *t); |
61 | extern void timeout_initialize(timeout_t *t); |
62 | extern void timeout_reinitialize(timeout_t *t); |
62 | extern void timeout_reinitialize(timeout_t *t); |
63 | extern void timeout_register(timeout_t *t, __u64 usec, timeout_handler_t f, void *arg); |
63 | extern void timeout_register(timeout_t *t, uint64_t usec, timeout_handler_t f, void *arg); |
64 | extern bool timeout_unregister(timeout_t *t); |
64 | extern bool timeout_unregister(timeout_t *t); |
65 | 65 | ||
66 | #endif |
66 | #endif |
67 | 67 | ||
68 | /** @} |
68 | /** @} |