os/kernelhwsrv/kerneltest/f32test/smassstorage/inc/scsicmdbuilder.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/smassstorage/inc/scsicmdbuilder.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,87 @@
     1.4 +// Copyright (c) 2004-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 +// Provides utilities to build SCSI commands
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @internalTechnology
    1.24 +*/
    1.25 +
    1.26 +#ifndef __SCSICMDBUILDER_H__
    1.27 +#define __SCSICMDBUILDER_H__
    1.28 +
    1.29 +#include <e32std.h>
    1.30 +#include <f32file.h>
    1.31 +
    1.32 +const TInt KScsiCmdMaxLen 	= 10;
    1.33 +const TInt KCbwLength       = 31;
    1.34 +const TInt KCswLength       = 13;
    1.35 +const TInt KKiloBytes		= 1024;
    1.36 +
    1.37 +GLREF_D TBuf8<KScsiCmdMaxLen> scsiCmdBuf;
    1.38 +
    1.39 +/**
    1.40 + builds read/write SCSI command
    1.41 + */
    1.42 +GLREF_C void BuildReadWrite(TInt aFlag, TInt aLogicalBlkAddr, TInt aTotalBlks);
    1.43 +
    1.44 +/**
    1.45 + Builds prevent/allow medium removal SCSI command
    1.46 + 
    1.47 + @param aFlag: indicating if the command is to allow or prevent medium removal
    1.48 + */ 
    1.49 +GLREF_C void BuildMediumRemoval(TInt aFlag);
    1.50 +
    1.51 +/**
    1.52 + Builds a test unit ready SCSI command
    1.53 + */
    1.54 +GLREF_C void BuildTestUnitReady();
    1.55 +
    1.56 +/**
    1.57 + Builds a start/stop unit command
    1.58 + 
    1.59 + @param aFlag: indicating if the command is to start or stop unit
    1.60 + */ 
    1.61 +GLREF_C void BuildStartStopUnit(TInt aFlag);
    1.62 +
    1.63 +/**
    1.64 + Copy an int. Little endian
    1.65 + 
    1.66 + @param dest the destination
    1.67 + @param source the source
    1.68 + */
    1.69 +GLREF_C void fillInt(TUint8* dest, TInt source);
    1.70 +
    1.71 +/**
    1.72 + Extracts an integer from a buffer. Assume little endian 
    1.73 + */
    1.74 +GLREF_C TInt extractInt(const TUint8* aBuf);
    1.75 +
    1.76 +/**
    1.77 + Builds a CBW message
    1.78 + 
    1.79 + @param aCbw:            stores CBW
    1.80 + @param aDCBWTag:        a command block tag sent by the host. Used to associates a CSW
    1.81 +         				 with corresponding CBW
    1.82 + @param aDataTranferLen: the number of bytes the host expects to transfer
    1.83 + @param aInOutFlag:      value for bmCBWFlags field, indicating the direction of transfer
    1.84 + @param aCBWCB:			 the actual command to be wrapped
    1.85 + @param aTestLun:	 	 local unit number
    1.86 + */
    1.87 +GLREF_C void createCBW(TDes8& aCbw, TInt aDCBWTag, TInt aDataTransferLen, TUint8 aInOutFlag, TDes8& aCBWCB, TUint8 aTestLun);
    1.88 +
    1.89 +#endif // __SCSICMDBUILDER_H__
    1.90 +