sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef TSCSIBLOCKCMDS_H sl@0: #define TSCSIBLOCKCMDS_H sl@0: sl@0: sl@0: /** sl@0: Data type for Logical Block Address sl@0: */ sl@0: typedef TUint32 TLba; sl@0: sl@0: /** sl@0: Data type for PROTECT filed used in READ (10) and WRITE (10) sl@0: SBC-3 5.6 Table 33 and 5.25 Table 68 sl@0: */ sl@0: typedef TUint TProtect; // 3 bits sl@0: sl@0: class TScsiClientReq; sl@0: sl@0: sl@0: /** sl@0: Encode SCSI MODE SENSE(6) REQUEST sl@0: Ref SPC-2 7.8 Request sl@0: Ref SPC-3 6.9 Request sl@0: Ref SPC-3 7.4 Response format sl@0: Ref SBC-3 6.3 Response format for SBC sl@0: */ sl@0: class TScsiClientModeSense6Req: public TScsiClientReq sl@0: { sl@0: public: sl@0: /** SCSI PAGE CONTROL values */ sl@0: enum TPageControl sl@0: { sl@0: ECurrentValues = 0x00, sl@0: EChangeableValues = 0x01, sl@0: EDefaultValues = 0x02, sl@0: ESavedValues = 0x03 sl@0: }; sl@0: sl@0: /** Length of MODE SENSE (6) response */ sl@0: static const TUint KResponseLength = 4; sl@0: sl@0: TScsiClientModeSense6Req(TPageControl aPageControl, sl@0: TUint aPageCode, sl@0: TUint aSubPageCode = 0); sl@0: sl@0: TInt EncodeRequestL(TDes8& aBuffer) const; sl@0: sl@0: public: sl@0: /** SCSI PAGE CONTROL field */ sl@0: TPageControl iPageControl; sl@0: /** SCSI PAGE CODE field */ sl@0: TUint iPageCode; sl@0: /** SCSI SUB PAGE CODE field */ sl@0: TUint iSubPageCode; sl@0: /** SCSI ALLOCATION LENGTH field */ sl@0: TAllocationLength iAllocationLength; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Encode SCSI MODE SENSE(6) RESPONSE sl@0: Ref SPC-3 6.9 Request sl@0: Ref SPC-3 7.4 Response format sl@0: Ref SBC-3 6.3 Response format for SBC sl@0: */ sl@0: class TScsiClientModeSense6Resp: public TScsiClientResp sl@0: { sl@0: public: sl@0: /** Length of MODE SENSE (6) response */ sl@0: static const TUint KResponseLength = 4; sl@0: sl@0: TScsiClientModeSense6Resp() {}; sl@0: sl@0: TInt DataLength() const {return KResponseLength;} sl@0: void DecodeL(const TDesC8& aPtr); sl@0: sl@0: public: sl@0: /** Returned SCSI WP flag */ sl@0: TBool iWriteProtected; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Encode MODE SENSE (10) REQUEST sl@0: Ref SPC-2 7.9 Request sl@0: Ref SPC-3 6.10 Request sl@0: Ref SPC-2 8.2 Response format sl@0: Ref SPC-3 7.4 Response format sl@0: Ref SBC-3 6.3 Response format for SBC sl@0: */ sl@0: class TScsiClientModeSense10Req: public TScsiClientReq sl@0: { sl@0: public: sl@0: /** SCSI PAGE CONTROL values */ sl@0: enum TPageControl sl@0: { sl@0: ECurrentValues = 0x00, sl@0: EChangeableValues = 0x01, sl@0: EDefaultValues = 0x02, sl@0: ESavedValues = 0x03 sl@0: }; sl@0: sl@0: /** Length of MODE SENSE (10) response */ sl@0: static const TUint KResponseLength = 8; sl@0: sl@0: TScsiClientModeSense10Req(TPageControl aPageControl, sl@0: TUint aPageCode, sl@0: TUint aSubPageCode = 0); sl@0: sl@0: TInt EncodeRequestL(TDes8& aBuffer) const; sl@0: sl@0: public: sl@0: /** SCSI PAGE CONTROL field */ sl@0: TPageControl iPageControl; sl@0: /** SCSI PAGE CODE field */ sl@0: TUint iPageCode; sl@0: /** SCSI SUB PAGE CODE field */ sl@0: TUint iSubPageCode; sl@0: /** SCSI ALLOCATION LENGTH field */ sl@0: TAllocationLength iAllocationLength; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Decode SCSI MODE SENSE (10) RESPONSE sl@0: Ref SPC-3 6.10 Request sl@0: Ref SPC-3 7.4 Response format sl@0: Ref SBC-3 6.3 Response format for SBC sl@0: */ sl@0: class TScsiClientModeSense10Resp: public TScsiClientResp sl@0: { sl@0: public: sl@0: /** Length of MODE SENSE (10) response */ sl@0: static const TUint KResponseLength = 8; sl@0: sl@0: TScsiClientModeSense10Resp() {}; sl@0: sl@0: TInt DataLength() const {return KResponseLength;} sl@0: void DecodeL(const TDesC8& aPtr); sl@0: sl@0: public: sl@0: /** Returned SCSI WP flag */ sl@0: TBool iWriteProtected; sl@0: }; sl@0: sl@0: /** sl@0: Encode READ CAPCAITY (10) REQUEST sl@0: Ref SBC 2 5.10 sl@0: Ref SBC 3 5.10 sl@0: */ sl@0: class TScsiClientReadCapacity10Req: public TScsiClientReq sl@0: { sl@0: public: sl@0: /** Length of READ CAPACITY (10) response */ sl@0: static const TInt KResponseLength = 8; sl@0: TScsiClientReadCapacity10Req(); sl@0: TScsiClientReadCapacity10Req(TLba aLba); sl@0: TInt EncodeRequestL(TDes8& aBuffer) const; sl@0: sl@0: public: sl@0: /** SCSI LOGICAL BLOCK ADDRESS */ sl@0: TLba iLba; sl@0: }; sl@0: sl@0: /** sl@0: Decode READ CAPCAITY (10) RESPONSE sl@0: */ sl@0: class TScsiClientReadCapacity10Resp: public TScsiClientResp sl@0: { sl@0: public: sl@0: /** Length of READ CAPACITY (10) response */ sl@0: static const TInt KResponseLength = 8; sl@0: TScsiClientReadCapacity10Resp() {}; sl@0: sl@0: void DecodeL(const TDesC8& aPtr); sl@0: TInt DataLength() const {return KResponseLength;} sl@0: sl@0: public: sl@0: /** Returned SCSI LOGICAL BLOCK ADDRESS */ sl@0: TLba iLba; sl@0: /** Returned SCSI BLOCK LENGTH IN BYTES */ sl@0: TUint32 iBlockSize; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Base class for encoding SCSI READ (10) and SCSI WRITE (10) requests sl@0: */ sl@0: class TScsiClientRdWr10Req: public TScsiClientReq sl@0: { sl@0: public: sl@0: TScsiClientRdWr10Req(TOperationCode aOperationCode); sl@0: TInt EncodeRequestL(TDes8& aBuffer) const; sl@0: sl@0: public: sl@0: /** SCSI LOGICAL BLOCK ADDRESS field */ sl@0: TUint32 iLogicalBlockAddress; sl@0: /** SCSI TRANSFER LENGTH field */ sl@0: TUint16 iBlockTransferLength; sl@0: /** SCSI RDPROTECT or SCSI WRPROTECT field */ sl@0: TProtect iProtect; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Encode SCSI READ (10) REQUEST sl@0: */ sl@0: class TScsiClientRead10Req: public TScsiClientRdWr10Req sl@0: { sl@0: public: sl@0: TScsiClientRead10Req(); sl@0: TInt EncodeRequestL(TDes8& aBuffer) const; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: Encode START STOP UNIT REQUEST sl@0: Ref SBC-2 5.17 sl@0: */ sl@0: class TScsiClientStartStopUnitReq: public TScsiClientReq sl@0: { sl@0: public: sl@0: TScsiClientStartStopUnitReq(); sl@0: TInt EncodeRequestL(TDes8& aBuffer) const; sl@0: sl@0: public: sl@0: /** SCSI IMMED flag */ sl@0: TBool iImmed; sl@0: /** SCSI START flag */ sl@0: TBool iStart; sl@0: /** SCSI LOEJ flag */ sl@0: TBool iLoej; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Encode SCSI WRITE (10) REQUEST sl@0: */ sl@0: class TScsiClientWrite10Req: public TScsiClientRdWr10Req sl@0: { sl@0: public: sl@0: TScsiClientWrite10Req(); sl@0: TInt EncodeRequestL(TDes8& aBuffer) const; sl@0: }; sl@0: sl@0: sl@0: #include "tscsiblockcmds.inl" sl@0: sl@0: #endif // TSCSIBLOCKCMDS_H