os/kernelhwsrv/kernel/eka/include/d32usbc.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/d32usbc.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1163 @@
     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.h
    1.18 +// User side class definitions for USB Device support.
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +/**
    1.23 + @file d32usbc.h
    1.24 + @publishedPartner
    1.25 + @released
    1.26 +*/
    1.27 +
    1.28 +#ifndef __D32USBC_H__
    1.29 +#define __D32USBC_H__
    1.30 +
    1.31 +#include <e32ver.h>
    1.32 +#include <usb.h>
    1.33 +#include <d32usbcshared.h>
    1.34 +
    1.35 +
    1.36 +
    1.37 +/** @internalComponent
    1.38 +*/
    1.39 +enum TTransferType
    1.40 +	{
    1.41 +	ETransferTypeReadData,
    1.42 +	ETransferTypeReadPacket,
    1.43 +	ETransferTypeWrite,
    1.44 +	ETransferTypeNone,
    1.45 +	ETransferTypeReadOneOrMore,
    1.46 +	ETransferTypeReadUntilShort
    1.47 +	};
    1.48 +
    1.49 +
    1.50 +/** Available endpoints. At most only these are available per interface.
    1.51 +*/
    1.52 +enum TEndpointNumber
    1.53 +	{
    1.54 +	EEndpoint0 = 0,
    1.55 +	EEndpoint1 = 1,
    1.56 +	EEndpoint2 = 2,
    1.57 +	EEndpoint3 = 3,
    1.58 +	EEndpoint4 = 4,
    1.59 +	EEndpoint5 = 5
    1.60 +	};
    1.61 +
    1.62 +
    1.63 +
    1.64 +
    1.65 +/** Bandwidth indicators for an Interface
    1.66 +
    1.67 +	@see RDevUsbcClient::SetInterface()
    1.68 +*/
    1.69 +enum TUsbcBandwidthPriority
    1.70 +	{
    1.71 +	/** Economical OUT buffering. */
    1.72 +	EUsbcBandwidthOUTDefault = 0x00,
    1.73 +	/** More memory than Default for OUT buffering. */
    1.74 +	EUsbcBandwidthOUTPlus1   = 0x01,
    1.75 +	/** More memory than Plus1 for OUT buffering. */
    1.76 +	EUsbcBandwidthOUTPlus2   = 0x02,
    1.77 +	/** Maximum memory for OUT buffering.
    1.78 +		Use this value for high volume USB High-speed
    1.79 +		data transfers only, otherwise memory will be wasted.
    1.80 +	*/
    1.81 +	EUsbcBandwidthOUTMaximum = 0x03,
    1.82 +	//
    1.83 +	/** Economical IN buffering */
    1.84 +	EUsbcBandwidthINDefault  = 0x00,
    1.85 +	/** More memory than Default for IN buffering */
    1.86 +	EUsbcBandwidthINPlus1    = 0x10,
    1.87 +	/** More memory than Plus1 for IN buffering */
    1.88 +	EUsbcBandwidthINPlus2    = 0x20,
    1.89 +	/** Maximum memory for IN buffering.
    1.90 +		Use this value for high volume USB High-speed
    1.91 +		data transfers only, otherwise memory will be wasted.
    1.92 +	*/
    1.93 +	EUsbcBandwidthINMaximum  = 0x30
    1.94 +	};
    1.95 +
    1.96 +
    1.97 +
    1.98 +
    1.99 +
   1.100 +
   1.101 +
   1.102 +/** Bit positions of endpoints.
   1.103 +
   1.104 +	@see RDevUsbcClient::EndpointStatusNotify()
   1.105 +	@see RDevUsbcClient::EndpointTransferCancel()
   1.106 +
   1.107 +	Bit position of endpoint0.
   1.108 +*/
   1.109 +const TUint KUsbcEndpoint0Bit = 1<<EEndpoint0;
   1.110 +/** Bit position of endpoint1.
   1.111 +*/
   1.112 +const TUint KUsbcEndpoint1Bit = 1<<EEndpoint1;
   1.113 +/** Bit position of endpoint2.
   1.114 +*/
   1.115 +const TUint KUsbcEndpoint2Bit = 1<<EEndpoint2;
   1.116 +/** Bit position of endpoint3.
   1.117 +*/
   1.118 +const TUint KUsbcEndpoint3Bit = 1<<EEndpoint3;
   1.119 +/** Bit position of endpoint4.
   1.120 +*/
   1.121 +const TUint KUsbcEndpoint4Bit = 1<<EEndpoint4;
   1.122 +/** Bit position of endpoint5.
   1.123 +*/
   1.124 +const TUint KUsbcEndpoint5Bit = 1<<EEndpoint5;
   1.125 +
   1.126 +
   1.127 +
   1.128 +
   1.129 +
   1.130 +
   1.131 +
   1.132 +
   1.133 +/** This must be filled in prior to a call to RDevUsbcClient::SetInterface().
   1.134 +*/
   1.135 +class TUsbcInterfaceInfo
   1.136 +	{
   1.137 +public:
   1.138 +	TUsbcInterfaceInfo(TInt aClass=0, TInt aSubClass=0, TInt aProtocol=0,
   1.139 +					   TDesC16* aString=NULL, TUint aTotalEndpoints=0);
   1.140 +public:
   1.141 +	/** The class, subclass and protocol that this interface supports. */
   1.142 +	TUsbcClassInfo iClass;
   1.143 +	/** The description string for the interface. Used to construct the interface string descriptor. */
   1.144 +	const TDesC16* iString;
   1.145 +	/** Total number of endpoints being requested (0-5). Endpoint 0 should not be included in this number. */
   1.146 +	TUint iTotalEndpointsUsed;
   1.147 +	/** Desired properties of the endpoints requested.
   1.148 +		Do NOT include endpoint 0.
   1.149 +		APIs use endpoint numbers that are offsets into this array.
   1.150 +	*/
   1.151 +	TUsbcEndpointInfo iEndpointData[KMaxEndpointsPerClient];
   1.152 +	/** 32 flag bits used for specifying miscellaneous Interface features.
   1.153 +		Currently defined are:
   1.154 +		- KUsbcInterfaceInfo_NoEp0RequestsPlease = 0x00000001
   1.155 +	*/
   1.156 +	TUint32 iFeatureWord;
   1.157 +	};
   1.158 +
   1.159 +
   1.160 +/** Package buffer for a TUsbcInterfaceInfo object.
   1.161 +
   1.162 +	@see TUsbcInterfaceInfo
   1.163 +*/
   1.164 +typedef TPckgBuf<TUsbcInterfaceInfo> TUsbcInterfaceInfoBuf;
   1.165 +
   1.166 +
   1.167 +/** The user side handle to the USB client driver.
   1.168 +*/
   1.169 +class RDevUsbcClient : public RBusLogicalChannel
   1.170 +	{
   1.171 +public:
   1.172 +	/** @internalComponent */
   1.173 +	enum TVer
   1.174 +		{
   1.175 +		EMajorVersionNumber = 0,
   1.176 +		EMinorVersionNumber = 1,
   1.177 +		EBuildVersionNumber = KE32BuildVersionNumber
   1.178 +		};
   1.179 +
   1.180 +	enum TRequest
   1.181 +		{
   1.182 +		// Positive requests.
   1.183 +		ERequestEp0 = 0x0,
   1.184 +		ERequestEp1 = EEndpoint1,
   1.185 +		ERequestEp2 = EEndpoint2,
   1.186 +		ERequestEp3 = EEndpoint3,
   1.187 +		ERequestEp4 = EEndpoint4,
   1.188 +		ERequestEp5 = EEndpoint5,
   1.189 +		ERequestUnused = 6,
   1.190 +		ERequestAlternateDeviceStatusNotify = 7,
   1.191 +		ERequestReEnumerate = 8,
   1.192 +		ERequestEndpointStatusNotify = 9,
   1.193 +		// The cancel TRequest's are interpreted as bitmaps. As they're not mixed
   1.194 +		// with the previous ones, it doesn't matter if they have the same absolute
   1.195 +		// value as those.
   1.196 +		ERequestEp0Cancel = 1<<ERequestEp0,
   1.197 +		ERequestEp1Cancel = 1<<ERequestEp1,
   1.198 +		ERequestEp2Cancel = 1<<ERequestEp2,
   1.199 +		ERequestEp3Cancel = 1<<ERequestEp3,
   1.200 +		ERequestEp4Cancel = 1<<ERequestEp4,
   1.201 +		ERequestEp5Cancel = 1<<ERequestEp5,
   1.202 +		ERequestUnusedCancel = 1<<ERequestUnused,
   1.203 +        ERequestAllCancel = (ERequestEp0Cancel | ERequestEp1Cancel |
   1.204 +							 ERequestEp2Cancel | ERequestEp3Cancel |
   1.205 +							 ERequestEp4Cancel | ERequestEp5Cancel |
   1.206 +							 ERequestUnusedCancel),
   1.207 +		ERequestAlternateDeviceStatusNotifyCancel = 1<<ERequestAlternateDeviceStatusNotify,
   1.208 +		ERequestReEnumerateCancel = 1<<ERequestReEnumerate,
   1.209 +		ERequestEndpointStatusNotifyCancel = 1<<ERequestEndpointStatusNotify,
   1.210 +        ERequestOtgFeaturesNotify = 10,
   1.211 +        ERequestOtgFeaturesNotifyCancel = 1<<ERequestOtgFeaturesNotify,
   1.212 +		};
   1.213 +
   1.214 +	enum TControl
   1.215 +		{
   1.216 +		// Changing the order of these enums will break BC.
   1.217 +		EControlEndpointZeroRequestError,					// 0
   1.218 +		EControlEndpointCaps,
   1.219 +		EControlDeviceCaps,
   1.220 +		EControlGetAlternateSetting,
   1.221 +		EControlDeviceStatus,
   1.222 +		EControlEndpointStatus,
   1.223 +		EControlSetInterface,
   1.224 +		EControlReleaseInterface,
   1.225 +		EControlQueryReceiveBuffer,
   1.226 +		EControlSendEp0StatusPacket,						// 9
   1.227 +		//
   1.228 +		EControlHaltEndpoint,								// 10
   1.229 +		EControlClearHaltEndpoint,
   1.230 +		EControlSetDeviceControl,
   1.231 +		EControlReleaseDeviceControl,
   1.232 +		EControlEndpointZeroMaxPacketSizes,
   1.233 +		EControlSetEndpointZeroMaxPacketSize,
   1.234 +		EControlGetDeviceDescriptor,
   1.235 +		EControlSetDeviceDescriptor,
   1.236 +		EControlGetDeviceDescriptorSize,
   1.237 +		EControlGetConfigurationDescriptor,					// 19
   1.238 +		//
   1.239 +		EControlSetConfigurationDescriptor,					// 20
   1.240 +		EControlGetConfigurationDescriptorSize,
   1.241 +		EControlGetInterfaceDescriptor,
   1.242 +		EControlSetInterfaceDescriptor,
   1.243 +		EControlGetInterfaceDescriptorSize,
   1.244 +		EControlGetEndpointDescriptor,
   1.245 +		EControlSetEndpointDescriptor,
   1.246 +		EControlGetEndpointDescriptorSize,
   1.247 +		EControlGetCSInterfaceDescriptor,
   1.248 +		EControlSetCSInterfaceDescriptor,					// 29
   1.249 +		//
   1.250 +		EControlGetCSInterfaceDescriptorSize,				// 30
   1.251 +		EControlGetCSEndpointDescriptor,
   1.252 +		EControlSetCSEndpointDescriptor,
   1.253 +		EControlGetCSEndpointDescriptorSize,
   1.254 +		EControlSignalRemoteWakeup,
   1.255 +		EControlGetStringDescriptorLangId,
   1.256 +		EControlSetStringDescriptorLangId,
   1.257 +		EControlGetManufacturerStringDescriptor,
   1.258 +		EControlSetManufacturerStringDescriptor,
   1.259 +		EControlRemoveManufacturerStringDescriptor,			// 39
   1.260 +		//
   1.261 +		EControlGetProductStringDescriptor,					// 40
   1.262 +		EControlSetProductStringDescriptor,
   1.263 +		EControlRemoveProductStringDescriptor,
   1.264 +		EControlGetSerialNumberStringDescriptor,
   1.265 +		EControlSetSerialNumberStringDescriptor,
   1.266 +		EControlRemoveSerialNumberStringDescriptor,
   1.267 +		EControlGetConfigurationStringDescriptor,
   1.268 +		EControlSetConfigurationStringDescriptor,
   1.269 +		EControlRemoveConfigurationStringDescriptor,
   1.270 +		EControlDeviceDisconnectFromHost,					// 49
   1.271 +		//
   1.272 +		EControlDeviceConnectToHost,						// 50
   1.273 +		EControlDevicePowerUpUdc,
   1.274 +		EControlDumpRegisters,
   1.275 +		EControlSetInterface1,								// (not used)
   1.276 +		EControlAllocateEndpointResource,
   1.277 +		EControlDeAllocateEndpointResource,
   1.278 +		EControlQueryEndpointResourceUse,
   1.279 +		EControlGetEndpointZeroMaxPacketSize,
   1.280 +		EControlGetDeviceQualifierDescriptor,
   1.281 +		EControlSetDeviceQualifierDescriptor,				// 59
   1.282 +		//
   1.283 +		EControlGetOtherSpeedConfigurationDescriptor,		// 60
   1.284 +		EControlSetOtherSpeedConfigurationDescriptor,
   1.285 +		EControlCurrentlyUsingHighSpeed,
   1.286 +		EControlSetStringDescriptor,
   1.287 +		EControlGetStringDescriptor,
   1.288 +		EControlRemoveStringDescriptor,
   1.289 +        EControlSetOtgDescriptor,
   1.290 +        EControlGetOtgDescriptor,
   1.291 +        EControlGetOtgFeatures
   1.292 +		};
   1.293 +
   1.294 +public:
   1.295 +
   1.296 +#ifndef __KERNEL_MODE__
   1.297 +
   1.298 +	/** Opens a channel.
   1.299 +
   1.300 +		@param aUnit This should be 0 (zero).
   1.301 +
   1.302 +		@return KErrNone if successful.
   1.303 +	*/
   1.304 +	inline TInt Open(TInt aUnit);
   1.305 +
   1.306 +	inline TVersion VersionRequired() const;
   1.307 +
   1.308 +	/** Stalls ep0 to signal command fault to the host.
   1.309 +
   1.310 +		@return KErrNone if successful.
   1.311 +	*/
   1.312 +	inline TInt EndpointZeroRequestError();
   1.313 +
   1.314 +	/** Retrieves the capabilities of all the endpoints on the device.
   1.315 +
   1.316 +		Suggested use is as follows:
   1.317 +
   1.318 +		@code
   1.319 +		TUsbcEndpointData data[KUsbcMaxEndpoints];
   1.320 +		TPtr8 dataPtr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
   1.321 +		ret = usbPort.EndpointCaps(dataPtr);
   1.322 +		@endcode
   1.323 +
   1.324 +		@param aEpCapsBuf a descriptor encapsulating an array of TUsbcEndpointData.
   1.325 +
   1.326 +		@return KErrNone if successful.
   1.327 +	*/
   1.328 +	inline TInt EndpointCaps(TDes8& aEpCapsBuf);
   1.329 +
   1.330 +	/** Retrieves the capabilities of the USB device.
   1.331 +
   1.332 +		@see TUsbDeviceCaps
   1.333 +
   1.334 +		@param aDevCapsBuf a TUsbDeviceCaps object.
   1.335 +
   1.336 +		@return KErrNone if successful.
   1.337 +	*/
   1.338 +	inline TInt DeviceCaps(TUsbDeviceCaps& aDevCapsBuf);
   1.339 +
   1.340 +	/** Copies the current alternate setting for this interface into aInterfaceNumber
   1.341 +		For USB Interfaces whose main interface is active, this will be 0 (zero).
   1.342 +
   1.343 +		@param aInterfaceNumber current alternate setting for this interface is copied into this.
   1.344 +
   1.345 +		@return KErrNone if successful.
   1.346 +	*/
   1.347 +	inline TInt GetAlternateSetting(TInt& aInterfaceNumber);
   1.348 +
   1.349 +	/** Copies the current device status into aDeviceStatus.
   1.350 +
   1.351 +		@param aDeviceStatus current device status is copied into this.
   1.352 +
   1.353 +		@return KErrNone if successful
   1.354 +	*/
   1.355 +	inline TInt DeviceStatus(TUsbcDeviceState& aDeviceStatus);
   1.356 +
   1.357 +	/** Copies the current endpoint status into aEndpointStatus.
   1.358 +
   1.359 +		@param aEndpoint endpoint number valid for the current alternate setting.
   1.360 +		@param aEndpointStatus the current endpoint status, might be stalled, not stalled or unknown.
   1.361 +
   1.362 +		@return KErrNone if successful.
   1.363 +	*/
   1.364 +	inline TInt EndpointStatus(TEndpointNumber aEndpoint, TEndpointState& aEndpointStatus);
   1.365 +
   1.366 +	/** Copies the number of bytes available in the aEndpoint read buffer into aNumberOfBytes.
   1.367 +
   1.368 +		@param aEndpoint endpoint number valid for the current alternate setting.
   1.369 +		@param aNumberOfBytes number of bytes available in the aEndpoint read buffer.
   1.370 +
   1.371 +		@return KErrNone if successful.
   1.372 +	*/
   1.373 +	inline TInt QueryReceiveBuffer(TEndpointNumber aEndpoint, TInt& aNumberOfBytes);
   1.374 +
   1.375 +	/** Requests that a zero length status packet be sent to the host in response
   1.376 +		to a class or vendor specific ep0 SETUP packet.
   1.377 +
   1.378 +		@return KErrNone if successful.
   1.379 +	*/
   1.380 +	inline TInt SendEp0StatusPacket();
   1.381 +
   1.382 +	/** Stalls endpoint aEndpoint, usually to indicate an error condition with a previous command.
   1.383 +		The host will normally send a SET_FEATURE command on ep0 to acknowledge and clear the stall.
   1.384 +
   1.385 +		@return KErrNone if successful.
   1.386 +	*/
   1.387 +	inline TInt HaltEndpoint(TEndpointNumber aEndpoint);
   1.388 +
   1.389 +	/** Clears the stall condition on endpoint aEndpoint. This is inluded for symmetry and test purposes.
   1.390 +
   1.391 +		@return KErrNone if successful.
   1.392 +	*/
   1.393 +	inline TInt ClearHaltEndpoint(TEndpointNumber aEndpoint);
   1.394 +
   1.395 +	/** Requests that device control be allocated to this channel.
   1.396 +
   1.397 +		@return KErrNone if successful.
   1.398 +	*/
   1.399 +	inline TInt SetDeviceControl();
   1.400 +
   1.401 +	/** Relinquishes device control previously allocated to this channel.
   1.402 +
   1.403 +		@return KErrNone if successful.
   1.404 +	*/
   1.405 +	inline TInt ReleaseDeviceControl();
   1.406 +
   1.407 +	/** Returns a bitmap of available ep0 maximum packet sizes.
   1.408 +
   1.409 +		@return bitmap of available ep0 maximum packet sizes.
   1.410 +	*/
   1.411 +	inline TUint EndpointZeroMaxPacketSizes();
   1.412 +
   1.413 +	/** Requests that a maximum packet size of aMaxPacketSize be set on ep0.
   1.414 +
   1.415 +		@param aMaxPacketSize The maximum packet size.
   1.416 +
   1.417 +		@return KErrNone if successful.
   1.418 +	*/
   1.419 +	inline TInt SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize);
   1.420 +
   1.421 +	/** Queries the current maximum packet size on ep0.
   1.422 +
   1.423 +		@return The currently set maximum packet size on ep0.
   1.424 +	*/
   1.425 +	inline TInt GetEndpointZeroMaxPacketSize();
   1.426 +
   1.427 +	/** Copies the current device descriptor into aDeviceDescriptor.
   1.428 +
   1.429 +		@param aDeviceDescriptor Receives the current device descriptor.
   1.430 +
   1.431 +		@return KErrNone if successful.
   1.432 +	*/
   1.433 +	inline TInt GetDeviceDescriptor(TDes8& aDeviceDescriptor);
   1.434 +
   1.435 +	/** Sets the contents of aDeviceDescriptor to be the current device descriptor.
   1.436 +
   1.437 +		@param aDeviceDescriptor contains the device descriptor.
   1.438 +
   1.439 +		@return KErrNone if successful.
   1.440 +	*/
   1.441 +	inline TInt SetDeviceDescriptor(const TDesC8& aDeviceDescriptor);
   1.442 +
   1.443 +	/** Gets the size of the current device descriptor. This is unlikely to be anything other than 9.
   1.444 +
   1.445 +		@param aSize receives the size of the current device descriptor.
   1.446 +
   1.447 +		@return KErrNone if successful.
   1.448 +	*/
   1.449 +	inline TInt GetDeviceDescriptorSize(TInt& aSize);
   1.450 +
   1.451 +	/** Copies the current configuration descriptor into aConfigurationDescriptor.
   1.452 +
   1.453 +		@param aConfigurationDescriptor Receives the current configuration descriptor.
   1.454 +
   1.455 +		@return KErrNone if successful.
   1.456 +	*/
   1.457 +	inline TInt GetConfigurationDescriptor(TDes8& aConfigurationDescriptor);
   1.458 +
   1.459 +	/** Sets the contents of aConfigurationDescriptor to be the current configuration descriptor.
   1.460 +
   1.461 +		@param aConfigurationDescriptor contains the configuration descriptor.
   1.462 +
   1.463 +		@return KErrNone if successful.
   1.464 +	*/
   1.465 +	inline TInt SetConfigurationDescriptor(const TDesC8& aConfigurationDescriptor);
   1.466 +
   1.467 +	/** Gets the size of the current configuration descriptor.
   1.468 +
   1.469 +		@param aSize receives the size of the current configuration descriptor.
   1.470 +
   1.471 +		@return KErrNone if successful.
   1.472 +	*/
   1.473 +	inline TInt GetConfigurationDescriptorSize(TInt& aSize);
   1.474 +
   1.475 +	/** Copies the interface descriptor into aInterfaceDescriptor for the interface with alternate
   1.476 +		setting aSettingNumber, 0 for the main interface.
   1.477 +
   1.478 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.479 +		@param aInterfaceDescriptor Receives the interface descriptor.
   1.480 +
   1.481 +		@return KErrNone if successful.
   1.482 +	*/
   1.483 +	inline TInt GetInterfaceDescriptor(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
   1.484 +
   1.485 +	/** Sets the interface descriptor contained in aInterfaceDescriptor for the interface with
   1.486 +		alternate setting aSettingNumber, 0 for the main interface, for transmission to the host
   1.487 +		during enumeration.
   1.488 +
   1.489 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.490 +		@param aInterfaceDescriptor Contains the interface descriptor to be set.
   1.491 +
   1.492 +		@return KErrNone if successful.
   1.493 +	*/
   1.494 +	inline TInt SetInterfaceDescriptor(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
   1.495 +
   1.496 +	/** Copies the size of the interface descriptor for the interface with alternate
   1.497 +		setting aSettingNumber, 0 for the main interface, into aSize.
   1.498 +
   1.499 +		@param aSettingNumber The alternate setting.
   1.500 +		@param aSize receives the size of the interface descriptor.
   1.501 +
   1.502 +		@return KErrNone if successful.
   1.503 +	*/
   1.504 +	inline TInt GetInterfaceDescriptorSize(TInt aSettingNumber, TInt& aSize);
   1.505 +
   1.506 +	/** Copies the endpoint descriptor for logical endpoint number aEndpointNumber into aEndpointDescriptor
   1.507 +		for the interface with alternate setting aSettingNumber, 0 for the main interface.
   1.508 +
   1.509 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.510 +		@param aEndpointNumber.
   1.511 +		@param aEndpointDescriptor Receives the endpoint descriptor.
   1.512 +
   1.513 +		@return KErrNone if successful.
   1.514 +	*/
   1.515 +	inline TInt GetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber, TDes8& aEndpointDescriptor);
   1.516 +
   1.517 +	/** Sets the endpoint descriptor for logical endpoint number aEndpointNumber contained in
   1.518 +		aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
   1.519 +		for transmission to the host during enumeration.
   1.520 +
   1.521 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.522 +		@param aEndpointNumber Valid endpoint number on this interface.
   1.523 +		@param aEndpointDescriptor Contains the endpoint descriptor to be set.
   1.524 +
   1.525 +		@return KErrNone if successful.
   1.526 +	*/
   1.527 +	inline TInt SetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
   1.528 +									  const TDesC8& aEndpointDescriptor);
   1.529 +
   1.530 +	/** Copies the size of the endpoint descriptor for logical endpoint number aEndpointNumber for the
   1.531 +		interface with alternate setting aSettingNumber, 0 for the main interface, into aSize.
   1.532 +
   1.533 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.534 +		@param aEndpointNumber Valid endpoint number on this interface.
   1.535 +		@param aSize receives the size of the endpoint descriptor.
   1.536 +
   1.537 +		@return KErrNone if successful.
   1.538 +	*/
   1.539 +	inline TInt GetEndpointDescriptorSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
   1.540 +
   1.541 +    /** Get OTG descriptor size
   1.542 +
   1.543 +		@param aSize TInt reference which contains OTG descriptor size on return
   1.544 +    */
   1.545 +    inline void GetOtgDescriptorSize(TInt& aSize);
   1.546 +
   1.547 +    /** Get OTG descriptor of USB on-the-go feature
   1.548 +
   1.549 +		@param aOtgDesc User-side buffer to store copy of descriptor
   1.550 +
   1.551 +		@return KErrNone if successful
   1.552 +    */
   1.553 +    inline TInt GetOtgDescriptor(TDes8& aOtgDesc);
   1.554 +
   1.555 +    /** Set OTG descriptor by user to enable/disable USB on-the-go feature
   1.556 +
   1.557 +		@param aOtgDesc Descriptor buffer containing OTG features
   1.558 +
   1.559 +		@return KErrNone if successful
   1.560 +    */
   1.561 +    inline TInt SetOtgDescriptor(const TDesC8& aOtgDesc);
   1.562 +
   1.563 +	/** Copies the current device_qualifier descriptor into aDescriptor.
   1.564 +
   1.565 +		@param aDescriptor Receives the current device_qualifier descriptor.
   1.566 +
   1.567 +		@return KErrNone if successful.
   1.568 +	*/
   1.569 +	inline TInt GetDeviceQualifierDescriptor(TDes8& aDescriptor);
   1.570 +
   1.571 +	/** Sets the device_qualifier descriptor to the contents of aDescriptor.
   1.572 +
   1.573 +		@param aDescriptor contains the new device_qualifier descriptor.
   1.574 +
   1.575 +		@return KErrNone if successful.
   1.576 +	*/
   1.577 +	inline TInt SetDeviceQualifierDescriptor(const TDesC8& aDescriptor);
   1.578 +
   1.579 +	/** Copies the current other_speed_configuration descriptor into aDescriptor.
   1.580 +
   1.581 +		@param aDescriptor Receives the current other_speed_configuration descriptor.
   1.582 +
   1.583 +		@return KErrNone if successful.
   1.584 +	*/
   1.585 +	inline TInt GetOtherSpeedConfigurationDescriptor(TDes8& aDescriptor);
   1.586 +
   1.587 +	/** Sets the other_speed_configuration descriptor to the contents of aDescriptor.
   1.588 +
   1.589 +		@param aDescriptor contains the new other_speed_configuration descriptor.
   1.590 +
   1.591 +		@return KErrNone if successful.
   1.592 +	*/
   1.593 +	inline TInt SetOtherSpeedConfigurationDescriptor(const TDesC8& aDescriptor);
   1.594 +
   1.595 +	/** Copies the class specific interface descriptor block into aInterfaceDescriptor for the interface
   1.596 +		with alternate setting aSettingNumber, 0 for the main interface.
   1.597 +
   1.598 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.599 +		@param aInterfaceDescriptor Contains the interface descriptor to be set.
   1.600 +
   1.601 +		@return KErrNone if successful.
   1.602 +	*/
   1.603 +	inline TInt GetCSInterfaceDescriptorBlock(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
   1.604 +
   1.605 +	/** aSettingNumber is the alternate interface setting, 0 for the main interface, that the descriptor block
   1.606 +		aDes should be attached to. aDes is a block of data containing at least one class specific descriptor
   1.607 +		for transmission during enumeration after the class interface descriptor (or alternate interface
   1.608 +		descriptor) has been sent, but before the endpoint descriptors belonging to this interface are sent.
   1.609 +		aDes may contain as many descriptors as are necessary or only 1. SetCSInterfaceDescriptorBlock()
   1.610 +		should be called at any time after SetInterface() has been called to establish a main interface or an
   1.611 +		alternate interface. More than one call may be made - the data blocks will be concatenated prior to
   1.612 +		sending. No checking or validation of the contents of aDes will be made and it is the caller's
   1.613 +		responsibility to ensure that the data supplied is correct and appropriate to the interface identified
   1.614 +		by aSettingNumber.
   1.615 +
   1.616 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.617 +		@param aInterfaceDescriptor Contains the interface descriptor to be set.
   1.618 +
   1.619 +		@return KErrNone if successful.
   1.620 +	*/
   1.621 +	inline TInt SetCSInterfaceDescriptorBlock(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
   1.622 +
   1.623 +	/** Copies the size of the class specific interface descriptor block for the interface with alternate
   1.624 +		setting aSettingNumber, 0 for the main interface, into aSize.
   1.625 +
   1.626 +		@param aSettingNumber The alternate setting number.
   1.627 +		@param aSize receives the size of the interface descriptor.
   1.628 +
   1.629 +		@return KErrNone if successful.
   1.630 +	*/
   1.631 +	inline TInt GetCSInterfaceDescriptorBlockSize(TInt aSettingNumber, TInt& aSize);
   1.632 +
   1.633 +	/** Copies the class specific endpoint descriptor for logical endpoint number aEndpointNumber
   1.634 +		into aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main
   1.635 +		interface.
   1.636 +
   1.637 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.638 +		@param aEndpointNumber Valid endpoint number on this interface.
   1.639 +		@param aEndpointDescriptor Receives the endpoint descriptor.
   1.640 +
   1.641 +		@return KErrNone if successful.
   1.642 +	*/
   1.643 +	inline TInt GetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
   1.644 +											 TDes8& aEndpointDescriptor);
   1.645 +
   1.646 +	/** Sets the class specific endpoint descriptor for logical endpoint number aEndpointNumber contained in
   1.647 +		aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
   1.648 +		for transmission to the host during enumeration.
   1.649 +
   1.650 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.651 +		@param aEndpointNumber Valid endpoint number on this interface.
   1.652 +		@param aEndpointDescriptor Contains the endpoint descriptor to be set.
   1.653 +
   1.654 +		@return KErrNone if successful.
   1.655 +	*/
   1.656 +	inline TInt SetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
   1.657 +											 const TDesC8& aEndpointDescriptor);
   1.658 +
   1.659 +	/** Copies the size of the class specific endpoint descriptor block for logical endpoint number
   1.660 +		aEndpointNumber for the interface with alternate setting aSettingNumber, 0 for the main interface,
   1.661 +		into aSize.
   1.662 +
   1.663 +		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   1.664 +		@param aEndpointNumber Valid endpoint number on this interface.
   1.665 +		@param aSize On return, contains the size of the class specific endpoint descriptor block.
   1.666 +
   1.667 +		@return KErrNone if successful.
   1.668 +	*/
   1.669 +	inline TInt GetCSEndpointDescriptorBlockSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
   1.670 +
   1.671 +	/** Generates a Remote Wakeup bus condition
   1.672 +		The capability of the device to generate Remote Wakeup signalling is enquired in
   1.673 +		RDevUsbcClient::DeviceCaps.
   1.674 +
   1.675 +		@return KErrNone if this signalling is possible and the signal has been generated.
   1.676 +	*/
   1.677 +	inline TInt SignalRemoteWakeup();
   1.678 +
   1.679 +	/** Simulates a physical removal of the USB cable by disabling the D+/- pull-ups.The iConnect member of
   1.680 +		TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(), indicates whether this functionality is
   1.681 +		supported.
   1.682 +
   1.683 +		@return KErrNone if successful.
   1.684 +	*/
   1.685 +	inline TInt DeviceDisconnectFromHost();
   1.686 +
   1.687 +	/** Simulates a physical insertion of the USB cable by enabling the D+/- pull-ups.The iConnect member
   1.688 +		of TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(),  indicates whether this functionality
   1.689 +		is supported.
   1.690 +
   1.691 +		@return KErrNone if successful.
   1.692 +	*/
   1.693 +	inline TInt DeviceConnectToHost();
   1.694 +
   1.695 +	/** Powers up the UDC and connects it to the bus if one or more interfaces exist.
   1.696 +
   1.697 +		@return KErrNone if UDC successfully powered up, KErrNotReady if no
   1.698 +		interfaces have been registered yet, KErrHardwareNotAvailable if UDC
   1.699 +		couldn't be activated.
   1.700 +	*/
   1.701 +	inline TInt PowerUpUdc();
   1.702 +
   1.703 +	/** Enquires about the current operating speed of the UDC.
   1.704 +
   1.705 +		@return ETrue if the UDC is currently operating at High speed, EFalse otherwise.
   1.706 +	*/
   1.707 +	inline TBool CurrentlyUsingHighSpeed();
   1.708 +
   1.709 +	/** Allocates the use of aResource to aEndpoint. it will be used from when the current bus transfer	has been
   1.710 +		completed.
   1.711 +
   1.712 +		@param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
   1.713 +		behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
   1.714 +		@param aEndpoint The endpoint number to which the resource is to be allocated.
   1.715 +
   1.716 +		@return KErrNone if successful, KErrInUse if the resource is already consumed and cannot be allocated,
   1.717 +		KErrNotSupported if the endpoint does not support the resource requested.
   1.718 +
   1.719 +		@publishedPartner @deprecated
   1.720 +
   1.721 +		@see TUsbcEndpointInfo
   1.722 +	*/
   1.723 +	inline TInt AllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
   1.724 +
   1.725 +	/** Deallocates the use of aResource aEndpoint or ends a specified endpoint behaviour.
   1.726 +
   1.727 +		@param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
   1.728 +		behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
   1.729 +		@param aEndpoint The endpoint number from which the resource is to be removed.
   1.730 +
   1.731 +		@return KErrNone if the resource has been successfully deallocated, KErrNotSupported if the endpoint
   1.732 +		does not support the resource requested.
   1.733 +
   1.734 +		@publishedPartner @deprecated
   1.735 +
   1.736 +		@see TUsbcEndpointInfo
   1.737 +	*/
   1.738 +	inline TInt DeAllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
   1.739 +
   1.740 +	/** Queries endpoint resource use.
   1.741 +
   1.742 +		@param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
   1.743 +		behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
   1.744 +		@param aEndpoint The endpoint number at which the resource is to be queried.
   1.745 +
   1.746 +		@return ETrue is the specified resource is in use at the endpoint and EFalse if not.
   1.747 +	*/
   1.748 +	inline TBool QueryEndpointResourceUse(TInt aEndpoint, TUsbcEndpointResource aResource);
   1.749 +
   1.750 +	/** Request (i.e. claim for this channel) up to five endpoints and set the class type for this USB
   1.751 +		interface. 'aInterfaceData' is a package buffer which describes the interface and all the endpoints
   1.752 +		being requested by the driver for this interface.
   1.753 +
   1.754 +		@param aInterfaceNumber Distinguishes between alternate interfaces. If these are not be used then this
   1.755 +		should always be zero. If this parameter is used, then its value must be one more than that of the
   1.756 +		proceeding alternate interface.
   1.757 +		@param aInterfaceData a package buffer which describes the interface and all the endpoints being
   1.758 +		requested by the driver for this interface.
   1.759 +		@param aBandwidthPriority is a bitmap combining the required IN and OUT priorities. Values are in the
   1.760 +		range [0,3] from the lowest priority bandwidth, 0, to the highest 3 and are separately specified for
   1.761 +		IN and OUT endpoints. Interfaces requiring higher bandwidth are allocated significantly more buffering
   1.762 +		than low bandwidth interfaces. Interfaces should not be given a higher bandwidth priority than they
   1.763 +		require.
   1.764 +
   1.765 +		@return KErrInUse if any of the endpoints being requested have already been claimed by another channel
   1.766 +		KErrNotSupported if an endpoint with all of the specified properties is not supported on this
   1.767 +		platform. KErrNoMemory if insufficient memory is available to complete the operation.
   1.768 +	*/
   1.769 +	inline TInt SetInterface(TInt aInterfaceNumber, TUsbcInterfaceInfoBuf& aInterfaceData,
   1.770 +							 TUint32 aBandwidthPriority =
   1.771 +							 (EUsbcBandwidthOUTDefault | EUsbcBandwidthINDefault));
   1.772 +
   1.773 +	/** Release an interface previously claimed by this channel. Alternate interfaces need to be released
   1.774 +		in strict descending order, starting with the last (i.e. highest numbered) one.
   1.775 +		It is not necessary to release an interface that wasn't successfully requested.
   1.776 +
   1.777 +		@param aInterfaceNumber Specifies the alternate setting number 'aInterfaceNum' of the interface to be
   1.778 +		released.
   1.779 +
   1.780 +		@return KErrNone if successful. KErrArgument if the alternate setting doesn't exist or is released out
   1.781 +		of order.
   1.782 +	*/
   1.783 +	inline TInt ReleaseInterface(TInt aInterfaceNumber);
   1.784 +
   1.785 +	/** Copies the current string descriptor language ID (LANGID) code into the aLangId argument. Even though
   1.786 +		the USB spec allows for the existence of a whole array of LANGID codes, we only support one.
   1.787 +
   1.788 +		@param aLangId receives the LANGID code.
   1.789 +
   1.790 +		@return KErrNone if successful, KErrArgument if problem with argument (memory cannot be written to, etc.).
   1.791 +	*/
   1.792 +	inline TInt GetStringDescriptorLangId(TUint16& aLangId);
   1.793 +
   1.794 +	/** Sets the string descriptor language ID (LANGID). Even though the USB spec allows for the existence of
   1.795 +		a whole array of LANGID codes, we only support one.
   1.796 +
   1.797 +		@param aLangId the LANGID code to be set.
   1.798 +
   1.799 +		@return KErrNone if successful.
   1.800 +	*/
   1.801 +	inline TInt SetStringDescriptorLangId(TUint16 aLangId);
   1.802 +
   1.803 +	/** Copies the string descriptor identified by the iManufacturer index field of the Standard Device
   1.804 +		Descriptor into the aString argument.
   1.805 +
   1.806 +		@param aString receives manufacturer string.
   1.807 +
   1.808 +		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
   1.809 +		descriptor, KErrNotFound if the string descriptor couldn't be found.
   1.810 +	*/
   1.811 +	inline TInt GetManufacturerStringDescriptor(TDes16& aString);
   1.812 +
   1.813 +	/** Sets the string descriptor identified by the iManufacturer index field of the Standard Device
   1.814 +		Descriptor to the aString argument.
   1.815 +
   1.816 +		@param aString Contains the new manufacturer string descriptor.
   1.817 +
   1.818 +		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
   1.819 +		aString (in which case the old string descriptor will be preserved).
   1.820 +	*/
   1.821 +	inline TInt SetManufacturerStringDescriptor(const TDesC16& aString);
   1.822 +
   1.823 +	/** Removes (deletes) the string descriptor identified by the iManufacturer index field of the Standard
   1.824 +		Device Descriptor and sets that field to zero.
   1.825 +
   1.826 +		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
   1.827 +	*/
   1.828 +	inline TInt RemoveManufacturerStringDescriptor();
   1.829 +
   1.830 +	/** Retrieves the string descriptor identified by the iProduct index field of the Standard Device
   1.831 +		Descriptor into the aString argument.
   1.832 +
   1.833 +		@param aString receives product string.
   1.834 +
   1.835 +		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
   1.836 +		descriptor, KErrNotFound if the string descriptor couldn't be found.
   1.837 +	*/
   1.838 +	inline TInt GetProductStringDescriptor(TDes16& aString);
   1.839 +
   1.840 +	/** Sets the string descriptor identified by the iProduct index field of the Standard Device Descriptor to
   1.841 +		the aString argument.
   1.842 +
   1.843 +		@param aString Contains the new product string descriptor.
   1.844 +
   1.845 +		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
   1.846 +		aString (in which case the old string descriptor will be preserved).
   1.847 +	*/
   1.848 +	inline TInt SetProductStringDescriptor(const TDesC16& aString);
   1.849 +
   1.850 +	/** Removes (deletes) the string descriptor identified by the iProduct index field of the Standard Device
   1.851 +		Descriptor and sets that field to zero.
   1.852 +
   1.853 +		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
   1.854 +	*/
   1.855 +	inline TInt RemoveProductStringDescriptor();
   1.856 +
   1.857 +	/** Retrieves the string descriptor identified by the iSerialNumber index field of the Standard Device
   1.858 +		Descriptor into the aString argument.
   1.859 +
   1.860 +		@param aString receives product string.
   1.861 +
   1.862 +		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
   1.863 +		descriptor, KErrNotFound if the string descriptor couldn't be found.
   1.864 +	*/
   1.865 +	inline TInt GetSerialNumberStringDescriptor(TDes16& aString);
   1.866 +
   1.867 +	/** Sets the string descriptor identified by the iSerialNumber index field of the Standard Device
   1.868 +		Descriptor to the aString argument.
   1.869 +
   1.870 +		@param aString Contains the new serial number string descriptor.
   1.871 +
   1.872 +		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
   1.873 +		aString (in which case the old string descriptor will be preserved).
   1.874 +	*/
   1.875 +	inline TInt SetSerialNumberStringDescriptor(const TDesC16& aString);
   1.876 +
   1.877 +	/** Removes (deletes) the string descriptor identified by the iSerialNumber index field of the Standard
   1.878 +		Device Descriptor and sets that field to zero.
   1.879 +
   1.880 +		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
   1.881 +	*/
   1.882 +	inline TInt RemoveSerialNumberStringDescriptor();
   1.883 +
   1.884 +	/** Retrieves the string descriptor identified by the iConfiguration index field of the (first) Standard
   1.885 +		Configuration Descriptor into the aString argument.
   1.886 +
   1.887 +		@param aString receives configuration string.
   1.888 +
   1.889 +		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
   1.890 +		descriptor, KErrNotFound if the string descriptor couldn't be found.
   1.891 +	*/
   1.892 +	inline TInt GetConfigurationStringDescriptor(TDes16& aString);
   1.893 +
   1.894 +	/** Sets the string descriptor identified by the iConfiguration index field of the Standard Configuration
   1.895 +		Descriptor to the aString argument.
   1.896 +
   1.897 +		@param aString Contains the new serial number string descriptor.
   1.898 +
   1.899 +		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
   1.900 +		aString (in which case the old string descriptor will be preserved).
   1.901 +	*/
   1.902 +	inline TInt SetConfigurationStringDescriptor(const TDesC16& aString);
   1.903 +
   1.904 +	/** Removes (deletes) the string descriptor identified by the iConfiguration index field of the Standard
   1.905 +		Configuration Descriptor and sets that field to zero.
   1.906 +
   1.907 +		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
   1.908 +	*/
   1.909 +	inline TInt RemoveConfigurationStringDescriptor();
   1.910 +
   1.911 +	/** Copies the string of the USB string descriptor at the specified index in the string descriptor array
   1.912 +		into the aString argument.
   1.913 +
   1.914 +		Although this function can also be used for it, for querying most standard string descriptors
   1.915 +		there exists a set of dedicated access functions.
   1.916 +
   1.917 +		@see RDevUsbcClient::GetStringDescriptorLangId
   1.918 +		@see RDevUsbcClient::GetManufacturerStringDescriptor
   1.919 +		@see RDevUsbcClient::GetProductStringDescriptor
   1.920 +		@see RDevUsbcClient::GetSerialNumberStringDescriptor
   1.921 +		@see RDevUsbcClient::GetConfigurationStringDescriptor
   1.922 +
   1.923 +		@param aIndex The position of the string descriptor in the string descriptor array.
   1.924 +		@param aString The target location for the string descriptor copy.
   1.925 +
   1.926 +		@return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index,
   1.927 +		KErrArgument if MaxLength() of aString is too small to hold the entire descriptor.
   1.928 +	*/
   1.929 +	inline TInt GetStringDescriptor(TUint8 aIndex, TDes16& aString);
   1.930 +
   1.931 +	/** Sets the aString argument to be the string of a USB string descriptor at the specified index in the
   1.932 +		string descriptor array. If a string descriptor already exists at that position then its string will
   1.933 +		be replaced.
   1.934 +
   1.935 +		Care should be taken, when choosing aIndex, not to inadvertently overwrite one of the standard
   1.936 +		string descriptors.	For their manipulation there exists a set of dedicated access functions.
   1.937 +
   1.938 +		@see RDevUsbcClient::SetStringDescriptorLangId
   1.939 +		@see RDevUsbcClient::SetManufacturerStringDescriptor
   1.940 +		@see RDevUsbcClient::SetProductStringDescriptor
   1.941 +		@see RDevUsbcClient::SetSerialNumberStringDescriptor
   1.942 +		@see RDevUsbcClient::SetConfigurationStringDescriptor
   1.943 +
   1.944 +		@param aIndex The position of the string descriptor in the string descriptor array.
   1.945 +		@param aString Contains the string descriptor to be set.
   1.946 +
   1.947 +		@return KErrNone if successful, KErrArgument if aIndex is invalid, KErrNoMemory if no memory
   1.948 +		is available to store the new string (an existing descriptor at that index will be preserved).
   1.949 +	*/
   1.950 +	inline TInt SetStringDescriptor(TUint8 aIndex, const TDesC16& aString);
   1.951 +
   1.952 +	/** Removes (deletes) the USB string descriptor at the specified index in the string descriptor array.
   1.953 +		The position in the array of other string descriptors is not affected.
   1.954 +
   1.955 +		Care should be taken, when choosing aIndex, not to inadvertently delete a standard string descriptor
   1.956 +		(also because index references from non-string descriptors would be invalidated). For the deletion
   1.957 +		of most standard string descriptors there exists a set of dedicated functions.
   1.958 +
   1.959 +		@see RDevUsbcClient::RemoveManufacturerStringDescriptor
   1.960 +		@see RDevUsbcClient::RemoveProductStringDescriptor
   1.961 +		@see RDevUsbcClient::RemoveSerialNumberStringDescriptor
   1.962 +		@see RDevUsbcClient::RemoveConfigurationStringDescriptor
   1.963 +
   1.964 +		@param aIndex The position of the string descriptor in the string descriptor array.
   1.965 +
   1.966 +		@return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index.
   1.967 +	*/
   1.968 +	inline TInt RemoveStringDescriptor(TUint8 aIndex);
   1.969 +
   1.970 +	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
   1.971 +		Request completes when the specified number of bytes is received, length taken from max. length of
   1.972 +		descriptor.
   1.973 +
   1.974 +		@param aStatus The request status.
   1.975 +		@param aEndpoint The endpoint number to read from.
   1.976 +		@param aDes	Descriptor to receive the data.
   1.977 +	*/
   1.978 +	inline void Read(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes);
   1.979 +
   1.980 +	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
   1.981 +		Request completes when the specified number of bytes is received.
   1.982 +
   1.983 +		@param aStatus The request status.
   1.984 +		@param aEndpoint The endpoint number to read from.
   1.985 +		@param aDes	Descriptor to receive the data.
   1.986 +		@param aLen The number of bytes to read.
   1.987 +	*/
   1.988 +	inline void Read(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aLen);
   1.989 +
   1.990 +	/** Asynchronously read an entire packet of data from endpoint 'aEndpoint' into the descriptor 'aDes'.
   1.991 +		If a packet has previously been partly read. then only the remainder of the packet will be returned.
   1.992 +		The request should be for the maximum packet size of the endpoint. If less data is requested, then
   1.993 +		after this read completes the remainder of the data in the packet will be discarded and the next read
   1.994 +		will start from the next available packet.
   1.995 +		Request completes when either a complete packet is received or the length of the packet currently
   1.996 +		being received exceeds 'aMaxLen'.
   1.997 +
   1.998 +		@param aStatus The request status.
   1.999 +		@param aEndpoint The endpoint number to read from.
  1.1000 +		@param aDes	Descriptor to receive the data.
  1.1001 +		@param aMaxLen .
  1.1002 +	*/
  1.1003 +	inline void ReadPacket(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aMaxLen);
  1.1004 +
  1.1005 +	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
  1.1006 +		Request completes when the specified number of bytes is received (in first version,
  1.1007 +		length taken from max. length of descriptor).
  1.1008 +
  1.1009 +		@param aStatus The request status.
  1.1010 +		@param aEndpoint The endpoint number to read from.
  1.1011 +		@param aDes	Descriptor to receive the data.
  1.1012 +	*/
  1.1013 +	inline void ReadUntilShort(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes);
  1.1014 +
  1.1015 +	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
  1.1016 +		Request completes when the specified number of bytes is received (in first version,
  1.1017 +		length taken from max. length of descriptor).
  1.1018 +
  1.1019 +		@param aStatus The request status.
  1.1020 +		@param aEndpoint The endpoint number to read from.
  1.1021 +		@param aDes	Descriptor to receive the data.
  1.1022 +		@param aLen The number of bytes to receive.
  1.1023 +	*/
  1.1024 +	inline void ReadUntilShort(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aLen);
  1.1025 +
  1.1026 +	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'. The request completes
  1.1027 +		when the specified number of bytes is received, length taken from max. length of descriptor or a
  1.1028 +		packet whose size is smaller than the endpoint's maximum packet size is received.
  1.1029 +
  1.1030 +		@param aStatus The request status.
  1.1031 +		@param aEndpoint The endpoint number to read from.
  1.1032 +		@param aDes	Descriptor to receive the data.
  1.1033 +	*/
  1.1034 +	inline void ReadOneOrMore(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes);
  1.1035 +
  1.1036 +	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'. The request completes
  1.1037 +		when the specified number of bytes is received, or a packet whose size is smaller than the endpoint's
  1.1038 +		maximum packet size is received.
  1.1039 +
  1.1040 +		@param aStatus The request status.
  1.1041 +		@param aEndpoint The endpoint number to read from.
  1.1042 +		@param aDes	Descriptor to receive the data.
  1.1043 +		@param aLen The number of bytes to receive.
  1.1044 +	*/
  1.1045 +	inline void ReadOneOrMore(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aLen);
  1.1046 +
  1.1047 +	/** Cancels an outstanding read request. The request will complete with whatever data is available.
  1.1048 +	*/
  1.1049 +	inline void ReadCancel(TEndpointNumber aEndpoint);
  1.1050 +
  1.1051 +	/** Asynchronously write 'aLen' bytes of data to endpoint 'aEndpoint' from descriptor 'aDes'. 'aZlpRequired'
  1.1052 +		(optional) signals that ZLP termination may be required.
  1.1053 +
  1.1054 +		@param aStatus The request status.
  1.1055 +		@param aEndpoint The endpoint number to write to.
  1.1056 +		@param aDes	Descriptor to provide the data.
  1.1057 +		@param aLen The number of bytes of data to be written.
  1.1058 +		@param aZlpRequired True, if ZLP termination is required; false, otherwise.
  1.1059 +	*/
  1.1060 +	inline void Write(TRequestStatus& aStatus, TEndpointNumber aEndpoint, const TDesC8& aDes, TInt aLen,
  1.1061 +					  TBool aZlpRequired=EFalse);
  1.1062 +
  1.1063 +	/** Cancels an outstanding write request on endpoint aEndpoint.
  1.1064 +
  1.1065 +		@param aEndpoint The endpoint number whose write is to be cancelled.
  1.1066 +	*/
  1.1067 +	inline void WriteCancel(TEndpointNumber aEndpoint);
  1.1068 +
  1.1069 +	/** Cancels any transfer on any endpoint specified in aEndpointMask.
  1.1070 +
  1.1071 +		@code
  1.1072 +		// Cancel transfer requests on endpoints 1, 2 & 3
  1.1073 +		usbPort.EndpointTransferCancel(KUsbcEndpoint1Bit | KUsbcEndpoint2Bit | KUsbcEndpoint3Bit);
  1.1074 +		@endcode
  1.1075 +
  1.1076 +		@param aEndpointMask bitmap of the endpoints.
  1.1077 +	*/
  1.1078 +	inline void EndpointTransferCancel(TUint aEndpointMask);
  1.1079 +
  1.1080 +	/**	Register for notification when a change of the Interface alternate setting or the USB Controller's
  1.1081 +		current state occurs. When the alternate setting or the Controller state changes, then the
  1.1082 +		asynchronous function completes and the current alternate setting number or Controller state is
  1.1083 +		written back to aValue. If the KUsbAlternateSetting bit is set then the remaining bits are the
  1.1084 +		alternate setting number. Otherwise aValue is interpreted as a TUsbcDeviceState.
  1.1085 +
  1.1086 +		@see TUsbcDeviceState
  1.1087 +
  1.1088 +		@param aStatus The request status.
  1.1089 +		@param aValue Receives the alternate setting number or Controller state.
  1.1090 +	*/
  1.1091 +	inline void AlternateDeviceStatusNotify(TRequestStatus& aStatus, TUint& aValue);
  1.1092 +
  1.1093 +	/** Completes an AlternateDeviceStatusNotify request. If a request has previously been made then the
  1.1094 +		status variable is updated with the current device state.
  1.1095 +	*/
  1.1096 +	inline void AlternateDeviceStatusNotifyCancel();
  1.1097 +
  1.1098 +	/** If the channel has changed the grouping of endpoints between interfaces or changed the interface class
  1.1099 +		type from the defaults then it is necessary to force a re-enumeration. This will typically involve the
  1.1100 +		Symbian OS device initiating a disconnection and re-connection. This is an asynchronous operation
  1.1101 +		which will complete when the Controller is successfully configured by the host, i.e. has achieved
  1.1102 +		EUsbcDeviceStateConfigured.  Since it is not known if the operation has failed, at the same time that
  1.1103 +		a ReEnumerate request is made, a timer should be set up to complete after approximately 5 seconds. It
  1.1104 +		can be assumed that if the operation has not completed after this time interval then it will not
  1.1105 +		complete.
  1.1106 +
  1.1107 +		@param aStatus The request status.
  1.1108 +	*/
  1.1109 +	inline void ReEnumerate(TRequestStatus& aStatus);
  1.1110 +
  1.1111 +	/** Cancels an outstanding ReEnumerate() request.
  1.1112 +	*/
  1.1113 +	inline void ReEnumerateCancel();
  1.1114 +
  1.1115 +	/**	Register for notification when a change in stall status of any of the interface's endpoints occurs,
  1.1116 +		but not ep0. When a change in stall status occurs, then the asynchronous function completes and the
  1.1117 +		current stall state is written back to 'aEndpointStatus' as a bit map: Only stall state changes caused
  1.1118 +		by SET_FEATURE and CLEAR_FEATURE standard commands on ep0 will be notified when this function
  1.1119 +		completes. After this request completes the request should be re-issued to obtain future
  1.1120 +		notifications.
  1.1121 +
  1.1122 +		@param aStatus The request status.
  1.1123 +		@param aEndpointMask a bitmap of the endpoints stall status. This is filled in when the call completes
  1.1124 +		bit 1 represents the interface's virtual endpoint 1, (KUsbcEndpoint1Bit)
  1.1125 +		bit 2 represents the interface's virtual endpoint 2, (KUsbcEndpoint2Bit) etc.
  1.1126 +		bit value 0 - not stalled,
  1.1127 +		bit value 1 - stalled.
  1.1128 +	*/
  1.1129 +	inline void EndpointStatusNotify(TRequestStatus& aStatus, TUint& aEndpointMask);
  1.1130 +
  1.1131 +	/** Completes an endpoint status notify request.
  1.1132 +	*/
  1.1133 + 	inline void EndpointStatusNotifyCancel();
  1.1134 +
  1.1135 +    /** Get current on-the-go features relating to the ability of device/host pair to
  1.1136 +        perform OTG role swap.
  1.1137 +
  1.1138 +        @param aFeatures On return it contanis features the device currently has
  1.1139 +                bit 2 represents b_hnp_enable,       (KUsbOtgAttr_B_HnpEnable)
  1.1140 +                bit 3 represents a_hnp_support,      (KUsbOtgAttr_A_HnpSupport)
  1.1141 +                bit 4 represents a_alt_hnp_support,  (KUsbOtgAttr_A_AltHnpSupport)
  1.1142 +        @return KErrNone if successful, KErrNotSupported if OTG is not supported by
  1.1143 +                this device, otherwise system-wide error returns
  1.1144 +    */
  1.1145 +    inline TInt GetOtgFeatures(TUint8& aFeatures);
  1.1146 +
  1.1147 +    /** Register for notification on USB on-the-go features' change. If any OTG feature
  1.1148 +        is changed, request completes and current feature value is filled in aValue.
  1.1149 +
  1.1150 +        @param aStatus Request status object
  1.1151 +        @param aValue On request completion, it contains current OTG feature value
  1.1152 +    */
  1.1153 +    inline void OtgFeaturesNotify(TRequestStatus& aStatus, TUint8& aValue);
  1.1154 +
  1.1155 +    /** Cancel pending OTG feature request.
  1.1156 +    */
  1.1157 +    inline void OtgFeaturesNotifyCancel();
  1.1158 +
  1.1159 +#endif // #ifndef __KERNEL_MODE__
  1.1160 +	};
  1.1161 +
  1.1162 +
  1.1163 +#include <d32usbc.inl>
  1.1164 +
  1.1165 +
  1.1166 +#endif // __D32USBC_H__