sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Provides utilities to build SCSI commands
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file
|
sl@0
|
20 |
@internalTechnology
|
sl@0
|
21 |
*/
|
sl@0
|
22 |
|
sl@0
|
23 |
#ifndef __SCSICMDBUILDER_H__
|
sl@0
|
24 |
#define __SCSICMDBUILDER_H__
|
sl@0
|
25 |
|
sl@0
|
26 |
#include <e32std.h>
|
sl@0
|
27 |
#include <f32file.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
const TInt KScsiCmdMaxLen = 10;
|
sl@0
|
30 |
const TInt KCbwLength = 31;
|
sl@0
|
31 |
const TInt KCswLength = 13;
|
sl@0
|
32 |
const TInt KKiloBytes = 1024;
|
sl@0
|
33 |
|
sl@0
|
34 |
GLREF_D TBuf8<KScsiCmdMaxLen> scsiCmdBuf;
|
sl@0
|
35 |
|
sl@0
|
36 |
/**
|
sl@0
|
37 |
builds read/write SCSI command
|
sl@0
|
38 |
*/
|
sl@0
|
39 |
GLREF_C void BuildReadWrite(TInt aFlag, TInt aLogicalBlkAddr, TInt aTotalBlks);
|
sl@0
|
40 |
|
sl@0
|
41 |
/**
|
sl@0
|
42 |
Builds prevent/allow medium removal SCSI command
|
sl@0
|
43 |
|
sl@0
|
44 |
@param aFlag: indicating if the command is to allow or prevent medium removal
|
sl@0
|
45 |
*/
|
sl@0
|
46 |
GLREF_C void BuildMediumRemoval(TInt aFlag);
|
sl@0
|
47 |
|
sl@0
|
48 |
/**
|
sl@0
|
49 |
Builds a test unit ready SCSI command
|
sl@0
|
50 |
*/
|
sl@0
|
51 |
GLREF_C void BuildTestUnitReady();
|
sl@0
|
52 |
|
sl@0
|
53 |
/**
|
sl@0
|
54 |
Builds a start/stop unit command
|
sl@0
|
55 |
|
sl@0
|
56 |
@param aFlag: indicating if the command is to start or stop unit
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
GLREF_C void BuildStartStopUnit(TInt aFlag);
|
sl@0
|
59 |
|
sl@0
|
60 |
/**
|
sl@0
|
61 |
Copy an int. Little endian
|
sl@0
|
62 |
|
sl@0
|
63 |
@param dest the destination
|
sl@0
|
64 |
@param source the source
|
sl@0
|
65 |
*/
|
sl@0
|
66 |
GLREF_C void fillInt(TUint8* dest, TInt source);
|
sl@0
|
67 |
|
sl@0
|
68 |
/**
|
sl@0
|
69 |
Extracts an integer from a buffer. Assume little endian
|
sl@0
|
70 |
*/
|
sl@0
|
71 |
GLREF_C TInt extractInt(const TUint8* aBuf);
|
sl@0
|
72 |
|
sl@0
|
73 |
/**
|
sl@0
|
74 |
Builds a CBW message
|
sl@0
|
75 |
|
sl@0
|
76 |
@param aCbw: stores CBW
|
sl@0
|
77 |
@param aDCBWTag: a command block tag sent by the host. Used to associates a CSW
|
sl@0
|
78 |
with corresponding CBW
|
sl@0
|
79 |
@param aDataTranferLen: the number of bytes the host expects to transfer
|
sl@0
|
80 |
@param aInOutFlag: value for bmCBWFlags field, indicating the direction of transfer
|
sl@0
|
81 |
@param aCBWCB: the actual command to be wrapped
|
sl@0
|
82 |
@param aTestLun: local unit number
|
sl@0
|
83 |
*/
|
sl@0
|
84 |
GLREF_C void createCBW(TDes8& aCbw, TInt aDCBWTag, TInt aDataTransferLen, TUint8 aInOutFlag, TDes8& aCBWCB, TUint8 aTestLun);
|
sl@0
|
85 |
|
sl@0
|
86 |
#endif // __SCSICMDBUILDER_H__
|
sl@0
|
87 |
|