On 21/12/17 14:59, Programmingkid wrote:
On Dec 21, 2017, at 9:36 AM, Jd Lyons lyons_dj@yahoo.com wrote:
I don’t know, this maybe an issue with the way we have defined “us”.
Looking through the SLOF code it seems they call it like this in the timebase.fs:
: tb@ ( -- tb ) BEGIN tbu@ tbl@ tbu@ rot over <> WHILE 2drop REPEAT 20 lshift swap ffffffff and or ;
: milliseconds ( -- ms ) tb@ d# 1000 * tb-frequency / ; : microseconds ( -- us ) tb@ d# 1000000 * tb-frequency / ;
: ms ( ms-to-wait -- ) milliseconds + BEGIN milliseconds over >= UNTIL drop ; : get-msecs ( -- n ) milliseconds ; : us ( us-to-wait -- ) microseconds + BEGIN microseconds over >= UNTIL drop ;
Not sure if I can port/hack this code over, the copier seems to have trouble with tbu@ tbl@?
The ms and get-msecs words don't appear to be implemented correctly on OpenBIOS. 10000 ms should pause OpenBIOS for 10 seconds. It does not.
I did find a function called udelay() in the drivers/timer.c file. Maybe I can implement the word us using udelay(). Then the ms word could be implemented using the us word.
Yeah... I did start fixing up the timers in OpenBIOS (get-msecs works for SPARC) but didn't get around to finishing it. Another things for the TODO list I guess... implementing udelay() is probably a good starting point, but it has been a while since I looked at that code.
ATB,
Mark.