Dependents:   RTnoV3 RTnoV3_LED RTnoV3_Template RTnoV3_ADC ... more

Committer:
sherckuith
Date:
Sat Dec 31 11:25:27 2011 +0000
Revision:
0:479ce5546098
Ethernet

Who changed what in which revision?

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