Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 1 - Device Manager / Device Manager Reference
Device Manager Functions / Opening and Closing Device Drivers


OpenSlot

You can use the OpenSlot function to open a device driver that serves a slot device.

pascal OSErr OpenSlot(ParmBlkPtr paramBlock, Boolean async); 
paramBlock
A pointer to a SlotDevParam or MultiDevParam structure of the ParamBlockRec union.
async
A Boolean value that indicates whether the request is asynchronous. You must set this field to false because device drivers cannot be opened asynchronously.
<--ioResultOSErrThe device driver's result code.
-->ioNamePtrStringPtrA pointer to the driver name.
<--ioRefNumshortThe driver reference number.
-->ioPermssncharRead/write permission.

Additional fields for a single device
-->ioMixPtrReserved for use by the driver open routine.
-->ioFlagsshortDetermines the number of additional fields.
-->ioSlotcharThe slot number.
-->ioIdcharThe slot resource ID.

Additional fields for multiple devices
-->ioMMixPtrReserved for use by the driver open routine.
-->ioMFlagsshortThe number of additional fields.
-->ioSEBlkPtrPtrA pointer to an external parameter block.

DESCRIPTION
The OpenSlot function is equivalent to the PBOpen function, except that it sets bit 9 of the trap word, which signals the _Open routine that the parameter block includes additional fields.

If the sResource serves a single device, you should clear all the bits of the ioFlags field and include the slot number and slot resource ID in the ioSlot and ioID fields.

If the sResource serves multiple devices, you should set the fMulti bit (bit 0) of the ioFlags field (clearing all other bits to 0), and specify, in the ioSEBlkPtr field, an external parameter block that is customized for the devices installed in the slot.

SPECIAL CONSIDERATIONS
The OpenSlot function may move memory; you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro for the OpenSlot function is _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 _Open returns, register D0 contains the result code. Register D0 is the only register affected by this function.
Registers on entry
A0Address of the parameter block
Registers on exit
D0Result code

RESULT CODES
noErr0No error
badUnitErr-21Driver reference number does not match unit table
unitEmptyErr-22Driver reference number specifies a nil handle in unit table
openErr-23Requested read/write permission does not match driver's open permission
dInstErr-26Driver resource not found
SEE ALSO
For information about the low-level function for opening other device drivers, see the description of the PBOpen function 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.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996