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