Chapter 4 Command Operation

Page 4 - 24

 

Example ‘C’ Routines for Command List

BYTE cdb[12];

/* cdb - Command Descriptor Block/

} parameter_block;

 

/* status_block - a structure used to hold the status information that is returned from

*the adapter. */

typedef struct

{

 

DWORD

sb_ident;

 

/* sb_ident - status block identifier. */

 

BYTE

sb_res;

 

/* sb_res - reserved field. */

 

BYTE

sb_status;

 

/* sb_status - command SCSI status type. */

 

BYTE

sb_error;

 

/* sb_error - error code number. */

 

BYTE

sb_flag;

 

/* sb_flag - command completion flag. */

/* possible values for sb_flag */

 

 

 

#define

ST_CDONE

 

0x80

/*command complete. */

#define

ST_ERROR

 

0x40

/*command error. */

#define

ST_RETRY

 

0x20

/*retry required. */

#define

ST_TRUNCATED

0x10 /* data transfer truncated. */

#define

ST_CONTINUED

0x04 /* block continued from previous. */

 

BYTE sb_info[8]

/* sb_info[8] SCSI request sense info. */

 

} status_block;

 

 

 

 

/* clist - a Command List structure

 

 

 

*/

 

 

 

 

 

typedef struct

 

 

 

 

 

{

 

 

 

 

 

DWORD

pbin;

 

/* parameter block IN pointer. */

 

DWORD

pbout;

 

/* parameter block OUT pointer. */

 

DWORD

sbin;

 

/* status block IN pointer. */

 

DWORD

sbout;

 

/* status block OUT pointer. */

 

DWORD

number_pbs;

/* number of parameter blocks. */

 

DWORD

number_sbs;

/* number of status blocks. */

 

DWORD

reserved[2];

 

/* two RESERVED fields. */

 

parameter_blockpblist[NPB];/*Parameter Block area. */

 

status_block

sblist[NSB};/* Status Block area. */

}command_list; /* Functions: */

/*_______________________________________________________________

* put_parameter_block - A function to add a command to the Command List

*______________________________________________________________*/

void put_parameter_block(pb,clist) parameter_block pb; command_list *clist;

21020285 D

User’s Guide

Page 82
Image 82
Ciprico Rimfire 3880 manual Stcdone