8ć11, Link status command – Rockwell Automation 6008-SV2R VMEbus remote I/O Scanner User Manual
Page 145

Chapter
Programming the Scanner
8
8Ć11
LINK STATUS command
/*
**
** LINKSTATUS() –– get 6008–SV2 channel link status
**
**
This function executes a LINK STATUS command. The results of the LINK STATUS are
**
placed in the link_config structure provided by the caller.
**
**
parameters:
pointer to channel structure
**
pointer to link_config structure
**
return values:
–1
= unable to lock general data area semaphore
**
–2
= did not get cmd–complete interrupt
**
ELSE
channel confirmation status word
**
**
Note that if the confirmation status word is not 0000H, the contents of the
**
link_config structure passed by the caller are NOT defined.
**
*/
int
linkstatus (channel far *chan, link_config far *linkcfg)
{
csa_data far
*csa;
unsigned short far
*gda;
unsigned char far
*scanlist;
unsigned short
ioaswblk_size;
unsigned short
res;
unsigned short
i;
/* map channel & establish pointers */
map_channel(chan);
csa = (csa_data far *) chan–>ControlStatusArea;
gda = (unsigned short far *) chan–>GeneralDataArea;
/* determine I/O Adapter Status Word block size */
ioaswblk_size = (unsigned short)
((chan–>ScannerMode == MODE_COMPATIBLE) ? SVC_IOASWBLK_SIZE :
SVS_IOASWBLK_SIZE);
/* get the semaphore */
if (lock_gda(chan) != 0) {
unmap_channel(chan);
fprintf(stdout, ”linkstat: lock aquire FAILED\n”);
return –1;
}
/* set up the control/status area */
csa–>cnfstat = 0x000F;
/* confirmation status word */
csa–>cmd = CMD_LINKSTAT;
/* command word */
csa–>datalen = 0;
/* length of data word */
/* send the command interrupt */
assert_cmd(chan);