DEFINITION MODULE Timer; (*$ Implementation:=FALSE *)
(* 10-Mar-1992/cn *)

FROM SYSTEM IMPORT ADDRESS;

FROM ExecD IMPORT
 nonstd,IORequest;

IMPORT R;

CONST
 timerName="timer.device";

 microHz=0;
 vBlank=1;
 (*36*) eClock=2;
 (*36*) waitUntil=3;
 (*36*) waitEClock=4;

TYPE
 TimeVal=RECORD
  secs:LONGCARD;
  micro:LONGCARD;
 END;
 TimeValPtr=POINTER TO TimeVal;

 (*36*) EClockVal=RECORD
         hi,lo:LONGCARD;
        END;
 (*36*) EClockValPtr=POINTER TO EClockVal;

CONST
 addRequest=nonstd+0;
 getSysTime=nonstd+1;
 setSysTime=nonstd+2;

TYPE
 TimeRequest=RECORD
  node:IORequest;
  CASE :INTEGER OF
  |0: time:TimeVal;
  |1: eClock:EClockVal;
  END;
 END;
 TimeRequestPtr=POINTER TO TimeRequest;

(* Synonyme zur einheitlichen Namensgebung *)
 IOTimer=TimeRequest;
 IOTimerPtr=TimeRequestPtr;

PROCEDURE AddTime(
           timer{R.A6}:ADDRESS;
           dest{R.A0},source{R.A1}:TimeValPtr); CODE -42;

PROCEDURE CmpTime(
           timer{R.A6}:ADDRESS;
           dest{R.A0},source{R.A1}:TimeValPtr):LONGINT; CODE -54;

PROCEDURE(*36*) GetSysTime(
                 timer{R.A6}:ADDRESS;
                 VAR dest{R.A0}:TimeVal); CODE -66;

PROCEDURE(*36*) ReadEClock(
                 timer{R.A6}:ADDRESS;
                 VAR dest{R.A0}:EClockVal):LONGCARD; CODE -60;

PROCEDURE SubTime(
           timer{R.A6}:ADDRESS;
           dest{R.A0},source{R.A1}:TimeValPtr); CODE -48;

END Timer.noimp
