0
|
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 CBULKONLYTRANSPORT_H
|
|
22 |
#define CBULKONLYTRANSPORT_H
|
|
23 |
|
|
24 |
class CUsbInterfaceHandler;
|
|
25 |
|
|
26 |
/**
|
|
27 |
The Bulk Only Transport implementation
|
|
28 |
*/
|
|
29 |
class CBulkOnlyTransport : public CBase, public MTransport
|
|
30 |
{
|
|
31 |
public:
|
|
32 |
static CBulkOnlyTransport* NewL(TUint aInterfaceId);
|
|
33 |
private:
|
|
34 |
CBulkOnlyTransport();
|
|
35 |
~CBulkOnlyTransport();
|
|
36 |
void ConstructL(TUint aInterfaceId);
|
|
37 |
|
|
38 |
public:
|
|
39 |
void SetLun(TLun aLun);
|
|
40 |
|
|
41 |
TInt SendDataTxCmdL(const MClientCommandServiceReq* aCommand,
|
|
42 |
TDesC8& aData,
|
|
43 |
TUint aPos,
|
|
44 |
TInt& aLen);
|
|
45 |
|
|
46 |
TInt SendControlCmdL(const MClientCommandServiceReq* aCommand);
|
|
47 |
|
|
48 |
TInt SendControlCmdL(const MClientCommandServiceReq* aReq,
|
|
49 |
MClientCommandServiceResp* aResp);
|
|
50 |
|
|
51 |
TInt SendDataRxCmdL(const MClientCommandServiceReq* aCommand,
|
|
52 |
TDes8& aData,
|
|
53 |
TInt& aLen);
|
|
54 |
|
|
55 |
void Suspend(TRequestStatus &aStatus);
|
|
56 |
void Resume();
|
|
57 |
|
|
58 |
private:
|
|
59 |
TInt Reset();
|
|
60 |
void UnInitialiseTransport();
|
|
61 |
TInt InitialiseTransport();
|
|
62 |
TInt GetEndpointAddress(RUsbInterface& aUsbInterface,
|
|
63 |
TInt aInterfaceSetting,
|
|
64 |
TUint8 aTransferType,
|
|
65 |
TUint8 aDirection,
|
|
66 |
TInt& aEndpointAddress);
|
|
67 |
|
|
68 |
void DoResetRecovery();
|
|
69 |
void GetMaxLun(TLun* aReceiveData, const RMessage2& aMessage);
|
|
70 |
void SendCbwL(const MClientCommandServiceReq* aReq,
|
|
71 |
TBotCbw::TCbwDirection aDirection,
|
|
72 |
TUint32 aTransferLength);
|
|
73 |
|
|
74 |
void ReceiveCswL();
|
|
75 |
TInt ProcessZeroTransferL();
|
|
76 |
TInt ProcessInTransferL(TUint32& aDataReceived);
|
|
77 |
TInt ProcessOutTransferL(TUint32& aDataReceived);
|
|
78 |
|
|
79 |
private:
|
|
80 |
static const TInt KCbwPacketSize = 31;
|
|
81 |
static const TInt KResponsePacketSize = 1024 * 128;
|
|
82 |
// Though the csw valid size is 13, we do try to read 64 in order to validate
|
|
83 |
// the device's operation
|
|
84 |
static const TInt KCswPacketSize = 64;
|
|
85 |
|
|
86 |
private:
|
|
87 |
TLun iLun;
|
|
88 |
|
|
89 |
RUsbBulkTransferDescriptor iBulkOutCbwTd;
|
|
90 |
RUsbBulkTransferDescriptor iBulkDataTd;
|
|
91 |
RUsbBulkTransferDescriptor iBulkInCswTd;
|
|
92 |
RUsbPipe iBulkPipeOut;
|
|
93 |
RUsbPipe iBulkPipeIn;
|
|
94 |
|
|
95 |
RUsbInterface iInterface;
|
|
96 |
TRequestStatus iStatus;
|
|
97 |
TBotCbw iCbw;
|
|
98 |
TUint32 iCbwTag;
|
|
99 |
TBotCsw iCsw;
|
|
100 |
CUsbInterfaceHandler* iUsbInterfaceHandler;
|
|
101 |
};
|
|
102 |
|
|
103 |
|
|
104 |
#ifdef MASSSTORAGE_PUBLISHER
|
|
105 |
class TMsPublisher
|
|
106 |
{
|
|
107 |
public:
|
|
108 |
static const TInt KMyUid = 0x10285B2E;
|
|
109 |
|
|
110 |
enum TPropertyKeys
|
|
111 |
{
|
|
112 |
KBotResetProperty = 1,
|
|
113 |
KStallProperty = 2
|
|
114 |
};
|
|
115 |
|
|
116 |
|
|
117 |
TMsPublisher(TPropertyKeys aKey);
|
|
118 |
};
|
|
119 |
|
|
120 |
#endif
|
|
121 |
|
|
122 |
#endif // CBULKONLYTRANSPORT_H
|
|
123 |
|