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 #include <l4/util/thread_time.h>
31 int init_timer(struct dope_services *d);
34 /*************************
35 *** SERVICE FUNCTIONS ***
36 *************************/
38 /*** RETURN CURRENT SYSTEM TIME COUNTER IN MICROSECONDS ***/
39 static u32 get_time(void) {
41 return (u32)l4re_kip()->clock;
43 // return l4_tsc_to_us(l4util_thread_time(l4re_kip()));
48 /*** RETURN DIFFERENCE BETWEEN TWO TIMES ***/
49 static u32 get_diff(u32 time1, u32 time2) {
54 return (u32)0xffffffff - time1;
60 /*** WAIT THE SPECIFIED NUMBER OF MICROSECONDS ***/
61 static void __usleep(u32 num_usec) {
65 /****************************************
66 *** SERVICE STRUCTURE OF THIS MODULE ***
67 ****************************************/
69 static struct timer_services services = {
76 /**************************
77 *** MODULE ENTRY POINT ***
78 **************************/
80 int init_timer(struct dope_services *d) {
83 l4_calibrate_tsc(l4re_kip());
87 d->register_module("Timer 1.0", &services);