Rev 2183 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2183 | Rev 2916 | ||
|---|---|---|---|
| Line 30... | Line 30... | ||
| 30 | * @{ |
30 | * @{ |
| 31 | */ |
31 | */ |
| 32 | 32 | ||
| 33 | /** |
33 | /** |
| 34 | * @file |
34 | * @file |
| 35 | * @brief Timeout management functions. |
35 | * @brief Timeout management functions. |
| 36 | */ |
36 | */ |
| 37 | 37 | ||
| 38 | #include <time/timeout.h> |
38 | #include <time/timeout.h> |
| 39 | #include <arch/types.h> |
39 | #include <arch/types.h> |
| 40 | #include <config.h> |
40 | #include <config.h> |
| Line 59... | Line 59... | ||
| 59 | 59 | ||
| 60 | /** Reinitialize timeout |
60 | /** Reinitialize timeout |
| 61 | * |
61 | * |
| 62 | * Initialize all members except the lock. |
62 | * Initialize all members except the lock. |
| 63 | * |
63 | * |
| 64 | * @param t Timeout to be initialized. |
64 | * @param t Timeout to be initialized. |
| 65 | * |
65 | * |
| 66 | */ |
66 | */ |
| 67 | void timeout_reinitialize(timeout_t *t) |
67 | void timeout_reinitialize(timeout_t *t) |
| 68 | { |
68 | { |
| 69 | t->cpu = NULL; |
69 | t->cpu = NULL; |
| Line 76... | Line 76... | ||
| 76 | 76 | ||
| 77 | /** Initialize timeout |
77 | /** Initialize timeout |
| 78 | * |
78 | * |
| 79 | * Initialize all members including the lock. |
79 | * Initialize all members including the lock. |
| 80 | * |
80 | * |
| 81 | * @param t Timeout to be initialized. |
81 | * @param t Timeout to be initialized. |
| 82 | * |
82 | * |
| 83 | */ |
83 | */ |
| 84 | void timeout_initialize(timeout_t *t) |
84 | void timeout_initialize(timeout_t *t) |
| 85 | { |
85 | { |
| 86 | spinlock_initialize(&t->lock, "timeout_t_lock"); |
86 | spinlock_initialize(&t->lock, "timeout_t_lock"); |
| Line 92... | Line 92... | ||
| 92 | * |
92 | * |
| 93 | * Insert timeout handler f (with argument arg) |
93 | * Insert timeout handler f (with argument arg) |
| 94 | * to timeout list and make it execute in |
94 | * to timeout list and make it execute in |
| 95 | * time microseconds (or slightly more). |
95 | * time microseconds (or slightly more). |
| 96 | * |
96 | * |
| 97 | * @param t Timeout structure. |
97 | * @param t Timeout structure. |
| 98 | * @param time Number of usec in the future to execute |
98 | * @param time Number of usec in the future to execute the handler. |
| 99 | * the handler. |
- | |
| 100 | * @param f Timeout handler function. |
99 | * @param f Timeout handler function. |
| 101 | * @param arg Timeout handler argument. |
100 | * @param arg Timeout handler argument. |
| 102 | * |
101 | * |
| 103 | */ |
102 | */ |
| - | 103 | void |
|
| 104 | void timeout_register(timeout_t *t, uint64_t time, timeout_handler_t f, void *arg) |
104 | timeout_register(timeout_t *t, uint64_t time, timeout_handler_t f, void *arg) |
| 105 | { |
105 | { |
| 106 | timeout_t *hlp = NULL; |
106 | timeout_t *hlp = NULL; |
| 107 | link_t *l, *m; |
107 | link_t *l, *m; |
| 108 | ipl_t ipl; |
108 | ipl_t ipl; |
| 109 | uint64_t sum; |
109 | uint64_t sum; |
| Line 163... | Line 163... | ||
| 163 | 163 | ||
| 164 | /** Unregister timeout |
164 | /** Unregister timeout |
| 165 | * |
165 | * |
| 166 | * Remove timeout from timeout list. |
166 | * Remove timeout from timeout list. |
| 167 | * |
167 | * |
| 168 | * @param t Timeout to unregister. |
168 | * @param t Timeout to unregister. |
| 169 | * |
169 | * |
| 170 | * @return true on success, false on failure. |
170 | * @return True on success, false on failure. |
| 171 | */ |
171 | */ |
| 172 | bool timeout_unregister(timeout_t *t) |
172 | bool timeout_unregister(timeout_t *t) |
| 173 | { |
173 | { |
| 174 | timeout_t *hlp; |
174 | timeout_t *hlp; |
| 175 | link_t *l; |
175 | link_t *l; |