os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tsbcclientinterface.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 TSBCCLIENTINTERFACE_H
    22 #define TSBCCLIENTINTERFACE_H
    23 
    24 /**
    25 Utility class to support SCSI BLOCK COMMAND (SBC) primitives.
    26 */
    27 class TSbcClientInterface
    28     {
    29 public:
    30     /** SCSI MODE PAGE CODE values */
    31     enum ModePageCode
    32         {
    33         EReturnAllModePages = 0x3F
    34         };
    35 
    36 	TSbcClientInterface(MTransport& aTransport);
    37 	~TSbcClientInterface();
    38 
    39     void InitBuffers(RBuf8* aHeadbuf, RBuf8* aTailbuf);
    40 
    41     TInt ModeSense6L(TUint aPageCode, TBool& aWriteProtected);
    42     TInt ModeSense10L(TUint aPageCode, TBool& aWriteProtected);
    43 	TInt Read10L(TLba aLba, TDes8& aBuffer, TInt& aLen);
    44     TInt ReadCapacity10L(TLba& aLba, TUint32& aBlockSize);
    45 	TInt StartStopUnitL(TBool aStart);
    46 	TInt Write10L(TLba aLba, TDesC8& aBuffer, TUint aPos, TInt& aLen);
    47 
    48 	void SetCapacityL(TUint32 aBlockLength, TUint32 aLastLba);
    49 
    50 public:
    51     /** Helper class for block boundary read/write */
    52     TBlockTransfer iBlockTransfer;
    53 
    54 private:
    55     /** Reference to the transport interface */
    56     MTransport& iTransport;
    57     };
    58 
    59 
    60 inline void TSbcClientInterface::InitBuffers(RBuf8* aHeadbuf, RBuf8* aTailbuf)
    61     {
    62     iBlockTransfer.InitBuffers(aHeadbuf, aTailbuf);
    63     }
    64 
    65 
    66 /**
    67 Initialise block transfer values
    68 
    69 @param aBlockLength Block Length of the media
    70 @param aLastLba Last Logical Block Address of the media
    71 */
    72 inline void TSbcClientInterface::SetCapacityL(TUint32 aBlockLength, TUint32 aLastLba)
    73     {
    74     iBlockTransfer.SetCapacityL(aBlockLength, aLastLba);
    75     }
    76 
    77 #endif // TSBCCLIENTINTERFACE_H