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