os/kernelhwsrv/kernel/eka/include/d32usbc.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // e32/include/d32usbc.h
    15 // User side class definitions for USB Device support.
    16 // 
    17 //
    18 
    19 /**
    20  @file d32usbc.h
    21  @publishedPartner
    22  @released
    23 */
    24 
    25 #ifndef __D32USBC_H__
    26 #define __D32USBC_H__
    27 
    28 #include <e32ver.h>
    29 #include <usb.h>
    30 #include <d32usbcshared.h>
    31 
    32 
    33 
    34 /** @internalComponent
    35 */
    36 enum TTransferType
    37 	{
    38 	ETransferTypeReadData,
    39 	ETransferTypeReadPacket,
    40 	ETransferTypeWrite,
    41 	ETransferTypeNone,
    42 	ETransferTypeReadOneOrMore,
    43 	ETransferTypeReadUntilShort
    44 	};
    45 
    46 
    47 /** Available endpoints. At most only these are available per interface.
    48 */
    49 enum TEndpointNumber
    50 	{
    51 	EEndpoint0 = 0,
    52 	EEndpoint1 = 1,
    53 	EEndpoint2 = 2,
    54 	EEndpoint3 = 3,
    55 	EEndpoint4 = 4,
    56 	EEndpoint5 = 5
    57 	};
    58 
    59 
    60 
    61 
    62 /** Bandwidth indicators for an Interface
    63 
    64 	@see RDevUsbcClient::SetInterface()
    65 */
    66 enum TUsbcBandwidthPriority
    67 	{
    68 	/** Economical OUT buffering. */
    69 	EUsbcBandwidthOUTDefault = 0x00,
    70 	/** More memory than Default for OUT buffering. */
    71 	EUsbcBandwidthOUTPlus1   = 0x01,
    72 	/** More memory than Plus1 for OUT buffering. */
    73 	EUsbcBandwidthOUTPlus2   = 0x02,
    74 	/** Maximum memory for OUT buffering.
    75 		Use this value for high volume USB High-speed
    76 		data transfers only, otherwise memory will be wasted.
    77 	*/
    78 	EUsbcBandwidthOUTMaximum = 0x03,
    79 	//
    80 	/** Economical IN buffering */
    81 	EUsbcBandwidthINDefault  = 0x00,
    82 	/** More memory than Default for IN buffering */
    83 	EUsbcBandwidthINPlus1    = 0x10,
    84 	/** More memory than Plus1 for IN buffering */
    85 	EUsbcBandwidthINPlus2    = 0x20,
    86 	/** Maximum memory for IN buffering.
    87 		Use this value for high volume USB High-speed
    88 		data transfers only, otherwise memory will be wasted.
    89 	*/
    90 	EUsbcBandwidthINMaximum  = 0x30
    91 	};
    92 
    93 
    94 
    95 
    96 
    97 
    98 
    99 /** Bit positions of endpoints.
   100 
   101 	@see RDevUsbcClient::EndpointStatusNotify()
   102 	@see RDevUsbcClient::EndpointTransferCancel()
   103 
   104 	Bit position of endpoint0.
   105 */
   106 const TUint KUsbcEndpoint0Bit = 1<<EEndpoint0;
   107 /** Bit position of endpoint1.
   108 */
   109 const TUint KUsbcEndpoint1Bit = 1<<EEndpoint1;
   110 /** Bit position of endpoint2.
   111 */
   112 const TUint KUsbcEndpoint2Bit = 1<<EEndpoint2;
   113 /** Bit position of endpoint3.
   114 */
   115 const TUint KUsbcEndpoint3Bit = 1<<EEndpoint3;
   116 /** Bit position of endpoint4.
   117 */
   118 const TUint KUsbcEndpoint4Bit = 1<<EEndpoint4;
   119 /** Bit position of endpoint5.
   120 */
   121 const TUint KUsbcEndpoint5Bit = 1<<EEndpoint5;
   122 
   123 
   124 
   125 
   126 
   127 
   128 
   129 
   130 /** This must be filled in prior to a call to RDevUsbcClient::SetInterface().
   131 */
   132 class TUsbcInterfaceInfo
   133 	{
   134 public:
   135 	TUsbcInterfaceInfo(TInt aClass=0, TInt aSubClass=0, TInt aProtocol=0,
   136 					   TDesC16* aString=NULL, TUint aTotalEndpoints=0);
   137 public:
   138 	/** The class, subclass and protocol that this interface supports. */
   139 	TUsbcClassInfo iClass;
   140 	/** The description string for the interface. Used to construct the interface string descriptor. */
   141 	const TDesC16* iString;
   142 	/** Total number of endpoints being requested (0-5). Endpoint 0 should not be included in this number. */
   143 	TUint iTotalEndpointsUsed;
   144 	/** Desired properties of the endpoints requested.
   145 		Do NOT include endpoint 0.
   146 		APIs use endpoint numbers that are offsets into this array.
   147 	*/
   148 	TUsbcEndpointInfo iEndpointData[KMaxEndpointsPerClient];
   149 	/** 32 flag bits used for specifying miscellaneous Interface features.
   150 		Currently defined are:
   151 		- KUsbcInterfaceInfo_NoEp0RequestsPlease = 0x00000001
   152 	*/
   153 	TUint32 iFeatureWord;
   154 	};
   155 
   156 
   157 /** Package buffer for a TUsbcInterfaceInfo object.
   158 
   159 	@see TUsbcInterfaceInfo
   160 */
   161 typedef TPckgBuf<TUsbcInterfaceInfo> TUsbcInterfaceInfoBuf;
   162 
   163 
   164 /** The user side handle to the USB client driver.
   165 */
   166 class RDevUsbcClient : public RBusLogicalChannel
   167 	{
   168 public:
   169 	/** @internalComponent */
   170 	enum TVer
   171 		{
   172 		EMajorVersionNumber = 0,
   173 		EMinorVersionNumber = 1,
   174 		EBuildVersionNumber = KE32BuildVersionNumber
   175 		};
   176 
   177 	enum TRequest
   178 		{
   179 		// Positive requests.
   180 		ERequestEp0 = 0x0,
   181 		ERequestEp1 = EEndpoint1,
   182 		ERequestEp2 = EEndpoint2,
   183 		ERequestEp3 = EEndpoint3,
   184 		ERequestEp4 = EEndpoint4,
   185 		ERequestEp5 = EEndpoint5,
   186 		ERequestUnused = 6,
   187 		ERequestAlternateDeviceStatusNotify = 7,
   188 		ERequestReEnumerate = 8,
   189 		ERequestEndpointStatusNotify = 9,
   190 		// The cancel TRequest's are interpreted as bitmaps. As they're not mixed
   191 		// with the previous ones, it doesn't matter if they have the same absolute
   192 		// value as those.
   193 		ERequestEp0Cancel = 1<<ERequestEp0,
   194 		ERequestEp1Cancel = 1<<ERequestEp1,
   195 		ERequestEp2Cancel = 1<<ERequestEp2,
   196 		ERequestEp3Cancel = 1<<ERequestEp3,
   197 		ERequestEp4Cancel = 1<<ERequestEp4,
   198 		ERequestEp5Cancel = 1<<ERequestEp5,
   199 		ERequestUnusedCancel = 1<<ERequestUnused,
   200         ERequestAllCancel = (ERequestEp0Cancel | ERequestEp1Cancel |
   201 							 ERequestEp2Cancel | ERequestEp3Cancel |
   202 							 ERequestEp4Cancel | ERequestEp5Cancel |
   203 							 ERequestUnusedCancel),
   204 		ERequestAlternateDeviceStatusNotifyCancel = 1<<ERequestAlternateDeviceStatusNotify,
   205 		ERequestReEnumerateCancel = 1<<ERequestReEnumerate,
   206 		ERequestEndpointStatusNotifyCancel = 1<<ERequestEndpointStatusNotify,
   207         ERequestOtgFeaturesNotify = 10,
   208         ERequestOtgFeaturesNotifyCancel = 1<<ERequestOtgFeaturesNotify,
   209 		};
   210 
   211 	enum TControl
   212 		{
   213 		// Changing the order of these enums will break BC.
   214 		EControlEndpointZeroRequestError,					// 0
   215 		EControlEndpointCaps,
   216 		EControlDeviceCaps,
   217 		EControlGetAlternateSetting,
   218 		EControlDeviceStatus,
   219 		EControlEndpointStatus,
   220 		EControlSetInterface,
   221 		EControlReleaseInterface,
   222 		EControlQueryReceiveBuffer,
   223 		EControlSendEp0StatusPacket,						// 9
   224 		//
   225 		EControlHaltEndpoint,								// 10
   226 		EControlClearHaltEndpoint,
   227 		EControlSetDeviceControl,
   228 		EControlReleaseDeviceControl,
   229 		EControlEndpointZeroMaxPacketSizes,
   230 		EControlSetEndpointZeroMaxPacketSize,
   231 		EControlGetDeviceDescriptor,
   232 		EControlSetDeviceDescriptor,
   233 		EControlGetDeviceDescriptorSize,
   234 		EControlGetConfigurationDescriptor,					// 19
   235 		//
   236 		EControlSetConfigurationDescriptor,					// 20
   237 		EControlGetConfigurationDescriptorSize,
   238 		EControlGetInterfaceDescriptor,
   239 		EControlSetInterfaceDescriptor,
   240 		EControlGetInterfaceDescriptorSize,
   241 		EControlGetEndpointDescriptor,
   242 		EControlSetEndpointDescriptor,
   243 		EControlGetEndpointDescriptorSize,
   244 		EControlGetCSInterfaceDescriptor,
   245 		EControlSetCSInterfaceDescriptor,					// 29
   246 		//
   247 		EControlGetCSInterfaceDescriptorSize,				// 30
   248 		EControlGetCSEndpointDescriptor,
   249 		EControlSetCSEndpointDescriptor,
   250 		EControlGetCSEndpointDescriptorSize,
   251 		EControlSignalRemoteWakeup,
   252 		EControlGetStringDescriptorLangId,
   253 		EControlSetStringDescriptorLangId,
   254 		EControlGetManufacturerStringDescriptor,
   255 		EControlSetManufacturerStringDescriptor,
   256 		EControlRemoveManufacturerStringDescriptor,			// 39
   257 		//
   258 		EControlGetProductStringDescriptor,					// 40
   259 		EControlSetProductStringDescriptor,
   260 		EControlRemoveProductStringDescriptor,
   261 		EControlGetSerialNumberStringDescriptor,
   262 		EControlSetSerialNumberStringDescriptor,
   263 		EControlRemoveSerialNumberStringDescriptor,
   264 		EControlGetConfigurationStringDescriptor,
   265 		EControlSetConfigurationStringDescriptor,
   266 		EControlRemoveConfigurationStringDescriptor,
   267 		EControlDeviceDisconnectFromHost,					// 49
   268 		//
   269 		EControlDeviceConnectToHost,						// 50
   270 		EControlDevicePowerUpUdc,
   271 		EControlDumpRegisters,
   272 		EControlSetInterface1,								// (not used)
   273 		EControlAllocateEndpointResource,
   274 		EControlDeAllocateEndpointResource,
   275 		EControlQueryEndpointResourceUse,
   276 		EControlGetEndpointZeroMaxPacketSize,
   277 		EControlGetDeviceQualifierDescriptor,
   278 		EControlSetDeviceQualifierDescriptor,				// 59
   279 		//
   280 		EControlGetOtherSpeedConfigurationDescriptor,		// 60
   281 		EControlSetOtherSpeedConfigurationDescriptor,
   282 		EControlCurrentlyUsingHighSpeed,
   283 		EControlSetStringDescriptor,
   284 		EControlGetStringDescriptor,
   285 		EControlRemoveStringDescriptor,
   286         EControlSetOtgDescriptor,
   287         EControlGetOtgDescriptor,
   288         EControlGetOtgFeatures
   289 		};
   290 
   291 public:
   292 
   293 #ifndef __KERNEL_MODE__
   294 
   295 	/** Opens a channel.
   296 
   297 		@param aUnit This should be 0 (zero).
   298 
   299 		@return KErrNone if successful.
   300 	*/
   301 	inline TInt Open(TInt aUnit);
   302 
   303 	inline TVersion VersionRequired() const;
   304 
   305 	/** Stalls ep0 to signal command fault to the host.
   306 
   307 		@return KErrNone if successful.
   308 	*/
   309 	inline TInt EndpointZeroRequestError();
   310 
   311 	/** Retrieves the capabilities of all the endpoints on the device.
   312 
   313 		Suggested use is as follows:
   314 
   315 		@code
   316 		TUsbcEndpointData data[KUsbcMaxEndpoints];
   317 		TPtr8 dataPtr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
   318 		ret = usbPort.EndpointCaps(dataPtr);
   319 		@endcode
   320 
   321 		@param aEpCapsBuf a descriptor encapsulating an array of TUsbcEndpointData.
   322 
   323 		@return KErrNone if successful.
   324 	*/
   325 	inline TInt EndpointCaps(TDes8& aEpCapsBuf);
   326 
   327 	/** Retrieves the capabilities of the USB device.
   328 
   329 		@see TUsbDeviceCaps
   330 
   331 		@param aDevCapsBuf a TUsbDeviceCaps object.
   332 
   333 		@return KErrNone if successful.
   334 	*/
   335 	inline TInt DeviceCaps(TUsbDeviceCaps& aDevCapsBuf);
   336 
   337 	/** Copies the current alternate setting for this interface into aInterfaceNumber
   338 		For USB Interfaces whose main interface is active, this will be 0 (zero).
   339 
   340 		@param aInterfaceNumber current alternate setting for this interface is copied into this.
   341 
   342 		@return KErrNone if successful.
   343 	*/
   344 	inline TInt GetAlternateSetting(TInt& aInterfaceNumber);
   345 
   346 	/** Copies the current device status into aDeviceStatus.
   347 
   348 		@param aDeviceStatus current device status is copied into this.
   349 
   350 		@return KErrNone if successful
   351 	*/
   352 	inline TInt DeviceStatus(TUsbcDeviceState& aDeviceStatus);
   353 
   354 	/** Copies the current endpoint status into aEndpointStatus.
   355 
   356 		@param aEndpoint endpoint number valid for the current alternate setting.
   357 		@param aEndpointStatus the current endpoint status, might be stalled, not stalled or unknown.
   358 
   359 		@return KErrNone if successful.
   360 	*/
   361 	inline TInt EndpointStatus(TEndpointNumber aEndpoint, TEndpointState& aEndpointStatus);
   362 
   363 	/** Copies the number of bytes available in the aEndpoint read buffer into aNumberOfBytes.
   364 
   365 		@param aEndpoint endpoint number valid for the current alternate setting.
   366 		@param aNumberOfBytes number of bytes available in the aEndpoint read buffer.
   367 
   368 		@return KErrNone if successful.
   369 	*/
   370 	inline TInt QueryReceiveBuffer(TEndpointNumber aEndpoint, TInt& aNumberOfBytes);
   371 
   372 	/** Requests that a zero length status packet be sent to the host in response
   373 		to a class or vendor specific ep0 SETUP packet.
   374 
   375 		@return KErrNone if successful.
   376 	*/
   377 	inline TInt SendEp0StatusPacket();
   378 
   379 	/** Stalls endpoint aEndpoint, usually to indicate an error condition with a previous command.
   380 		The host will normally send a SET_FEATURE command on ep0 to acknowledge and clear the stall.
   381 
   382 		@return KErrNone if successful.
   383 	*/
   384 	inline TInt HaltEndpoint(TEndpointNumber aEndpoint);
   385 
   386 	/** Clears the stall condition on endpoint aEndpoint. This is inluded for symmetry and test purposes.
   387 
   388 		@return KErrNone if successful.
   389 	*/
   390 	inline TInt ClearHaltEndpoint(TEndpointNumber aEndpoint);
   391 
   392 	/** Requests that device control be allocated to this channel.
   393 
   394 		@return KErrNone if successful.
   395 	*/
   396 	inline TInt SetDeviceControl();
   397 
   398 	/** Relinquishes device control previously allocated to this channel.
   399 
   400 		@return KErrNone if successful.
   401 	*/
   402 	inline TInt ReleaseDeviceControl();
   403 
   404 	/** Returns a bitmap of available ep0 maximum packet sizes.
   405 
   406 		@return bitmap of available ep0 maximum packet sizes.
   407 	*/
   408 	inline TUint EndpointZeroMaxPacketSizes();
   409 
   410 	/** Requests that a maximum packet size of aMaxPacketSize be set on ep0.
   411 
   412 		@param aMaxPacketSize The maximum packet size.
   413 
   414 		@return KErrNone if successful.
   415 	*/
   416 	inline TInt SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize);
   417 
   418 	/** Queries the current maximum packet size on ep0.
   419 
   420 		@return The currently set maximum packet size on ep0.
   421 	*/
   422 	inline TInt GetEndpointZeroMaxPacketSize();
   423 
   424 	/** Copies the current device descriptor into aDeviceDescriptor.
   425 
   426 		@param aDeviceDescriptor Receives the current device descriptor.
   427 
   428 		@return KErrNone if successful.
   429 	*/
   430 	inline TInt GetDeviceDescriptor(TDes8& aDeviceDescriptor);
   431 
   432 	/** Sets the contents of aDeviceDescriptor to be the current device descriptor.
   433 
   434 		@param aDeviceDescriptor contains the device descriptor.
   435 
   436 		@return KErrNone if successful.
   437 	*/
   438 	inline TInt SetDeviceDescriptor(const TDesC8& aDeviceDescriptor);
   439 
   440 	/** Gets the size of the current device descriptor. This is unlikely to be anything other than 9.
   441 
   442 		@param aSize receives the size of the current device descriptor.
   443 
   444 		@return KErrNone if successful.
   445 	*/
   446 	inline TInt GetDeviceDescriptorSize(TInt& aSize);
   447 
   448 	/** Copies the current configuration descriptor into aConfigurationDescriptor.
   449 
   450 		@param aConfigurationDescriptor Receives the current configuration descriptor.
   451 
   452 		@return KErrNone if successful.
   453 	*/
   454 	inline TInt GetConfigurationDescriptor(TDes8& aConfigurationDescriptor);
   455 
   456 	/** Sets the contents of aConfigurationDescriptor to be the current configuration descriptor.
   457 
   458 		@param aConfigurationDescriptor contains the configuration descriptor.
   459 
   460 		@return KErrNone if successful.
   461 	*/
   462 	inline TInt SetConfigurationDescriptor(const TDesC8& aConfigurationDescriptor);
   463 
   464 	/** Gets the size of the current configuration descriptor.
   465 
   466 		@param aSize receives the size of the current configuration descriptor.
   467 
   468 		@return KErrNone if successful.
   469 	*/
   470 	inline TInt GetConfigurationDescriptorSize(TInt& aSize);
   471 
   472 	/** Copies the interface descriptor into aInterfaceDescriptor for the interface with alternate
   473 		setting aSettingNumber, 0 for the main interface.
   474 
   475 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   476 		@param aInterfaceDescriptor Receives the interface descriptor.
   477 
   478 		@return KErrNone if successful.
   479 	*/
   480 	inline TInt GetInterfaceDescriptor(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
   481 
   482 	/** Sets the interface descriptor contained in aInterfaceDescriptor for the interface with
   483 		alternate setting aSettingNumber, 0 for the main interface, for transmission to the host
   484 		during enumeration.
   485 
   486 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   487 		@param aInterfaceDescriptor Contains the interface descriptor to be set.
   488 
   489 		@return KErrNone if successful.
   490 	*/
   491 	inline TInt SetInterfaceDescriptor(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
   492 
   493 	/** Copies the size of the interface descriptor for the interface with alternate
   494 		setting aSettingNumber, 0 for the main interface, into aSize.
   495 
   496 		@param aSettingNumber The alternate setting.
   497 		@param aSize receives the size of the interface descriptor.
   498 
   499 		@return KErrNone if successful.
   500 	*/
   501 	inline TInt GetInterfaceDescriptorSize(TInt aSettingNumber, TInt& aSize);
   502 
   503 	/** Copies the endpoint descriptor for logical endpoint number aEndpointNumber into aEndpointDescriptor
   504 		for the interface with alternate setting aSettingNumber, 0 for the main interface.
   505 
   506 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   507 		@param aEndpointNumber.
   508 		@param aEndpointDescriptor Receives the endpoint descriptor.
   509 
   510 		@return KErrNone if successful.
   511 	*/
   512 	inline TInt GetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber, TDes8& aEndpointDescriptor);
   513 
   514 	/** Sets the endpoint descriptor for logical endpoint number aEndpointNumber contained in
   515 		aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
   516 		for transmission to the host during enumeration.
   517 
   518 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   519 		@param aEndpointNumber Valid endpoint number on this interface.
   520 		@param aEndpointDescriptor Contains the endpoint descriptor to be set.
   521 
   522 		@return KErrNone if successful.
   523 	*/
   524 	inline TInt SetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
   525 									  const TDesC8& aEndpointDescriptor);
   526 
   527 	/** Copies the size of the endpoint descriptor for logical endpoint number aEndpointNumber for the
   528 		interface with alternate setting aSettingNumber, 0 for the main interface, into aSize.
   529 
   530 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   531 		@param aEndpointNumber Valid endpoint number on this interface.
   532 		@param aSize receives the size of the endpoint descriptor.
   533 
   534 		@return KErrNone if successful.
   535 	*/
   536 	inline TInt GetEndpointDescriptorSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
   537 
   538     /** Get OTG descriptor size
   539 
   540 		@param aSize TInt reference which contains OTG descriptor size on return
   541     */
   542     inline void GetOtgDescriptorSize(TInt& aSize);
   543 
   544     /** Get OTG descriptor of USB on-the-go feature
   545 
   546 		@param aOtgDesc User-side buffer to store copy of descriptor
   547 
   548 		@return KErrNone if successful
   549     */
   550     inline TInt GetOtgDescriptor(TDes8& aOtgDesc);
   551 
   552     /** Set OTG descriptor by user to enable/disable USB on-the-go feature
   553 
   554 		@param aOtgDesc Descriptor buffer containing OTG features
   555 
   556 		@return KErrNone if successful
   557     */
   558     inline TInt SetOtgDescriptor(const TDesC8& aOtgDesc);
   559 
   560 	/** Copies the current device_qualifier descriptor into aDescriptor.
   561 
   562 		@param aDescriptor Receives the current device_qualifier descriptor.
   563 
   564 		@return KErrNone if successful.
   565 	*/
   566 	inline TInt GetDeviceQualifierDescriptor(TDes8& aDescriptor);
   567 
   568 	/** Sets the device_qualifier descriptor to the contents of aDescriptor.
   569 
   570 		@param aDescriptor contains the new device_qualifier descriptor.
   571 
   572 		@return KErrNone if successful.
   573 	*/
   574 	inline TInt SetDeviceQualifierDescriptor(const TDesC8& aDescriptor);
   575 
   576 	/** Copies the current other_speed_configuration descriptor into aDescriptor.
   577 
   578 		@param aDescriptor Receives the current other_speed_configuration descriptor.
   579 
   580 		@return KErrNone if successful.
   581 	*/
   582 	inline TInt GetOtherSpeedConfigurationDescriptor(TDes8& aDescriptor);
   583 
   584 	/** Sets the other_speed_configuration descriptor to the contents of aDescriptor.
   585 
   586 		@param aDescriptor contains the new other_speed_configuration descriptor.
   587 
   588 		@return KErrNone if successful.
   589 	*/
   590 	inline TInt SetOtherSpeedConfigurationDescriptor(const TDesC8& aDescriptor);
   591 
   592 	/** Copies the class specific interface descriptor block into aInterfaceDescriptor for the interface
   593 		with alternate setting aSettingNumber, 0 for the main interface.
   594 
   595 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   596 		@param aInterfaceDescriptor Contains the interface descriptor to be set.
   597 
   598 		@return KErrNone if successful.
   599 	*/
   600 	inline TInt GetCSInterfaceDescriptorBlock(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
   601 
   602 	/** aSettingNumber is the alternate interface setting, 0 for the main interface, that the descriptor block
   603 		aDes should be attached to. aDes is a block of data containing at least one class specific descriptor
   604 		for transmission during enumeration after the class interface descriptor (or alternate interface
   605 		descriptor) has been sent, but before the endpoint descriptors belonging to this interface are sent.
   606 		aDes may contain as many descriptors as are necessary or only 1. SetCSInterfaceDescriptorBlock()
   607 		should be called at any time after SetInterface() has been called to establish a main interface or an
   608 		alternate interface. More than one call may be made - the data blocks will be concatenated prior to
   609 		sending. No checking or validation of the contents of aDes will be made and it is the caller's
   610 		responsibility to ensure that the data supplied is correct and appropriate to the interface identified
   611 		by aSettingNumber.
   612 
   613 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   614 		@param aInterfaceDescriptor Contains the interface descriptor to be set.
   615 
   616 		@return KErrNone if successful.
   617 	*/
   618 	inline TInt SetCSInterfaceDescriptorBlock(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
   619 
   620 	/** Copies the size of the class specific interface descriptor block for the interface with alternate
   621 		setting aSettingNumber, 0 for the main interface, into aSize.
   622 
   623 		@param aSettingNumber The alternate setting number.
   624 		@param aSize receives the size of the interface descriptor.
   625 
   626 		@return KErrNone if successful.
   627 	*/
   628 	inline TInt GetCSInterfaceDescriptorBlockSize(TInt aSettingNumber, TInt& aSize);
   629 
   630 	/** Copies the class specific endpoint descriptor for logical endpoint number aEndpointNumber
   631 		into aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main
   632 		interface.
   633 
   634 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   635 		@param aEndpointNumber Valid endpoint number on this interface.
   636 		@param aEndpointDescriptor Receives the endpoint descriptor.
   637 
   638 		@return KErrNone if successful.
   639 	*/
   640 	inline TInt GetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
   641 											 TDes8& aEndpointDescriptor);
   642 
   643 	/** Sets the class specific endpoint descriptor for logical endpoint number aEndpointNumber contained in
   644 		aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
   645 		for transmission to the host during enumeration.
   646 
   647 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   648 		@param aEndpointNumber Valid endpoint number on this interface.
   649 		@param aEndpointDescriptor Contains the endpoint descriptor to be set.
   650 
   651 		@return KErrNone if successful.
   652 	*/
   653 	inline TInt SetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
   654 											 const TDesC8& aEndpointDescriptor);
   655 
   656 	/** Copies the size of the class specific endpoint descriptor block for logical endpoint number
   657 		aEndpointNumber for the interface with alternate setting aSettingNumber, 0 for the main interface,
   658 		into aSize.
   659 
   660 		@param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
   661 		@param aEndpointNumber Valid endpoint number on this interface.
   662 		@param aSize On return, contains the size of the class specific endpoint descriptor block.
   663 
   664 		@return KErrNone if successful.
   665 	*/
   666 	inline TInt GetCSEndpointDescriptorBlockSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
   667 
   668 	/** Generates a Remote Wakeup bus condition
   669 		The capability of the device to generate Remote Wakeup signalling is enquired in
   670 		RDevUsbcClient::DeviceCaps.
   671 
   672 		@return KErrNone if this signalling is possible and the signal has been generated.
   673 	*/
   674 	inline TInt SignalRemoteWakeup();
   675 
   676 	/** Simulates a physical removal of the USB cable by disabling the D+/- pull-ups.The iConnect member of
   677 		TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(), indicates whether this functionality is
   678 		supported.
   679 
   680 		@return KErrNone if successful.
   681 	*/
   682 	inline TInt DeviceDisconnectFromHost();
   683 
   684 	/** Simulates a physical insertion of the USB cable by enabling the D+/- pull-ups.The iConnect member
   685 		of TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(),  indicates whether this functionality
   686 		is supported.
   687 
   688 		@return KErrNone if successful.
   689 	*/
   690 	inline TInt DeviceConnectToHost();
   691 
   692 	/** Powers up the UDC and connects it to the bus if one or more interfaces exist.
   693 
   694 		@return KErrNone if UDC successfully powered up, KErrNotReady if no
   695 		interfaces have been registered yet, KErrHardwareNotAvailable if UDC
   696 		couldn't be activated.
   697 	*/
   698 	inline TInt PowerUpUdc();
   699 
   700 	/** Enquires about the current operating speed of the UDC.
   701 
   702 		@return ETrue if the UDC is currently operating at High speed, EFalse otherwise.
   703 	*/
   704 	inline TBool CurrentlyUsingHighSpeed();
   705 
   706 	/** Allocates the use of aResource to aEndpoint. it will be used from when the current bus transfer	has been
   707 		completed.
   708 
   709 		@param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
   710 		behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
   711 		@param aEndpoint The endpoint number to which the resource is to be allocated.
   712 
   713 		@return KErrNone if successful, KErrInUse if the resource is already consumed and cannot be allocated,
   714 		KErrNotSupported if the endpoint does not support the resource requested.
   715 
   716 		@publishedPartner @deprecated
   717 
   718 		@see TUsbcEndpointInfo
   719 	*/
   720 	inline TInt AllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
   721 
   722 	/** Deallocates the use of aResource aEndpoint or ends a specified endpoint behaviour.
   723 
   724 		@param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
   725 		behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
   726 		@param aEndpoint The endpoint number from which the resource is to be removed.
   727 
   728 		@return KErrNone if the resource has been successfully deallocated, KErrNotSupported if the endpoint
   729 		does not support the resource requested.
   730 
   731 		@publishedPartner @deprecated
   732 
   733 		@see TUsbcEndpointInfo
   734 	*/
   735 	inline TInt DeAllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
   736 
   737 	/** Queries endpoint resource use.
   738 
   739 		@param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
   740 		behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
   741 		@param aEndpoint The endpoint number at which the resource is to be queried.
   742 
   743 		@return ETrue is the specified resource is in use at the endpoint and EFalse if not.
   744 	*/
   745 	inline TBool QueryEndpointResourceUse(TInt aEndpoint, TUsbcEndpointResource aResource);
   746 
   747 	/** Request (i.e. claim for this channel) up to five endpoints and set the class type for this USB
   748 		interface. 'aInterfaceData' is a package buffer which describes the interface and all the endpoints
   749 		being requested by the driver for this interface.
   750 
   751 		@param aInterfaceNumber Distinguishes between alternate interfaces. If these are not be used then this
   752 		should always be zero. If this parameter is used, then its value must be one more than that of the
   753 		proceeding alternate interface.
   754 		@param aInterfaceData a package buffer which describes the interface and all the endpoints being
   755 		requested by the driver for this interface.
   756 		@param aBandwidthPriority is a bitmap combining the required IN and OUT priorities. Values are in the
   757 		range [0,3] from the lowest priority bandwidth, 0, to the highest 3 and are separately specified for
   758 		IN and OUT endpoints. Interfaces requiring higher bandwidth are allocated significantly more buffering
   759 		than low bandwidth interfaces. Interfaces should not be given a higher bandwidth priority than they
   760 		require.
   761 
   762 		@return KErrInUse if any of the endpoints being requested have already been claimed by another channel
   763 		KErrNotSupported if an endpoint with all of the specified properties is not supported on this
   764 		platform. KErrNoMemory if insufficient memory is available to complete the operation.
   765 	*/
   766 	inline TInt SetInterface(TInt aInterfaceNumber, TUsbcInterfaceInfoBuf& aInterfaceData,
   767 							 TUint32 aBandwidthPriority =
   768 							 (EUsbcBandwidthOUTDefault | EUsbcBandwidthINDefault));
   769 
   770 	/** Release an interface previously claimed by this channel. Alternate interfaces need to be released
   771 		in strict descending order, starting with the last (i.e. highest numbered) one.
   772 		It is not necessary to release an interface that wasn't successfully requested.
   773 
   774 		@param aInterfaceNumber Specifies the alternate setting number 'aInterfaceNum' of the interface to be
   775 		released.
   776 
   777 		@return KErrNone if successful. KErrArgument if the alternate setting doesn't exist or is released out
   778 		of order.
   779 	*/
   780 	inline TInt ReleaseInterface(TInt aInterfaceNumber);
   781 
   782 	/** Copies the current string descriptor language ID (LANGID) code into the aLangId argument. Even though
   783 		the USB spec allows for the existence of a whole array of LANGID codes, we only support one.
   784 
   785 		@param aLangId receives the LANGID code.
   786 
   787 		@return KErrNone if successful, KErrArgument if problem with argument (memory cannot be written to, etc.).
   788 	*/
   789 	inline TInt GetStringDescriptorLangId(TUint16& aLangId);
   790 
   791 	/** Sets the string descriptor language ID (LANGID). Even though the USB spec allows for the existence of
   792 		a whole array of LANGID codes, we only support one.
   793 
   794 		@param aLangId the LANGID code to be set.
   795 
   796 		@return KErrNone if successful.
   797 	*/
   798 	inline TInt SetStringDescriptorLangId(TUint16 aLangId);
   799 
   800 	/** Copies the string descriptor identified by the iManufacturer index field of the Standard Device
   801 		Descriptor into the aString argument.
   802 
   803 		@param aString receives manufacturer string.
   804 
   805 		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
   806 		descriptor, KErrNotFound if the string descriptor couldn't be found.
   807 	*/
   808 	inline TInt GetManufacturerStringDescriptor(TDes16& aString);
   809 
   810 	/** Sets the string descriptor identified by the iManufacturer index field of the Standard Device
   811 		Descriptor to the aString argument.
   812 
   813 		@param aString Contains the new manufacturer string descriptor.
   814 
   815 		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
   816 		aString (in which case the old string descriptor will be preserved).
   817 	*/
   818 	inline TInt SetManufacturerStringDescriptor(const TDesC16& aString);
   819 
   820 	/** Removes (deletes) the string descriptor identified by the iManufacturer index field of the Standard
   821 		Device Descriptor and sets that field to zero.
   822 
   823 		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
   824 	*/
   825 	inline TInt RemoveManufacturerStringDescriptor();
   826 
   827 	/** Retrieves the string descriptor identified by the iProduct index field of the Standard Device
   828 		Descriptor into the aString argument.
   829 
   830 		@param aString receives product string.
   831 
   832 		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
   833 		descriptor, KErrNotFound if the string descriptor couldn't be found.
   834 	*/
   835 	inline TInt GetProductStringDescriptor(TDes16& aString);
   836 
   837 	/** Sets the string descriptor identified by the iProduct index field of the Standard Device Descriptor to
   838 		the aString argument.
   839 
   840 		@param aString Contains the new product string descriptor.
   841 
   842 		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
   843 		aString (in which case the old string descriptor will be preserved).
   844 	*/
   845 	inline TInt SetProductStringDescriptor(const TDesC16& aString);
   846 
   847 	/** Removes (deletes) the string descriptor identified by the iProduct index field of the Standard Device
   848 		Descriptor and sets that field to zero.
   849 
   850 		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
   851 	*/
   852 	inline TInt RemoveProductStringDescriptor();
   853 
   854 	/** Retrieves the string descriptor identified by the iSerialNumber index field of the Standard Device
   855 		Descriptor into the aString argument.
   856 
   857 		@param aString receives product string.
   858 
   859 		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
   860 		descriptor, KErrNotFound if the string descriptor couldn't be found.
   861 	*/
   862 	inline TInt GetSerialNumberStringDescriptor(TDes16& aString);
   863 
   864 	/** Sets the string descriptor identified by the iSerialNumber index field of the Standard Device
   865 		Descriptor to the aString argument.
   866 
   867 		@param aString Contains the new serial number string descriptor.
   868 
   869 		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
   870 		aString (in which case the old string descriptor will be preserved).
   871 	*/
   872 	inline TInt SetSerialNumberStringDescriptor(const TDesC16& aString);
   873 
   874 	/** Removes (deletes) the string descriptor identified by the iSerialNumber index field of the Standard
   875 		Device Descriptor and sets that field to zero.
   876 
   877 		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
   878 	*/
   879 	inline TInt RemoveSerialNumberStringDescriptor();
   880 
   881 	/** Retrieves the string descriptor identified by the iConfiguration index field of the (first) Standard
   882 		Configuration Descriptor into the aString argument.
   883 
   884 		@param aString receives configuration string.
   885 
   886 		@return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
   887 		descriptor, KErrNotFound if the string descriptor couldn't be found.
   888 	*/
   889 	inline TInt GetConfigurationStringDescriptor(TDes16& aString);
   890 
   891 	/** Sets the string descriptor identified by the iConfiguration index field of the Standard Configuration
   892 		Descriptor to the aString argument.
   893 
   894 		@param aString Contains the new serial number string descriptor.
   895 
   896 		@return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
   897 		aString (in which case the old string descriptor will be preserved).
   898 	*/
   899 	inline TInt SetConfigurationStringDescriptor(const TDesC16& aString);
   900 
   901 	/** Removes (deletes) the string descriptor identified by the iConfiguration index field of the Standard
   902 		Configuration Descriptor and sets that field to zero.
   903 
   904 		@return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
   905 	*/
   906 	inline TInt RemoveConfigurationStringDescriptor();
   907 
   908 	/** Copies the string of the USB string descriptor at the specified index in the string descriptor array
   909 		into the aString argument.
   910 
   911 		Although this function can also be used for it, for querying most standard string descriptors
   912 		there exists a set of dedicated access functions.
   913 
   914 		@see RDevUsbcClient::GetStringDescriptorLangId
   915 		@see RDevUsbcClient::GetManufacturerStringDescriptor
   916 		@see RDevUsbcClient::GetProductStringDescriptor
   917 		@see RDevUsbcClient::GetSerialNumberStringDescriptor
   918 		@see RDevUsbcClient::GetConfigurationStringDescriptor
   919 
   920 		@param aIndex The position of the string descriptor in the string descriptor array.
   921 		@param aString The target location for the string descriptor copy.
   922 
   923 		@return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index,
   924 		KErrArgument if MaxLength() of aString is too small to hold the entire descriptor.
   925 	*/
   926 	inline TInt GetStringDescriptor(TUint8 aIndex, TDes16& aString);
   927 
   928 	/** Sets the aString argument to be the string of a USB string descriptor at the specified index in the
   929 		string descriptor array. If a string descriptor already exists at that position then its string will
   930 		be replaced.
   931 
   932 		Care should be taken, when choosing aIndex, not to inadvertently overwrite one of the standard
   933 		string descriptors.	For their manipulation there exists a set of dedicated access functions.
   934 
   935 		@see RDevUsbcClient::SetStringDescriptorLangId
   936 		@see RDevUsbcClient::SetManufacturerStringDescriptor
   937 		@see RDevUsbcClient::SetProductStringDescriptor
   938 		@see RDevUsbcClient::SetSerialNumberStringDescriptor
   939 		@see RDevUsbcClient::SetConfigurationStringDescriptor
   940 
   941 		@param aIndex The position of the string descriptor in the string descriptor array.
   942 		@param aString Contains the string descriptor to be set.
   943 
   944 		@return KErrNone if successful, KErrArgument if aIndex is invalid, KErrNoMemory if no memory
   945 		is available to store the new string (an existing descriptor at that index will be preserved).
   946 	*/
   947 	inline TInt SetStringDescriptor(TUint8 aIndex, const TDesC16& aString);
   948 
   949 	/** Removes (deletes) the USB string descriptor at the specified index in the string descriptor array.
   950 		The position in the array of other string descriptors is not affected.
   951 
   952 		Care should be taken, when choosing aIndex, not to inadvertently delete a standard string descriptor
   953 		(also because index references from non-string descriptors would be invalidated). For the deletion
   954 		of most standard string descriptors there exists a set of dedicated functions.
   955 
   956 		@see RDevUsbcClient::RemoveManufacturerStringDescriptor
   957 		@see RDevUsbcClient::RemoveProductStringDescriptor
   958 		@see RDevUsbcClient::RemoveSerialNumberStringDescriptor
   959 		@see RDevUsbcClient::RemoveConfigurationStringDescriptor
   960 
   961 		@param aIndex The position of the string descriptor in the string descriptor array.
   962 
   963 		@return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index.
   964 	*/
   965 	inline TInt RemoveStringDescriptor(TUint8 aIndex);
   966 
   967 	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
   968 		Request completes when the specified number of bytes is received, length taken from max. length of
   969 		descriptor.
   970 
   971 		@param aStatus The request status.
   972 		@param aEndpoint The endpoint number to read from.
   973 		@param aDes	Descriptor to receive the data.
   974 	*/
   975 	inline void Read(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes);
   976 
   977 	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
   978 		Request completes when the specified number of bytes is received.
   979 
   980 		@param aStatus The request status.
   981 		@param aEndpoint The endpoint number to read from.
   982 		@param aDes	Descriptor to receive the data.
   983 		@param aLen The number of bytes to read.
   984 	*/
   985 	inline void Read(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aLen);
   986 
   987 	/** Asynchronously read an entire packet of data from endpoint 'aEndpoint' into the descriptor 'aDes'.
   988 		If a packet has previously been partly read. then only the remainder of the packet will be returned.
   989 		The request should be for the maximum packet size of the endpoint. If less data is requested, then
   990 		after this read completes the remainder of the data in the packet will be discarded and the next read
   991 		will start from the next available packet.
   992 		Request completes when either a complete packet is received or the length of the packet currently
   993 		being received exceeds 'aMaxLen'.
   994 
   995 		@param aStatus The request status.
   996 		@param aEndpoint The endpoint number to read from.
   997 		@param aDes	Descriptor to receive the data.
   998 		@param aMaxLen .
   999 	*/
  1000 	inline void ReadPacket(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aMaxLen);
  1001 
  1002 	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
  1003 		Request completes when the specified number of bytes is received (in first version,
  1004 		length taken from max. length of descriptor).
  1005 
  1006 		@param aStatus The request status.
  1007 		@param aEndpoint The endpoint number to read from.
  1008 		@param aDes	Descriptor to receive the data.
  1009 	*/
  1010 	inline void ReadUntilShort(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes);
  1011 
  1012 	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'.
  1013 		Request completes when the specified number of bytes is received (in first version,
  1014 		length taken from max. length of descriptor).
  1015 
  1016 		@param aStatus The request status.
  1017 		@param aEndpoint The endpoint number to read from.
  1018 		@param aDes	Descriptor to receive the data.
  1019 		@param aLen The number of bytes to receive.
  1020 	*/
  1021 	inline void ReadUntilShort(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aLen);
  1022 
  1023 	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'. The request completes
  1024 		when the specified number of bytes is received, length taken from max. length of descriptor or a
  1025 		packet whose size is smaller than the endpoint's maximum packet size is received.
  1026 
  1027 		@param aStatus The request status.
  1028 		@param aEndpoint The endpoint number to read from.
  1029 		@param aDes	Descriptor to receive the data.
  1030 	*/
  1031 	inline void ReadOneOrMore(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes);
  1032 
  1033 	/** Asynchronously read data from endpoint 'aEndpoint' into the descriptor 'aDes'. The request completes
  1034 		when the specified number of bytes is received, or a packet whose size is smaller than the endpoint's
  1035 		maximum packet size is received.
  1036 
  1037 		@param aStatus The request status.
  1038 		@param aEndpoint The endpoint number to read from.
  1039 		@param aDes	Descriptor to receive the data.
  1040 		@param aLen The number of bytes to receive.
  1041 	*/
  1042 	inline void ReadOneOrMore(TRequestStatus& aStatus, TEndpointNumber aEndpoint, TDes8& aDes, TInt aLen);
  1043 
  1044 	/** Cancels an outstanding read request. The request will complete with whatever data is available.
  1045 	*/
  1046 	inline void ReadCancel(TEndpointNumber aEndpoint);
  1047 
  1048 	/** Asynchronously write 'aLen' bytes of data to endpoint 'aEndpoint' from descriptor 'aDes'. 'aZlpRequired'
  1049 		(optional) signals that ZLP termination may be required.
  1050 
  1051 		@param aStatus The request status.
  1052 		@param aEndpoint The endpoint number to write to.
  1053 		@param aDes	Descriptor to provide the data.
  1054 		@param aLen The number of bytes of data to be written.
  1055 		@param aZlpRequired True, if ZLP termination is required; false, otherwise.
  1056 	*/
  1057 	inline void Write(TRequestStatus& aStatus, TEndpointNumber aEndpoint, const TDesC8& aDes, TInt aLen,
  1058 					  TBool aZlpRequired=EFalse);
  1059 
  1060 	/** Cancels an outstanding write request on endpoint aEndpoint.
  1061 
  1062 		@param aEndpoint The endpoint number whose write is to be cancelled.
  1063 	*/
  1064 	inline void WriteCancel(TEndpointNumber aEndpoint);
  1065 
  1066 	/** Cancels any transfer on any endpoint specified in aEndpointMask.
  1067 
  1068 		@code
  1069 		// Cancel transfer requests on endpoints 1, 2 & 3
  1070 		usbPort.EndpointTransferCancel(KUsbcEndpoint1Bit | KUsbcEndpoint2Bit | KUsbcEndpoint3Bit);
  1071 		@endcode
  1072 
  1073 		@param aEndpointMask bitmap of the endpoints.
  1074 	*/
  1075 	inline void EndpointTransferCancel(TUint aEndpointMask);
  1076 
  1077 	/**	Register for notification when a change of the Interface alternate setting or the USB Controller's
  1078 		current state occurs. When the alternate setting or the Controller state changes, then the
  1079 		asynchronous function completes and the current alternate setting number or Controller state is
  1080 		written back to aValue. If the KUsbAlternateSetting bit is set then the remaining bits are the
  1081 		alternate setting number. Otherwise aValue is interpreted as a TUsbcDeviceState.
  1082 
  1083 		@see TUsbcDeviceState
  1084 
  1085 		@param aStatus The request status.
  1086 		@param aValue Receives the alternate setting number or Controller state.
  1087 	*/
  1088 	inline void AlternateDeviceStatusNotify(TRequestStatus& aStatus, TUint& aValue);
  1089 
  1090 	/** Completes an AlternateDeviceStatusNotify request. If a request has previously been made then the
  1091 		status variable is updated with the current device state.
  1092 	*/
  1093 	inline void AlternateDeviceStatusNotifyCancel();
  1094 
  1095 	/** If the channel has changed the grouping of endpoints between interfaces or changed the interface class
  1096 		type from the defaults then it is necessary to force a re-enumeration. This will typically involve the
  1097 		Symbian OS device initiating a disconnection and re-connection. This is an asynchronous operation
  1098 		which will complete when the Controller is successfully configured by the host, i.e. has achieved
  1099 		EUsbcDeviceStateConfigured.  Since it is not known if the operation has failed, at the same time that
  1100 		a ReEnumerate request is made, a timer should be set up to complete after approximately 5 seconds. It
  1101 		can be assumed that if the operation has not completed after this time interval then it will not
  1102 		complete.
  1103 
  1104 		@param aStatus The request status.
  1105 	*/
  1106 	inline void ReEnumerate(TRequestStatus& aStatus);
  1107 
  1108 	/** Cancels an outstanding ReEnumerate() request.
  1109 	*/
  1110 	inline void ReEnumerateCancel();
  1111 
  1112 	/**	Register for notification when a change in stall status of any of the interface's endpoints occurs,
  1113 		but not ep0. When a change in stall status occurs, then the asynchronous function completes and the
  1114 		current stall state is written back to 'aEndpointStatus' as a bit map: Only stall state changes caused
  1115 		by SET_FEATURE and CLEAR_FEATURE standard commands on ep0 will be notified when this function
  1116 		completes. After this request completes the request should be re-issued to obtain future
  1117 		notifications.
  1118 
  1119 		@param aStatus The request status.
  1120 		@param aEndpointMask a bitmap of the endpoints stall status. This is filled in when the call completes
  1121 		bit 1 represents the interface's virtual endpoint 1, (KUsbcEndpoint1Bit)
  1122 		bit 2 represents the interface's virtual endpoint 2, (KUsbcEndpoint2Bit) etc.
  1123 		bit value 0 - not stalled,
  1124 		bit value 1 - stalled.
  1125 	*/
  1126 	inline void EndpointStatusNotify(TRequestStatus& aStatus, TUint& aEndpointMask);
  1127 
  1128 	/** Completes an endpoint status notify request.
  1129 	*/
  1130  	inline void EndpointStatusNotifyCancel();
  1131 
  1132     /** Get current on-the-go features relating to the ability of device/host pair to
  1133         perform OTG role swap.
  1134 
  1135         @param aFeatures On return it contanis features the device currently has
  1136                 bit 2 represents b_hnp_enable,       (KUsbOtgAttr_B_HnpEnable)
  1137                 bit 3 represents a_hnp_support,      (KUsbOtgAttr_A_HnpSupport)
  1138                 bit 4 represents a_alt_hnp_support,  (KUsbOtgAttr_A_AltHnpSupport)
  1139         @return KErrNone if successful, KErrNotSupported if OTG is not supported by
  1140                 this device, otherwise system-wide error returns
  1141     */
  1142     inline TInt GetOtgFeatures(TUint8& aFeatures);
  1143 
  1144     /** Register for notification on USB on-the-go features' change. If any OTG feature
  1145         is changed, request completes and current feature value is filled in aValue.
  1146 
  1147         @param aStatus Request status object
  1148         @param aValue On request completion, it contains current OTG feature value
  1149     */
  1150     inline void OtgFeaturesNotify(TRequestStatus& aStatus, TUint8& aValue);
  1151 
  1152     /** Cancel pending OTG feature request.
  1153     */
  1154     inline void OtgFeaturesNotifyCancel();
  1155 
  1156 #endif // #ifndef __KERNEL_MODE__
  1157 	};
  1158 
  1159 
  1160 #include <d32usbc.inl>
  1161 
  1162 
  1163 #endif // __D32USBC_H__