|
1 /* |
|
2 * Copyright (c) 2008-2009 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 "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 * Shared HOST definitions |
|
16 * |
|
17 */ |
|
18 |
|
19 /** |
|
20 @file |
|
21 @publishedPartner |
|
22 */ |
|
23 |
|
24 #ifndef __USBHOSTDEFS_H__ |
|
25 #define __USBHOSTDEFS_H__ |
|
26 |
|
27 #include <e32std.h> |
|
28 |
|
29 /** An event in the attachment-detachment lifecycle of a USB device. */ |
|
30 enum TUsbHostStackEventType |
|
31 { |
|
32 /** A device attachment has occurred. */ |
|
33 EDeviceAttachment = 0, |
|
34 |
|
35 /** An attempt to load Function Driver(s) has occurred. */ |
|
36 EDriverLoad = 1, |
|
37 |
|
38 /** A device detachment has occurred. */ |
|
39 EDeviceDetachment = 2, |
|
40 }; |
|
41 |
|
42 /** For a 'driver loading' event, whether the attempt to load drivers was |
|
43 successful, partially successful, or unsuccessful. */ |
|
44 const TUint KMultipleDriversFound = 0x00000004; |
|
45 |
|
46 enum TDriverLoadStatus |
|
47 { |
|
48 /** Driver loading was successful for all the device's interfaces. */ |
|
49 EDriverLoadSuccess = 0, |
|
50 |
|
51 /** Driver loading was successful for one or more of the device's |
|
52 interfaces, but not for all of them. */ |
|
53 EDriverLoadPartialSuccess = 1, |
|
54 |
|
55 /** Driver loading was successful for none of the device's interfaces. */ |
|
56 EDriverLoadFailure = 2, |
|
57 |
|
58 /** Driver loading was successful for all the device's interfaces, with multiple drivers found */ |
|
59 EDriverLoadSuccessMultipleDriversFound = EDriverLoadSuccess|KMultipleDriversFound, |
|
60 |
|
61 /** Driver loading was successful for one or more of the device's |
|
62 interfaces, but not for all of them, with multiple drivers found. */ |
|
63 EDriverLoadPartialSuccessMultipleDriversFound = EDriverLoadPartialSuccess|KMultipleDriversFound, |
|
64 |
|
65 /** Driver loading was successful for none of the device's interfaces, with multiple drivers found. */ |
|
66 EDriverLoadFailureMultipleDriversFound = EDriverLoadFailure|KMultipleDriversFound |
|
67 }; |
|
68 |
|
69 NONSHARABLE_CLASS(TDeviceEventInformation) |
|
70 { |
|
71 public: |
|
72 inline TDeviceEventInformation() |
|
73 // These initialisations are arbitrary |
|
74 : iDeviceId(0), |
|
75 iEventType(EDeviceAttachment), |
|
76 iError(KErrNone), |
|
77 iDriverLoadStatus(EDriverLoadSuccess), |
|
78 iVid(0), |
|
79 iPid(0) |
|
80 {} |
|
81 |
|
82 // Always relevant- the ID of the device the event relates to. |
|
83 TUint iDeviceId; |
|
84 |
|
85 // Always relevant- the type of event that has occurred. |
|
86 TUsbHostStackEventType iEventType; |
|
87 |
|
88 // Relevant to attachment and driver load events. |
|
89 TInt iError; |
|
90 |
|
91 // Relevant to driver load events only. |
|
92 TDriverLoadStatus iDriverLoadStatus; |
|
93 |
|
94 // Relevant to attachments with iError KErrNone. |
|
95 TUint16 iVid; |
|
96 |
|
97 // Relevant to attachments with iError KErrNone. |
|
98 TUint16 iPid; |
|
99 }; |
|
100 |
|
101 const TInt KUsbMaxSupportedLanguageIds = 127; // Max number of supported USB Language Ids |
|
102 |
|
103 |
|
104 enum TUsbOtgAttributes |
|
105 { |
|
106 /** Device supported SRP protocol */ |
|
107 EUsbOtgSRPSupported = 0x01, |
|
108 |
|
109 /** Device supported HNP protocol */ |
|
110 EUsbOtgHNPSupported = 0x02, |
|
111 |
|
112 EUsbOtgAttributeCount, |
|
113 }; |
|
114 |
|
115 NONSHARABLE_CLASS(TOtgDescriptor) |
|
116 { |
|
117 public: |
|
118 inline TOtgDescriptor() |
|
119 : iDeviceId(0), |
|
120 iAttributes(0), |
|
121 iReserved1(0), |
|
122 iReserved2(0), |
|
123 iReserved3(0) |
|
124 {} |
|
125 |
|
126 // The ID of the device the OTG descriptor relates to. |
|
127 TUint iDeviceId; |
|
128 |
|
129 // The OTG attributes - currently only D0 and D1 are used for SRP and HNP. |
|
130 TUint8 iAttributes; |
|
131 |
|
132 // Reserved |
|
133 TInt iReserved1; |
|
134 |
|
135 // Reserved |
|
136 TInt iReserved2; |
|
137 |
|
138 // Reserved |
|
139 TInt iReserved3; |
|
140 }; |
|
141 |
|
142 #endif //__USBHOSTDEFS_H__ |