Rev 2089 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2089 | Rev 2103 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | 34 | ||
35 | #ifndef KERN_TIMEOUT_H_ |
35 | #ifndef KERN_TIMEOUT_H_ |
36 | #define KERN_TIMEOUT_H_ |
36 | #define KERN_TIMEOUT_H_ |
37 | 37 | ||
38 | #include <arch/types.h> |
38 | #include <arch/types.h> |
39 | #include <proc/task.h> |
39 | #include <adt/list.h> |
- | 40 | #include <cpu.h> |
|
- | 41 | ||
- | 42 | typedef void (* timeout_handler_t)(void *arg); |
|
- | 43 | ||
- | 44 | typedef struct { |
|
- | 45 | SPINLOCK_DECLARE(lock); |
|
- | 46 | ||
- | 47 | link_t link; /**< Link to the list of active timeouts on THE->cpu */ |
|
- | 48 | ||
- | 49 | uint64_t ticks; /**< Timeout will be activated in this amount of clock() ticks. */ |
|
- | 50 | ||
- | 51 | timeout_handler_t handler; /**< Function that will be called on timeout activation. */ |
|
- | 52 | void *arg; /**< Argument to be passed to handler() function. */ |
|
- | 53 | ||
- | 54 | cpu_t *cpu; /**< On which processor is this timeout registered. */ |
|
- | 55 | } timeout_t; |
|
40 | 56 | ||
41 | #define us2ticks(us) ((uint64_t) (((uint32_t) (us) / (1000000 / HZ)))) |
57 | #define us2ticks(us) ((uint64_t) (((uint32_t) (us) / (1000000 / HZ)))) |
42 | 58 | ||
43 | extern void timeout_init(void); |
59 | extern void timeout_init(void); |
44 | extern void timeout_initialize(timeout_t *t); |
60 | extern void timeout_initialize(timeout_t *t); |