Fork for fixes
uitility/uip_clock.h@0:5350a66d5279, 2014-09-15 (annotated)
- Committer:
- hudakz
- Date:
- Mon Sep 15 11:12:30 2014 +0000
- Revision:
- 0:5350a66d5279
rev. 00
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:5350a66d5279 | 1 | /** |
hudakz | 0:5350a66d5279 | 2 | * \defgroup clock Clock interface |
hudakz | 0:5350a66d5279 | 3 | * |
hudakz | 0:5350a66d5279 | 4 | * The clock interface is the interface between the \ref timer "timer library" |
hudakz | 0:5350a66d5279 | 5 | * and the platform specific clock functionality. The clock |
hudakz | 0:5350a66d5279 | 6 | * interface must be implemented for each platform that uses the \ref |
hudakz | 0:5350a66d5279 | 7 | * timer "timer library". |
hudakz | 0:5350a66d5279 | 8 | * |
hudakz | 0:5350a66d5279 | 9 | * The clock interface does only one this: it measures time. The clock |
hudakz | 0:5350a66d5279 | 10 | * interface provides a macro, CLOCK_SECOND, which corresponds to one |
hudakz | 0:5350a66d5279 | 11 | * second of system time. |
hudakz | 0:5350a66d5279 | 12 | * |
hudakz | 0:5350a66d5279 | 13 | * \sa \ref timer "Timer library" |
hudakz | 0:5350a66d5279 | 14 | * |
hudakz | 0:5350a66d5279 | 15 | * @{ |
hudakz | 0:5350a66d5279 | 16 | */ |
hudakz | 0:5350a66d5279 | 17 | /* |
hudakz | 0:5350a66d5279 | 18 | * Copyright (c) 2004, Swedish Institute of Computer Science. |
hudakz | 0:5350a66d5279 | 19 | * All rights reserved. |
hudakz | 0:5350a66d5279 | 20 | * |
hudakz | 0:5350a66d5279 | 21 | * Redistribution and use in source and binary forms, with or without |
hudakz | 0:5350a66d5279 | 22 | * modification, are permitted provided that the following conditions |
hudakz | 0:5350a66d5279 | 23 | * are met: |
hudakz | 0:5350a66d5279 | 24 | * 1. Redistributions of source code must retain the above copyright |
hudakz | 0:5350a66d5279 | 25 | * notice, this list of conditions and the following disclaimer. |
hudakz | 0:5350a66d5279 | 26 | * 2. Redistributions in binary form must reproduce the above copyright |
hudakz | 0:5350a66d5279 | 27 | * notice, this list of conditions and the following disclaimer in the |
hudakz | 0:5350a66d5279 | 28 | * documentation and/or other materials provided with the distribution. |
hudakz | 0:5350a66d5279 | 29 | * 3. Neither the name of the Institute nor the names of its contributors |
hudakz | 0:5350a66d5279 | 30 | * may be used to endorse or promote products derived from this software |
hudakz | 0:5350a66d5279 | 31 | * without specific prior written permission. |
hudakz | 0:5350a66d5279 | 32 | * |
hudakz | 0:5350a66d5279 | 33 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND |
hudakz | 0:5350a66d5279 | 34 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
hudakz | 0:5350a66d5279 | 35 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
hudakz | 0:5350a66d5279 | 36 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE |
hudakz | 0:5350a66d5279 | 37 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
hudakz | 0:5350a66d5279 | 38 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
hudakz | 0:5350a66d5279 | 39 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
hudakz | 0:5350a66d5279 | 40 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
hudakz | 0:5350a66d5279 | 41 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
hudakz | 0:5350a66d5279 | 42 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
hudakz | 0:5350a66d5279 | 43 | * SUCH DAMAGE. |
hudakz | 0:5350a66d5279 | 44 | * |
hudakz | 0:5350a66d5279 | 45 | * This file is part of the uIP TCP/IP stack |
hudakz | 0:5350a66d5279 | 46 | * |
hudakz | 0:5350a66d5279 | 47 | * Author: Adam Dunkels <adam@sics.se> |
hudakz | 0:5350a66d5279 | 48 | * |
hudakz | 0:5350a66d5279 | 49 | * $Id: clock.h,v 1.3 2006/06/11 21:46:39 adam Exp $ |
hudakz | 0:5350a66d5279 | 50 | */ |
hudakz | 0:5350a66d5279 | 51 | #ifndef __UIP_CLOCK_H__ |
hudakz | 0:5350a66d5279 | 52 | #define __UIP_CLOCK_H__ |
hudakz | 0:5350a66d5279 | 53 | |
hudakz | 0:5350a66d5279 | 54 | #include "clock-arch.h" |
hudakz | 0:5350a66d5279 | 55 | |
hudakz | 0:5350a66d5279 | 56 | /** |
hudakz | 0:5350a66d5279 | 57 | * Initialize the clock library. |
hudakz | 0:5350a66d5279 | 58 | * |
hudakz | 0:5350a66d5279 | 59 | * This function initializes the clock library and should be called |
hudakz | 0:5350a66d5279 | 60 | * from the main() function of the system. |
hudakz | 0:5350a66d5279 | 61 | * |
hudakz | 0:5350a66d5279 | 62 | */ |
hudakz | 0:5350a66d5279 | 63 | void uip_clock_init(void); |
hudakz | 0:5350a66d5279 | 64 | |
hudakz | 0:5350a66d5279 | 65 | /** |
hudakz | 0:5350a66d5279 | 66 | * Get the current clock time. |
hudakz | 0:5350a66d5279 | 67 | * |
hudakz | 0:5350a66d5279 | 68 | * This function returns the current system clock time. |
hudakz | 0:5350a66d5279 | 69 | * |
hudakz | 0:5350a66d5279 | 70 | * \return The current clock time, measured in system ticks. |
hudakz | 0:5350a66d5279 | 71 | */ |
hudakz | 0:5350a66d5279 | 72 | clock_time_t clock_time(void); |
hudakz | 0:5350a66d5279 | 73 | |
hudakz | 0:5350a66d5279 | 74 | /** |
hudakz | 0:5350a66d5279 | 75 | * A second, measured in system clock time. |
hudakz | 0:5350a66d5279 | 76 | * |
hudakz | 0:5350a66d5279 | 77 | * \hideinitializer |
hudakz | 0:5350a66d5279 | 78 | */ |
hudakz | 0:5350a66d5279 | 79 | |
hudakz | 0:5350a66d5279 | 80 | #ifdef CLOCK_CONF_SECOND |
hudakz | 0:5350a66d5279 | 81 | #define CLOCK_SECOND CLOCK_CONF_SECOND |
hudakz | 0:5350a66d5279 | 82 | #else |
hudakz | 0:5350a66d5279 | 83 | #define CLOCK_SECOND (clock_time_t) 32 |
hudakz | 0:5350a66d5279 | 84 | #endif |
hudakz | 0:5350a66d5279 | 85 | #endif /* __CLOCK_H__ */ |
hudakz | 0:5350a66d5279 | 86 | |
hudakz | 0:5350a66d5279 | 87 | /** @} */ |