|
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 // e32/include/d32usbcshared.inl |
|
15 // User side class definitions for USB Device support. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file d32usbcshared.inl |
|
21 @publishedPartner |
|
22 @released |
|
23 */ |
|
24 |
|
25 #ifndef __D32USBCSHARED_INL__ |
|
26 #define __D32USBCSHARED_INL__ |
|
27 |
|
28 inline TInt TUsbcEndpointCaps::MaxPacketSize() const |
|
29 { |
|
30 return (iSizes & KUsbEpSize1024) ? 1024 : |
|
31 ((iSizes & KUsbEpSize1023) ? 1023 : |
|
32 ((iSizes & KUsbEpSize512) ? 512 : |
|
33 ((iSizes & KUsbEpSize256) ? 256 : |
|
34 ((iSizes & KUsbEpSize128) ? 128 : |
|
35 ((iSizes & KUsbEpSize64) ? 64 : |
|
36 ((iSizes & KUsbEpSize32) ? 32 : |
|
37 ((iSizes & KUsbEpSize16) ? 16 : |
|
38 ((iSizes & KUsbEpSize8) ? 8 : 0)))))))); |
|
39 } |
|
40 |
|
41 |
|
42 inline TInt TUsbcEndpointCaps::MinPacketSize() const |
|
43 { |
|
44 return (iSizes & KUsbEpSize8) ? 8 : |
|
45 ((iSizes & KUsbEpSize16) ? 16 : |
|
46 ((iSizes & KUsbEpSize32) ? 32 : |
|
47 ((iSizes & KUsbEpSize64) ? 64 : |
|
48 ((iSizes & KUsbEpSize128) ? 128 : |
|
49 ((iSizes & KUsbEpSize256) ? 256 : |
|
50 ((iSizes & KUsbEpSize512) ? 512 : |
|
51 ((iSizes & KUsbEpSize1023) ? 1023 : |
|
52 ((iSizes & KUsbEpSize1024) ? 1024 : 0)))))))); |
|
53 } |
|
54 |
|
55 |
|
56 static inline TUint PacketSize2Mask(TInt aSize) |
|
57 { |
|
58 return (aSize == 8) ? KUsbEpSize8 : |
|
59 ((aSize == 16) ? KUsbEpSize16 : |
|
60 ((aSize == 32) ? KUsbEpSize32 : |
|
61 ((aSize == 64) ? KUsbEpSize64 : |
|
62 ((aSize == 128) ? KUsbEpSize128 : |
|
63 ((aSize == 256) ? KUsbEpSize256 : |
|
64 ((aSize == 512) ? KUsbEpSize512 : |
|
65 ((aSize == 1023) ? KUsbEpSize1023 : |
|
66 ((aSize == 1024) ? KUsbEpSize1024 : 0)))))))); |
|
67 } |
|
68 |
|
69 |
|
70 static inline TUint EpTypeMask2Value(TInt aType) |
|
71 { |
|
72 return (aType & KUsbEpTypeControl) ? KUsbEpAttr_TransferTypeControl : |
|
73 ((aType & KUsbEpTypeIsochronous) ? KUsbEpAttr_TransferTypeIsochronous : |
|
74 ((aType & KUsbEpTypeBulk) ? KUsbEpAttr_TransferTypeBulk : |
|
75 ((aType & KUsbEpTypeInterrupt) ? KUsbEpAttr_TransferTypeInterrupt : -1))); |
|
76 } |
|
77 |
|
78 |
|
79 /** @internalTechnology |
|
80 */ |
|
81 struct TEndpointDescriptorInfo |
|
82 { |
|
83 TInt iSetting; // alternate setting |
|
84 TInt iEndpoint; // excludes ep0 |
|
85 TAny* iArg; // address of data |
|
86 }; |
|
87 |
|
88 |
|
89 /** @internalTechnology |
|
90 */ |
|
91 struct TCSDescriptorInfo |
|
92 { |
|
93 TInt iSetting; // alternate setting |
|
94 TInt iEndpoint; // excludes ep0, not used for CS ifc desc |
|
95 TAny* iArg; // address of data |
|
96 TInt iSize; // size of data (descriptor block) |
|
97 }; |
|
98 |
|
99 inline TUsbcEndpointInfo::TUsbcEndpointInfo(TUint aType, TUint aDir, TInt aSize, |
|
100 TInt aInterval, TInt aExtra) |
|
101 : iType(aType), iDir(aDir), iSize(aSize), iInterval(aInterval), |
|
102 iInterval_Hs(-1), iTransactions(0), iExtra(aExtra), iFeatureWord1(0), |
|
103 iReserved(0) |
|
104 {} |
|
105 |
|
106 inline TUsbcClassInfo::TUsbcClassInfo(TInt aClass, TInt aSubClass, TInt aProtocol) |
|
107 : iClassNum(aClass), iSubClassNum(aSubClass), iProtocolNum(aProtocol), iReserved(0) |
|
108 {} |
|
109 |
|
110 |
|
111 #endif |
|
112 |
|
113 |