First public contribution.
1 // Copyright (c) 2004-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Provides utilities to build SCSI commands
23 #ifndef __SCSICMDBUILDER_H__
24 #define __SCSICMDBUILDER_H__
29 const TInt KScsiCmdMaxLen = 10;
30 const TInt KCbwLength = 31;
31 const TInt KCswLength = 13;
32 const TInt KKiloBytes = 1024;
34 GLREF_D TBuf8<KScsiCmdMaxLen> scsiCmdBuf;
37 builds read/write SCSI command
39 GLREF_C void BuildReadWrite(TInt aFlag, TInt aLogicalBlkAddr, TInt aTotalBlks);
42 Builds prevent/allow medium removal SCSI command
44 @param aFlag: indicating if the command is to allow or prevent medium removal
46 GLREF_C void BuildMediumRemoval(TInt aFlag);
49 Builds a test unit ready SCSI command
51 GLREF_C void BuildTestUnitReady();
54 Builds a start/stop unit command
56 @param aFlag: indicating if the command is to start or stop unit
58 GLREF_C void BuildStartStopUnit(TInt aFlag);
61 Copy an int. Little endian
63 @param dest the destination
64 @param source the source
66 GLREF_C void fillInt(TUint8* dest, TInt source);
69 Extracts an integer from a buffer. Assume little endian
71 GLREF_C TInt extractInt(const TUint8* aBuf);
76 @param aCbw: stores CBW
77 @param aDCBWTag: a command block tag sent by the host. Used to associates a CSW
78 with corresponding CBW
79 @param aDataTranferLen: the number of bytes the host expects to transfer
80 @param aInOutFlag: value for bmCBWFlags field, indicating the direction of transfer
81 @param aCBWCB: the actual command to be wrapped
82 @param aTestLun: local unit number
84 GLREF_C void createCBW(TDes8& aCbw, TInt aDCBWTag, TInt aDataTransferLen, TUint8 aInOutFlag, TDes8& aCBWCB, TUint8 aTestLun);
86 #endif // __SCSICMDBUILDER_H__