Chapter 4 Command Operation
Example ‘C’ Routines for Command List | Page 4 - 23 |
Example ‘C’ Routines for Command List
The following ‘C’ listing is included here as an example of how you may set- up the Parameter Block, Status Block and Command List structures and manipulate the Command List Indexes.
/* Global Defines: */ #define EMPTY 0
#define NPB | 100 | /* NPB - | Num of Parameter Blocks in Command List. */ |
#define NSB | 200 | /* NSB - | Num of Status Blocks in Command List. */ |
#define BYTE | unsigned char | /* an 8 bit value */ | |
#define WORD | unsigned int | /* a 16 bit value */ | |
#define DWORD unsigned long | /* a 32 bit value */ |
/* parameter_block - a structure used to pass a command to the RF3880 VME to
*SCSI adapter. The fields are: */
typedef struct |
|
|
|
{ |
|
|
|
DWORD | identifier; | /* identifier - command identifier. */ | |
BYTE | /* command flags. */ | ||
BYTE | /* command flags. */ | ||
BYTE | modifier; | /* modifier - address modifier. */ | |
BYTE | target; | /* target - target ID or adpater ID. */ | |
/* possible values for |
|
| |
#defineCF_VALID |
| 0x80 | /* dat and dir bits valid. */ |
#defineCF_FREE |
| 0x40 | /* reserved bit, not used. */ |
#defineCF_INHIBIT_CMD_COMPLETE0x20 | /* command list, synch control. */ | ||
#defineCF_FREE1 |
| 0x10 | /* reserved bit, not used.*/ |
#defineCF_IRS |
| 0x08 | /* inhibit |
#defineCF_DATA |
| 0x04 | /* data for this opration. */ |
#defineCF_DIR |
| 0x02 | /* direction; 1 = (writes). */ |
/* possible values for |
|
| |
#defineCF_JUST_SEND_MSG | 0x08 | /* | |
#defineCF_INHIBIT_DISCONNECT | 0x04 | /* inhibit disconnect. */ | |
#defineCF_TAG_MESSAGE_TYPE | 0x02 | /* tag message type. */ | |
union |
|
|
|
{ |
|
|
|
WORD | w[2]; |
|
|
DWORD | d; |
|
|
} sdp; |
| /* sdp - source/dest. memory address */ | |
union |
|
|
|
{ |
|
|
|
WORD | w[2]; |
|
|
DWORD | d; |
|
|
} bytes; |
| /* bytes - data transfer count */ |
User’s Guide | 21020285 D |