timer.pas 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. unit timer;
  14. interface
  15. uses
  16. exec;
  17. var
  18. TimerBase : Pointer;
  19. { * timer.device definitions (V50)
  20. *********************************************************************
  21. * }
  22. const
  23. UNIT_MICROHZ = 0;
  24. UNIT_VBLANK = 1;
  25. UNIT_ECLOCK = 2;
  26. UNIT_WAITUNTIL = 3;
  27. UNIT_WAITECLOCK = 4;
  28. { *** V50 *** }
  29. UNIT_CPUCLOCK = 5;
  30. UNIT_WAITCPUCLOCK = 6;
  31. const
  32. TIMERNAME = 'timer.device';
  33. type
  34. PTimeVal = ^TTimeVal;
  35. TTimeVal = packed record
  36. tv_secs : DWord;
  37. tv_micro: DWord;
  38. end;
  39. type
  40. PEClockVal = ^TEClockVal;
  41. TEClockVal = packed record
  42. ev_hi: DWord;
  43. ev_lo: DWord;
  44. end;
  45. type
  46. PTimeRequest = ^TTimeRequest;
  47. TTimeRequest = packed record
  48. tr_node: TIORequest;
  49. tr_time: TTimeVal;
  50. end;
  51. const
  52. TR_ADDREQUEST = (CMD_NONSTD);
  53. TR_GETSYSTIME = (CMD_NONSTD + 1);
  54. TR_SETSYSTIME = (CMD_NONSTD + 2);
  55. procedure AddTime(Dest : PTimeVal location 'a0';
  56. Source: PTimeVal location 'a1');
  57. SysCall TimerBase 42;
  58. procedure SubTime(Dest : PTimeVal location 'a0';
  59. Source: PTimeVal location 'a1');
  60. SysCall TimerBase 48;
  61. function CmpTime(Dest : PTimeVal location 'a0';
  62. Source: PTimeVal location 'a1'): LongInt;
  63. SysCall TimerBase 54;
  64. function ReadEClock(Dest: PTimeVal location 'a0'): DWord;
  65. SysCall TimerBase 60;
  66. procedure GetSysTime(Dest: PTimeVal location 'a0');
  67. SysCall TimerBase 66;
  68. {.$include timerd.inc}
  69. {.$include timerf.inc}
  70. implementation
  71. begin
  72. end.