Fork for fixes
utility/uip_timer.h@1:01c2344f98a3, 2014-11-20 (annotated)
- Committer:
- hudakz
- Date:
- Thu Nov 20 21:26:54 2014 +0000
- Revision:
- 1:01c2344f98a3
- Parent:
- uitility/uip_timer.h@0:5350a66d5279
rev. 01
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:5350a66d5279 | 1 | /** |
hudakz | 0:5350a66d5279 | 2 | * \defgroup timer Timer library |
hudakz | 0:5350a66d5279 | 3 | * |
hudakz | 0:5350a66d5279 | 4 | * The timer library provides functions for setting, resetting and |
hudakz | 0:5350a66d5279 | 5 | * restarting timers, and for checking if a timer has expired. An |
hudakz | 0:5350a66d5279 | 6 | * application must "manually" check if its timers have expired; this |
hudakz | 0:5350a66d5279 | 7 | * is not done automatically. |
hudakz | 0:5350a66d5279 | 8 | * |
hudakz | 0:5350a66d5279 | 9 | * A timer is declared as a \c struct \c timer and all access to the |
hudakz | 0:5350a66d5279 | 10 | * timer is made by a pointer to the declared timer. |
hudakz | 0:5350a66d5279 | 11 | * |
hudakz | 0:5350a66d5279 | 12 | * \note The timer library uses the \ref clock "Clock library" to |
hudakz | 0:5350a66d5279 | 13 | * measure time. Intervals should be specified in the format used by |
hudakz | 0:5350a66d5279 | 14 | * the clock library. |
hudakz | 0:5350a66d5279 | 15 | * |
hudakz | 0:5350a66d5279 | 16 | * @{ |
hudakz | 0:5350a66d5279 | 17 | */ |
hudakz | 0:5350a66d5279 | 18 | /** |
hudakz | 0:5350a66d5279 | 19 | * \file |
hudakz | 0:5350a66d5279 | 20 | * Timer library header file. |
hudakz | 0:5350a66d5279 | 21 | * \author |
hudakz | 0:5350a66d5279 | 22 | * Adam Dunkels <adam@sics.se> |
hudakz | 0:5350a66d5279 | 23 | */ |
hudakz | 0:5350a66d5279 | 24 | /* |
hudakz | 0:5350a66d5279 | 25 | * Copyright (c) 2004, Swedish Institute of Computer Science. |
hudakz | 0:5350a66d5279 | 26 | * All rights reserved. |
hudakz | 0:5350a66d5279 | 27 | * |
hudakz | 0:5350a66d5279 | 28 | * Redistribution and use in source and binary forms, with or without |
hudakz | 0:5350a66d5279 | 29 | * modification, are permitted provided that the following conditions |
hudakz | 0:5350a66d5279 | 30 | * are met: |
hudakz | 0:5350a66d5279 | 31 | * 1. Redistributions of source code must retain the above copyright |
hudakz | 0:5350a66d5279 | 32 | * notice, this list of conditions and the following disclaimer. |
hudakz | 0:5350a66d5279 | 33 | * 2. Redistributions in binary form must reproduce the above copyright |
hudakz | 0:5350a66d5279 | 34 | * notice, this list of conditions and the following disclaimer in the |
hudakz | 0:5350a66d5279 | 35 | * documentation and/or other materials provided with the distribution. |
hudakz | 0:5350a66d5279 | 36 | * 3. Neither the name of the Institute nor the names of its contributors |
hudakz | 0:5350a66d5279 | 37 | * may be used to endorse or promote products derived from this software |
hudakz | 0:5350a66d5279 | 38 | * without specific prior written permission. |
hudakz | 0:5350a66d5279 | 39 | * |
hudakz | 0:5350a66d5279 | 40 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND |
hudakz | 0:5350a66d5279 | 41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
hudakz | 0:5350a66d5279 | 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
hudakz | 0:5350a66d5279 | 43 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE |
hudakz | 0:5350a66d5279 | 44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
hudakz | 0:5350a66d5279 | 45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
hudakz | 0:5350a66d5279 | 46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
hudakz | 0:5350a66d5279 | 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
hudakz | 0:5350a66d5279 | 48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
hudakz | 0:5350a66d5279 | 49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
hudakz | 0:5350a66d5279 | 50 | * SUCH DAMAGE. |
hudakz | 0:5350a66d5279 | 51 | * |
hudakz | 0:5350a66d5279 | 52 | * This file is part of the uIP TCP/IP stack |
hudakz | 0:5350a66d5279 | 53 | * |
hudakz | 0:5350a66d5279 | 54 | * Author: Adam Dunkels <adam@sics.se> |
hudakz | 0:5350a66d5279 | 55 | * |
hudakz | 0:5350a66d5279 | 56 | * $Id: timer.h,v 1.3 2006/06/11 21:46:39 adam Exp $ |
hudakz | 0:5350a66d5279 | 57 | */ |
hudakz | 0:5350a66d5279 | 58 | #ifndef __UIP_TIMER_H__ |
hudakz | 0:5350a66d5279 | 59 | #define __UIP_TIMER_H__ |
hudakz | 0:5350a66d5279 | 60 | |
hudakz | 0:5350a66d5279 | 61 | #include "uip_clock.h" |
hudakz | 0:5350a66d5279 | 62 | |
hudakz | 0:5350a66d5279 | 63 | /** |
hudakz | 0:5350a66d5279 | 64 | * A timer. |
hudakz | 0:5350a66d5279 | 65 | * |
hudakz | 0:5350a66d5279 | 66 | * This structure is used for declaring a timer. The timer must be set |
hudakz | 0:5350a66d5279 | 67 | * with timer_set() before it can be used. |
hudakz | 0:5350a66d5279 | 68 | * |
hudakz | 0:5350a66d5279 | 69 | * \hideinitializer |
hudakz | 0:5350a66d5279 | 70 | */ |
hudakz | 0:5350a66d5279 | 71 | struct uip_timer |
hudakz | 0:5350a66d5279 | 72 | { |
hudakz | 0:5350a66d5279 | 73 | clock_time_t start; |
hudakz | 0:5350a66d5279 | 74 | clock_time_t interval; |
hudakz | 0:5350a66d5279 | 75 | }; |
hudakz | 0:5350a66d5279 | 76 | |
hudakz | 0:5350a66d5279 | 77 | void uip_timer_set(struct uip_timer* t, clock_time_t interval); |
hudakz | 0:5350a66d5279 | 78 | void uip_timer_reset(struct uip_timer* t); |
hudakz | 0:5350a66d5279 | 79 | void uip_timer_restart(struct uip_timer* t); |
hudakz | 0:5350a66d5279 | 80 | int uip_timer_expired(struct uip_timer* t); |
hudakz | 0:5350a66d5279 | 81 | #endif /* __UIP_TIMER_H__ */ |
hudakz | 0:5350a66d5279 | 82 | |
hudakz | 0:5350a66d5279 | 83 | /** @} */ |