User`s guide

PCI Bus Considerations
Set...
To ...
Set slot = -1 Assume bus = 0 and call the xpcGetPCIDeviceInfo
function to find the first instance of the b oard.
Set slot = S Assume bus = 0 and call the xpcGetPCIDeviceInfo
function to find the specified board. If the board
matches the IDs, return the P CI information to the
driver. Otherwise, return an error.
Set slot = [B, S]CheckbusB and slot S for th e s pecified board. I f t he
board matches th e IDs, return the PCI inf orm a tio n to
the driver. Otherwise, return an error.
Setting
slot = [0, S]isidenticaltoslot = S.
The following example illustrates how to use the xp cGetPCIDeviceInfo
function to program the driver to accept slot number input or slot and bus
number input from the driver block.
1 Call this function from the mdlStart callback function.
2 Pass the slot number or slot and bus number into the xpcGetPCIDev iceInfo
function using code like the following:
uint16_T vendorId, deviceId;
int32_T bus, slot, subvendor, subdevice;
xpcPCIDevice pciInfo;
/* S_PCI_SLOT_ARG is passed in from the mask */
/* Typically the slot arg is a scalar containing -1 if there is only one board of
this type in the target */
/* If there are multiple boards of this type the slot arg is a vector containing bus
and slot info */
/* This code snipped parses the slot arg into bus and slot */
if ( (int_T)(mxGetN(ssGetSFcnParam(S, S_PCI_SLOT_ARG))) == 1 ) {
bus = 0;
slot = (int32_T)(mxGetPr(ssGetSFcnParam(S, S_PCI_SLOT_ARG))[0]);
} else {
bus = (int32_T)(mxGetPr(ssGetSFcnParam(S, S_PCI_SLOT_ARG))[0]);
slot = (int32_T)(mxGetPr(ssGetSFcnParam(S, S_PCI_SLOT_ARG))[1]);
}
2-5