2 * \brief DOpE timer module
4 * \author Norman Feske <nf2@inf.tu-dresden.de>
8 * Copyright (C) 2002-2004 Norman Feske <nf2@os.inf.tu-dresden.de>
9 * Technische Universitaet Dresden, Operating Systems Research Group
11 * This file is part of the DOpE package, which is distributed under
12 * the terms of the GNU General Public Licence 2. Please see the
13 * COPYING file for details.
20 #include <l4/re/env.h>
21 #include <l4/util/macros.h>
25 int init_timer(struct dope_services *d);
28 /*************************
29 *** SERVICE FUNCTIONS ***
30 *************************/
32 /*** RETURN CURRENT SYSTEM TIME COUNTER IN MICROSECONDS ***/
33 static u32 get_time(void) {
34 return (u32)l4_kip_clock_lw(l4re_kip());
38 /*** RETURN DIFFERENCE BETWEEN TWO TIMES ***/
39 static u32 get_diff(u32 time1, u32 time2) {
44 return (u32)0xffffffff - time1;
50 /*** WAIT THE SPECIFIED NUMBER OF MICROSECONDS ***/
51 static void __usleep(u32 num_usec) {
55 /****************************************
56 *** SERVICE STRUCTURE OF THIS MODULE ***
57 ****************************************/
59 static struct timer_services services = {
66 /**************************
67 *** MODULE ENTRY POINT ***
68 **************************/
70 int init_timer(struct dope_services *d) {
73 l4_calibrate_tsc(l4re_kip());
77 d->register_module("Timer 1.0", &services);