home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / c / gcc233.lha / os-include / inline / timer.h < prev    next >
C/C++ Source or Header  |  1992-12-29  |  2KB  |  90 lines

  1. #ifndef _INLINE_TIMER_H
  2. #define _INLINE_TIMER_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <inline/stubs.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. #ifndef BASE_EXT_DECL
  10. #define BASE_EXT_DECL extern struct Device * TimerBase;
  11. #endif
  12. #ifndef BASE_PAR_DECL
  13. #define BASE_PAR_DECL
  14. #define BASE_PAR_DECL0 void
  15. #endif
  16. #ifndef BASE_NAME
  17. #define BASE_NAME TimerBase
  18. #endif
  19.  
  20. static __inline void 
  21. AddTime (BASE_PAR_DECL struct timeval *dest,struct timeval *src)
  22. {
  23.   BASE_EXT_DECL
  24.   register struct Device *a6 __asm("a6") = BASE_NAME;
  25.   register struct timeval *a0 __asm("a0") = dest;
  26.   register struct timeval *a1 __asm("a1") = src;
  27.   __asm __volatile ("jsr a6@(-0x2a)"
  28.   : /* no output */
  29.   : "r" (a6), "r" (a0), "r" (a1)
  30.   : "a0","a1","d0","d1", "memory");
  31. }
  32. static __inline LONG 
  33. CmpTime (BASE_PAR_DECL struct timeval *dest,struct timeval *src)
  34. {
  35.   BASE_EXT_DECL
  36.   register LONG  _res  __asm("d0");
  37.   register struct Device *a6 __asm("a6") = BASE_NAME;
  38.   register struct timeval *a0 __asm("a0") = dest;
  39.   register struct timeval *a1 __asm("a1") = src;
  40.   __asm __volatile ("jsr a6@(-0x36)"
  41.   : "=r" (_res)
  42.   : "r" (a6), "r" (a0), "r" (a1)
  43.   : "a0","a1","d0","d1", "memory");
  44.   return _res;
  45. }
  46. static __inline void 
  47. GetSysTime (BASE_PAR_DECL struct timeval *dest)
  48. {
  49.   BASE_EXT_DECL
  50.   register struct Device *a6 __asm("a6") = BASE_NAME;
  51.   register struct timeval *a0 __asm("a0") = dest;
  52.   __asm __volatile ("jsr a6@(-0x42)"
  53.   : /* no output */
  54.   : "r" (a6), "r" (a0)
  55.   : "a0","a1","d0","d1", "memory");
  56. }
  57. static __inline ULONG 
  58. ReadEClock (BASE_PAR_DECL struct EClockVal *dest)
  59. {
  60.   BASE_EXT_DECL
  61.   register ULONG  _res  __asm("d0");
  62.   register struct Device *a6 __asm("a6") = BASE_NAME;
  63.   register struct EClockVal *a0 __asm("a0") = dest;
  64.   __asm __volatile ("jsr a6@(-0x3c)"
  65.   : "=r" (_res)
  66.   : "r" (a6), "r" (a0)
  67.   : "a0","a1","d0","d1", "memory");
  68.   return _res;
  69. }
  70. static __inline void 
  71. SubTime (BASE_PAR_DECL struct timeval *dest,struct timeval *src)
  72. {
  73.   BASE_EXT_DECL
  74.   register struct Device *a6 __asm("a6") = BASE_NAME;
  75.   register struct timeval *a0 __asm("a0") = dest;
  76.   register struct timeval *a1 __asm("a1") = src;
  77.   __asm __volatile ("jsr a6@(-0x30)"
  78.   : /* no output */
  79.   : "r" (a6), "r" (a0), "r" (a1)
  80.   : "a0","a1","d0","d1", "memory");
  81. }
  82. #undef BASE_EXT_DECL
  83. #undef BASE_PAR_DECL
  84. #undef BASE_PAR_DECL0
  85. #undef BASE_NAME
  86.  
  87. __END_DECLS
  88.  
  89. #endif /* _INLINE_TIMER_H */
  90.