lpc1768

Committer:
jh1cdv00
Date:
Tue Jan 27 01:38:19 2015 +0000
Revision:
0:f35dada1dac1
lpc1768

Who changed what in which revision?

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