home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / os-include / inline / battmem.h < prev    next >
C/C++ Source or Header  |  1994-09-22  |  2KB  |  83 lines

  1. #ifndef _INLINE_BATTMEM_H
  2. #define _INLINE_BATTMEM_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
  11. #define BASE_EXT_DECL0 extern struct Node * BattMemBase;
  12. #endif
  13. #ifndef BASE_PAR_DECL
  14. #define BASE_PAR_DECL
  15. #define BASE_PAR_DECL0 void
  16. #endif
  17. #ifndef BASE_NAME
  18. #define BASE_NAME BattMemBase
  19. #endif
  20.  
  21. BASE_EXT_DECL0
  22.  
  23. extern __inline void 
  24. ObtainBattSemaphore (BASE_PAR_DECL0)
  25. {
  26.   BASE_EXT_DECL
  27.   register struct Node *a6 __asm("a6") = BASE_NAME;
  28.   __asm __volatile ("jsr a6@(-0x6)"
  29.   : /* no output */
  30.   : "r" (a6)
  31.   : "a0","a1","d0","d1", "memory");
  32. }
  33. extern __inline ULONG 
  34. ReadBattMem (BASE_PAR_DECL APTR buffer,unsigned long offset,unsigned long length)
  35. {
  36.   BASE_EXT_DECL
  37.   register ULONG  _res  __asm("d0");
  38.   register struct Node *a6 __asm("a6") = BASE_NAME;
  39.   register APTR a0 __asm("a0") = buffer;
  40.   register unsigned long d0 __asm("d0") = offset;
  41.   register unsigned long d1 __asm("d1") = length;
  42.   __asm __volatile ("jsr a6@(-0x12)"
  43.   : "=r" (_res)
  44.   : "r" (a6), "r" (a0), "r" (d0), "r" (d1)
  45.   : "a0","a1","d0","d1", "memory");
  46.   return _res;
  47. }
  48. extern __inline void 
  49. ReleaseBattSemaphore (BASE_PAR_DECL0)
  50. {
  51.   BASE_EXT_DECL
  52.   register struct Node *a6 __asm("a6") = BASE_NAME;
  53.   __asm __volatile ("jsr a6@(-0xc)"
  54.   : /* no output */
  55.   : "r" (a6)
  56.   : "a0","a1","d0","d1", "memory");
  57. }
  58. extern __inline ULONG 
  59. WriteBattMem (BASE_PAR_DECL APTR buffer,unsigned long offset,unsigned long length)
  60. {
  61.   BASE_EXT_DECL
  62.   register ULONG  _res  __asm("d0");
  63.   register struct Node *a6 __asm("a6") = BASE_NAME;
  64.   register APTR a0 __asm("a0") = buffer;
  65.   register unsigned long d0 __asm("d0") = offset;
  66.   register unsigned long d1 __asm("d1") = length;
  67.   __asm __volatile ("jsr a6@(-0x18)"
  68.   : "=r" (_res)
  69.   : "r" (a6), "r" (a0), "r" (d0), "r" (d1)
  70.   : "a0","a1","d0","d1", "memory");
  71.   return _res;
  72. }
  73.  
  74. #undef BASE_EXT_DECL
  75. #undef BASE_EXT_DECL0
  76. #undef BASE_PAR_DECL
  77. #undef BASE_PAR_DECL0
  78. #undef BASE_NAME
  79.  
  80. __END_DECLS
  81.  
  82. #endif /* _INLINE_BATTMEM_H */
  83.