sl@0: // Copyright (c) 2004-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: // Provides utilities to build SCSI commands sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef __SCSICMDBUILDER_H__ sl@0: #define __SCSICMDBUILDER_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: const TInt KScsiCmdMaxLen = 10; sl@0: const TInt KCbwLength = 31; sl@0: const TInt KCswLength = 13; sl@0: const TInt KKiloBytes = 1024; sl@0: sl@0: GLREF_D TBuf8 scsiCmdBuf; sl@0: sl@0: /** sl@0: builds read/write SCSI command sl@0: */ sl@0: GLREF_C void BuildReadWrite(TInt aFlag, TInt aLogicalBlkAddr, TInt aTotalBlks); sl@0: sl@0: /** sl@0: Builds prevent/allow medium removal SCSI command sl@0: sl@0: @param aFlag: indicating if the command is to allow or prevent medium removal sl@0: */ sl@0: GLREF_C void BuildMediumRemoval(TInt aFlag); sl@0: sl@0: /** sl@0: Builds a test unit ready SCSI command sl@0: */ sl@0: GLREF_C void BuildTestUnitReady(); sl@0: sl@0: /** sl@0: Builds a start/stop unit command sl@0: sl@0: @param aFlag: indicating if the command is to start or stop unit sl@0: */ sl@0: GLREF_C void BuildStartStopUnit(TInt aFlag); sl@0: sl@0: /** sl@0: Copy an int. Little endian sl@0: sl@0: @param dest the destination sl@0: @param source the source sl@0: */ sl@0: GLREF_C void fillInt(TUint8* dest, TInt source); sl@0: sl@0: /** sl@0: Extracts an integer from a buffer. Assume little endian sl@0: */ sl@0: GLREF_C TInt extractInt(const TUint8* aBuf); sl@0: sl@0: /** sl@0: Builds a CBW message sl@0: sl@0: @param aCbw: stores CBW sl@0: @param aDCBWTag: a command block tag sent by the host. Used to associates a CSW sl@0: with corresponding CBW sl@0: @param aDataTranferLen: the number of bytes the host expects to transfer sl@0: @param aInOutFlag: value for bmCBWFlags field, indicating the direction of transfer sl@0: @param aCBWCB: the actual command to be wrapped sl@0: @param aTestLun: local unit number sl@0: */ sl@0: GLREF_C void createCBW(TDes8& aCbw, TInt aDCBWTag, TInt aDataTransferLen, TUint8 aInOutFlag, TDes8& aCBWCB, TUint8 aTestLun); sl@0: sl@0: #endif // __SCSICMDBUILDER_H__ sl@0: