Dependencies:   mbed

Committer:
robertcook
Date:
Wed Jun 13 18:39:46 2012 +0000
Revision:
0:32a0996dff0f

        

Who changed what in which revision?

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