OpenSlotYou can use the
OpenSlotfunction to open a device driver that serves a slot device.
pascal OSErr OpenSlot(ParmBlkPtr paramBlock, Boolean async);
- A pointer to a
MultiDevParamstructure of the
- A Boolean value that indicates whether the request is asynchronous. You must set this field to
falsebecause device drivers cannot be opened asynchronously.
<-- ioResult OSErr The device driver's result code. --> ioNamePtr StringPtr A pointer to the driver name. <-- ioRefNum short The driver reference number. --> ioPermssn char Read/write permission.
Additional fields for a single device
--> ioMix Ptr Reserved for use by the driver open routine. --> ioFlags short Determines the number of additional fields. --> ioSlot char The slot number. --> ioId char The slot resource ID.
Additional fields for multiple devices
--> ioMMix Ptr Reserved for use by the driver open routine. --> ioMFlags short The number of additional fields. --> ioSEBlkPtr Ptr A pointer to an external parameter block.
OpenSlotfunction is equivalent to the
PBOpenfunction, except that it sets bit 9 of the trap word, which signals the
_Openroutine that the parameter block includes additional fields.
If the sResource serves a single device, you should clear all the bits of the
ioFlagsfield and include the slot number and slot resource ID in the
If the sResource serves multiple devices, you should set the
fMultibit (bit 0) of the
ioFlagsfield (clearing all other bits to 0), and specify, in the
ioSEBlkPtrfield, an external parameter block that is customized for the devices installed in the slot.
OpenSlotfunction may move memory; you should not call it at interrupt time.
ASSEMBLY-LANGUAGE INFORMATIONThe trap macro for the
_Open(0xA200). Bit 9 of the trap word is set to signal that the parameter block contains additional fields for slot devices.
You must set up register A0 with the address of the parameter block. When
_Openreturns, register D0 contains the result code. Register D0 is the only register affected by this function.
Registers on entry A0 Address of the parameter block
Registers on exit D0 Result code
noErr 0 No error badUnitErr -21 Driver reference number does not match unit table unitEmptyErr -22 Driver reference number specifies a
nilhandle in unit table
openErr -23 Requested read/write permission does not match driver's open permission dInstErr -26 Driver resource not found
SEE ALSOFor information about the low-level function for opening other device drivers, see the description of the
PBOpenfunction on page 1-61. For an example of opening a device driver, see Listing 1-1 on page 1-18. Refer to the chapter "Slot Manager" in this book for more information about slot device drivers.