|
1 /* |
|
2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Class declaration for CBulkOnlyTransportUsbcLdd. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalTechnology |
|
23 */ |
|
24 |
|
25 #ifndef TBULKMM_H |
|
26 #define TBULKMM_H |
|
27 |
|
28 // Maximum size for SCSI Read10 Write10 and Verify10 commands |
|
29 // Windows requests size of 64K whereas MAC requests size of 128K |
|
30 static const TUint32 KMaxBufSize = 128 * 1024; |
|
31 |
|
32 #ifdef MSDC_MULTITHREADED |
|
33 class TBulkMm |
|
34 { |
|
35 public: |
|
36 TBulkMm(); |
|
37 void GetNextTransferBuffer(TUint aLength, TPtr8& aPtr); |
|
38 void GetNextTransferBuffer(TPtr8& aPtr); |
|
39 |
|
40 TUint MaxTransferSize() const {return KMaxBufSize;} |
|
41 |
|
42 TUint8* Buf1(); |
|
43 TUint8* Buf2(); |
|
44 |
|
45 private: |
|
46 TBuf8<KMaxBufSize> iDataBuf1; // For data transfers (Reading and Writing) |
|
47 TBuf8<KMaxBufSize> iDataBuf2; |
|
48 |
|
49 TBool iSwap; |
|
50 }; |
|
51 |
|
52 #else |
|
53 |
|
54 class TBulkMm |
|
55 { |
|
56 public: |
|
57 TBulkMm() {}; |
|
58 |
|
59 void GetNextTransferBuffer(TUint aLength, TPtr8& aPtr); |
|
60 void GetNextTransferBuffer(TPtr8& aPtr); |
|
61 |
|
62 TUint MaxTransferSize() const {return KMaxBufSize;} |
|
63 |
|
64 private: |
|
65 TBuf8<KMaxBufSize> iDataBuf; |
|
66 }; |
|
67 |
|
68 #endif |
|
69 |
|
70 #ifdef MSDC_MULTITHREADED |
|
71 inline TUint8* TBulkMm::Buf1() |
|
72 { |
|
73 return const_cast<TUint8*>(iDataBuf1.Ptr()); |
|
74 } |
|
75 |
|
76 |
|
77 inline TUint8* TBulkMm::Buf2() |
|
78 { |
|
79 return const_cast<TUint8*>(iDataBuf2.Ptr()); |
|
80 } |
|
81 |
|
82 |
|
83 inline void TBulkMm::GetNextTransferBuffer(TPtr8& aPtr) |
|
84 { |
|
85 GetNextTransferBuffer(KMaxBufSize, aPtr); |
|
86 } |
|
87 |
|
88 #else |
|
89 inline void TBulkMm::GetNextTransferBuffer(TUint aLength, TPtr8& aPtr) |
|
90 { |
|
91 iDataBuf.SetLength(aLength); |
|
92 aPtr.Set(iDataBuf.LeftTPtr(iDataBuf.Length())); |
|
93 } |
|
94 |
|
95 |
|
96 inline void TBulkMm::GetNextTransferBuffer(TPtr8& aPtr) |
|
97 { |
|
98 GetNextTransferBuffer(KMaxBufSize, aPtr); |
|
99 } |
|
100 #endif |
|
101 |
|
102 #endif |
|
103 |