DriverFamilyMatching.pas 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. {
  2. File: DriverFamilyMatching.p
  3. Contains: Interfaces for create native drivers NDRV
  4. Version: Universal Interfaces 3.4.2
  5. Copyright: © 1995-2002 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. {
  11. Modified for use with Free Pascal
  12. Version 200
  13. Please report any bugs to <[email protected]>
  14. }
  15. {$mode macpas}
  16. {$packenum 1}
  17. {$macro on}
  18. {$inline on}
  19. {$CALLING MWPASCAL}
  20. unit DriverFamilyMatching;
  21. interface
  22. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  23. {$setc GAP_INTERFACES_VERSION := $0200}
  24. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  25. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  26. {$endc}
  27. {$ifc defined CPUPOWERPC and defined CPUI386}
  28. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  29. {$endc}
  30. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  31. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  32. {$endc}
  33. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  34. {$setc __ppc__ := 1}
  35. {$elsec}
  36. {$setc __ppc__ := 0}
  37. {$endc}
  38. {$ifc not defined __i386__ and defined CPUI386}
  39. {$setc __i386__ := 1}
  40. {$elsec}
  41. {$setc __i386__ := 0}
  42. {$endc}
  43. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  44. {$error Conflicting definitions for __ppc__ and __i386__}
  45. {$endc}
  46. {$ifc defined __ppc__ and __ppc__}
  47. {$setc TARGET_CPU_PPC := TRUE}
  48. {$setc TARGET_CPU_X86 := FALSE}
  49. {$elifc defined __i386__ and __i386__}
  50. {$setc TARGET_CPU_PPC := FALSE}
  51. {$setc TARGET_CPU_X86 := TRUE}
  52. {$elsec}
  53. {$error Neither __ppc__ nor __i386__ is defined.}
  54. {$endc}
  55. {$setc TARGET_CPU_PPC_64 := FALSE}
  56. {$ifc defined FPC_BIG_ENDIAN}
  57. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  58. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  59. {$elifc defined FPC_LITTLE_ENDIAN}
  60. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  61. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  62. {$elsec}
  63. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  64. {$endc}
  65. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  66. {$setc CALL_NOT_IN_CARBON := FALSE}
  67. {$setc OLDROUTINENAMES := FALSE}
  68. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  69. {$setc OPAQUE_UPP_TYPES := TRUE}
  70. {$setc OTCARBONAPPLICATION := TRUE}
  71. {$setc OTKERNEL := FALSE}
  72. {$setc PM_USE_SESSION_APIS := TRUE}
  73. {$setc TARGET_API_MAC_CARBON := TRUE}
  74. {$setc TARGET_API_MAC_OS8 := FALSE}
  75. {$setc TARGET_API_MAC_OSX := TRUE}
  76. {$setc TARGET_CARBON := TRUE}
  77. {$setc TARGET_CPU_68K := FALSE}
  78. {$setc TARGET_CPU_MIPS := FALSE}
  79. {$setc TARGET_CPU_SPARC := FALSE}
  80. {$setc TARGET_OS_MAC := TRUE}
  81. {$setc TARGET_OS_UNIX := FALSE}
  82. {$setc TARGET_OS_WIN32 := FALSE}
  83. {$setc TARGET_RT_MAC_68881 := FALSE}
  84. {$setc TARGET_RT_MAC_CFM := FALSE}
  85. {$setc TARGET_RT_MAC_MACHO := TRUE}
  86. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  87. {$setc TYPE_BOOL := FALSE}
  88. {$setc TYPE_EXTENDED := FALSE}
  89. {$setc TYPE_LONGLONG := TRUE}
  90. uses MacTypes,NameRegistry,CodeFragments;
  91. {$ALIGN MAC68K}
  92. {
  93. ##############################################
  94. Well known properties in the Name Registry
  95. ##############################################
  96. }
  97. { CPassThru }
  98. {
  99. #########################################################
  100. Descriptor for Drivers and NDRVs
  101. #########################################################
  102. }
  103. {
  104. QuickTime 3.0: "DriverType" has a name collision with cross-platform code.
  105. Use Mac prefix to avoid collision
  106. }
  107. { Driver Typing Information Used to Match Drivers With Devices }
  108. type
  109. MacDriverTypePtr = ^MacDriverType;
  110. MacDriverType = record
  111. nameInfoStr: Str31; { Driver Name/Info String }
  112. version: NumVersion; { Driver Version Number }
  113. end;
  114. {$ifc TARGET_OS_MAC}
  115. DriverType = MacDriverType;
  116. DriverTypePtr = ^DriverType;
  117. {$endc} {TARGET_OS_MAC}
  118. { OS Runtime Information Used to Setup and Maintain a Driver's Runtime Environment }
  119. RuntimeOptions = OptionBits;
  120. const
  121. kDriverIsLoadedUponDiscovery = $00000001; { auto-load driver when discovered }
  122. kDriverIsOpenedUponLoad = $00000002; { auto-open driver when loaded }
  123. kDriverIsUnderExpertControl = $00000004; { I/O expert handles loads/opens }
  124. kDriverIsConcurrent = $00000008; { supports concurrent requests }
  125. kDriverQueuesIOPB = $00000010; { device manager doesn't queue IOPB }
  126. kDriverIsLoadedAtBoot = $00000020; { Driver is loaded at the boot time }
  127. kDriverIsForVirtualDevice = $00000040; { Driver is for a virtual Device }
  128. kDriverSupportDMSuspendAndResume = $00000080; { Driver supports Device Manager Suspend and Resume command }
  129. type
  130. DriverOSRuntimePtr = ^DriverOSRuntime;
  131. DriverOSRuntime = record
  132. driverRuntime: RuntimeOptions; { Options for OS Runtime }
  133. driverName: Str31; { Driver's name to the OS }
  134. driverDescReserved: array [0..7] of UInt32; { Reserved area }
  135. end;
  136. { OS Service Information Used To Declare What APIs a Driver Supports }
  137. ServiceCount = UInt32;
  138. DriverServiceInfoPtr = ^DriverServiceInfo;
  139. DriverServiceInfo = record
  140. serviceCategory: OSType; { Service Category Name }
  141. serviceType: OSType; { Type within Category }
  142. serviceVersion: NumVersion; { Version of service }
  143. end;
  144. DriverOSServicePtr = ^DriverOSService;
  145. DriverOSService = record
  146. nServices: ServiceCount; { Number of Services Supported }
  147. service: array [0..0] of DriverServiceInfo; { The List of Services (at least one) }
  148. end;
  149. { Categories }
  150. const
  151. kServiceCategoryDisplay = $64697370 (* 'disp' *); { Display Manager }
  152. kServiceCategoryOpenTransport = $6F74616E (* 'otan' *); { Open Transport }
  153. kServiceCategoryBlockStorage = $626C6F6B (* 'blok' *); { Block Storage }
  154. kServiceCategoryNdrvDriver = $6E647276 (* 'ndrv' *); { Generic Native Driver }
  155. kServiceCategoryScsiSIM = $73637369 (* 'scsi' *); { SCSI }
  156. kServiceCategoryFileManager = $66696C65 (* 'file' *); { File Manager }
  157. kServiceCategoryIDE = $6964652D (* 'ide-' *); { ide }
  158. kServiceCategoryADB = $6164622D (* 'adb-' *); { adb }
  159. kServiceCategoryPCI = $7063692D (* 'pci-' *); { pci bus }
  160. { Nu Bus }
  161. kServiceCategoryDFM = $64666D2D (* 'dfm-' *); { DFM }
  162. kServiceCategoryMotherBoard = $6D726264 (* 'mrbd' *); { mother Board }
  163. kServiceCategoryKeyboard = $6B796264 (* 'kybd' *); { Keyboard }
  164. kServiceCategoryPointing = $706F6974 (* 'poit' *); { Pointing }
  165. kServiceCategoryRTC = $7274632D (* 'rtc-' *); { RTC }
  166. kServiceCategoryNVRAM = $6E72616D (* 'nram' *); { NVRAM }
  167. kServiceCategorySound = $736F6E64 (* 'sond' *); { Sound (1/3/96 MCS) }
  168. kServiceCategoryPowerMgt = $70676D74 (* 'pgmt' *); { Power Management }
  169. kServiceCategoryGeneric = $67656E72 (* 'genr' *); { Generic Service Category to receive general Events }
  170. { Ndrv ServiceCategory Types }
  171. kNdrvTypeIsGeneric = $67656E72 (* 'genr' *); { generic }
  172. kNdrvTypeIsVideo = $7669646F (* 'vido' *); { video }
  173. kNdrvTypeIsBlockStorage = $626C6F6B (* 'blok' *); { block storage }
  174. kNdrvTypeIsNetworking = $6E657477 (* 'netw' *); { networking }
  175. kNdrvTypeIsSerial = $7365726C (* 'serl' *); { serial }
  176. kNdrvTypeIsParallel = $7061726C (* 'parl' *); { parallel }
  177. kNdrvTypeIsSound = $736F6E64 (* 'sond' *); { sound }
  178. kNdrvTypeIsBusBridge = $62726467 (* 'brdg' *);
  179. kNdrvTypeIsFWConference = $63727368 (* 'crsh' *); { FireWire conference camera }
  180. kNdrvTypeIsAVC = $61766320 (* 'avc ' *); { FireWire AVC devices (DV cameras) }
  181. type
  182. DriverDescVersion = UInt32;
  183. DriverDescVersion_fix = DriverDescVersion; { used as field type when a record declaration contains a DriverDescVersion field identifier }
  184. { The Driver Description }
  185. const
  186. kTheDescriptionSignature = $6D74656A (* 'mtej' *);
  187. kDriverDescriptionSignature = $70646573 (* 'pdes' *);
  188. kInitialDriverDescriptor = 0;
  189. kVersionOneDriverDescriptor = 1;
  190. type
  191. DriverDescriptionPtr = ^DriverDescription;
  192. DriverDescription = record
  193. driverDescSignature: OSType; { Signature field of this structure }
  194. driverDescVersion: DriverDescVersion_fix; { Version of this data structure }
  195. driverType: MacDriverType; { Type of Driver }
  196. driverOSRuntimeInfo: DriverOSRuntime; { OS Runtime Requirements of Driver }
  197. driverServices: DriverOSService; { Apple Service API Membership }
  198. end;
  199. {$ALIGN MAC68K}
  200. end.