Rockwell Automation 6008-SV2R VMEbus remote I/O Scanner User Manual
Page 158
![background image](/manuals/580456/158/background.png)
Chapter
Programming the Scanner
8
8Ć24
/*
**
** LOCK_GDA() –– lock a channel’s general data area
**
**
This function locks a channel’s general data area semaphore.
**
**
parameters:
pointer to channel struct
**
return value:
none
**
*/
int
lock_gda(channel far *chan)
{
csa_data far
*csaptr;
int
res;
/* map channel & establish pointers */
map_channel(chan);
csaptr = (csa_data far *) chan–>ControlStatusArea;
/* attempt to lock the semaphore */
res = sv2_lock((unsigned short far *) &csaptr–>semaphore);
/* unmap channel & return */
unmap_channel(chan);
return res;
}
/*
**
** UNLOCK_GDA() –– unlock a channel’s General Data Area
**
**
This function unlocks a channel’s general data area semaphore.
**
**
parameters:
pointer to channel struct
**
return value:
none
**
*/
void
unlock_gda (channel far *chan)
{
csa_data far
*csa;
/* map channel & establish pointers */
map_channel(chan);
csa = (csa_data far *) chan–>ControlStatusArea;
/* clear the semaphore bit */
csa–>semaphore &= (unsigned short) (~SEMAPHORE);
/* unmap the channel */
unmap_channel(chan);
return;
}