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