[OpenBIOS] [PATCH 4/5] other.fs: rework get-msecs word so it can be shared cross-platform
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Sun May 4 19:29:42 CEST 2014
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>
---
openbios-devel/forth/device/other.fs | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/openbios-devel/forth/device/other.fs b/openbios-devel/forth/device/other.fs
index c67c829..b390073 100644
--- a/openbios-devel/forth/device/other.fs
+++ b/openbios-devel/forth/device/other.fs
@@ -93,25 +93,22 @@ defer (poke)
\ 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
--
1.7.10.4
More information about the OpenBIOS
mailing list