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