home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
MISC
/
scsiutil.lzh
/
SCSIUTIL
/
doscsicmd.c
< prev
next >
Wrap
Text File
|
1996-10-22
|
3KB
|
79 lines
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned long ulong;
#include "dcmd.h"
extern int path, devtyp;
struct d_cmd dcd; /* direct command structure */
struct cmdblk cmd; /* command block for the driver */
union errdetails {
struct rbferr {
unsigned ed_valid:1, /* error is valid */
ed_class:3, /* error class = 7 */
ed_zero:4; /* always 0 */
uchar ed_seg; /* segment number always 0 */
unsigned ed_filemrk:1, /* filemark */
ed_eom:1, /* end of medium */
ed_ili:1, /* incorrect length indicator */
ed_zero2:1, /* always zero */
ed_main:4; /* main sense key */
uchar ed_info[4], /* info byte [lba] */
ed_senslen; /* additional sense info length */
ulong ed_zero3; /* always zero */
uchar ed_code, /* error code */
ed_zero4, /* always 0 */
ed_fru; /* fru code */
unsigned ed_fpv:1, /* field pointer valid */
ed_cd:1, /* command/data bit */
ed_zero5:2, /* always zero */
ed_bpv:1, /* block pointer valid */
ed_bitptr:3; /* bit pointer */
uchar ed_fptr[2]; /* field pointer */
} rerr;
struct sbferr {
unsigned ed_valid:1, /* error is valid */
ed_class:3, /* error class = 7 */
ed_zero:4; /* always 0 */
uchar ed_seg; /* segment number always 0 */
unsigned ed_filemrk:1, /* filemark */
ed_eom:1, /* end of medium */
ed_ili:1, /* incorrect length indicator */
ed_zero2:1, /* always zero */
ed_main:4; /* main sense key */
uchar ed_info[4]; /* info byte [lba] */
uchar ed_senslen; /* additional sense info length */
uchar ed_cpsrc; /* COPY source sense data ptr */
uchar ed_cpdest; /* COPY destination sense data ptr */
uchar ed_zero3[2]; /* always zero */
uchar ed_recov[2]; /* # recoverable errors */
uchar ed_cptstat; /* COPY target status */
uchar ed_cptsens[8]; /* COPY target sense data (0-7) */
} serr;
} edat;
int DoScsiCmd(uchar * data, int datasize, uchar * cmdb, int cmdsize, uchar flags)
{
/* set up the direct command structure */
dcd.manager = devtyp; /* device manager */
dcd.dcmdsync = DCMDSYNC; /* set sync to validate the call */
dcd.device = SCSIdevice; /* this is indeed a SCSI specific op */
dcd.dcmdblk = &cmd; /* pointer to command block */
/* and now the SCSI driver required block */
cmd._cb_cmdptr = cmdb; /* pointer to the command */
cmd._cb_datptr = data; /* place for the data */
cmd._cb_cmdlen = cmdsize;
cmd._cb_datlen = datasize; /* the number of data bytes to xfer */
cmd._cb_xfer = flags; /* read data flag */
cmd._cb_errptr = &edat; /* pointer to the error block */
cmd._cb_errlen = sizeof edat;/* and the size reserved for it */
if ( flags == INPUT )
return _gs_dcmd(path, &dcd);
else
return _ss_dcmd(path, &dcd);
}