Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
timeouts.h
00001 /** 00002 * @file 00003 * Timer implementations 00004 */ 00005 00006 /* 00007 * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without modification, 00011 * are permitted provided that the following conditions are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. The name of the author may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00024 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00026 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00029 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00030 * OF SUCH DAMAGE. 00031 * 00032 * This file is part of the lwIP TCP/IP stack. 00033 * 00034 * Author: Adam Dunkels <adam@sics.se> 00035 * Simon Goldschmidt 00036 * 00037 */ 00038 #ifndef LWIP_HDR_TIMEOUTS_H 00039 #define LWIP_HDR_TIMEOUTS_H 00040 00041 #include "lwip/opt.h" 00042 #include "lwip/err.h" 00043 #if !NO_SYS 00044 #include "lwip/sys.h" 00045 #endif 00046 00047 #ifdef __cplusplus 00048 extern "C" { 00049 #endif 00050 00051 #ifndef LWIP_DEBUG_TIMERNAMES 00052 #ifdef LWIP_DEBUG 00053 #define LWIP_DEBUG_TIMERNAMES SYS_DEBUG 00054 #else /* LWIP_DEBUG */ 00055 #define LWIP_DEBUG_TIMERNAMES 0 00056 #endif /* LWIP_DEBUG*/ 00057 #endif 00058 00059 /** Function prototype for a stack-internal timer function that has to be 00060 * called at a defined interval */ 00061 typedef void (* lwip_cyclic_timer_handler)(void); 00062 00063 /** This struct contains information about a stack-internal timer function 00064 that has to be called at a defined interval */ 00065 struct lwip_cyclic_timer { 00066 u32_t interval_ms; 00067 lwip_cyclic_timer_handler handler; 00068 #if LWIP_DEBUG_TIMERNAMES 00069 const char* handler_name; 00070 #endif /* LWIP_DEBUG_TIMERNAMES */ 00071 }; 00072 00073 /** This array contains all stack-internal cyclic timers. To get the number of 00074 * timers, use LWIP_ARRAYSIZE() */ 00075 extern const struct lwip_cyclic_timer lwip_cyclic_timers[]; 00076 00077 #if LWIP_TIMERS 00078 00079 /** Function prototype for a timeout callback function. Register such a function 00080 * using sys_timeout(). 00081 * 00082 * @param arg Additional argument to pass to the function - set up by sys_timeout() 00083 */ 00084 typedef void (* sys_timeout_handler)(void *arg); 00085 00086 struct sys_timeo { 00087 struct sys_timeo *next; 00088 u32_t time; 00089 sys_timeout_handler h; 00090 void *arg; 00091 #if LWIP_DEBUG_TIMERNAMES 00092 const char* handler_name; 00093 #endif /* LWIP_DEBUG_TIMERNAMES */ 00094 }; 00095 00096 void sys_timeouts_init(void); 00097 00098 #if LWIP_DEBUG_TIMERNAMES 00099 void sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name); 00100 #define sys_timeout(msecs, handler, arg) sys_timeout_debug(msecs, handler, arg, #handler) 00101 #else /* LWIP_DEBUG_TIMERNAMES */ 00102 void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg); 00103 #endif /* LWIP_DEBUG_TIMERNAMES */ 00104 00105 void sys_untimeout(sys_timeout_handler handler, void *arg); 00106 void sys_restart_timeouts(void); 00107 #if NO_SYS 00108 void sys_check_timeouts(void); 00109 u32_t sys_timeouts_sleeptime(void); 00110 #else /* NO_SYS */ 00111 void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg); 00112 #endif /* NO_SYS */ 00113 00114 00115 #endif /* LWIP_TIMERS */ 00116 00117 #ifdef __cplusplus 00118 } 00119 #endif 00120 00121 #endif /* LWIP_HDR_TIMEOUTS_H */
Generated on Tue Jul 12 2022 14:25:03 by
