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