[OpenBIOS] [commit] r1290 - trunk/openbios-devel/forth/device

repository service svn at openbios.org
Mon May 12 17:43:39 CEST 2014


Author: mcayland
Date: Mon May 12 17:43:38 2014
New Revision: 1290
URL: http://tracker.coreboot.org/trac/openbios/changeset/1290

Log:
other.fs: rework get-msecs word so it can be shared cross-platform

Rather than mess with [IFDEF]s, just have one implementation which falls back
to a simple incrementing dummy counter if a pointer to a real counter hasn't
been configured.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/forth/device/other.fs

Modified: trunk/openbios-devel/forth/device/other.fs
==============================================================================
--- trunk/openbios-devel/forth/device/other.fs	Mon May 12 17:43:35 2014	(r1289)
+++ trunk/openbios-devel/forth/device/other.fs	Mon May 12 17:43:38 2014	(r1290)
@@ -93,25 +93,22 @@
  
 \ 5.3.7.3 Time
 
-[IFDEF] CONFIG_PPC
+\ Pointer to OBP tick value updated by timer interrupt
+variable obp-ticks
 
+\ Dummy implementation for platforms without a timer interrupt
 0 value dummy-msecs
 
 : get-msecs    ( -- n )
-  dummy-msecs dup 1+ to dummy-msecs
-  ;
-
-[ELSE]
-
-\ OBP tick value updated by timer interrupt
-variable obp-ticks
-
-: get-msecs    ( -- n )
-  obp-ticks @
+  \ If obp-ticks pointer is set, use it. Otherwise fall back to
+  \ dummy implementation
+  obp-ticks @ 0<> if
+    obp-ticks @
+  else
+    dummy-msecs dup 1+ to dummy-msecs
+  then
   ;
 
-[THEN]
-
 : ms    ( n -- )
   get-msecs +
   begin dup get-msecs < until



More information about the OpenBIOS mailing list