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 2 - Slot Manager / Slot Manager Reference
Slot Manager Routines / Enabling, Disabling, Deleting, and Restoring sResources


InsertSRTRec

You can use the InsertSRTRec function to add an sResource to the slot resource table.

FUNCTION InsertSRTRec (spBlkPtr: SpBlockPtr): OSErr;
spBlkPtr
A pointer to a Slot Manager parameter block.
-->spsPointerPtrA NIL pointer.
-->spParamDataLongIntEither a value of 0 to enable the sResource or a value of 1 to disable it.
-->spRefNumIntegerThe device driver reference number.
-->spSlotSignedByteThe slot number.
-->spIdSignedByteThe sResource ID.
-->spExtDevSignedByteThe external device identifier.

DESCRIPTION
The InsertSRTRec function installs an sResource from the firmware of a NuBus card into the slot resource table. For example, if the user makes a selection in the Monitors control panel that requires your video card to switch to a new sResource that was deleted by PrimaryInit code, you can use the InsertSRTRec function to restore that sResource.

You specify an sResource with the spSlot, spID, and spExtDev fields of the Slot Manager parameter block you point to in the spBlkPtr parameter. You must set the spsPointer field to NIL. Set the spParamData field to 1 to disable the restored sResource or to 0 to enable it.

If you place a valid device driver reference number in the spRefNum field, the Slot Manager updates the dCtlDevBase field in that device driver's device control entry (that is, in the device control entry that has that driver reference number in the dCtlRefNum field). The dCtlDevBase field contains the base address of the slot device. For a video card this is the base address for the pixel map in the card's GDevice record (which is described in Inside Macintosh: Imaging With QuickDraw). For other types of cards the base address is optional and defined by the card designer.

The base address consists of the card's slot address plus an optional offset that the card designer can specify using the MinorBaseOS or MajorBaseOS entries of the sResource. The Slot Manager calculates the base address by using bit 2 (the f32BitMode flag) of the sRsrcFlags entry of the sResource. As shown in Table 2-4, the Slot Manager first checks the value of bit 2 of the sRsrcFlags field, and then it checks for a MinorBaseOS entry. If it finds one, it uses this value to create a 32-bit value to store in the dCtlDevBase field. If it does not find a MinorBaseOS entry, it uses the value in the MajorBaseOS entry, if any.
Table 2-4 How the Slot Manager determines the base address of a slot device
sRsrcFlagsMinorBaseOSMajorBaseOSAddress format
Field missing$x xxxxAny or none$Fs0x xxxx
Field missingNone$xx xxxx$sxxx xxxx
Bit 2 is 0$x xxxxAny or none$Fs0x xxxx
Bit 2 is 0None$xx xxxx$sxxx xxxx
Bit 2 is 1$x xxxxAny or none$Fsxx xxxx
Bit 2 is 1None$xx xxxx$sxxx xxxx

Note
In this table, x represents any hexadecimal digit and s represents a slot number.
SPECIAL CONSIDERATIONS
The InsertSRTRec function is available only with version 1 or later of the Slot Manager. You can use the SVersion function, described on page 2-30, to determine whether the Slot Manager is version 1 or later.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the InsertSRTRec function are
Trap macroSelector
_SlotManager$000A

You must set up register D0 with the routine selector and register A0 with the address of the Slot Manager parameter block. When _SlotManager returns, register D0 contains the result code.
Registers on entry
A0Address of the parameter block
D0$000A
Registers on exit
D0Result code

RESULT CODES
noErr0No error
memFullErr-108Not enough room in heap
smUnExBusErr-308Bus error
smBadRefId-330Reference ID not found in list
smBadsList-331Bad sResource: Id1 < Id2 < Id3 ... format is not followed
smReservedErr-332Reserved field not zero
smSlotOOBErr-337Slot number out of bounds
smNoMoresRsrcs-344Specified sResource not found
smBadsPtrErr-346Bad pointer was passed to SCalcSPointer
smByteLanesErr-347ByteLanes field in card's format block was determined to be zero
SEE ALSO
For more information about the slot resource table, see "About the Slot Manager" on page 2-15.

For information about deleting an sResource from the slot resource table, see the SDeleteSRTRec function, described on page 2-52. For more information on deleting and restoring sResources, see "Deleting and Restoring sResources" on page 2-17.

For more information about the device control entry and device driver reference numbers, see the chapter "Device Manager" in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996