Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <disk.h>
4
#include "scsireq.h"
5
 
6
long
7
SReinitialise(ScsiReq *rp)
8
{
9
	uchar cmd[6];
10
 
11
	memset(cmd, 0, sizeof(cmd));
12
	cmd[0] = ScmdEInitialise;
13
	rp->cmd.p = cmd;
14
	rp->cmd.count = sizeof(cmd);
15
	rp->data.p = cmd;
16
	rp->data.count = 0;
17
	rp->data.write = 1;
18
	return SRrequest(rp);
19
}
20
 
21
long
22
SRmmove(ScsiReq *rp, int transport, int source, int destination, int invert)
23
{
24
	uchar cmd[12];
25
 
26
	memset(cmd, 0, sizeof(cmd));
27
	cmd[0] = ScmdMMove;
28
	cmd[2] = transport>>8;
29
	cmd[3] = transport;
30
	cmd[4] = source>>8;
31
	cmd[5] = source;
32
	cmd[6] = destination>>8;
33
	cmd[7] = destination;
34
	cmd[10] = invert & 0x01;
35
	rp->cmd.p = cmd;
36
	rp->cmd.count = sizeof(cmd);
37
	rp->data.p = cmd;
38
	rp->data.count = 0;
39
	rp->data.write = 1;
40
	return SRrequest(rp);
41
}
42
 
43
long
44
SRestatus(ScsiReq *rp, uchar type, uchar *list, int nbytes)
45
{
46
	uchar cmd[12];
47
 
48
	memset(cmd, 0, sizeof(cmd));
49
	cmd[0] = ScmdEStatus;
50
	cmd[1] = type & 0x07;
51
	cmd[4] = 0xFF;
52
	cmd[5] = 0xFF;
53
	cmd[7] = nbytes>>16;
54
	cmd[8] = nbytes>>8;
55
	cmd[9] = nbytes;
56
	rp->cmd.p = cmd;
57
	rp->cmd.count = sizeof(cmd);
58
	rp->data.p = list;
59
	rp->data.count = nbytes;
60
	rp->data.write = 0;
61
	return SRrequest(rp);
62
}