|
1 // Copyright (c) 1995-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/d32usbc.inl |
|
15 // User side class definitions for USB Device support (inline header). |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file d32usbc.inl |
|
21 @publishedPartner |
|
22 @released |
|
23 */ |
|
24 |
|
25 #ifndef __D32USBC_INL__ |
|
26 #define __D32USBC_INL__ |
|
27 |
|
28 |
|
29 /** @internalTechnology |
|
30 */ |
|
31 struct TUsbcIfcInfo |
|
32 { |
|
33 TUsbcInterfaceInfoBuf* iInterfaceData; |
|
34 TPtr8* iString; |
|
35 TUint32 iBandwidthPriority; |
|
36 }; |
|
37 |
|
38 |
|
39 /** @internalTechnology |
|
40 */ |
|
41 struct TEndpointTransferInfo |
|
42 { |
|
43 TDesC8* iDes; |
|
44 TTransferType iTransferType; |
|
45 TInt iTransferSize; |
|
46 TBool iZlpReqd; |
|
47 }; |
|
48 |
|
49 inline TUsbcInterfaceInfo::TUsbcInterfaceInfo(TInt aClass, TInt aSubClass, |
|
50 TInt aProtocol, TDesC16* aString, |
|
51 TUint aTotalEndpoints) |
|
52 : iClass(aClass, aSubClass, aProtocol), iString(aString), |
|
53 iTotalEndpointsUsed(aTotalEndpoints), iEndpointData(), iFeatureWord(0) |
|
54 {} |
|
55 |
|
56 |
|
57 #ifndef __KERNEL_MODE__ |
|
58 |
|
59 /** @capability CommDD |
|
60 */ |
|
61 inline TInt RDevUsbcClient::Open(TInt aUnit) |
|
62 { |
|
63 _LIT(KUsbDevName, "Usbc"); |
|
64 return (DoCreate(KUsbDevName, VersionRequired(), aUnit, NULL, NULL, EOwnerThread)); |
|
65 } |
|
66 |
|
67 |
|
68 inline TVersion RDevUsbcClient::VersionRequired() const |
|
69 { |
|
70 return (TVersion(EMajorVersionNumber, EMinorVersionNumber, EBuildVersionNumber)); |
|
71 } |
|
72 |
|
73 |
|
74 inline TInt RDevUsbcClient::EndpointZeroRequestError() |
|
75 { |
|
76 return DoControl(EControlEndpointZeroRequestError); |
|
77 } |
|
78 |
|
79 |
|
80 inline TInt RDevUsbcClient::EndpointCaps(TDes8& aCapsBuf) |
|
81 { |
|
82 return DoControl(EControlEndpointCaps, &aCapsBuf); |
|
83 } |
|
84 |
|
85 |
|
86 inline TInt RDevUsbcClient::DeviceCaps(TUsbDeviceCaps& aCapsBuf) |
|
87 { |
|
88 return DoControl(EControlDeviceCaps, &aCapsBuf); |
|
89 } |
|
90 |
|
91 |
|
92 inline TInt RDevUsbcClient::GetAlternateSetting(TInt &aInterfaceNumber) |
|
93 { |
|
94 return DoControl(EControlGetAlternateSetting, &aInterfaceNumber); |
|
95 } |
|
96 |
|
97 |
|
98 inline TInt RDevUsbcClient::DeviceStatus(TUsbcDeviceState &aDeviceStatus) |
|
99 { |
|
100 return DoControl(EControlDeviceStatus, &aDeviceStatus); |
|
101 } |
|
102 |
|
103 |
|
104 inline TInt RDevUsbcClient::EndpointStatus(TEndpointNumber aEndpoint,TEndpointState &aEndpointStatus) |
|
105 { |
|
106 return DoControl(EControlEndpointStatus,(TAny*) aEndpoint, &aEndpointStatus); |
|
107 } |
|
108 |
|
109 |
|
110 inline TInt RDevUsbcClient::QueryReceiveBuffer(TEndpointNumber aEndpoint,TInt& aNumberOfBytes) |
|
111 { |
|
112 return DoControl(EControlQueryReceiveBuffer, (TAny*) aEndpoint, &aNumberOfBytes); |
|
113 } |
|
114 |
|
115 |
|
116 inline TInt RDevUsbcClient::SendEp0StatusPacket() |
|
117 { |
|
118 return DoControl(EControlSendEp0StatusPacket); |
|
119 } |
|
120 |
|
121 |
|
122 inline TInt RDevUsbcClient::HaltEndpoint(TEndpointNumber aEndpoint) |
|
123 { |
|
124 return DoControl(EControlHaltEndpoint, (TAny*) aEndpoint); |
|
125 } |
|
126 |
|
127 |
|
128 inline TInt RDevUsbcClient::ClearHaltEndpoint(TEndpointNumber aEndpoint) |
|
129 { |
|
130 return DoControl(EControlClearHaltEndpoint, (TAny*) aEndpoint); |
|
131 } |
|
132 |
|
133 |
|
134 inline TUint RDevUsbcClient::EndpointZeroMaxPacketSizes() |
|
135 { |
|
136 return DoControl(EControlEndpointZeroMaxPacketSizes); |
|
137 } |
|
138 |
|
139 |
|
140 inline TInt RDevUsbcClient::SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize) |
|
141 { |
|
142 return DoControl(EControlSetEndpointZeroMaxPacketSize, (TAny*) aMaxPacketSize); |
|
143 } |
|
144 |
|
145 |
|
146 inline TInt RDevUsbcClient::GetEndpointZeroMaxPacketSize() |
|
147 { |
|
148 return DoControl(EControlGetEndpointZeroMaxPacketSize); |
|
149 } |
|
150 |
|
151 |
|
152 inline TInt RDevUsbcClient::GetDeviceDescriptor(TDes8& aDeviceDescriptor) |
|
153 { |
|
154 return DoControl(EControlGetDeviceDescriptor, &aDeviceDescriptor); |
|
155 } |
|
156 |
|
157 |
|
158 inline TInt RDevUsbcClient::SetDeviceDescriptor(const TDesC8& aDeviceDescriptor) |
|
159 { |
|
160 return DoControl(EControlSetDeviceDescriptor, const_cast<TDesC8*>(&aDeviceDescriptor)); |
|
161 } |
|
162 |
|
163 |
|
164 inline TInt RDevUsbcClient::GetDeviceDescriptorSize(TInt& aSize) |
|
165 { |
|
166 TPckgBuf<TInt> p; |
|
167 TInt r = DoControl(EControlGetDeviceDescriptorSize, &p); |
|
168 if (r == KErrNone) |
|
169 aSize = p(); |
|
170 return r; |
|
171 } |
|
172 |
|
173 |
|
174 inline TInt RDevUsbcClient::GetConfigurationDescriptor(TDes8& aConfigurationDescriptor) |
|
175 { |
|
176 return DoControl(EControlGetConfigurationDescriptor, &aConfigurationDescriptor); |
|
177 } |
|
178 |
|
179 |
|
180 inline TInt RDevUsbcClient::SetConfigurationDescriptor(const TDesC8& aConfigurationDescriptor) |
|
181 { |
|
182 return DoControl(EControlSetConfigurationDescriptor, const_cast<TDesC8*> (&aConfigurationDescriptor)); |
|
183 } |
|
184 |
|
185 |
|
186 inline TInt RDevUsbcClient::GetConfigurationDescriptorSize(TInt& aSize) |
|
187 { |
|
188 TPckgBuf<TInt> p; |
|
189 TInt r=DoControl(EControlGetConfigurationDescriptorSize, &p); |
|
190 if (r == KErrNone) |
|
191 aSize = p(); |
|
192 return r; |
|
193 } |
|
194 |
|
195 |
|
196 inline TInt RDevUsbcClient::GetInterfaceDescriptor(TInt aSettingNumber, TDes8& aInterfaceDescriptor) |
|
197 { |
|
198 return DoControl(EControlGetInterfaceDescriptor,(TAny*) aSettingNumber, &aInterfaceDescriptor); |
|
199 } |
|
200 |
|
201 |
|
202 inline TInt RDevUsbcClient::SetInterfaceDescriptor(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor) |
|
203 { |
|
204 return DoControl(EControlSetInterfaceDescriptor,(TAny*) aSettingNumber, |
|
205 const_cast<TDesC8*>(&aInterfaceDescriptor)); |
|
206 } |
|
207 |
|
208 |
|
209 inline TInt RDevUsbcClient::GetInterfaceDescriptorSize(TInt aSettingNumber, TInt& aSize) |
|
210 { |
|
211 TPckgBuf<TInt> p; |
|
212 TInt r = DoControl(EControlGetInterfaceDescriptorSize,(TAny*) aSettingNumber, &p); |
|
213 if (r == KErrNone) |
|
214 aSize = p(); |
|
215 return r; |
|
216 } |
|
217 |
|
218 |
|
219 inline TInt RDevUsbcClient::GetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber, |
|
220 TDes8& aEndpointDescriptor) |
|
221 { |
|
222 TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &aEndpointDescriptor}; |
|
223 return DoControl(EControlGetEndpointDescriptor, &info, NULL); |
|
224 } |
|
225 |
|
226 |
|
227 inline TInt RDevUsbcClient::SetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber, |
|
228 const TDesC8& aEndpointDescriptor) |
|
229 { |
|
230 TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, const_cast<TDesC8*>(&aEndpointDescriptor)}; |
|
231 return DoControl(EControlSetEndpointDescriptor, &info, NULL); |
|
232 } |
|
233 |
|
234 |
|
235 inline TInt RDevUsbcClient::GetEndpointDescriptorSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize) |
|
236 { |
|
237 TPckgBuf<TInt> p; |
|
238 TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &p}; |
|
239 TInt r = DoControl(EControlGetEndpointDescriptorSize, &info, NULL); |
|
240 if (r == KErrNone) |
|
241 aSize = p(); |
|
242 return r; |
|
243 } |
|
244 |
|
245 |
|
246 inline void RDevUsbcClient::GetOtgDescriptorSize(TInt& aSize) |
|
247 { |
|
248 aSize = KUsbDescSize_Otg; |
|
249 } |
|
250 |
|
251 |
|
252 inline TInt RDevUsbcClient::GetOtgDescriptor(TDes8& aOtgDesc) |
|
253 { |
|
254 return DoControl(EControlGetOtgDescriptor, (TAny*)&aOtgDesc); |
|
255 } |
|
256 |
|
257 |
|
258 inline TInt RDevUsbcClient::SetOtgDescriptor(const TDesC8& aOtgDesc) |
|
259 { |
|
260 return DoControl(EControlSetOtgDescriptor, (TAny*)&aOtgDesc); |
|
261 } |
|
262 |
|
263 |
|
264 inline TInt RDevUsbcClient::GetDeviceQualifierDescriptor(TDes8& aDescriptor) |
|
265 { |
|
266 return DoControl(EControlGetDeviceQualifierDescriptor, &aDescriptor); |
|
267 } |
|
268 |
|
269 |
|
270 inline TInt RDevUsbcClient::SetDeviceQualifierDescriptor(const TDesC8& aDescriptor) |
|
271 { |
|
272 return DoControl(EControlSetDeviceQualifierDescriptor, const_cast<TDesC8*>(&aDescriptor)); |
|
273 } |
|
274 |
|
275 |
|
276 inline TInt RDevUsbcClient::GetOtherSpeedConfigurationDescriptor(TDes8& aDescriptor) |
|
277 { |
|
278 return DoControl(EControlGetOtherSpeedConfigurationDescriptor, &aDescriptor); |
|
279 } |
|
280 |
|
281 |
|
282 inline TInt RDevUsbcClient::SetOtherSpeedConfigurationDescriptor(const TDesC8& aDescriptor) |
|
283 { |
|
284 return DoControl(EControlSetOtherSpeedConfigurationDescriptor, const_cast<TDesC8*> (&aDescriptor)); |
|
285 } |
|
286 |
|
287 |
|
288 inline TInt RDevUsbcClient::GetCSInterfaceDescriptorBlock(TInt aSettingNumber, TDes8& aInterfaceDescriptor) |
|
289 { |
|
290 return DoControl(EControlGetCSInterfaceDescriptor,(TAny*) aSettingNumber, &aInterfaceDescriptor); |
|
291 } |
|
292 |
|
293 |
|
294 inline TInt RDevUsbcClient::GetCSInterfaceDescriptorBlockSize(TInt aSettingNumber, TInt& aSize) |
|
295 { |
|
296 TPckgBuf<TInt> p; |
|
297 TInt r = DoControl(EControlGetCSInterfaceDescriptorSize,(TAny*) aSettingNumber, &p); |
|
298 if (r == KErrNone) |
|
299 aSize = p(); |
|
300 return r; |
|
301 } |
|
302 |
|
303 |
|
304 inline TInt RDevUsbcClient::GetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber, |
|
305 TDes8& aEndpointDescriptor) |
|
306 { |
|
307 TEndpointDescriptorInfo info={aSettingNumber, aEndpointNumber, &aEndpointDescriptor}; |
|
308 return DoControl(EControlGetCSEndpointDescriptor,&info,NULL); |
|
309 } |
|
310 |
|
311 |
|
312 inline TInt RDevUsbcClient::GetCSEndpointDescriptorBlockSize(TInt aSettingNumber, TInt aEndpointNumber, |
|
313 TInt& aSize) |
|
314 { |
|
315 TPckgBuf<TInt> p; |
|
316 TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &p}; |
|
317 TInt r = DoControl(EControlGetCSEndpointDescriptorSize, &info, NULL); |
|
318 if (r == KErrNone) |
|
319 aSize = p(); |
|
320 return r; |
|
321 } |
|
322 |
|
323 |
|
324 inline TInt RDevUsbcClient::SignalRemoteWakeup() |
|
325 { |
|
326 return DoControl(EControlSignalRemoteWakeup); |
|
327 } |
|
328 |
|
329 |
|
330 inline TInt RDevUsbcClient::DeviceDisconnectFromHost() |
|
331 { |
|
332 return DoControl(EControlDeviceDisconnectFromHost); |
|
333 } |
|
334 |
|
335 |
|
336 inline TInt RDevUsbcClient::DeviceConnectToHost() |
|
337 { |
|
338 return DoControl(EControlDeviceConnectToHost); |
|
339 } |
|
340 |
|
341 |
|
342 inline TInt RDevUsbcClient::PowerUpUdc() |
|
343 { |
|
344 return DoControl(EControlDevicePowerUpUdc); |
|
345 } |
|
346 |
|
347 |
|
348 inline TBool RDevUsbcClient::CurrentlyUsingHighSpeed() |
|
349 { |
|
350 return DoControl(EControlCurrentlyUsingHighSpeed); |
|
351 } |
|
352 |
|
353 |
|
354 inline TInt RDevUsbcClient::SetInterface(TInt aInterfaceNumber, TUsbcInterfaceInfoBuf& aInterfaceData, |
|
355 TUint32 aBandwidthPriority) |
|
356 { |
|
357 TPtr8 name_8(NULL,0); |
|
358 TUsbcIfcInfo ifcinfo; |
|
359 ifcinfo.iInterfaceData = const_cast<TUsbcInterfaceInfoBuf*>(&aInterfaceData); |
|
360 if (!aInterfaceData().iString) |
|
361 { |
|
362 ifcinfo.iString = NULL; |
|
363 } |
|
364 else |
|
365 { |
|
366 name_8.Set(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aInterfaceData().iString->Ptr())), |
|
367 aInterfaceData().iString->Size(), aInterfaceData().iString->Size()); |
|
368 ifcinfo.iString = &name_8; |
|
369 } |
|
370 ifcinfo.iBandwidthPriority = aBandwidthPriority; |
|
371 return DoControl(EControlSetInterface, (TAny*)aInterfaceNumber, &ifcinfo); |
|
372 } |
|
373 |
|
374 |
|
375 inline TInt RDevUsbcClient::ReleaseInterface(TInt aInterfaceNumber) |
|
376 { |
|
377 return DoControl(EControlReleaseInterface, (TAny*)aInterfaceNumber); |
|
378 } |
|
379 |
|
380 |
|
381 inline TInt RDevUsbcClient::SetCSInterfaceDescriptorBlock(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor) |
|
382 { |
|
383 TCSDescriptorInfo info = {aSettingNumber, 0, const_cast<TDesC8*>(&aInterfaceDescriptor), |
|
384 aInterfaceDescriptor.Size()}; |
|
385 return DoControl(EControlSetCSInterfaceDescriptor, &info, NULL); |
|
386 } |
|
387 |
|
388 |
|
389 inline TInt RDevUsbcClient::SetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber, |
|
390 const TDesC8& aEndpointDescriptor) |
|
391 { |
|
392 TCSDescriptorInfo info = {aSettingNumber, aEndpointNumber, const_cast<TDesC8*>(&aEndpointDescriptor), |
|
393 aEndpointDescriptor.Size()}; |
|
394 return DoControl(EControlSetCSEndpointDescriptor, &info, NULL); |
|
395 } |
|
396 |
|
397 |
|
398 inline TInt RDevUsbcClient::SetDeviceControl() |
|
399 { |
|
400 return DoControl(EControlSetDeviceControl); |
|
401 } |
|
402 |
|
403 |
|
404 inline TInt RDevUsbcClient::ReleaseDeviceControl() |
|
405 { |
|
406 return DoControl(EControlReleaseDeviceControl); |
|
407 } |
|
408 |
|
409 |
|
410 inline TInt RDevUsbcClient::GetStringDescriptorLangId(TUint16& aLangId) |
|
411 { |
|
412 TPckgBuf<TUint16> p; |
|
413 const TInt r = DoControl(EControlGetStringDescriptorLangId, &p); |
|
414 if (r == KErrNone) |
|
415 aLangId = p(); |
|
416 return r; |
|
417 } |
|
418 |
|
419 |
|
420 inline TInt RDevUsbcClient::SetStringDescriptorLangId(TUint16 aLangId) |
|
421 { |
|
422 return DoControl(EControlSetStringDescriptorLangId, (TAny*)(TUint)aLangId); |
|
423 } |
|
424 |
|
425 |
|
426 inline TInt RDevUsbcClient::GetManufacturerStringDescriptor(TDes16& aString) |
|
427 { |
|
428 TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize()); |
|
429 const TInt r = DoControl(EControlGetManufacturerStringDescriptor, &name_8); |
|
430 aString.SetLength(name_8.Size()/2); |
|
431 return r; |
|
432 } |
|
433 |
|
434 |
|
435 inline TInt RDevUsbcClient::SetManufacturerStringDescriptor(const TDesC16& aString) |
|
436 { |
|
437 TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size()); |
|
438 return DoControl(EControlSetManufacturerStringDescriptor, &name_8); |
|
439 } |
|
440 |
|
441 |
|
442 inline TInt RDevUsbcClient::RemoveManufacturerStringDescriptor() |
|
443 { |
|
444 return DoControl(EControlRemoveManufacturerStringDescriptor); |
|
445 } |
|
446 |
|
447 |
|
448 inline TInt RDevUsbcClient::GetProductStringDescriptor(TDes16& aString) |
|
449 { |
|
450 TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize()); |
|
451 const TInt r = DoControl(EControlGetProductStringDescriptor, &name_8); |
|
452 aString.SetLength(name_8.Size()/2); |
|
453 return r; |
|
454 } |
|
455 |
|
456 |
|
457 inline TInt RDevUsbcClient::SetProductStringDescriptor(const TDesC16& aString) |
|
458 { |
|
459 TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size()); |
|
460 return DoControl(EControlSetProductStringDescriptor, &name_8); |
|
461 } |
|
462 |
|
463 |
|
464 inline TInt RDevUsbcClient::RemoveProductStringDescriptor() |
|
465 { |
|
466 return DoControl(EControlRemoveProductStringDescriptor); |
|
467 } |
|
468 |
|
469 |
|
470 inline TInt RDevUsbcClient::GetSerialNumberStringDescriptor(TDes16& aString) |
|
471 { |
|
472 TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize()); |
|
473 const TInt r = DoControl(EControlGetSerialNumberStringDescriptor, &name_8); |
|
474 aString.SetLength(name_8.Size()/2); |
|
475 return r; |
|
476 } |
|
477 |
|
478 |
|
479 inline TInt RDevUsbcClient::SetSerialNumberStringDescriptor(const TDesC16& aString) |
|
480 { |
|
481 TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size()); |
|
482 return DoControl(EControlSetSerialNumberStringDescriptor, &name_8); |
|
483 } |
|
484 |
|
485 |
|
486 inline TInt RDevUsbcClient::RemoveSerialNumberStringDescriptor() |
|
487 { |
|
488 return DoControl(EControlRemoveSerialNumberStringDescriptor); |
|
489 } |
|
490 |
|
491 |
|
492 inline TInt RDevUsbcClient::GetConfigurationStringDescriptor(TDes16& aString) |
|
493 { |
|
494 TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize()); |
|
495 const TInt r = DoControl(EControlGetConfigurationStringDescriptor, &name_8); |
|
496 aString.SetLength(name_8.Size() / 2); |
|
497 return r; |
|
498 } |
|
499 |
|
500 |
|
501 inline TInt RDevUsbcClient::SetConfigurationStringDescriptor(const TDesC16& aString) |
|
502 { |
|
503 TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size()); |
|
504 return DoControl(EControlSetConfigurationStringDescriptor, &name_8); |
|
505 } |
|
506 |
|
507 |
|
508 inline TInt RDevUsbcClient::RemoveConfigurationStringDescriptor() |
|
509 { |
|
510 return DoControl(EControlRemoveConfigurationStringDescriptor); |
|
511 } |
|
512 |
|
513 |
|
514 inline TInt RDevUsbcClient::GetStringDescriptor(TUint8 aIndex, TDes16& aString) |
|
515 { |
|
516 TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize()); |
|
517 const TInt r = DoControl(EControlGetStringDescriptor, (TAny*)(TUint)aIndex, &name_8); |
|
518 aString.SetLength(name_8.Size() / 2); |
|
519 return r; |
|
520 } |
|
521 |
|
522 |
|
523 inline TInt RDevUsbcClient::SetStringDescriptor(TUint8 aIndex, const TDesC16& aString) |
|
524 { |
|
525 TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size()); |
|
526 return DoControl(EControlSetStringDescriptor, (TAny*)(TUint)aIndex, &name_8); |
|
527 } |
|
528 |
|
529 |
|
530 inline TInt RDevUsbcClient::RemoveStringDescriptor(TUint8 aIndex) |
|
531 { |
|
532 return DoControl(EControlRemoveStringDescriptor, (TAny*)(TUint)aIndex); |
|
533 } |
|
534 |
|
535 |
|
536 inline TInt RDevUsbcClient::AllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource) |
|
537 { |
|
538 return DoControl(EControlAllocateEndpointResource, (TAny*)aEndpoint, (TAny*)aResource); |
|
539 } |
|
540 |
|
541 |
|
542 inline TInt RDevUsbcClient::DeAllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource) |
|
543 { |
|
544 return DoControl(EControlDeAllocateEndpointResource, (TAny*)aEndpoint, (TAny*)aResource); |
|
545 } |
|
546 |
|
547 |
|
548 inline TBool RDevUsbcClient::QueryEndpointResourceUse(TInt aEndpoint, TUsbcEndpointResource aResource) |
|
549 { |
|
550 return DoControl(EControlQueryEndpointResourceUse, (TAny*)aEndpoint, (TAny*)aResource); |
|
551 } |
|
552 |
|
553 |
|
554 inline void RDevUsbcClient::ReadUntilShort(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes) |
|
555 { |
|
556 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; |
|
557 TEndpointTransferInfo info = {&aDes, ETransferTypeReadUntilShort, aDes.MaxLength()}; |
|
558 DoRequest(ep, aStatus, &info, NULL); |
|
559 } |
|
560 |
|
561 |
|
562 inline void RDevUsbcClient::ReadUntilShort(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes, |
|
563 TInt aLen) |
|
564 { |
|
565 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; |
|
566 TEndpointTransferInfo info = {&aDes, ETransferTypeReadUntilShort, aLen}; |
|
567 DoRequest(ep, aStatus, &info, NULL); |
|
568 } |
|
569 |
|
570 |
|
571 inline void RDevUsbcClient::ReadOneOrMore(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes) |
|
572 { |
|
573 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; |
|
574 TEndpointTransferInfo info = {&aDes, ETransferTypeReadOneOrMore, aDes.MaxLength()}; |
|
575 DoRequest(ep, aStatus, &info, NULL); |
|
576 } |
|
577 |
|
578 |
|
579 inline void RDevUsbcClient::ReadOneOrMore(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes, |
|
580 TInt aLen) |
|
581 { |
|
582 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; |
|
583 TEndpointTransferInfo info = {&aDes, ETransferTypeReadOneOrMore, aLen}; |
|
584 DoRequest(ep, aStatus, &info, NULL); |
|
585 } |
|
586 |
|
587 |
|
588 inline void RDevUsbcClient::Read(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes) |
|
589 { |
|
590 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; |
|
591 TEndpointTransferInfo info = {&aDes, ETransferTypeReadData, aDes.MaxLength()}; |
|
592 DoRequest(ep, aStatus, &info, NULL); |
|
593 } |
|
594 |
|
595 |
|
596 inline void RDevUsbcClient::Read(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes, TInt aLen) |
|
597 { |
|
598 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; |
|
599 TEndpointTransferInfo info = {&aDes, ETransferTypeReadData, aLen}; |
|
600 DoRequest(ep, aStatus, &info, NULL); |
|
601 } |
|
602 |
|
603 |
|
604 inline void RDevUsbcClient::ReadPacket(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes, |
|
605 TInt aMaxLen) |
|
606 { |
|
607 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; |
|
608 TEndpointTransferInfo info = {&aDes, ETransferTypeReadPacket, aMaxLen}; |
|
609 DoRequest(ep, aStatus, &info, NULL); |
|
610 } |
|
611 |
|
612 |
|
613 inline void RDevUsbcClient::Write(TRequestStatus &aStatus, TEndpointNumber aEndpoint, const TDesC8& aDes, |
|
614 TInt aLen, TBool aZlpRequired) |
|
615 { |
|
616 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; |
|
617 TEndpointTransferInfo info = {const_cast<TDesC8*>(&aDes), ETransferTypeWrite, aLen, aZlpRequired}; |
|
618 DoRequest(ep, aStatus, &info, NULL); |
|
619 } |
|
620 |
|
621 |
|
622 inline void RDevUsbcClient::AlternateDeviceStatusNotify(TRequestStatus& aStatus, TUint& aValue) |
|
623 { |
|
624 DoRequest(ERequestAlternateDeviceStatusNotify, aStatus, &aValue); |
|
625 } |
|
626 |
|
627 |
|
628 inline void RDevUsbcClient::ReEnumerate(TRequestStatus& aStatus) |
|
629 { |
|
630 DoRequest(ERequestReEnumerate, aStatus); |
|
631 } |
|
632 |
|
633 |
|
634 inline void RDevUsbcClient::EndpointStatusNotify(TRequestStatus& aStatus, TUint& aEndpointMask) |
|
635 { |
|
636 DoRequest(ERequestEndpointStatusNotify, aStatus, &aEndpointMask); |
|
637 } |
|
638 |
|
639 |
|
640 inline void RDevUsbcClient::ReadCancel(TEndpointNumber aEndpoint) |
|
641 { |
|
642 if (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) |
|
643 return; |
|
644 DoCancel(1 << aEndpoint); |
|
645 } |
|
646 |
|
647 |
|
648 inline void RDevUsbcClient::WriteCancel(TEndpointNumber aEndpoint) |
|
649 { |
|
650 ReadCancel(aEndpoint); |
|
651 } |
|
652 |
|
653 |
|
654 inline void RDevUsbcClient::EndpointTransferCancel(TUint aEndpointMask) |
|
655 { |
|
656 /* Mask off non-endpoint cancels */ |
|
657 DoCancel(aEndpointMask & ERequestAllCancel); |
|
658 } |
|
659 |
|
660 |
|
661 inline void RDevUsbcClient::AlternateDeviceStatusNotifyCancel() |
|
662 { |
|
663 DoCancel(ERequestAlternateDeviceStatusNotifyCancel); |
|
664 } |
|
665 |
|
666 |
|
667 inline void RDevUsbcClient::ReEnumerateCancel() |
|
668 { |
|
669 DoCancel(ERequestReEnumerateCancel); |
|
670 } |
|
671 |
|
672 |
|
673 inline void RDevUsbcClient::EndpointStatusNotifyCancel() |
|
674 { |
|
675 DoCancel(ERequestEndpointStatusNotifyCancel); |
|
676 } |
|
677 |
|
678 inline TInt RDevUsbcClient::GetOtgFeatures(TUint8& aFeatures) |
|
679 { |
|
680 TPckgBuf<TUint8> p; |
|
681 TInt r = DoControl(EControlGetOtgFeatures, &p); |
|
682 if (r == KErrNone) |
|
683 aFeatures = p(); |
|
684 return r; |
|
685 } |
|
686 |
|
687 |
|
688 inline void RDevUsbcClient::OtgFeaturesNotify(TRequestStatus& aStatus, TUint8& aValue) |
|
689 { |
|
690 DoRequest(ERequestOtgFeaturesNotify, aStatus, &aValue); |
|
691 } |
|
692 |
|
693 |
|
694 inline void RDevUsbcClient::OtgFeaturesNotifyCancel() |
|
695 { |
|
696 DoCancel(ERequestOtgFeaturesNotifyCancel); |
|
697 } |
|
698 |
|
699 |
|
700 #endif // #ifndef __KERNEL_MODE__ |
|
701 |
|
702 #endif // #ifndef __D32USBC_INL__ |