os/kernelhwsrv/userlibandfileserver/fileserver/smassstorage/inc/cbulkonlytransportusbcldd.h
Update contrib.
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Class declaration for CBulkOnlyTransportUsbcLdd.
25 #ifndef __CBULKONLYTRANSPORTUSBCLDD_H__
26 #define __CBULKONLYTRANSPORTUSBCLDD_H__
28 #include "cbulkonlytransport.h"
29 #include "cactivedevicestatenotifierbase.h"
31 // Maximum size for SCSI Read10 Write10 and Verify10 commands
32 // Windows requests size of 64K whereas MAC requests size of 128K
33 static const TUint32 KMaxBufSize = 128 * 1024;
36 class CBulkOnlyTransportUsbcLdd;
39 Represent session with control endpoint (Ep0).
40 handles the control interface, and responds to the class specific commands (RESET and GET_MAX_LUN).
42 class CControlInterfaceUsbcLdd : public CActive
53 static CControlInterfaceUsbcLdd* NewL(CBulkOnlyTransportUsbcLdd& aParent);
54 ~CControlInterfaceUsbcLdd();
58 virtual void DoCancel();
61 CControlInterfaceUsbcLdd(CBulkOnlyTransportUsbcLdd& aParent);
68 /** Buffer for request data*/
69 TBuf8<KRequestHdrSize> iData;
71 TUsbRequestHdr iRequestHeader;
73 /** reference to the CBulkOnlyTransport*/
74 CBulkOnlyTransportUsbcLdd& iParent;
76 /** represent carrent state for state mashine */
77 TControlState iCurrentState;
81 /** Transport Class that accessess the Non-SC LDD */
82 class CBulkOnlyTransportUsbcLdd : public CBulkOnlyTransport, public MLddDeviceStateNotification
85 CBulkOnlyTransportUsbcLdd(TInt aNumDrives,CUsbMassStorageController& aController);
87 ~CBulkOnlyTransportUsbcLdd();
90 RDevUsbcClient& Ldd();
91 TInt BytesAvailable(); // from Mtransport base class
93 TInt SetupConfigurationDescriptor(TBool aUnset = EFalse);
94 TInt SetupInterfaceDescriptors();
95 void ReleaseInterface();
96 void CancelControlInterface();
97 TInt StartControlInterface();
98 void ActivateDeviceStateNotifier();
99 void CancelDeviceStateNotifier();
100 void CancelReadWriteRequests();
101 void AllocateEndpointResources();
102 TInt GetDeviceStatus(TUsbcDeviceState& deviceStatus);
104 void ReadAndDiscardData(TInt aBytes);
106 void ExpireData(TAny* aAddress = NULL);
107 void ProcessCbwEvent();
108 void StallEndpointAndWaitForClear();
109 void ReadData(TUint aLength = 0);
110 void WriteUsb(TRequestStatus& aStatus, TPtrC8& aDes, TUint aLength, TBool aZlpRequired = EFalse);
112 TPtr8& SetCommandBufPtr(TUint aLength);
113 TPtr8& SetDataBufPtr();
114 void SetPaddingBufPtr(TUint aLength);
115 void SetCswBufPtr(TUint aLength);
116 void ProcessReadingDataEvent();
117 void DiscardData(TUint aLength);
118 void WriteToClient(TUint aLength);
119 void SetReadDataBufPtr(TUint aLength);
121 #ifdef MSDC_MULTITHREADED
122 virtual void GetBufferPointers(TPtr8& aDes1, TPtr8& aDes2);
125 void Activate(TRequestStatus& aStatus, TUint& aValue);
129 TInt ReadUsb(TUint aLength = 0);
133 CControlInterfaceUsbcLdd* iControlInterface;
134 CActiveDeviceStateNotifierBase* iDeviceStateNotifier;
136 /** buffer for Command Block Wrapper */
137 TBuf8 <KCbwLength> iCbwBuf;
139 TBuf8<KCommandBufferLength> iCommandBuf; // For Responses to commands
141 TBuf8<KMaxBufSize> iDataBuf1; // For data transfers (Reading and Writing)
143 TBuf8<KMaxBufSize> iDataBuf2;
146 /** internal buffer for CSW */
147 TBuf8<KCswLength> iCswBuf;
149 /** internal buffer for padding */
150 TBuf8<KBOTMaxBufSize> iBuf;
152 /** internal buffer for garbage */
153 TBuf8<512> iDiscardBuf;