Allen Litton
/
BreakoutBoardDemo
Demo Application for the Celeritous Breakout Board
EthernetNetIf/LPC1768/lwip/include/lwip/timers.h@0:1a3da73fe36a, 2012-05-18 (annotated)
- Committer:
- celeritous
- Date:
- Fri May 18 03:55:10 2012 +0000
- Revision:
- 0:1a3da73fe36a
Celeritous_BreakoutBoardDemo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
celeritous | 0:1a3da73fe36a | 1 | /* |
celeritous | 0:1a3da73fe36a | 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
celeritous | 0:1a3da73fe36a | 3 | * All rights reserved. |
celeritous | 0:1a3da73fe36a | 4 | * |
celeritous | 0:1a3da73fe36a | 5 | * Redistribution and use in source and binary forms, with or without modification, |
celeritous | 0:1a3da73fe36a | 6 | * are permitted provided that the following conditions are met: |
celeritous | 0:1a3da73fe36a | 7 | * |
celeritous | 0:1a3da73fe36a | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
celeritous | 0:1a3da73fe36a | 9 | * this list of conditions and the following disclaimer. |
celeritous | 0:1a3da73fe36a | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
celeritous | 0:1a3da73fe36a | 11 | * this list of conditions and the following disclaimer in the documentation |
celeritous | 0:1a3da73fe36a | 12 | * and/or other materials provided with the distribution. |
celeritous | 0:1a3da73fe36a | 13 | * 3. The name of the author may not be used to endorse or promote products |
celeritous | 0:1a3da73fe36a | 14 | * derived from this software without specific prior written permission. |
celeritous | 0:1a3da73fe36a | 15 | * |
celeritous | 0:1a3da73fe36a | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
celeritous | 0:1a3da73fe36a | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
celeritous | 0:1a3da73fe36a | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
celeritous | 0:1a3da73fe36a | 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
celeritous | 0:1a3da73fe36a | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
celeritous | 0:1a3da73fe36a | 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
celeritous | 0:1a3da73fe36a | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
celeritous | 0:1a3da73fe36a | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
celeritous | 0:1a3da73fe36a | 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
celeritous | 0:1a3da73fe36a | 25 | * OF SUCH DAMAGE. |
celeritous | 0:1a3da73fe36a | 26 | * |
celeritous | 0:1a3da73fe36a | 27 | * This file is part of the lwIP TCP/IP stack. |
celeritous | 0:1a3da73fe36a | 28 | * |
celeritous | 0:1a3da73fe36a | 29 | * Author: Adam Dunkels <adam@sics.se> |
celeritous | 0:1a3da73fe36a | 30 | * Simon Goldschmidt |
celeritous | 0:1a3da73fe36a | 31 | * |
celeritous | 0:1a3da73fe36a | 32 | */ |
celeritous | 0:1a3da73fe36a | 33 | #ifndef __LWIP_TIMERS_H__ |
celeritous | 0:1a3da73fe36a | 34 | #define __LWIP_TIMERS_H__ |
celeritous | 0:1a3da73fe36a | 35 | |
celeritous | 0:1a3da73fe36a | 36 | #include "lwip/opt.h" |
celeritous | 0:1a3da73fe36a | 37 | |
celeritous | 0:1a3da73fe36a | 38 | /* Timers are not supported when NO_SYS==1 and NO_SYS_NO_TIMERS==1 */ |
celeritous | 0:1a3da73fe36a | 39 | #define LWIP_TIMERS (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) |
celeritous | 0:1a3da73fe36a | 40 | |
celeritous | 0:1a3da73fe36a | 41 | #if LWIP_TIMERS |
celeritous | 0:1a3da73fe36a | 42 | |
celeritous | 0:1a3da73fe36a | 43 | #include "lwip/err.h" |
celeritous | 0:1a3da73fe36a | 44 | #include "lwip/sys.h" |
celeritous | 0:1a3da73fe36a | 45 | |
celeritous | 0:1a3da73fe36a | 46 | #ifdef __cplusplus |
celeritous | 0:1a3da73fe36a | 47 | extern "C" { |
celeritous | 0:1a3da73fe36a | 48 | #endif |
celeritous | 0:1a3da73fe36a | 49 | |
celeritous | 0:1a3da73fe36a | 50 | #ifndef LWIP_DEBUG_TIMERNAMES |
celeritous | 0:1a3da73fe36a | 51 | #ifdef LWIP_DEBUG |
celeritous | 0:1a3da73fe36a | 52 | #define LWIP_DEBUG_TIMERNAMES SYS_DEBUG |
celeritous | 0:1a3da73fe36a | 53 | #else /* LWIP_DEBUG */ |
celeritous | 0:1a3da73fe36a | 54 | #define LWIP_DEBUG_TIMERNAMES 0 |
celeritous | 0:1a3da73fe36a | 55 | #endif /* LWIP_DEBUG*/ |
celeritous | 0:1a3da73fe36a | 56 | #endif |
celeritous | 0:1a3da73fe36a | 57 | |
celeritous | 0:1a3da73fe36a | 58 | /** Function prototype for a timeout callback function. Register such a function |
celeritous | 0:1a3da73fe36a | 59 | * using sys_timeout(). |
celeritous | 0:1a3da73fe36a | 60 | * |
celeritous | 0:1a3da73fe36a | 61 | * @param arg Additional argument to pass to the function - set up by sys_timeout() |
celeritous | 0:1a3da73fe36a | 62 | */ |
celeritous | 0:1a3da73fe36a | 63 | typedef void (* sys_timeout_handler)(void *arg); |
celeritous | 0:1a3da73fe36a | 64 | |
celeritous | 0:1a3da73fe36a | 65 | struct sys_timeo { |
celeritous | 0:1a3da73fe36a | 66 | struct sys_timeo *next; |
celeritous | 0:1a3da73fe36a | 67 | u32_t time; |
celeritous | 0:1a3da73fe36a | 68 | sys_timeout_handler h; |
celeritous | 0:1a3da73fe36a | 69 | void *arg; |
celeritous | 0:1a3da73fe36a | 70 | #if LWIP_DEBUG_TIMERNAMES |
celeritous | 0:1a3da73fe36a | 71 | const char* handler_name; |
celeritous | 0:1a3da73fe36a | 72 | #endif /* LWIP_DEBUG_TIMERNAMES */ |
celeritous | 0:1a3da73fe36a | 73 | }; |
celeritous | 0:1a3da73fe36a | 74 | |
celeritous | 0:1a3da73fe36a | 75 | void sys_timeouts_init(void); |
celeritous | 0:1a3da73fe36a | 76 | |
celeritous | 0:1a3da73fe36a | 77 | #if LWIP_DEBUG_TIMERNAMES |
celeritous | 0:1a3da73fe36a | 78 | void sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name); |
celeritous | 0:1a3da73fe36a | 79 | #define sys_timeout(msecs, handler, arg) sys_timeout_debug(msecs, handler, arg, #handler) |
celeritous | 0:1a3da73fe36a | 80 | #else /* LWIP_DEBUG_TIMERNAMES */ |
celeritous | 0:1a3da73fe36a | 81 | void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg); |
celeritous | 0:1a3da73fe36a | 82 | #endif /* LWIP_DEBUG_TIMERNAMES */ |
celeritous | 0:1a3da73fe36a | 83 | |
celeritous | 0:1a3da73fe36a | 84 | void sys_untimeout(sys_timeout_handler handler, void *arg); |
celeritous | 0:1a3da73fe36a | 85 | #if NO_SYS |
celeritous | 0:1a3da73fe36a | 86 | void sys_check_timeouts(void); |
celeritous | 0:1a3da73fe36a | 87 | void sys_restart_timeouts(void); |
celeritous | 0:1a3da73fe36a | 88 | #else /* NO_SYS */ |
celeritous | 0:1a3da73fe36a | 89 | void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg); |
celeritous | 0:1a3da73fe36a | 90 | #endif /* NO_SYS */ |
celeritous | 0:1a3da73fe36a | 91 | |
celeritous | 0:1a3da73fe36a | 92 | |
celeritous | 0:1a3da73fe36a | 93 | #ifdef __cplusplus |
celeritous | 0:1a3da73fe36a | 94 | } |
celeritous | 0:1a3da73fe36a | 95 | #endif |
celeritous | 0:1a3da73fe36a | 96 | |
celeritous | 0:1a3da73fe36a | 97 | #endif /* LWIP_TIMERS */ |
celeritous | 0:1a3da73fe36a | 98 | #endif /* __LWIP_TIMERS_H__ */ |