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@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