Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


added second and millisecond timer support
Jack Lange [Fri, 26 Sep 2008 21:48:27 +0000 (16:48 -0500)]
palacios/include/geekos/timer.h
palacios/src/geekos/timer.c

index 768a31b..7fb783d 100644 (file)
@@ -30,8 +30,13 @@ typedef struct {
     int origTicks;
 } timerEvent;
 
+int Start_Timer_Secs(int seconds, timerCallback cb);
+int Start_Timer_MSecs(int msecs, timerCallback cb);
 int Start_Timer(int ticks, timerCallback);
-int Get_Remaing_Timer_Ticks(int id);
+
+double Get_Remaining_Timer_Secs(int id);
+int Get_Remaining_Timer_MSecs(int id);
+int Get_Remaining_Timer_Ticks(int id);
 int Cancel_Timer(int id);
 
 
index d3d4a6a..7f4ab49 100644 (file)
@@ -338,6 +338,19 @@ void Init_Timer(void)
 }
 
 
+int Start_Timer_Secs(int seconds, timerCallback cb) {
+  return Start_Timer(seconds * HZ, cb);
+}
+
+
+int Start_Timer_MSecs(int msecs, timerCallback cb) {
+  msecs += 10 - (msecs % 10);
+
+  return Start_Timer(msecs * (HZ / 1000), cb);
+}
+
+
+
 int Start_Timer(int ticks, timerCallback cb)
 {
     int ret;
@@ -358,7 +371,8 @@ int Start_Timer(int ticks, timerCallback cb)
     }
 }
 
-int Get_Remaing_Timer_Ticks(int id)
+
+int Get_Remaining_Timer_Ticks(int id)
 {
     int i;
 
@@ -372,6 +386,19 @@ int Get_Remaing_Timer_Ticks(int id)
     return -1;
 }
 
+
+
+double Get_Remaining_Timer_Secs(int id) {
+  return (Get_Remaining_Timer_Ticks(id) / HZ);
+}
+
+
+int Get_Remaining_Timer_MSecs(int id) {
+  return ((Get_Remaining_Timer_Ticks(id) * 1000) / HZ);
+}
+
+
+
 int Cancel_Timer(int id)
 {
     int i;