timer.pas 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2004 Karoly Balogh for Genesi S.a.r.l. <www.genesi.lu>
  4. timer.device interface unit for MorphOS/PowerPC
  5. MorphOS port was done on a free Pegasos II/G4 machine
  6. provided by Genesi S.a.r.l. <www.genesi.lu>
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {$IFNDEF FPC_DOTTEDUNITS}
  14. unit timer;
  15. {$ENDIF FPC_DOTTEDUNITS}
  16. interface
  17. {$IFDEF FPC_DOTTEDUNITS}
  18. uses
  19. Amiga.Core.Exec;
  20. {$ELSE FPC_DOTTEDUNITS}
  21. uses
  22. exec;
  23. {$ENDIF FPC_DOTTEDUNITS}
  24. var
  25. TimerBase : Pointer;
  26. { * timer.device definitions (V50)
  27. *********************************************************************
  28. * }
  29. const
  30. UNIT_MICROHZ = 0;
  31. UNIT_VBLANK = 1;
  32. UNIT_ECLOCK = 2;
  33. UNIT_WAITUNTIL = 3;
  34. UNIT_WAITECLOCK = 4;
  35. { *** V50 *** }
  36. UNIT_CPUCLOCK = 5;
  37. UNIT_WAITCPUCLOCK = 6;
  38. const
  39. TIMERNAME = 'timer.device';
  40. type
  41. PTimeVal = ^TTimeVal;
  42. TTimeVal = packed record
  43. tv_secs : DWord;
  44. tv_micro: DWord;
  45. end;
  46. type
  47. PEClockVal = ^TEClockVal;
  48. TEClockVal = packed record
  49. ev_hi: DWord;
  50. ev_lo: DWord;
  51. end;
  52. type
  53. PTimeRequest = ^TTimeRequest;
  54. TTimeRequest = packed record
  55. tr_node: TIORequest;
  56. tr_time: TTimeVal;
  57. end;
  58. const
  59. TR_ADDREQUEST = (CMD_NONSTD);
  60. TR_GETSYSTIME = (CMD_NONSTD + 1);
  61. TR_SETSYSTIME = (CMD_NONSTD + 2);
  62. procedure AddTime(Dest : PTimeVal location 'a0';
  63. Source: PTimeVal location 'a1');
  64. SysCall TimerBase 42;
  65. procedure SubTime(Dest : PTimeVal location 'a0';
  66. Source: PTimeVal location 'a1');
  67. SysCall TimerBase 48;
  68. function CmpTime(Dest : PTimeVal location 'a0';
  69. Source: PTimeVal location 'a1'): LongInt;
  70. SysCall TimerBase 54;
  71. function ReadEClock(Dest: PTimeVal location 'a0'): DWord;
  72. SysCall TimerBase 60;
  73. procedure GetSysTime(Dest: PTimeVal location 'a0');
  74. SysCall TimerBase 66;
  75. {.$include timerd.inc}
  76. {.$include timerf.inc}
  77. implementation
  78. begin
  79. end.