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