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