home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / DeskBus.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  7.3 KB  |  264 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        DeskBus.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __DESKBUS__
  18. #define __DESKBUS__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __MIXEDMODE__
  27. #include <MixedMode.h>
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if GENERATINGPOWERPC
  35. #pragma options align=mac68k
  36. #endif
  37.  
  38. #ifdef __CFM68K__
  39. #pragma lib_export on
  40. #endif
  41.  
  42. typedef char ADBAddress;
  43.  
  44. /*
  45.         ADBCompletionProcPtr uses register based parameters on the 68k and cannot
  46.         be written in or called from a high-level language without the help of
  47.         mixed mode or assembly glue.
  48.  
  49.         In:
  50.          => dataBuffPtr     A0.L
  51.          => opDataAreaPtr    A2.L
  52.          => command         D0.L
  53. */
  54.  
  55. #if GENERATINGCFM
  56. typedef UniversalProcPtr ADBCompletionUPP;
  57. #else
  58. typedef Register68kProcPtr ADBCompletionUPP;
  59. #endif
  60.  
  61. enum {
  62.     uppADBCompletionProcInfo = kRegisterBased
  63.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(Ptr)))
  64.          | REGISTER_ROUTINE_PARAMETER(2, kRegisterA2, SIZE_CODE(sizeof(Ptr)))
  65.          | REGISTER_ROUTINE_PARAMETER(3, kRegisterD0, SIZE_CODE(sizeof(long)))
  66. };
  67.  
  68. #if GENERATINGCFM
  69. #define NewADBCompletionProc(userRoutine)        \
  70.         (ADBCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBCompletionProcInfo, GetCurrentArchitecture())
  71. #else
  72. #define NewADBCompletionProc(userRoutine)        \
  73.         ((ADBCompletionUPP) (userRoutine))
  74. #endif
  75.  
  76. #if GENERATINGCFM
  77. #define CallADBCompletionProc(userRoutine, dataBuffPtr, opDataAreaPtr, command)        \
  78.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppADBCompletionProcInfo, (dataBuffPtr), (opDataAreaPtr), (command))
  79. #else
  80. /* (*ADBCompletionProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  81. #endif
  82.  
  83. /*
  84.         ADBDeviceDriverProcPtr uses register based parameters on the 68k and cannot
  85.         be written in or called from a high-level language without the help of
  86.         mixed mode or assembly glue.
  87.  
  88.         In:
  89.          => devAddress      D0.B
  90.          => devType         D1.B
  91. */
  92.  
  93. #if GENERATINGCFM
  94. typedef UniversalProcPtr ADBDeviceDriverUPP;
  95. #else
  96. typedef Register68kProcPtr ADBDeviceDriverUPP;
  97. #endif
  98.  
  99. enum {
  100.     uppADBDeviceDriverProcInfo = kRegisterBased
  101.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterD0, SIZE_CODE(sizeof(char)))
  102.          | REGISTER_ROUTINE_PARAMETER(2, kRegisterD1, SIZE_CODE(sizeof(char)))
  103. };
  104.  
  105. #if GENERATINGCFM
  106. #define NewADBDeviceDriverProc(userRoutine)        \
  107.         (ADBDeviceDriverUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBDeviceDriverProcInfo, GetCurrentArchitecture())
  108. #else
  109. #define NewADBDeviceDriverProc(userRoutine)        \
  110.         ((ADBDeviceDriverUPP) (userRoutine))
  111. #endif
  112.  
  113. #if GENERATINGCFM
  114. #define CallADBDeviceDriverProc(userRoutine, devAddress, devType)        \
  115.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppADBDeviceDriverProcInfo, (devAddress), (devType))
  116. #else
  117. /* (*ADBDeviceDriverProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  118. #endif
  119.  
  120. /*
  121.         ADBServiceRoutineProcPtr uses register based parameters on the 68k and cannot
  122.         be written in or called from a high-level language without the help of
  123.         mixed mode or assembly glue.
  124.  
  125.         In:
  126.          => dataBuffPtr     A0.L
  127.          => completionProc    A1.L
  128.          => dataPtr         A2.L
  129.          => command         D0.L
  130. */
  131.  
  132. #if GENERATINGCFM
  133. typedef UniversalProcPtr ADBServiceRoutineUPP;
  134. #else
  135. typedef Register68kProcPtr ADBServiceRoutineUPP;
  136. #endif
  137.  
  138. enum {
  139.     uppADBServiceRoutineProcInfo = kRegisterBased
  140.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(Ptr)))
  141.          | REGISTER_ROUTINE_PARAMETER(2, kRegisterA1, SIZE_CODE(sizeof(ADBCompletionUPP)))
  142.          | REGISTER_ROUTINE_PARAMETER(3, kRegisterA2, SIZE_CODE(sizeof(Ptr)))
  143.          | REGISTER_ROUTINE_PARAMETER(4, kRegisterD0, SIZE_CODE(sizeof(long)))
  144. };
  145.  
  146. #if GENERATINGCFM
  147. #define NewADBServiceRoutineProc(userRoutine)        \
  148.         (ADBServiceRoutineUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBServiceRoutineProcInfo, GetCurrentArchitecture())
  149. #else
  150. #define NewADBServiceRoutineProc(userRoutine)        \
  151.         ((ADBServiceRoutineUPP) (userRoutine))
  152. #endif
  153.  
  154. #if GENERATINGCFM
  155. #define CallADBServiceRoutineProc(userRoutine, dataBuffPtr, completionProc, dataPtr, command)        \
  156.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppADBServiceRoutineProcInfo, (dataBuffPtr), (completionProc), (dataPtr), (command))
  157. #else
  158. /* (*ADBServiceRoutineProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  159. #endif
  160.  
  161. /*
  162.         ADBInitProcPtr uses register based parameters on the 68k and cannot
  163.         be written in or called from a high-level language without the help of
  164.         mixed mode or assembly glue.
  165.  
  166.         In:
  167.          => callOrder       D0.B
  168. */
  169.  
  170. #if GENERATINGCFM
  171. typedef UniversalProcPtr ADBInitUPP;
  172. #else
  173. typedef Register68kProcPtr ADBInitUPP;
  174. #endif
  175.  
  176. enum {
  177.     uppADBInitProcInfo = kRegisterBased
  178.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterD0, SIZE_CODE(sizeof(char)))
  179. };
  180.  
  181. #if GENERATINGCFM
  182. #define NewADBInitProc(userRoutine)        \
  183.         (ADBInitUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBInitProcInfo, GetCurrentArchitecture())
  184. #else
  185. #define NewADBInitProc(userRoutine)        \
  186.         ((ADBInitUPP) (userRoutine))
  187. #endif
  188.  
  189. #if GENERATINGCFM
  190. #define CallADBInitProc(userRoutine, callOrder)        \
  191.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppADBInitProcInfo, (callOrder))
  192. #else
  193. /* (*ADBInitProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  194. #endif
  195.  
  196. struct ADBOpBlock {
  197.     Ptr                                dataBuffPtr;                /* address of data buffer */
  198.     ADBServiceRoutineUPP            opServiceRtPtr;                /* service routine pointer */
  199.     Ptr                                opDataAreaPtr;                /* optional data area address */
  200. };
  201. typedef struct ADBOpBlock ADBOpBlock;
  202.  
  203. typedef ADBOpBlock *ADBOpBPtr;
  204.  
  205. struct ADBDataBlock {
  206.     char                            devType;                    /* device type */
  207.     char                            origADBAddr;                /* original ADB Address */
  208.     ADBServiceRoutineUPP            dbServiceRtPtr;                /* service routine pointer */
  209.     Ptr                                dbDataAreaAddr;                /* data area address */
  210. };
  211. typedef struct ADBDataBlock ADBDataBlock;
  212.  
  213. typedef ADBDataBlock *ADBDBlkPtr;
  214.  
  215. struct ADBSetInfoBlock {
  216.     ADBServiceRoutineUPP            siService;                    /* service routine pointer */
  217.     Ptr                                siDataAreaAddr;                /* data area address */
  218. };
  219. typedef struct ADBSetInfoBlock ADBSetInfoBlock;
  220.  
  221. typedef ADBSetInfoBlock *ADBSInfoPtr;
  222.  
  223. extern pascal void ADBReInit(void)
  224.  ONEWORDINLINE(0xA07B);
  225. extern pascal OSErr ADBOp(Ptr data, ADBCompletionUPP compRout, Ptr buffer, short commandNum);
  226.  
  227. #if !GENERATINGCFM
  228. #pragma parameter __D0 CountADBs
  229. #endif
  230. extern pascal short CountADBs(void)
  231.  ONEWORDINLINE(0xA077);
  232.  
  233. #if !GENERATINGCFM
  234. #pragma parameter __D0 GetIndADB(__A0, __D0)
  235. #endif
  236. extern pascal ADBAddress GetIndADB(ADBDataBlock *info, short devTableIndex)
  237.  ONEWORDINLINE(0xA078);
  238.  
  239. #if !GENERATINGCFM
  240. #pragma parameter __D0 GetADBInfo(__A0, __D0)
  241. #endif
  242. extern pascal OSErr GetADBInfo(ADBDataBlock *info, ADBAddress adbAddr)
  243.  ONEWORDINLINE(0xA079);
  244.  
  245. #if !GENERATINGCFM
  246. #pragma parameter __D0 SetADBInfo(__A0, __D0)
  247. #endif
  248. extern pascal OSErr SetADBInfo(const ADBSetInfoBlock *info, ADBAddress adbAddr)
  249.  ONEWORDINLINE(0xA07A);
  250.  
  251. #ifdef __CFM68K__
  252. #pragma lib_export off
  253. #endif
  254.  
  255. #if GENERATINGPOWERPC
  256. #pragma options align=reset
  257. #endif
  258.  
  259. #ifdef __cplusplus
  260. }
  261. #endif
  262.  
  263. #endif /* __DESKBUS__ */
  264.