Mac OS 9
DriverGestalt.h
Go to the documentation of this file.
1 
19 #ifndef __DRIVERGESTALT__
20 #define __DRIVERGESTALT__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __OSUTILS__
27 #include <OSUtils.h>
28 #endif
29 
30 #ifndef __NAMEREGISTRY__
31 #include <NameRegistry.h>
32 #endif
33 
34 #ifndef __SCSI__
35 #include <SCSI.h>
36 #endif
37 
38 #ifndef __USB__
39 #include <USB.h>
40 #endif
41 
42 #ifndef __DISKS__
43 #include <Disks.h>
44 #endif
45 
46 #if PRAGMA_ONCE
47 #pragma once
48 #endif
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 #if PRAGMA_IMPORT
55 #pragma import on
56 #endif
57 
58 #if PRAGMA_STRUCT_ALIGN
59 #pragma options align = mac68k
60 #elif PRAGMA_STRUCT_PACKPUSH
61 #pragma pack(push, 2)
62 #elif PRAGMA_STRUCT_PACK
63 #pragma pack(2)
64 #endif
65 
66 /*__________________________________________________________________________________*/
67 /* The Driver Gestalt bit in the dCtlFlags */
68 enum {
69  kbDriverGestaltEnable = 2,
70  kmDriverGestaltEnableMask = (1 << kbDriverGestaltEnable)
71 };
72 
73 /*__________________________________________________________________________________*/
74 /* Driver Gestalt related csCodes */
75 enum {
76  kDriverGestaltCode = 43, /* various uses */
77  kDriverConfigureCode = 43, /* various uses */
78  kcsSetBootPartitionCode = 44, /* Set Startup Partition Control Call */
79  kcsGetBootPartitionStatus = 44, /* Get Startup Partition Status Call */
80  kdgLowPowerMode = 70, /* Sets/Returns the current energy consumption level */
81  kdgReturnDeviceID = 120, /* returns SCSI DevID in csParam[0] */
82  kdgGetCDDeviceInfo = 121 /* returns CDDeviceCharacteristics in csParam[0] */
83 };
84 
85 /*__________________________________________________________________________________*/
86 /* Driver Gestalt selectors */
87 enum {
88  kdgVersion = FOUR_CHAR_CODE(
89  'vers'), /* Version number of the driver in standard Apple format */
90  kdgDeviceType =
91  FOUR_CHAR_CODE('devt'), /* The type of device the driver is driving. */
92  kdgInterface = FOUR_CHAR_CODE(
93  'intf'), /* The underlying interface that the driver is using (if any) */
94  kdgSync =
95  FOUR_CHAR_CODE('sync'), /* True if driver only behaves synchronously. */
96  kdgBoot =
97  FOUR_CHAR_CODE('boot'), /* value to place in PRAM for this drive (long) */
98  kdgWide = FOUR_CHAR_CODE('wide'), /* True if driver supports ioWPosOffset */
99  kdgPurge = FOUR_CHAR_CODE(
100  'purg'), /* Driver purge permission (True = purge; False = no purge) */
101  kdgSupportsSwitching =
102  FOUR_CHAR_CODE('lpwr'), /* True if driver supports power switching */
103  kdgMin3VPower =
104  FOUR_CHAR_CODE('pmn3'), /* Minimum 3.3V power consumption in microWatts */
105  kdgMin5VPower =
106  FOUR_CHAR_CODE('pmn5'), /* Minimum 5V power consumption in microWatts */
107  kdgMax3VPower =
108  FOUR_CHAR_CODE('pmx3'), /* Maximum 3.3V power consumption in microWatts */
109  kdgMax5VPower =
110  FOUR_CHAR_CODE('pmx5'), /* Maximum 5V power consumption in microWatts */
111  kdgInHighPower = FOUR_CHAR_CODE(
112  'psta'), /* True if device is currently in high power mode */
113  kdgSupportsPowerCtl =
114  FOUR_CHAR_CODE('psup'), /* True if driver supports following five calls */
115  kdgAPI = FOUR_CHAR_CODE('dAPI'), /* API support for PC Exchange */
116  kdgEject = FOUR_CHAR_CODE(
117  'ejec'), /* Eject options for shutdown/restart (Shutdown Mgr) */
118  kdgFlush = FOUR_CHAR_CODE('flus'), /* Determine if disk driver supports flush
119  and if it needs a flush */
120  kdgVMOptions =
121  FOUR_CHAR_CODE('vmop'), /* Disk drive's Virtual Memory options */
122  kdgMediaInfo = FOUR_CHAR_CODE('minf'), /* return media specific information */
123  kdgPhysDriveIconSuite =
124  FOUR_CHAR_CODE('dics'), /* Return a pointer to a IconFamily ('icns') data
125  structure for */
126  /* Disk Driver physical drive (formerly in csCode 21) in
127  driverGestaltResponse. */
128  kdgMediaIconSuite =
129  FOUR_CHAR_CODE('mics'), /* Return a pointer to a IconFamily ('icns') data
130  structure for */
131  /* Disk Driver media (formerly in csCode 22) in driverGestaltResponse. */
132  /* See IconServices.r for information detailing the 'icns' resource data
133  format */
134  kdgMediaName = FOUR_CHAR_CODE(
135  'mnam'), /* Return a pointer to a pascal string describing the Disk Driver
136  (formerly in csCode 21) in driverGestaltResponse. */
137  kdgGetDriveAddInfo = FOUR_CHAR_CODE(
138  'digt'), /* Get a disk driver's add-drive information record */
139  kdcAddDriveWithInfo =
140  FOUR_CHAR_CODE('diad'), /* Tell disk driver to add the drive specified
141  with the drive information record */
142  /* DriverGestalt selector for ATA drivers to signify that they are device 0/1
143  compliant. */
144  /* see
145  http://developer.apple.com/techpubs/hardware/Developer_Notes/System_Software/ATA_Device_Zero_One.pdf
146  */
147  kdgATADev1 = FOUR_CHAR_CODE('dev1'),
148  kdgDeviceReference =
149  FOUR_CHAR_CODE('dvrf'), /* Returns a 32-bit reference number for the
150  device, format is interface specific */
151  kdgNameRegistryEntry = FOUR_CHAR_CODE(
152  'nmrg'), /* Returns a pointer to the Name Registry ID for the device */
153  kdgDeviceModelInfo = FOUR_CHAR_CODE(
154  'info'), /* Returns a pointer to a Device Model Info structure */
155  kdgSupportedMediaTypes =
156  FOUR_CHAR_CODE('mdty'), /* Returns a count and a pointer to list of all
157  media types supported by the device */
158  kdgOpenFirmwareBootSupport =
159  FOUR_CHAR_CODE('ofpt'), /* Returns information that Open Firmware needs to
160  support booting from the device */
161  kdgOpenFirmwareBootingSupport = FOUR_CHAR_CODE(
162  'ofbt') /* Returns same information as kdgOpenFirmwareBootSupport, but is
163  only used during booting*/
164 };
165 
166 /*__________________________________________________________________________________*/
167 /* Driver Configure selectors */
168 enum {
169  kdcFlush = FOUR_CHAR_CODE('flus'), /* Tell a disk driver to flush its cache
170  and any hardware caches */
171  kdcVMOptions = FOUR_CHAR_CODE(
172  'vmop') /* Change the disk driver's Virtual Memory options */
173 };
174 
175 /*__________________________________________________________________________________*/
176 /* control parameter block for Driver Configure calls */
178  QElemPtr qLink;
179  short qType;
180  short ioTrap;
181  Ptr ioCmdAddr;
182  ProcPtr ioCompletion;
183  OSErr ioResult;
184  StringPtr ioNamePtr;
185  short ioVRefNum;
186  short ioCRefNum; /* refNum for I/O operation */
187  short csCode; /* == kDriverConfigureCode */
188  OSType driverConfigureSelector;
189  UInt32 driverConfigureParameter;
190 };
191 typedef struct DriverConfigParam DriverConfigParam;
192 /*__________________________________________________________________________________*/
193 /* status parameter block for Driver Gestalt calls */
195  QElemPtr qLink;
196  short qType;
197  short ioTrap;
198  Ptr ioCmdAddr;
199  ProcPtr ioCompletion;
200  OSErr ioResult;
201  StringPtr ioNamePtr;
202  short ioVRefNum;
203  short ioCRefNum; /* refNum for I/O operation */
204  short csCode; /* == kDriverGestaltCode */
205  OSType driverGestaltSelector; /* 'sync', 'vers', etc. */
206  UInt32
207  driverGestaltResponse; /* Could be a pointer, bit field or other format */
208  UInt32 driverGestaltResponse1; /* Could be a pointer, bit field or other
209  format */
210  UInt32 driverGestaltResponse2; /* Could be a pointer, bit field or other
211  format */
212  UInt32 driverGestaltResponse3; /* Could be a pointer, bit field or other
213  format */
214  UInt16 driverGestaltfiller; /* To pad out to the size of a controlPB */
215 };
217 /* Note that the various response definitions are overlays of the response
218  fields above. For instance the deviceType response would be returned in
219  driverGestaltResponse. The DriverGestaltPurgeResponse would be in
220  driverGestaltResponse and driverGestaltResponse1
221  */
222 /* GetDriverGestaltDevTResponse(gestaltPtr)->deviceType */
223 #define GetDriverGestaltDevTResponse(p) \
224  ((DriverGestaltDevTResponse *)(&((p)->driverGestaltResponse)))
225 #define GetDriverGestaltIntfResponse(p) \
226  ((DriverGestaltIntfResponse *)(&((p)->driverGestaltResponse)))
227 #define GetDriverGestaltPowerResponse(p) \
228  ((DriverGestaltPowerResponse *)(&((p)->driverGestaltResponse)))
229 #define GetDriverGestaltSyncResponse(p) \
230  ((DriverGestaltSyncResponse *)(&((p)->driverGestaltResponse)))
231 #define GetDriverGestaltBootResponse(p) \
232  ((DriverGestaltBootResponse *)(&((p)->driverGestaltResponse)))
233 #define GetDriverGestaltPurgeResponse(p) \
234  ((DriverGestaltPurgeResponse *)(&((p)->driverGestaltResponse)))
235 #define GetDriverGestaltEjectResponse(p) \
236  ((DriverGestaltEjectResponse *)(&((p)->driverGestaltResponse)))
237 #define GetDriverGestaltVersionResponse(p) \
238  (((NumVersion *)(&((p)->driverGestaltResponse))))
239 #define GetDriverGestaltAPIResponse(p) \
240  ((DriverGestaltAPIResponse *)(&((p)->driverGestaltResponse)))
241 #define GetDriverGestaltBooleanResponse(p) \
242  ((Boolean *)(&((p)->driverGestaltResponse)))
243 #define GetDriverGestaltFlushResponse(p) \
244  ((DriverGestaltFlushResponse *)(&((p)->driverGestaltResponse)))
245 #define GetDriverGestaltVMOptionsResponse(p) \
246  ((DriverGestaltVMOptionsResponse *)(&((p)->driverGestaltResponse)))
247 #define GetDriverGestaltMediaInfoResponse(p) \
248  ((DriverGestaltMediaInfoResponse *)(&((p)->driverGestaltResponse)))
249 #define GetDriverGestaltDeviceReferenceResponse(p) \
250  ((DriverGestaltDeviceReferenceResponse *)(&((p)->driverGestaltResponse)))
251 #define GetDriverGestaltNameRegistryResponse(p) \
252  ((DriverGestaltNameRegistryResponse *)(&((p)->driverGestaltResponse)))
253 #define GetDriverGestaltDeviceModelInfoResponse(p) \
254  ((DriverGestaltDeviceModelInfoResponse **)(&((p)->driverGestaltResponse)))
255 #define GetDriverGestaltSupportedMediaTypesResponse(p) \
256  ((DriverGestaltSupportedMediaTypesResponse **)(&((p)->driverGestaltResponse)))
257 #define GetDriverGestaltOFBootSupportResponse(p) \
258  ((DriverGestaltOFBootSupportResponse *)(&((p)->driverGestaltResponse)))
259 #define GetDriverGestaltATADev1Response(p) \
260  ((DriverGestaltATADev1Response *)(&((p)->driverGestaltResponse)))
261 #define GetDriverGestaltDriveAddInfoResponse(p) \
262  ((DriverGestaltDriveAddInfoResponse *)(&((p)->driverGestaltResponse)))
263 /*__________________________________________________________________________________*/
264 /* Device Types response */
266  OSType deviceType;
267 };
269 enum {
270  kdgDiskType = FOUR_CHAR_CODE('disk'), /* standard r/w disk drive */
271  kdgTapeType = FOUR_CHAR_CODE('tape'), /* tape drive */
272  kdgPrinterType = FOUR_CHAR_CODE('prnt'), /* printer */
273  kdgProcessorType = FOUR_CHAR_CODE('proc'), /* processor */
274  kdgWormType = FOUR_CHAR_CODE('worm'), /* write-once */
275  kdgCDType = FOUR_CHAR_CODE('cdrm'), /* cd-rom drive */
276  kdgFloppyType = FOUR_CHAR_CODE('flop'), /* floppy disk drive */
277  kdgScannerType = FOUR_CHAR_CODE('scan'), /* scanner */
278  kdgFileType = FOUR_CHAR_CODE(
279  'file'), /* Logical Partition type based on a file (Drive Container) */
280  kdgRemovableType = FOUR_CHAR_CODE(
281  'rdsk') /* A removable media hard disk drive ie. Syquest, Bernioulli */
282 };
283 
284 /*__________________________________________________________________________________*/
285 /* Device Interfaces response */
287  OSType interfaceType;
288 };
290 enum {
291  kdgScsiIntf = FOUR_CHAR_CODE('scsi'),
292  kdgPcmciaIntf = FOUR_CHAR_CODE('pcmc'),
293  kdgATAIntf = FOUR_CHAR_CODE('ata '),
294  kdgUSBIntf = FOUR_CHAR_CODE('usb '),
295  kdgFireWireIntf = FOUR_CHAR_CODE('fire'),
296  kdgExtBus = FOUR_CHAR_CODE('card'),
297  kdgNetworkIntf = FOUR_CHAR_CODE('net ')
298 };
299 
300 /*__________________________________________________________________________________*/
301 /* Power Saving */
303  unsigned long powerValue; /* Power consumed in �Watts */
304 };
306 /*__________________________________________________________________________________*/
307 /* Disk Specific */
309  Boolean behavesSynchronously;
310  UInt8 pad[3];
311 };
314  UInt8 extDev; /* Packed target (upper 5 bits) LUN (lower 3 bits) */
315  UInt8 partition; /* Unused */
316  UInt8 SIMSlot; /* Slot */
317  UInt8 SIMsRSRC; /* sRsrcID */
318 };
321  short partitionCmds; /* if bit 0 is nonzero, supports partition control and
322  status calls */
323  /* prohibitMounting (control, kProhibitMounting) */
324  /* partitionToVRef (status, kGetPartitionStatus) */
325  /* getPartitionInfo (status, kGetPartInfo) */
326  short unused1; /* all the unused fields should be zero */
327  short unused2;
328  short unused3;
329  short unused4;
330  short unused5;
331  short unused6;
332  short unused7;
333  short unused8;
334  short unused9;
335  short unused10;
336 };
339  Boolean canFlush; /* Return true if driver supports the */
340  /* kdcFlush Driver Configure _Control call */
341  Boolean needsFlush; /* Return true if driver/device has data cached */
342  /* and needs to be flushed when the disk volume */
343  /* is flushed by the File Manager */
344  UInt8 pad[2];
345 };
347 /* Flags for purge permissions */
348 enum {
349  kbCloseOk = 0, /* Ok to call Close */
350  kbRemoveOk = 1, /* Ok to call RemoveDrvr */
351  kbPurgeOk = 2, /* Ok to call DisposePtr */
352  kmNoCloseNoPurge = 0,
353  kmOkCloseNoPurge = (1 << kbCloseOk) + (1 << kbRemoveOk),
354  kmOkCloseOkPurge = (1 << kbCloseOk) + (1 << kbRemoveOk) + (1 << kbPurgeOk)
355 };
356 
357 /* Driver purge permission structure */
359  UInt16 purgePermission; /* 0 = Do not change the state of the driver */
360  /* 3 = Do Close() and DrvrRemove() this driver */
361  /* but don't deallocate driver code */
362  /* 7 = Do Close(), DrvrRemove(), and DisposePtr() */
363  UInt16 purgeReserved;
364  Ptr purgeDriverPointer; /* pointer to the start of the driver block (valid */
365  /* only of DisposePtr permission is given */
366 };
369  UInt32 ejectFeatures; /* */
370 };
372 /* Flags for Ejection Features field */
373 enum {
374  kRestartDontEject = 0, /* Dont Want eject during Restart */
375  kShutDownDontEject = 1, /* Dont Want eject during Shutdown */
376  kRestartDontEject_Mask = 1 << kRestartDontEject,
377  kShutDownDontEject_Mask = 1 << kShutDownDontEject
378 };
379 
416  UInt32 vmOptions;
417 };
419 /* Bits and masks for DriverGestaltVMOptionsResponse.vmOptions field */
420 enum {
421  kAllowVMReadBit = 0, /* Allow VM to use this drive for read access */
422  kAllowVMWriteBit = 1, /* Allow VM to use this drive for write access */
423  kAllowVMNoneMask = 0,
424  kAllowVMReadOnlyMask = 1 << kAllowVMReadBit,
425  kAllowVMReadWriteMask = (1 << kAllowVMReadBit) + (1 << kAllowVMWriteBit)
426 };
427 
494 /* drive info option flags */
495 enum {
496  driveInfoInteractBit =
497  31, /* Input to kdcAddDriveWithInfo: If set, it's OK for the driver */
498  driveInfoInteractMask =
499  (long)0x80000000, /* to perform user interaction to add the drive */
500  driveInfoChangedBit =
501  30, /* Output from kdgGetDriveInfo: If set, the drive was mounted, but */
502  driveInfoChangedMask =
503  0x40000000, /* the drive information record needs to be updated. */
504  driveInfoDriverReservedMask =
505  0x0000FFFF, /* bits 0-15 are defined by each driver for its own use */
506  driveInfoSystemReservedMask =
507  (long)0xFFFF0000 /* bits 16-31 are reserved for Apple system use */
508 };
509 
511  OptionBits options; /* option flags. */
512  ByteCount length; /* length of data */
513  void *data; /* this data must be held with HoldMemory */
514 };
531  UInt32 numberBlocks; /* number of blocks */
532  UInt32 blockSize; /* physical size of blocks */
533  SInt16 mediaType; /* media type identifier */
534 };
536 /* DriverGestaltMediaInfoResponse.mediaType constants */
537 enum {
538  kMediaTypeUnknown = 128, /* media type is unknown */
539  kMediaTypeCDROM = 129, /* media type is a CD-ROM */
540  kMediaTypeDVDROM = 130, /* media type is a DVD-ROM */
541  kMediaTypeDVDRAM = 131, /* media type is a DVD-RAM */
542  kMediaTypeDVDR = 132, /* media type is a DVD-RW */
543  kMediaTypeReadOnly = 133, /* basic read only type */
544  kMediaTypeWriteOnce = 134, /* basic write once type */
545  kMediaTypeRewritable = 135, /* rewritable media, i.e CD-RW */
546  kMediaTypeOverwritable = 136, /* random access read write media */
547  kMediaTypeNoMedia = -1 /* no media is present */
548 };
549 
551  UInt32 dev1Support; /* 1 = supports devices 0 and 1*/
552 };
554 /*__________________________________________________________________________________*/
555 /* Device Reference */
562 /*The union for the kdgDeviceReference Gestalt */
564  UInt32 devRef; /* Generic reference number for interfaces not specified */
565  DeviceIdent scsiID; /* kdgScsiIntf devices will return a DeviceIdent */
566  DeviceIdent ataID; /* kdgATAIntf devices will return a DeviceIdent */
567  USBDeviceRef usbRef; /* kdgUSBIntf devices will return a USBDeviceRef*/
568 };
571 /*__________________________________________________________________________________*/
572 /* Name Registry ID */
578 /* The structure for the kdgNameRegistryEntry Gestalt */
580  RegEntryIDPtr entryID;
581 };
584 /*__________________________________________________________________________________*/
585 /* Device Model Information */
595  UInt32 infoStructVersion;
596  StringPtr vendorName;
597  StringPtr productName;
598  StringPtr revisionNumber;
599  StringPtr subRevisionNumber;
600  StringPtr serialNumber;
601 };
604 /* infoStructVersion field values */
605 /* NOTE: May need/want to add a UniCode version of the InfoStruct at some point
606  */
607 enum { kInfoStructStringPtrsVers1 = 1 };
608 
609 /*__________________________________________________________________________________*/
610 /* Supported Media Types */
623 /* The structure for the kdgSupportedMediaTypes Gestalt */
625  UInt32 supportTypesCount; /* The number of Media Types in the array */
626  OSType supportedTypesArray[1]; /* Array of supported media types */
627 };
630 /*__________________________________________________________________________________*/
631 /* Open Firmware Boot support and Open Firmware Booting support */
653  UInt32 bootPartitionQualifier; /* The exact level of booting that the
654  driver and device supports */
655  UInt32 bootPartitionMapEntry; /* The Partition Map entry for the boot
656  partition if applicable */
657 };
660 /* Levels of boot support that the driver/device supports */
661 /* These values are used in the bootPartitionQualifier field of the
662  * DriverGestaltOFBootSupportResponse */
663 enum {
664  kOFBootAnyPartition = 1,
665  kOFBootSpecifiedPartition = 2,
666  kOFBootNotBootable = 3,
667  kOFBootNotPartitioned = 4
668 };
669 
670 /*__________________________________________________________________________________*/
671 /* CD-ROM Specific */
672 /* The CDDeviceCharacteristics result is returned in csParam[0..2] of a
673  standard CntrlParam parameter block called with csCode kdgGetCDDeviceInfo.
674 */
676  UInt8 speedMajor; /* High byte of fixed point number containing drive speed */
677  UInt8 speedMinor; /* Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc. */
678  UInt16 cdFeatures; /* Flags field for features and transport type of this
679  CD-ROM */
680  UInt16
681  extendedCdFeatures; /* extended flags to support new DVD-ROM/DVD-R etc. */
682 };
684 enum {
685  cdFeatureFlagsMask =
686  0xFFFC, /* The Flags are in the first 14 bits of the cdFeatures field */
687  cdTransportMask = 0x0003 /* The transport type is in the last 2 bits of the
688  cdFeatures field */
689 };
690 
691 /* Flags for cdFeatures field */
692 enum {
693  cdPowerInject = 0, /* device supports power inject of media*/
694  cdNotPowerEject = 1, /* device does not support power eject of media*/
695  cdMute = 2, /* device supports audio channels muting*/
696  cdLeftToChannel = 3, /* device supports left channel only mono audio*/
697  cdRightToChannel = 4, /* device supports right channel only mono audio*/
698  cdLeftPlusRight = 5, /* device supports left + right channels mono audio*/
699  cdSCSI_2 = 10, /* device supports SCSI2 command set (SCSI only)*/
700  cdStereoVolume = 11, /* device supports independent volume per channel*/
701  cdDisconnect = 12, /* device supports disconnect / reconnect (SCSI only)*/
702  cdWriteOnce = 13, /* device is a write-once type of drive*/
703  cdLockableButton = 14, /* device drawer/tray can be locked*/
704  cdExtendedFeatures = 15, /* extendedCdFeatures field is used*/
705  cdPowerInject_Mask = 1 << cdPowerInject,
706  cdNotPowerEject_Mask = 1 << cdNotPowerEject,
707  cdMute_Mask = 1 << cdMute,
708  cdLeftToChannel_Mask = 1 << cdLeftToChannel,
709  cdRightToChannel_Mask = 1 << cdRightToChannel,
710  cdLeftPlusRight_Mask = 1 << cdLeftPlusRight,
711  cdSCSI_2_Mask = 1 << cdSCSI_2,
712  cdStereoVolume_Mask = 1 << cdStereoVolume,
713  cdDisconnect_Mask = 1 << cdDisconnect,
714  cdWriteOnce_Mask = 1 << cdWriteOnce,
715  cdLockableButton_Mask = 1 << cdLockableButton,
716  cdExtendedFeatures_Mask = 1 << cdExtendedFeatures
717 };
718 
719 /* Transport types */
720 enum {
721  cdCaddy = 0, /* CD_SC,CD_SC_PLUS,CD-300 etc. - power eject only*/
722  cdTray = cdPowerInject_Mask, /* CD_300_PLUS etc. - power inject only*/
723  cdLid = cdNotPowerEject_Mask /* Power CD - no power inject/no power eject*/
724 };
725 
730 enum {
731  cdDVDROM = 0, /* device reads DVD-ROM media*/
732  cdDVDR = 1, /* device writes DVD-R media*/
733  cdDVDRAM = 2, /* device writes DVD-RAM media*/
734  cdDVDAudio = 3, /* device reads DVD-Audio media*/
735  cdDVDRW = 4, /* device writes DVD-RW media*/
736  cdCDRom = 5, /* device reads CD-ROM media*/
737  cdCDR = 6, /* device writes CD-R media*/
738  cdCDRW = 7, /* device writes CD-RW media*/
739  cdDVDROM_Mask = 1 << cdDVDROM,
740  cdDVDR_Mask = 1 << cdDVDR,
741  cdDVDRAM_Mask = 1 << cdDVDRAM,
742  cdDVDAudio_Mask = 1 << cdDVDAudio,
743  cdDVDRW_Mask = 1 << cdDVDRW,
744  cdCDRom_Mask = 1 << cdCDRom,
745  cdCDR_Mask = 1 << cdCDR,
746  cdCDRW_Mask = 1 << cdCDRW
747 };
748 
749 /* the following are used by PC Exchange (and Apple DOS/PC Compatibility Card)*/
750 
751 /* Control Codes*/
752 enum {
753  kRegisterPartition = 50, /* PCX needs a new Drive (for a non-macintosh
754  partition found on the disk)*/
755  OLD_REGISTER_PARTITION = 301, /* left in for compatibility with shipping Apple
756  DOS/PC Compatibility Card*/
757  THE_DRIVE = 0, /* DrvQElPtr for the partition to register*/
758  THE_PHYS_START = 1, /* The start of the partition in logical blocks*/
759  THE_PHYS_SIZE = 2, /* The size of the partition in logical blocks*/
760  kGetADrive = 51, /* control call to ask the driver to create a drive*/
761  OLD_GET_A_DRIVE = 302, /* left in for compatibility with shipping Apple DOS/PC
762  Compatibility Card*/
763  THE_VAR_QUEL = 0, /* a VAR parameter for the returned DrvQElPtr*/
764  kProhibitMounting = 52, /* Dont allow mounting of the following drives*/
765  kOldProhibitMounting = 2100, /* left in for compatibility with shipping Apple
766  DOS/PC Compatibility Card*/
767  kProhibitDevice = 0, /* CS Param 0 and 1 (partInfoRecPtr)*/
768  kIsContainerMounted = 53,
769  kOldIsContainerMounted = 2201, /* left in for compatibility with shipping
770  Apple DOS/PC Compatibility Card */
771  kContainerVRef = 0, /* CS Param 0 and 1 (VRefNum)*/
772  kContainerParID = 1, /* CS Param 2 and 3 (Parent ID)*/
773  kContainerName = 2, /* CS Param 4 and 5 (File Name)*/
774  kContainerResponse = 3, /* CS Param 6 and 7 (VAR pointer to short result)*/
775  kMountVolumeImg = 54,
776  OLD_MOUNT_VOLUME_IMG = 2000,
777  MV_HOST_VREFNUM = 0,
778  MV_HOST_PAR_ID = 1,
779  MV_HOST_NAME = 2,
780  MV_REQ_PERM = 3
781 };
782 
783 /* Status Codes*/
784 
785 enum {
786  kGetPartitionStatus = 50, /* what is the status of this partition?*/
787  kOldGetPartitionStatus = 2200, /* left in for compatibility with shipping
788  Apple DOS/PC Compatibility Card*/
789  kDeviceToQuery = 0, /* CS Param 0 and 1 (partInfoRecPtr)*/
790  kDeviceResponse = 1, /* CS Param 2 and 3 (VAR pointer to short result)*/
791  kGetPartInfo =
792  51, /* Get a partition info record based on the provided vrefnum*/
793  kOldGetPartInfo = 2300, /* left in for compatibility with shipping Apple
794  DOS/PC Compatibility Card*/
795  kPartInfoResponse =
796  0, /* var parameter (pointer to partInfoRec) CSParam [0-1]*/
797  kGetContainerAlias = 52, /* Get the alias that describes the file this drive
798  was mounted from.*/
799  kOldGetContainerAlias = 2400, /* left in for compatibility with shipping Apple
800  DOS/PC Compatibility Card*/
801  kGetAliasResponse =
802  0 /* var parameter (pointer to a Handle) CSParam [0-1]*/
803 };
804 
805 /* the result codes to come from the driver interface */
806 
807 enum {
808  DRIVER_NOT_INSTALLED = -1,
809  DRIVER_BUSY = -2,
810  CANT_MOUNT_WITHIN_THIS_FS =
811  -3, /* can only mount container within residing on HFS volume*/
812  VOLUME_ALREADY_MOUNTED = -4 /* Already Mounted*/
813 };
814 
815 /* requisite structures for PCX control and status calls*/
816 
817 enum {
818  kMaxProhibted =
819  2 /* the max number of volumes the PC can possibly have mounted*/
820 };
821 
822 /* GestaltSelector for Finding Driver information*/
823 
824 enum { kGetDriverInfo = FOUR_CHAR_CODE('vdrc') };
825 
826 /* VerifyCmd, FormatCmd and EjectCmd are now defined in Disks.h/p/a */
827 /* Partition information passed back and forth between PCX and the driver*/
828 struct partInfoRec {
829  DeviceIdent SCSIID; /* DeviceIdent for the device*/
830  UInt32 physPartitionLoc; /* physical block number of beginning of partition*/
831  UInt32 partitionNumber; /* the partition number of this partition*/
832 };
833 typedef struct partInfoRec partInfoRec;
834 typedef partInfoRec *partInfoRecPtr;
835 struct vPartInfoRec {
836  UInt8 VPRTVers; /* Virtual partition version number*/
837  UInt8 VPRTType; /* virtual partition type (DOS, HFS, etc)*/
838  SInt16 drvrRefNum; /* Driver Reference number of partition driver*/
839 };
840 typedef struct vPartInfoRec vPartInfoRec;
842 /* Information related to DOS partitions*/
843 enum {
844  kDOSSigLow = 0x01FE, /* offset into boot block for DOS signature*/
845  kDOSSigHi = 0x01FF, /* offset into boot block for DOS signature*/
846  kDOSSigValLo = 0x55, /* DOS signature value in low byte*/
847  kDOSSigValHi = 0xAA /* DOS signature value in high byte*/
848 };
849 
850 #if PRAGMA_STRUCT_ALIGN
851 #pragma options align = reset
852 #elif PRAGMA_STRUCT_PACKPUSH
853 #pragma pack(pop)
854 #elif PRAGMA_STRUCT_PACK
855 #pragma pack()
856 #endif
857 
858 #ifdef PRAGMA_IMPORT_OFF
859 #pragma import off
860 #elif PRAGMA_IMPORT
861 #pragma import reset
862 #endif
863 
864 #ifdef __cplusplus
865 }
866 #endif
867 
868 #endif /* __DRIVERGESTALT__ */
Disk Driver Interfaces.
Basic Macintosh data types.
unsigned char * StringPtr
Definition: MacTypes.h:477
unsigned char Boolean
Definition: MacTypes.h:318
NameRegistry Interfaces.
OS Utilities Interfaces.
SCSI Family Interfaces.
Public API for USB Services Library (and associated components)
Definition: DriverGestalt.h:675
Definition: SCSI.h:1211
Definition: DriverGestalt.h:177
Definition: DriverGestalt.h:320
Definition: DriverGestalt.h:550
Definition: DriverGestalt.h:313
Definition: DriverGestalt.h:265
Definition: DriverGestalt.h:594
Definition: DriverGestalt.h:510
Definition: DriverGestalt.h:368
Definition: DriverGestalt.h:338
Definition: DriverGestalt.h:286
Definition: DriverGestalt.h:530
Definition: DriverGestalt.h:579
Definition: DriverGestalt.h:652
Definition: DriverGestalt.h:194
Definition: DriverGestalt.h:302
Definition: DriverGestalt.h:358
Definition: DriverGestalt.h:624
Definition: DriverGestalt.h:308
Definition: DriverGestalt.h:415
Definition: OSUtils.h:131
Definition: NameRegistry.h:62
Definition: DriverGestalt.h:828
Definition: DriverGestalt.h:835
Definition: DriverGestalt.h:563