0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@file
|
|
18 |
@internalTechnology
|
|
19 |
*/
|
|
20 |
|
|
21 |
#ifndef TSCSIBLOCKCMDS_H
|
|
22 |
#define TSCSIBLOCKCMDS_H
|
|
23 |
|
|
24 |
|
|
25 |
/**
|
|
26 |
Data type for Logical Block Address
|
|
27 |
*/
|
|
28 |
typedef TUint32 TLba;
|
|
29 |
|
|
30 |
/**
|
|
31 |
Data type for PROTECT filed used in READ (10) and WRITE (10)
|
|
32 |
SBC-3 5.6 Table 33 and 5.25 Table 68
|
|
33 |
*/
|
|
34 |
typedef TUint TProtect; // 3 bits
|
|
35 |
|
|
36 |
class TScsiClientReq;
|
|
37 |
|
|
38 |
|
|
39 |
/**
|
|
40 |
Encode SCSI MODE SENSE(6) REQUEST
|
|
41 |
Ref SPC-2 7.8 Request
|
|
42 |
Ref SPC-3 6.9 Request
|
|
43 |
Ref SPC-3 7.4 Response format
|
|
44 |
Ref SBC-3 6.3 Response format for SBC
|
|
45 |
*/
|
|
46 |
class TScsiClientModeSense6Req: public TScsiClientReq
|
|
47 |
{
|
|
48 |
public:
|
|
49 |
/** SCSI PAGE CONTROL values */
|
|
50 |
enum TPageControl
|
|
51 |
{
|
|
52 |
ECurrentValues = 0x00,
|
|
53 |
EChangeableValues = 0x01,
|
|
54 |
EDefaultValues = 0x02,
|
|
55 |
ESavedValues = 0x03
|
|
56 |
};
|
|
57 |
|
|
58 |
/** Length of MODE SENSE (6) response */
|
|
59 |
static const TUint KResponseLength = 4;
|
|
60 |
|
|
61 |
TScsiClientModeSense6Req(TPageControl aPageControl,
|
|
62 |
TUint aPageCode,
|
|
63 |
TUint aSubPageCode = 0);
|
|
64 |
|
|
65 |
TInt EncodeRequestL(TDes8& aBuffer) const;
|
|
66 |
|
|
67 |
public:
|
|
68 |
/** SCSI PAGE CONTROL field */
|
|
69 |
TPageControl iPageControl;
|
|
70 |
/** SCSI PAGE CODE field */
|
|
71 |
TUint iPageCode;
|
|
72 |
/** SCSI SUB PAGE CODE field */
|
|
73 |
TUint iSubPageCode;
|
|
74 |
/** SCSI ALLOCATION LENGTH field */
|
|
75 |
TAllocationLength iAllocationLength;
|
|
76 |
};
|
|
77 |
|
|
78 |
|
|
79 |
/**
|
|
80 |
Encode SCSI MODE SENSE(6) RESPONSE
|
|
81 |
Ref SPC-3 6.9 Request
|
|
82 |
Ref SPC-3 7.4 Response format
|
|
83 |
Ref SBC-3 6.3 Response format for SBC
|
|
84 |
*/
|
|
85 |
class TScsiClientModeSense6Resp: public TScsiClientResp
|
|
86 |
{
|
|
87 |
public:
|
|
88 |
/** Length of MODE SENSE (6) response */
|
|
89 |
static const TUint KResponseLength = 4;
|
|
90 |
|
|
91 |
TScsiClientModeSense6Resp() {};
|
|
92 |
|
|
93 |
TInt DataLength() const {return KResponseLength;}
|
|
94 |
void DecodeL(const TDesC8& aPtr);
|
|
95 |
|
|
96 |
public:
|
|
97 |
/** Returned SCSI WP flag */
|
|
98 |
TBool iWriteProtected;
|
|
99 |
};
|
|
100 |
|
|
101 |
|
|
102 |
/**
|
|
103 |
Encode MODE SENSE (10) REQUEST
|
|
104 |
Ref SPC-2 7.9 Request
|
|
105 |
Ref SPC-3 6.10 Request
|
|
106 |
Ref SPC-2 8.2 Response format
|
|
107 |
Ref SPC-3 7.4 Response format
|
|
108 |
Ref SBC-3 6.3 Response format for SBC
|
|
109 |
*/
|
|
110 |
class TScsiClientModeSense10Req: public TScsiClientReq
|
|
111 |
{
|
|
112 |
public:
|
|
113 |
/** SCSI PAGE CONTROL values */
|
|
114 |
enum TPageControl
|
|
115 |
{
|
|
116 |
ECurrentValues = 0x00,
|
|
117 |
EChangeableValues = 0x01,
|
|
118 |
EDefaultValues = 0x02,
|
|
119 |
ESavedValues = 0x03
|
|
120 |
};
|
|
121 |
|
|
122 |
/** Length of MODE SENSE (10) response */
|
|
123 |
static const TUint KResponseLength = 8;
|
|
124 |
|
|
125 |
TScsiClientModeSense10Req(TPageControl aPageControl,
|
|
126 |
TUint aPageCode,
|
|
127 |
TUint aSubPageCode = 0);
|
|
128 |
|
|
129 |
TInt EncodeRequestL(TDes8& aBuffer) const;
|
|
130 |
|
|
131 |
public:
|
|
132 |
/** SCSI PAGE CONTROL field */
|
|
133 |
TPageControl iPageControl;
|
|
134 |
/** SCSI PAGE CODE field */
|
|
135 |
TUint iPageCode;
|
|
136 |
/** SCSI SUB PAGE CODE field */
|
|
137 |
TUint iSubPageCode;
|
|
138 |
/** SCSI ALLOCATION LENGTH field */
|
|
139 |
TAllocationLength iAllocationLength;
|
|
140 |
};
|
|
141 |
|
|
142 |
|
|
143 |
/**
|
|
144 |
Decode SCSI MODE SENSE (10) RESPONSE
|
|
145 |
Ref SPC-3 6.10 Request
|
|
146 |
Ref SPC-3 7.4 Response format
|
|
147 |
Ref SBC-3 6.3 Response format for SBC
|
|
148 |
*/
|
|
149 |
class TScsiClientModeSense10Resp: public TScsiClientResp
|
|
150 |
{
|
|
151 |
public:
|
|
152 |
/** Length of MODE SENSE (10) response */
|
|
153 |
static const TUint KResponseLength = 8;
|
|
154 |
|
|
155 |
TScsiClientModeSense10Resp() {};
|
|
156 |
|
|
157 |
TInt DataLength() const {return KResponseLength;}
|
|
158 |
void DecodeL(const TDesC8& aPtr);
|
|
159 |
|
|
160 |
public:
|
|
161 |
/** Returned SCSI WP flag */
|
|
162 |
TBool iWriteProtected;
|
|
163 |
};
|
|
164 |
|
|
165 |
/**
|
|
166 |
Encode READ CAPCAITY (10) REQUEST
|
|
167 |
Ref SBC 2 5.10
|
|
168 |
Ref SBC 3 5.10
|
|
169 |
*/
|
|
170 |
class TScsiClientReadCapacity10Req: public TScsiClientReq
|
|
171 |
{
|
|
172 |
public:
|
|
173 |
/** Length of READ CAPACITY (10) response */
|
|
174 |
static const TInt KResponseLength = 8;
|
|
175 |
TScsiClientReadCapacity10Req();
|
|
176 |
TScsiClientReadCapacity10Req(TLba aLba);
|
|
177 |
TInt EncodeRequestL(TDes8& aBuffer) const;
|
|
178 |
|
|
179 |
public:
|
|
180 |
/** SCSI LOGICAL BLOCK ADDRESS */
|
|
181 |
TLba iLba;
|
|
182 |
};
|
|
183 |
|
|
184 |
/**
|
|
185 |
Decode READ CAPCAITY (10) RESPONSE
|
|
186 |
*/
|
|
187 |
class TScsiClientReadCapacity10Resp: public TScsiClientResp
|
|
188 |
{
|
|
189 |
public:
|
|
190 |
/** Length of READ CAPACITY (10) response */
|
|
191 |
static const TInt KResponseLength = 8;
|
|
192 |
TScsiClientReadCapacity10Resp() {};
|
|
193 |
|
|
194 |
void DecodeL(const TDesC8& aPtr);
|
|
195 |
TInt DataLength() const {return KResponseLength;}
|
|
196 |
|
|
197 |
public:
|
|
198 |
/** Returned SCSI LOGICAL BLOCK ADDRESS */
|
|
199 |
TLba iLba;
|
|
200 |
/** Returned SCSI BLOCK LENGTH IN BYTES */
|
|
201 |
TUint32 iBlockSize;
|
|
202 |
};
|
|
203 |
|
|
204 |
|
|
205 |
/**
|
|
206 |
Base class for encoding SCSI READ (10) and SCSI WRITE (10) requests
|
|
207 |
*/
|
|
208 |
class TScsiClientRdWr10Req: public TScsiClientReq
|
|
209 |
{
|
|
210 |
public:
|
|
211 |
TScsiClientRdWr10Req(TOperationCode aOperationCode);
|
|
212 |
TInt EncodeRequestL(TDes8& aBuffer) const;
|
|
213 |
|
|
214 |
public:
|
|
215 |
/** SCSI LOGICAL BLOCK ADDRESS field */
|
|
216 |
TUint32 iLogicalBlockAddress;
|
|
217 |
/** SCSI TRANSFER LENGTH field */
|
|
218 |
TUint16 iBlockTransferLength;
|
|
219 |
/** SCSI RDPROTECT or SCSI WRPROTECT field */
|
|
220 |
TProtect iProtect;
|
|
221 |
};
|
|
222 |
|
|
223 |
|
|
224 |
/**
|
|
225 |
Encode SCSI READ (10) REQUEST
|
|
226 |
*/
|
|
227 |
class TScsiClientRead10Req: public TScsiClientRdWr10Req
|
|
228 |
{
|
|
229 |
public:
|
|
230 |
TScsiClientRead10Req();
|
|
231 |
TInt EncodeRequestL(TDes8& aBuffer) const;
|
|
232 |
};
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
/**
|
|
237 |
Encode START STOP UNIT REQUEST
|
|
238 |
Ref SBC-2 5.17
|
|
239 |
*/
|
|
240 |
class TScsiClientStartStopUnitReq: public TScsiClientReq
|
|
241 |
{
|
|
242 |
public:
|
|
243 |
TScsiClientStartStopUnitReq();
|
|
244 |
TInt EncodeRequestL(TDes8& aBuffer) const;
|
|
245 |
|
|
246 |
public:
|
|
247 |
/** SCSI IMMED flag */
|
|
248 |
TBool iImmed;
|
|
249 |
/** SCSI START flag */
|
|
250 |
TBool iStart;
|
|
251 |
/** SCSI LOEJ flag */
|
|
252 |
TBool iLoej;
|
|
253 |
};
|
|
254 |
|
|
255 |
|
|
256 |
/**
|
|
257 |
Encode SCSI WRITE (10) REQUEST
|
|
258 |
*/
|
|
259 |
class TScsiClientWrite10Req: public TScsiClientRdWr10Req
|
|
260 |
{
|
|
261 |
public:
|
|
262 |
TScsiClientWrite10Req();
|
|
263 |
TInt EncodeRequestL(TDes8& aBuffer) const;
|
|
264 |
};
|
|
265 |
|
|
266 |
|
|
267 |
#include "tscsiblockcmds.inl"
|
|
268 |
|
|
269 |
#endif // TSCSIBLOCKCMDS_H
|