Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

timer.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef timer_h
00004 #define timer_h
00005 
00006 #include "initcalls.h"
00007 #include "l4_types.h"
00008 
00009 //
00010 // INTERFACE definition follows 
00011 //
00012 
00013 
00014 class Timer
00015 {
00016 public:
00023   static void init() FIASCO_INIT;
00024 
00030   static void acknowledge();
00031 
00037   static void enable();
00038 
00042   static void disable();
00043 
00047   static void init_system_clock();
00048 
00052   static void update_system_clock();
00053 
00057   static Unsigned64 system_clock();
00058 
00062   static void update_timer(Unsigned64 wakeup);
00063 };
00064 
00065 //
00066 // IMPLEMENTATION includes follow (for use by inline functions)
00067 //
00068 
00069 
00070 #include "cpu.h"
00071 #include "config.h"
00072 #include "kip.h"
00073 #include "rtc.h"
00074 #include "pic.h"
00075 
00076 //
00077 // IMPLEMENTATION of inline functions (and needed classes)
00078 //
00079 
00080 
00081 
00082 
00083 inline void
00084 Timer::init_system_clock()
00085 {
00086   if (Config::kinfo_timer_uses_rdtsc)
00087     Kip::k()->clock = Cpu::time_us();
00088   else
00089     Kip::k()->clock = 0;
00090 }
00091 
00092 
00093 
00094 inline Unsigned64
00095 Timer::system_clock()
00096 {
00097   if (Config::kinfo_timer_uses_rdtsc)
00098     Kip::k()->clock = Cpu::time_us();
00099 
00100   return Kip::k()->clock;
00101 }
00102 
00103 
00104 
00105 inline void
00106 Timer::update_system_clock()
00107 {
00108   if (Config::kinfo_timer_uses_rdtsc)
00109     Kip::k()->clock = Cpu::time_us();
00110   else
00111     Kip::k()->clock += Config::scheduler_granularity;
00112 }
00113 
00114 
00115 
00116 inline void
00117 Timer::acknowledge()
00118 {
00119   // periodic scheduling is triggered by irq 8 connected with RTC
00120   Pic::disable_locked(8);  
00121   Rtc::ack_reset();
00122   Pic::enable_locked(8);
00123 }
00124 
00125 
00126 
00127 inline void
00128 Timer::enable()
00129 {
00130   Pic::enable(8);
00131   Pic::enable(2); // cascade
00132 }
00133 
00134 
00135 
00136 inline void
00137 Timer::disable()
00138 {
00139   Pic::disable(8);
00140 }
00141 
00142 
00143 
00144 inline void
00145 Timer::update_timer(Unsigned64)
00146 {
00147   // does nothing in periodic mode
00148 }
00149 
00150 #endif // timer_h

Generated on Mon Sep 26 14:20:12 2005 for Fiasco by  doxygen 1.4.2