00001 #ifndef DEVICES_TIMER_H 00002 //106060271615 00003 #define DEVICES_TIMER_H 00004 00005 #include <round.h> 00006 #include <stdint.h> 00007 00008 /* Number of timer interrupts per second. */ 00009 #define TIMER_FREQ 100 00010 00011 void timer_init (void); 00012 void timer_calibrate (void); 00013 00014 int64_t timer_ticks (void); 00015 int64_t timer_elapsed (int64_t); 00016 00017 /* Sleep and yield the CPU to other threads. */ 00018 void timer_sleep (int64_t ticks); 00019 void timer_msleep (int64_t milliseconds); 00020 void timer_usleep (int64_t microseconds); 00021 void timer_nsleep (int64_t nanoseconds); 00022 00023 /* Busy waits. */ 00024 void timer_mdelay (int64_t milliseconds); 00025 void timer_udelay (int64_t microseconds); 00026 void timer_ndelay (int64_t nanoseconds); 00027 00028 void timer_print_stats (void); 00029 00030 #endif /* devices/timer.h */