Update contrib.
1 // Copyright (c) 1997-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 // e32test/usb/t_usb_device/include/general.h
21 #define __E32TEST_EXTENSION__
34 #include <d32usbcsc.h>
35 #define RDEVCLIENT RDevUsbcScClient
36 #define TENDPOINTNUMBER TInt
39 #define RDEVCLIENT RDevUsbcClient
40 #define TENDPOINTNUMBER TEndpointNumber
43 static const TInt KHostLogFileSize = 64 * 1024; // 64kB
45 static const TInt KMaxInterfaces = 10;
46 static const TInt KMaxConcurrentTests = 10;
47 static const TInt KMaxInterfaceSettings = 10;
49 static const TInt KWaitSettingSize = 8;
51 static const TUint16 KFirstSettingThreadMask = 0x8000;
52 static const TUint16 KLastSettingThreadMask = 0x4000;
54 static const TUint16 KHostErrorIndex = 0xFFF;
56 static const TUint8 stridx1 = 0xCC;
57 static const TUint8 stridx2 = 0xDD;
58 static const TUint8 stridx3 = 0xEE;
59 static const TUint8 stridx4 = 0xFF;
62 _LIT(KActivePanic, "T_USB_SCDEVICE");
64 _LIT(KActivePanic, "T_USB_DEVICE");
67 // Descriptor Offset Constants
69 static const TInt KUsbDesc_SizeOffset = 0;
70 static const TInt KUsbDesc_TypeOffset = 1;
71 static const TInt KDevDesc_SpecOffset = 2;
72 static const TInt KDevDesc_DevClassOffset = 4;
73 static const TInt KDevDesc_DevSubClassOffset = 5;
74 static const TInt KDevDesc_DevProtocolOffset = 6;
75 static const TInt KDevDesc_Ep0SizeOffset = 7;
76 static const TInt KDevDesc_VendorIdOffset = 8;
77 static const TInt KDevDesc_ProductIdOffset = 10;
78 static const TInt KDevDesc_DevReleaseOffset = 12;
80 static const TInt KConfDesc_AttribOffset = 7;
81 static const TInt KConfDesc_MaxPowerOffset = 8;
83 static const TInt KIfcDesc_LengthOffset = 0;
84 static const TInt KIfcDesc_TypeOffset = 1;
85 static const TInt KIfcDesc_NumberOffset = 2;
86 static const TInt KIfcDesc_SettingOffset = 3;
87 static const TInt KIfcDesc_NumEndpointsOffset = 4;
88 static const TInt KIfcDesc_ClassOffset = 5;
89 static const TInt KIfcDesc_SubClassOffset = 6;
90 static const TInt KIfcDesc_ProtocolOffset = 7;
91 static const TInt KIfcDesc_InterfaceOffset = 8;
93 static const TInt KEpDesc_LengthOffset = 0;
94 static const TInt KEpDesc_TypeOffset = 1;
95 static const TInt KEpDesc_AddressOffset = 2;
96 static const TInt KEpDesc_AttributesOffset = 3;
97 static const TInt KEpDesc_PacketSizeOffset = 4;
98 static const TInt KEpDesc_IntervalOffset = 6;
99 static const TInt KEpDesc_SynchAddressOffset = 8;
124 TUint32 packetNumber;
125 TUint8 interfaceNumber;
126 TUint8 alternateSetting;
130 TUint16 settingRepeat;
135 typedef struct TestParam TestParamType;
136 typedef TestParamType* TestParamPtr;
141 #define HiByte(a) (TUint8)((a)>>8)
142 #define LoByte(a) (TUint8)((a)&0xFF)
144 #define TUSB_PRINT(string) \
146 iConsole->Printf(_L(string)); \
147 iConsole->Printf(_L("\n")); \
148 RDebug::Print(_L(string)); \
151 #define TUSB_PRINT1(string, a) \
153 iConsole->Printf(_L(string), (a)); \
154 iConsole->Printf(_L("\n")); \
155 RDebug::Print(_L(string), (a)); \
158 #define TUSB_PRINT2(string, a, b) \
160 iConsole->Printf(_L(string), (a), (b)); \
161 iConsole->Printf(_L("\n")); \
162 RDebug::Print(_L(string), (a), (b)); \
165 #define TUSB_PRINT3(string, a, b, c) \
167 iConsole->Printf(_L(string), (a), (b), (c)); \
168 iConsole->Printf(_L("\n")); \
169 RDebug::Print(_L(string), (a), (b), (c)); \
172 #define TUSB_PRINT4(string, a, b, c, d) \
174 iConsole->Printf(_L(string), (a), (b), (c), (d)); \
175 iConsole->Printf(_L("\n")); \
176 RDebug::Print(_L(string), (a), (b), (c), (d)); \
179 #define TUSB_PRINT5(string, a, b, c, d, e) \
181 iConsole->Printf(_L(string), (a), (b), (c), (d), (e)); \
182 iConsole->Printf(_L("\n")); \
183 RDebug::Print(_L(string), (a), (b), (c), (d), (e)); \
186 #define TUSB_PRINT6(string, a, b, c, d, e, f) \
188 iConsole->Printf(_L(string), (a), (b), (c), (d), (e), (f)); \
189 iConsole->Printf(_L("\n")); \
190 RDebug::Print(_L(string), (a), (b), (c), (d), (e), (f)); \
193 #define TUSB_VERBOSE_PRINT(string) \
197 TUSB_PRINT(string); \
201 #define TUSB_VERBOSE_PRINT1(string, a) \
205 TUSB_PRINT1(string, a); \
209 #define TUSB_VERBOSE_PRINT2(string, a, b) \
213 TUSB_PRINT2(string, a, b); \
217 #define TUSB_VERBOSE_PRINT3(string, a, b, c) \
221 TUSB_PRINT3(string, a, b, c); \
225 #define TUSB_VERBOSE_PRINT4(string, a, b, c, d) \
229 TUSB_PRINT4(string, a, b, c, d); \
233 #define TUSB_VERBOSE_PRINT5(string, a, b, c, d, e) \
237 TUSB_PRINT5(string, a, b, c, d, e); \
241 #define TUSB_VERBOSE_APRINT(string) \
245 aConsole->Printf(_L(string)); \
246 aConsole->Printf(_L("\n")); \
247 RDebug::Print(_L(string)); \
251 #define TUSB_HEAPSIZE(string) \
253 TInt totalSize = 0; \
254 TInt numCells = User::AllocSize (totalSize); \
255 RDebug::Print(_L(string)); \
256 RDebug::Print(_L(" Heap Cells %d Size %d\n"),numCells,totalSize); \
259 #endif // __GENERAL_H__