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.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
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 /** Returned by sys_timeouts_sleeptime() to indicate there is no timer, so we 00060 * can sleep forever. 00061 */ 00062 #define SYS_TIMEOUTS_SLEEPTIME_INFINITE 0xFFFFFFFF 00063 00064 /** Function prototype for a stack-internal timer function that has to be 00065 * called at a defined interval */ 00066 typedef void (* lwip_cyclic_timer_handler)(void); 00067 00068 /** This struct contains information about a stack-internal timer function 00069 that has to be called at a defined interval */ 00070 struct lwip_cyclic_timer { 00071 u32_t interval_ms; 00072 lwip_cyclic_timer_handler handler; 00073 #if LWIP_DEBUG_TIMERNAMES 00074 const char* handler_name; 00075 #endif /* LWIP_DEBUG_TIMERNAMES */ 00076 }; 00077 00078 /** This array contains all stack-internal cyclic timers. To get the number of 00079 * timers, use lwip_num_cyclic_timers */ 00080 extern const struct lwip_cyclic_timer lwip_cyclic_timers[]; 00081 /** Array size of lwip_cyclic_timers[] */ 00082 extern const int lwip_num_cyclic_timers; 00083 00084 #if LWIP_TIMERS 00085 00086 /** Function prototype for a timeout callback function. Register such a function 00087 * using sys_timeout(). 00088 * 00089 * @param arg Additional argument to pass to the function - set up by sys_timeout() 00090 */ 00091 typedef void (* sys_timeout_handler)(void *arg); 00092 00093 struct sys_timeo { 00094 struct sys_timeo *next; 00095 u32_t time; 00096 sys_timeout_handler h; 00097 void *arg; 00098 #if LWIP_DEBUG_TIMERNAMES 00099 const char* handler_name; 00100 #endif /* LWIP_DEBUG_TIMERNAMES */ 00101 }; 00102 00103 void sys_timeouts_init(void); 00104 00105 #if LWIP_DEBUG_TIMERNAMES 00106 void sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name); 00107 #define sys_timeout(msecs, handler, arg) sys_timeout_debug(msecs, handler, arg, #handler) 00108 #else /* LWIP_DEBUG_TIMERNAMES */ 00109 void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg); 00110 #endif /* LWIP_DEBUG_TIMERNAMES */ 00111 00112 void sys_untimeout(sys_timeout_handler handler, void *arg); 00113 void sys_restart_timeouts(void); 00114 void sys_check_timeouts(void); 00115 u32_t sys_timeouts_sleeptime(void); 00116 00117 #if LWIP_TESTMODE 00118 struct sys_timeo** sys_timeouts_get_next_timeout(void); 00119 void lwip_cyclic_timer(void *arg); 00120 #endif 00121 00122 #endif /* LWIP_TIMERS */ 00123 00124 #ifdef __cplusplus 00125 } 00126 #endif 00127 00128 #endif /* LWIP_HDR_TIMEOUTS_H */
Generated on Tue Jul 12 2022 13:55:00 by
