8ć15, Continuous bt write / continuous bt read command – Rockwell Automation 6008-SV2R VMEbus remote I/O Scanner User Manual
Page 149
Chapter
Programming the Scanner
8
8Ć15
CONTINUOUS BT WRITE / CONTINUOUS BT READ command
/*
**
** CONTINUOUS_BT_UPDATE() –– update a continuous block transfer write or read operation.
**
**
The bt_data parameter passed by the caller allows this routine to identify the
**
specific continuous block transfer operation to update. The command word field
**
identifies the block transfer table and the tag field specifies the table entry.
**
**
The routine copies the table entry’s command word, address word, tag word, transfer
**
length word, and interrupt word parameters to the bt_data parameter.
**
**
If the specified operation is a write block transfer, the routine copies data from the
**
bt_data parameter’s data buffer to the table entry data buffer. If the specified
**
operation is a read block transfer, the routine copies data from the table entry’s
**
data buffer to the bt_data parameter’s data buffer.
**
**
parameters:
pointer to channel structure
**
pointer to the bt_data structure
**
return values:
0
= success
**
–1
= could not lock table entry’s data buffer
**
*/
int
continuous_bt_update (channel far *chan, bt_data far *block)
{
csa_data far
*csa;
unsigned short far
*gda;
btentry far
*bt;
btentry far
*entry;
unsigned short
i;
/* map channel & establish pointers */
map_channel(chan);
csa = (csa_data far *) chan–>ControlStatusArea;
gda = (unsigned short far *) chan–>GeneralDataArea;
/* make pointer to continuous BT table */
if (block–>cmd == CMD_CONBTREAD) {
/* read operation */
bt = (btentry far *) chan–>ConBTRTable;
} else {
/* write operation */
bt = (btentry far *) chan–>ConBTWTable;
}
/* make pointer to continuous BT table entry */
entry = (btentry far *) &bt[block–>tag];
/* update transfer parameters */
block–>tag
= entry–>tag;
block–>addr
= entry–>addr;
block–>datalen
= entry–>datalen;
block–>irq
= entry–>irq;