os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiblockcmds.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiblockcmds.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,269 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @internalTechnology
1.22 +*/
1.23 +
1.24 +#ifndef TSCSIBLOCKCMDS_H
1.25 +#define TSCSIBLOCKCMDS_H
1.26 +
1.27 +
1.28 +/**
1.29 +Data type for Logical Block Address
1.30 +*/
1.31 +typedef TUint32 TLba;
1.32 +
1.33 +/**
1.34 +Data type for PROTECT filed used in READ (10) and WRITE (10)
1.35 +SBC-3 5.6 Table 33 and 5.25 Table 68
1.36 +*/
1.37 +typedef TUint TProtect; // 3 bits
1.38 +
1.39 +class TScsiClientReq;
1.40 +
1.41 +
1.42 +/**
1.43 +Encode SCSI MODE SENSE(6) REQUEST
1.44 +Ref SPC-2 7.8 Request
1.45 +Ref SPC-3 6.9 Request
1.46 +Ref SPC-3 7.4 Response format
1.47 +Ref SBC-3 6.3 Response format for SBC
1.48 +*/
1.49 +class TScsiClientModeSense6Req: public TScsiClientReq
1.50 + {
1.51 +public:
1.52 + /** SCSI PAGE CONTROL values */
1.53 + enum TPageControl
1.54 + {
1.55 + ECurrentValues = 0x00,
1.56 + EChangeableValues = 0x01,
1.57 + EDefaultValues = 0x02,
1.58 + ESavedValues = 0x03
1.59 + };
1.60 +
1.61 + /** Length of MODE SENSE (6) response */
1.62 + static const TUint KResponseLength = 4;
1.63 +
1.64 + TScsiClientModeSense6Req(TPageControl aPageControl,
1.65 + TUint aPageCode,
1.66 + TUint aSubPageCode = 0);
1.67 +
1.68 + TInt EncodeRequestL(TDes8& aBuffer) const;
1.69 +
1.70 +public:
1.71 + /** SCSI PAGE CONTROL field */
1.72 + TPageControl iPageControl;
1.73 + /** SCSI PAGE CODE field */
1.74 + TUint iPageCode;
1.75 + /** SCSI SUB PAGE CODE field */
1.76 + TUint iSubPageCode;
1.77 + /** SCSI ALLOCATION LENGTH field */
1.78 + TAllocationLength iAllocationLength;
1.79 + };
1.80 +
1.81 +
1.82 +/**
1.83 +Encode SCSI MODE SENSE(6) RESPONSE
1.84 +Ref SPC-3 6.9 Request
1.85 +Ref SPC-3 7.4 Response format
1.86 +Ref SBC-3 6.3 Response format for SBC
1.87 +*/
1.88 +class TScsiClientModeSense6Resp: public TScsiClientResp
1.89 + {
1.90 +public:
1.91 + /** Length of MODE SENSE (6) response */
1.92 + static const TUint KResponseLength = 4;
1.93 +
1.94 + TScsiClientModeSense6Resp() {};
1.95 +
1.96 + TInt DataLength() const {return KResponseLength;}
1.97 + void DecodeL(const TDesC8& aPtr);
1.98 +
1.99 +public:
1.100 + /** Returned SCSI WP flag */
1.101 + TBool iWriteProtected;
1.102 + };
1.103 +
1.104 +
1.105 +/**
1.106 +Encode MODE SENSE (10) REQUEST
1.107 +Ref SPC-2 7.9 Request
1.108 +Ref SPC-3 6.10 Request
1.109 +Ref SPC-2 8.2 Response format
1.110 +Ref SPC-3 7.4 Response format
1.111 +Ref SBC-3 6.3 Response format for SBC
1.112 +*/
1.113 +class TScsiClientModeSense10Req: public TScsiClientReq
1.114 + {
1.115 +public:
1.116 + /** SCSI PAGE CONTROL values */
1.117 + enum TPageControl
1.118 + {
1.119 + ECurrentValues = 0x00,
1.120 + EChangeableValues = 0x01,
1.121 + EDefaultValues = 0x02,
1.122 + ESavedValues = 0x03
1.123 + };
1.124 +
1.125 + /** Length of MODE SENSE (10) response */
1.126 + static const TUint KResponseLength = 8;
1.127 +
1.128 + TScsiClientModeSense10Req(TPageControl aPageControl,
1.129 + TUint aPageCode,
1.130 + TUint aSubPageCode = 0);
1.131 +
1.132 + TInt EncodeRequestL(TDes8& aBuffer) const;
1.133 +
1.134 +public:
1.135 + /** SCSI PAGE CONTROL field */
1.136 + TPageControl iPageControl;
1.137 + /** SCSI PAGE CODE field */
1.138 + TUint iPageCode;
1.139 + /** SCSI SUB PAGE CODE field */
1.140 + TUint iSubPageCode;
1.141 + /** SCSI ALLOCATION LENGTH field */
1.142 + TAllocationLength iAllocationLength;
1.143 + };
1.144 +
1.145 +
1.146 +/**
1.147 +Decode SCSI MODE SENSE (10) RESPONSE
1.148 +Ref SPC-3 6.10 Request
1.149 +Ref SPC-3 7.4 Response format
1.150 +Ref SBC-3 6.3 Response format for SBC
1.151 +*/
1.152 +class TScsiClientModeSense10Resp: public TScsiClientResp
1.153 + {
1.154 +public:
1.155 + /** Length of MODE SENSE (10) response */
1.156 + static const TUint KResponseLength = 8;
1.157 +
1.158 + TScsiClientModeSense10Resp() {};
1.159 +
1.160 + TInt DataLength() const {return KResponseLength;}
1.161 + void DecodeL(const TDesC8& aPtr);
1.162 +
1.163 +public:
1.164 + /** Returned SCSI WP flag */
1.165 + TBool iWriteProtected;
1.166 + };
1.167 +
1.168 +/**
1.169 +Encode READ CAPCAITY (10) REQUEST
1.170 +Ref SBC 2 5.10
1.171 +Ref SBC 3 5.10
1.172 +*/
1.173 +class TScsiClientReadCapacity10Req: public TScsiClientReq
1.174 + {
1.175 +public:
1.176 + /** Length of READ CAPACITY (10) response */
1.177 + static const TInt KResponseLength = 8;
1.178 + TScsiClientReadCapacity10Req();
1.179 + TScsiClientReadCapacity10Req(TLba aLba);
1.180 + TInt EncodeRequestL(TDes8& aBuffer) const;
1.181 +
1.182 +public:
1.183 + /** SCSI LOGICAL BLOCK ADDRESS */
1.184 + TLba iLba;
1.185 + };
1.186 +
1.187 +/**
1.188 +Decode READ CAPCAITY (10) RESPONSE
1.189 +*/
1.190 +class TScsiClientReadCapacity10Resp: public TScsiClientResp
1.191 + {
1.192 +public:
1.193 + /** Length of READ CAPACITY (10) response */
1.194 + static const TInt KResponseLength = 8;
1.195 + TScsiClientReadCapacity10Resp() {};
1.196 +
1.197 + void DecodeL(const TDesC8& aPtr);
1.198 + TInt DataLength() const {return KResponseLength;}
1.199 +
1.200 +public:
1.201 + /** Returned SCSI LOGICAL BLOCK ADDRESS */
1.202 + TLba iLba;
1.203 + /** Returned SCSI BLOCK LENGTH IN BYTES */
1.204 + TUint32 iBlockSize;
1.205 + };
1.206 +
1.207 +
1.208 +/**
1.209 +Base class for encoding SCSI READ (10) and SCSI WRITE (10) requests
1.210 +*/
1.211 +class TScsiClientRdWr10Req: public TScsiClientReq
1.212 + {
1.213 +public:
1.214 + TScsiClientRdWr10Req(TOperationCode aOperationCode);
1.215 + TInt EncodeRequestL(TDes8& aBuffer) const;
1.216 +
1.217 +public:
1.218 + /** SCSI LOGICAL BLOCK ADDRESS field */
1.219 + TUint32 iLogicalBlockAddress;
1.220 + /** SCSI TRANSFER LENGTH field */
1.221 + TUint16 iBlockTransferLength;
1.222 + /** SCSI RDPROTECT or SCSI WRPROTECT field */
1.223 + TProtect iProtect;
1.224 + };
1.225 +
1.226 +
1.227 +/**
1.228 +Encode SCSI READ (10) REQUEST
1.229 +*/
1.230 +class TScsiClientRead10Req: public TScsiClientRdWr10Req
1.231 + {
1.232 +public:
1.233 + TScsiClientRead10Req();
1.234 + TInt EncodeRequestL(TDes8& aBuffer) const;
1.235 + };
1.236 +
1.237 +
1.238 +
1.239 +/**
1.240 +Encode START STOP UNIT REQUEST
1.241 +Ref SBC-2 5.17
1.242 +*/
1.243 +class TScsiClientStartStopUnitReq: public TScsiClientReq
1.244 + {
1.245 +public:
1.246 + TScsiClientStartStopUnitReq();
1.247 + TInt EncodeRequestL(TDes8& aBuffer) const;
1.248 +
1.249 +public:
1.250 + /** SCSI IMMED flag */
1.251 + TBool iImmed;
1.252 + /** SCSI START flag */
1.253 + TBool iStart;
1.254 + /** SCSI LOEJ flag */
1.255 + TBool iLoej;
1.256 + };
1.257 +
1.258 +
1.259 +/**
1.260 +Encode SCSI WRITE (10) REQUEST
1.261 +*/
1.262 +class TScsiClientWrite10Req: public TScsiClientRdWr10Req
1.263 + {
1.264 +public:
1.265 + TScsiClientWrite10Req();
1.266 + TInt EncodeRequestL(TDes8& aBuffer) const;
1.267 + };
1.268 +
1.269 +
1.270 +#include "tscsiblockcmds.inl"
1.271 +
1.272 +#endif // TSCSIBLOCKCMDS_H