Continuous blockćtransfers – Rockwell Automation 6008-SV2R VMEbus remote I/O Scanner User Manual

Page 171

Advertising
background image

Chapter

Programming the Scanner

8

8Ć37

/* map channel & establish pointers */
map_channel(chan);
csa

=

(csa_data far *)

chan–>ControlStatusArea;

gda

=

(unsigned short far *)

chan–>GeneralDataArea;

/* check for semaphore */
if ((csa–>semaphore & SEMAPHORE) == 0x0000) {

/* no block transfer has completed */
unmap_channel(chan);
return –1;

}

/* get block transfer parameters */
block–>cnfstat

=

csa–>cnfstat;

block–>cmd

=

csa–>cmd;

block–>addr

=

csa–>addr;

block–>tag

=

csa–>tag;

block–>datalen

=

csa–>datalen;

/* if read */
if (csa–>cmd == CMD_OSBTREAD) {

/* copy block data */
for (i = 0; i < block–>datalen; i++) {

block–>data[i] = gda[i];

}

}

/* release semaphore */
unlock_gda(chan);
unmap_channel(chan);
return block–>cnfstat;

}

Continuous BlockĆTransfers

Continuous block-transfer operations are similar to single block-transfer
operations. They send and retrieve data the same way. The continuous
block-transfer offers a way to continuously poll an adapter and reduce
programming overhead.

While running a continuous block-transfer, the scanner prevents the
scanner and a VME processor from simultaneously updating the same
block table entry. Your application must resolve possible contention
among multiple master VME processors simultaneously accessing the
same block table entry.

Important: Your application should read block updates as highly critical
sections of code. The application should have the master processor acquire
a lock on the entry, copy the read/write data, and release the lock without
pausing, sleeping, polling, or handling interrupts. As long as the master
processor holds the lock, the scanner cannot update the block.

Advertising
This manual is related to the following products: