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