The Pedigree Project  0.1
timeouts.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
25 /*
26  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
27  * All rights reserved.
28  *
29  * Redistribution and use in source and binary forms, with or without modification,
30  * are permitted provided that the following conditions are met:
31  *
32  * 1. Redistributions of source code must retain the above copyright notice,
33  * this list of conditions and the following disclaimer.
34  * 2. Redistributions in binary form must reproduce the above copyright notice,
35  * this list of conditions and the following disclaimer in the documentation
36  * and/or other materials provided with the distribution.
37  * 3. The name of the author may not be used to endorse or promote products
38  * derived from this software without specific prior written permission.
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
41  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
42  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
43  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
45  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
48  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
49  * OF SUCH DAMAGE.
50  *
51  * This file is part of the lwIP TCP/IP stack.
52  *
53  * Author: Adam Dunkels <adam@sics.se>
54  * Simon Goldschmidt
55  *
56  */
57 #ifndef LWIP_HDR_TIMEOUTS_H
58 #define LWIP_HDR_TIMEOUTS_H
59 
60 #include "lwip/opt.h"
61 #include "lwip/err.h"
62 #if !NO_SYS
63 #include "lwip/sys.h"
64 #endif
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 #ifndef LWIP_DEBUG_TIMERNAMES
71 #ifdef LWIP_DEBUG
72 #define LWIP_DEBUG_TIMERNAMES SYS_DEBUG
73 #else /* LWIP_DEBUG */
74 #define LWIP_DEBUG_TIMERNAMES 0
75 #endif /* LWIP_DEBUG*/
76 #endif
77 
80 typedef void (* lwip_cyclic_timer_handler)(void);
81 
85  u32_t interval_ms;
87 #if LWIP_DEBUG_TIMERNAMES
88  const char* handler_name;
89 #endif /* LWIP_DEBUG_TIMERNAMES */
90 };
91 
94 extern const struct lwip_cyclic_timer lwip_cyclic_timers[];
95 
96 #if LWIP_TIMERS
97 
103 typedef void (* sys_timeout_handler)(void *arg);
104 
105 struct sys_timeo {
106  struct sys_timeo *next;
107  u32_t time;
108  sys_timeout_handler h;
109  void *arg;
110 #if LWIP_DEBUG_TIMERNAMES
111  const char* handler_name;
112 #endif /* LWIP_DEBUG_TIMERNAMES */
113 };
114 
115 void sys_timeouts_init(void);
116 
117 #if LWIP_DEBUG_TIMERNAMES
118 void sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name);
119 #define sys_timeout(msecs, handler, arg) sys_timeout_debug(msecs, handler, arg, #handler)
120 #else /* LWIP_DEBUG_TIMERNAMES */
121 void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg);
122 #endif /* LWIP_DEBUG_TIMERNAMES */
123 
124 void sys_untimeout(sys_timeout_handler handler, void *arg);
125 void sys_restart_timeouts(void);
126 #if NO_SYS
127 void sys_check_timeouts(void);
128 u32_t sys_timeouts_sleeptime(void);
129 #else /* NO_SYS */
130 void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg);
131 #endif /* NO_SYS */
132 
133 
134 #endif /* LWIP_TIMERS */
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif /* LWIP_HDR_TIMEOUTS_H */
void(* lwip_cyclic_timer_handler)(void)
Definition: timeouts.h:80