os/kernelhwsrv/kernel/eka/include/d32usbc.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/d32usbc.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,702 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32/include/d32usbc.inl
    1.18 +// User side class definitions for USB Device support (inline header).
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +/**
    1.23 + @file d32usbc.inl
    1.24 + @publishedPartner
    1.25 + @released
    1.26 +*/
    1.27 +
    1.28 +#ifndef __D32USBC_INL__
    1.29 +#define __D32USBC_INL__
    1.30 +
    1.31 +
    1.32 +/** @internalTechnology
    1.33 +*/
    1.34 +struct TUsbcIfcInfo
    1.35 +	{
    1.36 +	TUsbcInterfaceInfoBuf* iInterfaceData;
    1.37 +	TPtr8* iString;
    1.38 +	TUint32 iBandwidthPriority;
    1.39 +	};
    1.40 +
    1.41 +
    1.42 +/** @internalTechnology
    1.43 +*/
    1.44 +struct TEndpointTransferInfo
    1.45 +	{
    1.46 +	TDesC8* iDes;
    1.47 +	TTransferType iTransferType;
    1.48 +	TInt iTransferSize;
    1.49 +	TBool iZlpReqd;
    1.50 +	};
    1.51 +
    1.52 +inline TUsbcInterfaceInfo::TUsbcInterfaceInfo(TInt aClass, TInt aSubClass,
    1.53 +											  TInt aProtocol, TDesC16* aString,
    1.54 +											  TUint aTotalEndpoints)
    1.55 +	: iClass(aClass, aSubClass, aProtocol), iString(aString),
    1.56 +	  iTotalEndpointsUsed(aTotalEndpoints), iEndpointData(), iFeatureWord(0)
    1.57 +	{}
    1.58 +
    1.59 +
    1.60 +#ifndef __KERNEL_MODE__
    1.61 +
    1.62 +/** @capability CommDD
    1.63 +*/
    1.64 +inline TInt RDevUsbcClient::Open(TInt aUnit)
    1.65 +	{
    1.66 +	_LIT(KUsbDevName, "Usbc");
    1.67 +	return (DoCreate(KUsbDevName, VersionRequired(), aUnit, NULL, NULL, EOwnerThread));
    1.68 +	}
    1.69 +
    1.70 +
    1.71 +inline TVersion RDevUsbcClient::VersionRequired() const
    1.72 +	{
    1.73 +	return (TVersion(EMajorVersionNumber, EMinorVersionNumber, EBuildVersionNumber));
    1.74 +	}
    1.75 +
    1.76 +
    1.77 +inline TInt RDevUsbcClient::EndpointZeroRequestError()
    1.78 +	{
    1.79 +	return DoControl(EControlEndpointZeroRequestError);
    1.80 +	}
    1.81 +
    1.82 +
    1.83 +inline TInt RDevUsbcClient::EndpointCaps(TDes8& aCapsBuf)
    1.84 +	{
    1.85 +	return DoControl(EControlEndpointCaps, &aCapsBuf);
    1.86 +	}
    1.87 +
    1.88 +
    1.89 +inline TInt RDevUsbcClient::DeviceCaps(TUsbDeviceCaps& aCapsBuf)
    1.90 +	{
    1.91 +	return DoControl(EControlDeviceCaps, &aCapsBuf);
    1.92 +	}
    1.93 +
    1.94 +
    1.95 +inline TInt RDevUsbcClient::GetAlternateSetting(TInt &aInterfaceNumber)
    1.96 +	{
    1.97 +	return DoControl(EControlGetAlternateSetting, &aInterfaceNumber);
    1.98 +	}
    1.99 +
   1.100 +
   1.101 +inline TInt RDevUsbcClient::DeviceStatus(TUsbcDeviceState &aDeviceStatus)
   1.102 +	{
   1.103 +	return DoControl(EControlDeviceStatus, &aDeviceStatus);
   1.104 +	}
   1.105 +
   1.106 +
   1.107 +inline TInt RDevUsbcClient::EndpointStatus(TEndpointNumber aEndpoint,TEndpointState &aEndpointStatus)
   1.108 +	{
   1.109 +	return DoControl(EControlEndpointStatus,(TAny*) aEndpoint, &aEndpointStatus);
   1.110 +	}
   1.111 +
   1.112 +
   1.113 +inline TInt RDevUsbcClient::QueryReceiveBuffer(TEndpointNumber aEndpoint,TInt& aNumberOfBytes)
   1.114 +	{
   1.115 +	return DoControl(EControlQueryReceiveBuffer, (TAny*) aEndpoint, &aNumberOfBytes);
   1.116 +	}
   1.117 +
   1.118 +
   1.119 +inline TInt RDevUsbcClient::SendEp0StatusPacket()
   1.120 +	{
   1.121 +	return DoControl(EControlSendEp0StatusPacket);
   1.122 +	}
   1.123 +
   1.124 +
   1.125 +inline TInt RDevUsbcClient::HaltEndpoint(TEndpointNumber aEndpoint)
   1.126 +	{
   1.127 +	return DoControl(EControlHaltEndpoint, (TAny*) aEndpoint);
   1.128 +	}
   1.129 +
   1.130 +
   1.131 +inline TInt RDevUsbcClient::ClearHaltEndpoint(TEndpointNumber aEndpoint)
   1.132 +	{
   1.133 +	return DoControl(EControlClearHaltEndpoint, (TAny*) aEndpoint);
   1.134 +	}
   1.135 +
   1.136 +
   1.137 +inline TUint RDevUsbcClient::EndpointZeroMaxPacketSizes()
   1.138 +	{
   1.139 +	return DoControl(EControlEndpointZeroMaxPacketSizes);
   1.140 +	}
   1.141 +
   1.142 +
   1.143 +inline TInt RDevUsbcClient::SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize)
   1.144 +	{
   1.145 +	return DoControl(EControlSetEndpointZeroMaxPacketSize, (TAny*) aMaxPacketSize);
   1.146 +	}
   1.147 +
   1.148 +
   1.149 +inline TInt RDevUsbcClient::GetEndpointZeroMaxPacketSize()
   1.150 +	{
   1.151 +	return DoControl(EControlGetEndpointZeroMaxPacketSize);
   1.152 +	}
   1.153 +
   1.154 +
   1.155 +inline TInt RDevUsbcClient::GetDeviceDescriptor(TDes8& aDeviceDescriptor)
   1.156 +	{
   1.157 +	return DoControl(EControlGetDeviceDescriptor, &aDeviceDescriptor);
   1.158 +	}
   1.159 +
   1.160 +
   1.161 +inline TInt RDevUsbcClient::SetDeviceDescriptor(const TDesC8& aDeviceDescriptor)
   1.162 +	{
   1.163 +	return DoControl(EControlSetDeviceDescriptor, const_cast<TDesC8*>(&aDeviceDescriptor));
   1.164 +	}
   1.165 +
   1.166 +
   1.167 +inline TInt RDevUsbcClient::GetDeviceDescriptorSize(TInt& aSize)
   1.168 +	{
   1.169 +	TPckgBuf<TInt> p;
   1.170 +	TInt r = DoControl(EControlGetDeviceDescriptorSize, &p);
   1.171 +	if (r == KErrNone)
   1.172 +		aSize = p();
   1.173 +	return r;
   1.174 +	}
   1.175 +
   1.176 +
   1.177 +inline TInt RDevUsbcClient::GetConfigurationDescriptor(TDes8& aConfigurationDescriptor)
   1.178 +	{
   1.179 +	return DoControl(EControlGetConfigurationDescriptor, &aConfigurationDescriptor);
   1.180 +	}
   1.181 +
   1.182 +
   1.183 +inline TInt RDevUsbcClient::SetConfigurationDescriptor(const TDesC8& aConfigurationDescriptor)
   1.184 +	{
   1.185 +	return DoControl(EControlSetConfigurationDescriptor, const_cast<TDesC8*> (&aConfigurationDescriptor));
   1.186 +	}
   1.187 +
   1.188 +
   1.189 +inline TInt RDevUsbcClient::GetConfigurationDescriptorSize(TInt& aSize)
   1.190 +	{
   1.191 +	TPckgBuf<TInt> p;
   1.192 +	TInt r=DoControl(EControlGetConfigurationDescriptorSize, &p);
   1.193 +	if (r == KErrNone)
   1.194 +		aSize = p();
   1.195 +	return r;
   1.196 +	}
   1.197 +
   1.198 +
   1.199 +inline TInt RDevUsbcClient::GetInterfaceDescriptor(TInt aSettingNumber, TDes8& aInterfaceDescriptor)
   1.200 +	{
   1.201 +	return DoControl(EControlGetInterfaceDescriptor,(TAny*) aSettingNumber, &aInterfaceDescriptor);
   1.202 +	}
   1.203 +
   1.204 +
   1.205 +inline TInt RDevUsbcClient::SetInterfaceDescriptor(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor)
   1.206 +	{
   1.207 +	return DoControl(EControlSetInterfaceDescriptor,(TAny*) aSettingNumber,
   1.208 +					 const_cast<TDesC8*>(&aInterfaceDescriptor));
   1.209 +	}
   1.210 +
   1.211 +
   1.212 +inline TInt RDevUsbcClient::GetInterfaceDescriptorSize(TInt aSettingNumber, TInt& aSize)
   1.213 +	{
   1.214 +	TPckgBuf<TInt> p;
   1.215 +	TInt r = DoControl(EControlGetInterfaceDescriptorSize,(TAny*) aSettingNumber, &p);
   1.216 +	if (r == KErrNone)
   1.217 +		aSize = p();
   1.218 +	return r;
   1.219 +	}
   1.220 +
   1.221 +
   1.222 +inline TInt RDevUsbcClient::GetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
   1.223 +												  TDes8& aEndpointDescriptor)
   1.224 +	{
   1.225 +	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &aEndpointDescriptor};
   1.226 +	return DoControl(EControlGetEndpointDescriptor, &info, NULL);
   1.227 +	}
   1.228 +
   1.229 +
   1.230 +inline TInt RDevUsbcClient::SetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
   1.231 +												  const TDesC8& aEndpointDescriptor)
   1.232 +	{
   1.233 +	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, const_cast<TDesC8*>(&aEndpointDescriptor)};
   1.234 +	return DoControl(EControlSetEndpointDescriptor, &info, NULL);
   1.235 +	}
   1.236 +
   1.237 +
   1.238 +inline TInt RDevUsbcClient::GetEndpointDescriptorSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize)
   1.239 +	{
   1.240 +	TPckgBuf<TInt> p;
   1.241 +	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &p};
   1.242 +	TInt r = DoControl(EControlGetEndpointDescriptorSize, &info, NULL);
   1.243 +	if (r == KErrNone)
   1.244 +		aSize = p();
   1.245 +	return r;
   1.246 +	}
   1.247 +
   1.248 +
   1.249 +inline void RDevUsbcClient::GetOtgDescriptorSize(TInt& aSize)
   1.250 +	{
   1.251 +	aSize = KUsbDescSize_Otg;
   1.252 +	}
   1.253 +
   1.254 +
   1.255 +inline TInt RDevUsbcClient::GetOtgDescriptor(TDes8& aOtgDesc)
   1.256 +	{
   1.257 +	return DoControl(EControlGetOtgDescriptor, (TAny*)&aOtgDesc);
   1.258 +	}
   1.259 +
   1.260 +
   1.261 +inline TInt RDevUsbcClient::SetOtgDescriptor(const TDesC8& aOtgDesc)
   1.262 +	{
   1.263 +	return DoControl(EControlSetOtgDescriptor, (TAny*)&aOtgDesc);
   1.264 +	}
   1.265 +
   1.266 +
   1.267 +inline TInt RDevUsbcClient::GetDeviceQualifierDescriptor(TDes8& aDescriptor)
   1.268 +	{
   1.269 +	return DoControl(EControlGetDeviceQualifierDescriptor, &aDescriptor);
   1.270 +	}
   1.271 +
   1.272 +
   1.273 +inline TInt RDevUsbcClient::SetDeviceQualifierDescriptor(const TDesC8& aDescriptor)
   1.274 +	{
   1.275 +	return DoControl(EControlSetDeviceQualifierDescriptor, const_cast<TDesC8*>(&aDescriptor));
   1.276 +	}
   1.277 +
   1.278 +
   1.279 +inline TInt RDevUsbcClient::GetOtherSpeedConfigurationDescriptor(TDes8& aDescriptor)
   1.280 +	{
   1.281 +	return DoControl(EControlGetOtherSpeedConfigurationDescriptor, &aDescriptor);
   1.282 +	}
   1.283 +
   1.284 +
   1.285 +inline TInt RDevUsbcClient::SetOtherSpeedConfigurationDescriptor(const TDesC8& aDescriptor)
   1.286 +	{
   1.287 +	return DoControl(EControlSetOtherSpeedConfigurationDescriptor, const_cast<TDesC8*> (&aDescriptor));
   1.288 +	}
   1.289 +
   1.290 +
   1.291 +inline TInt RDevUsbcClient::GetCSInterfaceDescriptorBlock(TInt aSettingNumber, TDes8& aInterfaceDescriptor)
   1.292 +	{
   1.293 +	return DoControl(EControlGetCSInterfaceDescriptor,(TAny*) aSettingNumber, &aInterfaceDescriptor);
   1.294 +	}
   1.295 +
   1.296 +
   1.297 +inline TInt RDevUsbcClient::GetCSInterfaceDescriptorBlockSize(TInt aSettingNumber, TInt& aSize)
   1.298 +	{
   1.299 +	TPckgBuf<TInt> p;
   1.300 +	TInt r = DoControl(EControlGetCSInterfaceDescriptorSize,(TAny*) aSettingNumber, &p);
   1.301 +	if (r == KErrNone)
   1.302 +		aSize = p();
   1.303 +	return r;
   1.304 +	}
   1.305 +
   1.306 +
   1.307 +inline TInt RDevUsbcClient::GetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
   1.308 +														 TDes8& aEndpointDescriptor)
   1.309 +	{
   1.310 +	TEndpointDescriptorInfo info={aSettingNumber, aEndpointNumber, &aEndpointDescriptor};
   1.311 +	return DoControl(EControlGetCSEndpointDescriptor,&info,NULL);
   1.312 +	}
   1.313 +
   1.314 +
   1.315 +inline TInt RDevUsbcClient::GetCSEndpointDescriptorBlockSize(TInt aSettingNumber, TInt aEndpointNumber,
   1.316 +															 TInt& aSize)
   1.317 +	{
   1.318 +	TPckgBuf<TInt> p;
   1.319 +	TEndpointDescriptorInfo info = {aSettingNumber, aEndpointNumber, &p};
   1.320 +	TInt r = DoControl(EControlGetCSEndpointDescriptorSize, &info, NULL);
   1.321 +	if (r == KErrNone)
   1.322 +		aSize = p();
   1.323 +	return r;
   1.324 +	}
   1.325 +
   1.326 +
   1.327 +inline TInt RDevUsbcClient::SignalRemoteWakeup()
   1.328 +	{
   1.329 +	return DoControl(EControlSignalRemoteWakeup);
   1.330 +	}
   1.331 +
   1.332 +
   1.333 +inline TInt RDevUsbcClient::DeviceDisconnectFromHost()
   1.334 +	{
   1.335 +	return DoControl(EControlDeviceDisconnectFromHost);
   1.336 +	}
   1.337 +
   1.338 +
   1.339 +inline TInt RDevUsbcClient::DeviceConnectToHost()
   1.340 +	{
   1.341 +	return DoControl(EControlDeviceConnectToHost);
   1.342 +	}
   1.343 +
   1.344 +
   1.345 +inline TInt RDevUsbcClient::PowerUpUdc()
   1.346 +	{
   1.347 +	return DoControl(EControlDevicePowerUpUdc);
   1.348 +	}
   1.349 +
   1.350 +
   1.351 +inline TBool RDevUsbcClient::CurrentlyUsingHighSpeed()
   1.352 +	{
   1.353 +	return DoControl(EControlCurrentlyUsingHighSpeed);
   1.354 +	}
   1.355 +
   1.356 +
   1.357 +inline TInt RDevUsbcClient::SetInterface(TInt aInterfaceNumber, TUsbcInterfaceInfoBuf& aInterfaceData,
   1.358 +										 TUint32 aBandwidthPriority)
   1.359 +	{
   1.360 +	TPtr8 name_8(NULL,0);
   1.361 +	TUsbcIfcInfo ifcinfo;
   1.362 +	ifcinfo.iInterfaceData = const_cast<TUsbcInterfaceInfoBuf*>(&aInterfaceData);
   1.363 +	if (!aInterfaceData().iString)
   1.364 +		{
   1.365 +		ifcinfo.iString = NULL;
   1.366 +		}
   1.367 +	else
   1.368 +		{
   1.369 +		name_8.Set(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aInterfaceData().iString->Ptr())),
   1.370 +				   aInterfaceData().iString->Size(), aInterfaceData().iString->Size());
   1.371 +		ifcinfo.iString = &name_8;
   1.372 +		}
   1.373 +	ifcinfo.iBandwidthPriority = aBandwidthPriority;
   1.374 +	return DoControl(EControlSetInterface, (TAny*)aInterfaceNumber, &ifcinfo);
   1.375 +	}
   1.376 +
   1.377 +
   1.378 +inline TInt RDevUsbcClient::ReleaseInterface(TInt aInterfaceNumber)
   1.379 +	{
   1.380 +	return DoControl(EControlReleaseInterface, (TAny*)aInterfaceNumber);
   1.381 +	}
   1.382 +
   1.383 +
   1.384 +inline TInt RDevUsbcClient::SetCSInterfaceDescriptorBlock(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor)
   1.385 +	{
   1.386 +	TCSDescriptorInfo info = {aSettingNumber, 0, const_cast<TDesC8*>(&aInterfaceDescriptor),
   1.387 +							  aInterfaceDescriptor.Size()};
   1.388 +	return DoControl(EControlSetCSInterfaceDescriptor, &info, NULL);
   1.389 +	}
   1.390 +
   1.391 +
   1.392 +inline TInt RDevUsbcClient::SetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
   1.393 +														 const TDesC8& aEndpointDescriptor)
   1.394 +	{
   1.395 +	TCSDescriptorInfo info = {aSettingNumber, aEndpointNumber, const_cast<TDesC8*>(&aEndpointDescriptor),
   1.396 +							  aEndpointDescriptor.Size()};
   1.397 +	return DoControl(EControlSetCSEndpointDescriptor, &info, NULL);
   1.398 +	}
   1.399 +
   1.400 +
   1.401 +inline TInt RDevUsbcClient::SetDeviceControl()
   1.402 +	{
   1.403 +	return DoControl(EControlSetDeviceControl);
   1.404 +	}
   1.405 +
   1.406 +
   1.407 +inline TInt RDevUsbcClient::ReleaseDeviceControl()
   1.408 +	{
   1.409 +	return DoControl(EControlReleaseDeviceControl);
   1.410 +	}
   1.411 +
   1.412 +
   1.413 +inline TInt RDevUsbcClient::GetStringDescriptorLangId(TUint16& aLangId)
   1.414 +	{
   1.415 +	TPckgBuf<TUint16> p;
   1.416 +	const TInt r = DoControl(EControlGetStringDescriptorLangId, &p);
   1.417 +	if (r == KErrNone)
   1.418 +		aLangId = p();
   1.419 +	return r;
   1.420 +	}
   1.421 +
   1.422 +
   1.423 +inline TInt RDevUsbcClient::SetStringDescriptorLangId(TUint16 aLangId)
   1.424 +	{
   1.425 +	return DoControl(EControlSetStringDescriptorLangId, (TAny*)(TUint)aLangId);
   1.426 +	}
   1.427 +
   1.428 +
   1.429 +inline TInt RDevUsbcClient::GetManufacturerStringDescriptor(TDes16& aString)
   1.430 +	{
   1.431 +	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
   1.432 +	const TInt r = DoControl(EControlGetManufacturerStringDescriptor, &name_8);
   1.433 +	aString.SetLength(name_8.Size()/2);
   1.434 +	return r;
   1.435 +	}
   1.436 +
   1.437 +
   1.438 +inline TInt RDevUsbcClient::SetManufacturerStringDescriptor(const TDesC16& aString)
   1.439 +	{
   1.440 +	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
   1.441 +	return DoControl(EControlSetManufacturerStringDescriptor, &name_8);
   1.442 +	}
   1.443 +
   1.444 +
   1.445 +inline TInt RDevUsbcClient::RemoveManufacturerStringDescriptor()
   1.446 +	{
   1.447 +	return DoControl(EControlRemoveManufacturerStringDescriptor);
   1.448 +	}
   1.449 +
   1.450 +
   1.451 +inline TInt RDevUsbcClient::GetProductStringDescriptor(TDes16& aString)
   1.452 +	{
   1.453 +	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
   1.454 +	const TInt r = DoControl(EControlGetProductStringDescriptor, &name_8);
   1.455 +	aString.SetLength(name_8.Size()/2);
   1.456 +	return r;
   1.457 +	}
   1.458 +
   1.459 +
   1.460 +inline TInt RDevUsbcClient::SetProductStringDescriptor(const TDesC16& aString)
   1.461 +	{
   1.462 +	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
   1.463 +	return DoControl(EControlSetProductStringDescriptor, &name_8);
   1.464 +	}
   1.465 +
   1.466 +
   1.467 +inline TInt RDevUsbcClient::RemoveProductStringDescriptor()
   1.468 +	{
   1.469 +	return DoControl(EControlRemoveProductStringDescriptor);
   1.470 +	}
   1.471 +
   1.472 +
   1.473 +inline TInt RDevUsbcClient::GetSerialNumberStringDescriptor(TDes16& aString)
   1.474 +	{
   1.475 +	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
   1.476 +	const TInt r = DoControl(EControlGetSerialNumberStringDescriptor, &name_8);
   1.477 +	aString.SetLength(name_8.Size()/2);
   1.478 +	return r;
   1.479 +	}
   1.480 +
   1.481 +
   1.482 +inline TInt RDevUsbcClient::SetSerialNumberStringDescriptor(const TDesC16& aString)
   1.483 +	{
   1.484 +	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
   1.485 +	return DoControl(EControlSetSerialNumberStringDescriptor, &name_8);
   1.486 +	}
   1.487 +
   1.488 +
   1.489 +inline TInt RDevUsbcClient::RemoveSerialNumberStringDescriptor()
   1.490 +	{
   1.491 +	return DoControl(EControlRemoveSerialNumberStringDescriptor);
   1.492 +	}
   1.493 +
   1.494 +
   1.495 +inline TInt RDevUsbcClient::GetConfigurationStringDescriptor(TDes16& aString)
   1.496 +	{
   1.497 +	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
   1.498 +	const TInt r = DoControl(EControlGetConfigurationStringDescriptor, &name_8);
   1.499 +	aString.SetLength(name_8.Size() / 2);
   1.500 +	return r;
   1.501 +	}
   1.502 +
   1.503 +
   1.504 +inline TInt RDevUsbcClient::SetConfigurationStringDescriptor(const TDesC16& aString)
   1.505 +	{
   1.506 +	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
   1.507 +	return DoControl(EControlSetConfigurationStringDescriptor, &name_8);
   1.508 +	}
   1.509 +
   1.510 +
   1.511 +inline TInt RDevUsbcClient::RemoveConfigurationStringDescriptor()
   1.512 +	{
   1.513 +	return DoControl(EControlRemoveConfigurationStringDescriptor);
   1.514 +	}
   1.515 +
   1.516 +
   1.517 +inline TInt RDevUsbcClient::GetStringDescriptor(TUint8 aIndex, TDes16& aString)
   1.518 +	{
   1.519 +	TPtr8 name_8(const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aString.Ptr())), aString.MaxSize());
   1.520 +	const TInt r = DoControl(EControlGetStringDescriptor, (TAny*)(TUint)aIndex, &name_8);
   1.521 +	aString.SetLength(name_8.Size() / 2);
   1.522 +	return r;
   1.523 +	}
   1.524 +
   1.525 +
   1.526 +inline TInt RDevUsbcClient::SetStringDescriptor(TUint8 aIndex, const TDesC16& aString)
   1.527 +	{
   1.528 +	TPtrC8 name_8(reinterpret_cast<const TUint8*>(aString.Ptr()), aString.Size());
   1.529 +	return DoControl(EControlSetStringDescriptor, (TAny*)(TUint)aIndex, &name_8);
   1.530 +	}
   1.531 +
   1.532 +
   1.533 +inline TInt RDevUsbcClient::RemoveStringDescriptor(TUint8 aIndex)
   1.534 +	{
   1.535 +	return DoControl(EControlRemoveStringDescriptor, (TAny*)(TUint)aIndex);
   1.536 +	}
   1.537 +
   1.538 +
   1.539 +inline TInt RDevUsbcClient::AllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource)
   1.540 +	{
   1.541 +	return DoControl(EControlAllocateEndpointResource, (TAny*)aEndpoint, (TAny*)aResource);
   1.542 +	}
   1.543 +
   1.544 +
   1.545 +inline TInt RDevUsbcClient::DeAllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource)
   1.546 +	{
   1.547 +	return DoControl(EControlDeAllocateEndpointResource, (TAny*)aEndpoint, (TAny*)aResource);
   1.548 +	}
   1.549 +
   1.550 +
   1.551 +inline TBool RDevUsbcClient::QueryEndpointResourceUse(TInt aEndpoint, TUsbcEndpointResource aResource)
   1.552 +	{
   1.553 +	return DoControl(EControlQueryEndpointResourceUse, (TAny*)aEndpoint, (TAny*)aResource);
   1.554 +	}
   1.555 +
   1.556 +
   1.557 +inline void RDevUsbcClient::ReadUntilShort(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes)
   1.558 +	{
   1.559 +	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
   1.560 +	TEndpointTransferInfo info = {&aDes, ETransferTypeReadUntilShort, aDes.MaxLength()};
   1.561 +	DoRequest(ep, aStatus, &info, NULL);
   1.562 +	}
   1.563 +
   1.564 +
   1.565 +inline void RDevUsbcClient::ReadUntilShort(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes,
   1.566 +										   TInt aLen)
   1.567 +	{
   1.568 +	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
   1.569 +	TEndpointTransferInfo info = {&aDes, ETransferTypeReadUntilShort, aLen};
   1.570 +	DoRequest(ep, aStatus, &info, NULL);
   1.571 +	}
   1.572 +
   1.573 +
   1.574 +inline void RDevUsbcClient::ReadOneOrMore(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes)
   1.575 +	{
   1.576 +	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
   1.577 +	TEndpointTransferInfo info = {&aDes, ETransferTypeReadOneOrMore, aDes.MaxLength()};
   1.578 +	DoRequest(ep, aStatus, &info, NULL);
   1.579 +	}
   1.580 +
   1.581 +
   1.582 +inline void RDevUsbcClient::ReadOneOrMore(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes,
   1.583 +										  TInt aLen)
   1.584 +	{
   1.585 +	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
   1.586 +	TEndpointTransferInfo info = {&aDes, ETransferTypeReadOneOrMore, aLen};
   1.587 +	DoRequest(ep, aStatus, &info, NULL);
   1.588 +	}
   1.589 +
   1.590 +
   1.591 +inline void RDevUsbcClient::Read(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes)
   1.592 +	{
   1.593 +	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
   1.594 +	TEndpointTransferInfo info = {&aDes, ETransferTypeReadData, aDes.MaxLength()};
   1.595 +	DoRequest(ep, aStatus, &info, NULL);
   1.596 +	}
   1.597 +
   1.598 +
   1.599 +inline void RDevUsbcClient::Read(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes, TInt aLen)
   1.600 +	{
   1.601 +	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
   1.602 +	TEndpointTransferInfo info = {&aDes, ETransferTypeReadData, aLen};
   1.603 +	DoRequest(ep, aStatus, &info, NULL);
   1.604 +	}
   1.605 +
   1.606 +
   1.607 +inline void RDevUsbcClient::ReadPacket(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes,
   1.608 +									   TInt aMaxLen)
   1.609 +	{
   1.610 +	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
   1.611 +	TEndpointTransferInfo info = {&aDes, ETransferTypeReadPacket, aMaxLen};
   1.612 +	DoRequest(ep, aStatus, &info, NULL);
   1.613 +	}
   1.614 +
   1.615 +
   1.616 +inline void RDevUsbcClient::Write(TRequestStatus &aStatus, TEndpointNumber aEndpoint, const TDesC8& aDes,
   1.617 +								  TInt aLen, TBool aZlpRequired)
   1.618 +	{
   1.619 +	TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
   1.620 +	TEndpointTransferInfo info = {const_cast<TDesC8*>(&aDes), ETransferTypeWrite, aLen, aZlpRequired};
   1.621 +	DoRequest(ep, aStatus, &info, NULL);
   1.622 +	}
   1.623 +
   1.624 +
   1.625 +inline void RDevUsbcClient::AlternateDeviceStatusNotify(TRequestStatus& aStatus, TUint& aValue)
   1.626 +	{
   1.627 +	DoRequest(ERequestAlternateDeviceStatusNotify, aStatus, &aValue);
   1.628 +	}
   1.629 +
   1.630 +
   1.631 +inline void RDevUsbcClient::ReEnumerate(TRequestStatus& aStatus)
   1.632 +	{
   1.633 +	DoRequest(ERequestReEnumerate, aStatus);
   1.634 +	}
   1.635 +
   1.636 +
   1.637 +inline void RDevUsbcClient::EndpointStatusNotify(TRequestStatus& aStatus, TUint& aEndpointMask)
   1.638 +	{
   1.639 +	DoRequest(ERequestEndpointStatusNotify, aStatus, &aEndpointMask);
   1.640 +	}
   1.641 +
   1.642 +
   1.643 +inline void RDevUsbcClient::ReadCancel(TEndpointNumber aEndpoint)
   1.644 +	{
   1.645 +	if (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient)
   1.646 +		return;
   1.647 +	DoCancel(1 << aEndpoint);
   1.648 +	}
   1.649 +
   1.650 +
   1.651 +inline void RDevUsbcClient::WriteCancel(TEndpointNumber aEndpoint)
   1.652 +	{
   1.653 +	ReadCancel(aEndpoint);
   1.654 +	}
   1.655 +
   1.656 +
   1.657 +inline void RDevUsbcClient::EndpointTransferCancel(TUint aEndpointMask)
   1.658 +	{
   1.659 +	/* Mask off non-endpoint cancels */
   1.660 +	DoCancel(aEndpointMask & ERequestAllCancel);
   1.661 +	}
   1.662 +
   1.663 +
   1.664 +inline void RDevUsbcClient::AlternateDeviceStatusNotifyCancel()
   1.665 +	{
   1.666 +	DoCancel(ERequestAlternateDeviceStatusNotifyCancel);
   1.667 +	}
   1.668 +
   1.669 +
   1.670 +inline void RDevUsbcClient::ReEnumerateCancel()
   1.671 +	{
   1.672 +	DoCancel(ERequestReEnumerateCancel);
   1.673 +	}
   1.674 +
   1.675 +
   1.676 +inline void RDevUsbcClient::EndpointStatusNotifyCancel()
   1.677 +	{
   1.678 +	DoCancel(ERequestEndpointStatusNotifyCancel);
   1.679 +	}
   1.680 +
   1.681 +inline TInt RDevUsbcClient::GetOtgFeatures(TUint8& aFeatures)
   1.682 +	{
   1.683 +	TPckgBuf<TUint8> p;
   1.684 +	TInt r = DoControl(EControlGetOtgFeatures, &p);
   1.685 +	if (r == KErrNone)
   1.686 +		aFeatures = p();
   1.687 +	return r;
   1.688 +	}
   1.689 +
   1.690 +
   1.691 +inline void RDevUsbcClient::OtgFeaturesNotify(TRequestStatus& aStatus, TUint8& aValue)
   1.692 +	{
   1.693 +	DoRequest(ERequestOtgFeaturesNotify, aStatus, &aValue);
   1.694 +	}
   1.695 +
   1.696 +
   1.697 +inline void RDevUsbcClient::OtgFeaturesNotifyCancel()
   1.698 +	{
   1.699 +	DoCancel(ERequestOtgFeaturesNotifyCancel);
   1.700 +	}
   1.701 +
   1.702 +
   1.703 +#endif // #ifndef __KERNEL_MODE__
   1.704 +
   1.705 +#endif // #ifndef __D32USBC_INL__