Rev 2079 | Rev 2089 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2079 | Rev 2081 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | 42 | ||
43 | #define us2ticks(us) ((uint64_t)(((uint32_t) (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 | typedef struct { |
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 | uint64_t 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 | } timeout_t; |
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, uint64_t usec, timeout_handler_t f, void *arg); |
63 | extern void timeout_register(timeout_t *t, uint64_t usec, timeout_handler_t f, void *arg); |