Autoconfigure command – Rockwell Automation 6008-SV2R VMEbus remote I/O Scanner User Manual

Page 139

Advertising
background image

Chapter

Programming the Scanner

8

8Ć5

AUTOCONFIGURE command

/*
**
** AUTOCFG() –– autoconfigure a 6008–SV2 channel
**
**

This function executes a AUTOCONFIGURE command. The results of the autoconfigure 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
autocfg (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, ”autocfg: lock aquire FAILED\n”);
return –1;

}

/* set up the control/status area */
csa–>cnfstat = 0x000F;
csa–>cmd

= CMD_AUTOCFG;

csa–>datalen = 0;

/* send the command interrupt */
assert_cmd(chan);

Advertising
This manual is related to the following products: