os/kernelhwsrv/kernel/eka/include/d32usbdi.inl
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 
sl@0
    18
 The driver's name
sl@0
    19
 
sl@0
    20
 @return The name of the driver
sl@0
    21
 
sl@0
    22
 @internalComponent
sl@0
    23
*/
sl@0
    24
const TDesC& RUsbInterface::Name()
sl@0
    25
	{
sl@0
    26
	_LIT(KDriverName,"USBDI");
sl@0
    27
	return KDriverName;
sl@0
    28
	}
sl@0
    29
sl@0
    30
/**
sl@0
    31
The driver's version
sl@0
    32
sl@0
    33
@return The version number of the driver
sl@0
    34
sl@0
    35
@internalComponent
sl@0
    36
*/
sl@0
    37
TVersion RUsbInterface::VersionRequired()
sl@0
    38
	{
sl@0
    39
	const TInt KMajorVersionNumber=1;
sl@0
    40
	const TInt KMinorVersionNumber=0;
sl@0
    41
	const TInt KBuildVersionNumber=KE32BuildVersionNumber;
sl@0
    42
	return TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
sl@0
    43
	}
sl@0
    44
sl@0
    45
sl@0
    46
sl@0
    47
#ifndef __KERNEL_MODE__
sl@0
    48
RUsbInterface::RUsbInterface()
sl@0
    49
	: iHeadInterfaceDescriptor(NULL)
sl@0
    50
	, iInterfaceDescriptorData(NULL)
sl@0
    51
	, iTransferStrategy(NULL)
sl@0
    52
	, iAlternateSetting(0)
sl@0
    53
	{
sl@0
    54
	}
sl@0
    55
sl@0
    56
/**
sl@0
    57
Signals to the hub driver that this interface is idle and may be suspended.
sl@0
    58
As suspend operates at the device level, this will only trigger a removal of bus activity if all interfaces
sl@0
    59
associated with the device are marked as suspended.
sl@0
    60
sl@0
    61
@param [in] aResumeSignal The TRequestStatus that will be completed when the interface is resumed.
sl@0
    62
*/
sl@0
    63
void RUsbInterface::PermitSuspendAndWaitForResume(TRequestStatus& aResumeSignal)
sl@0
    64
	{
sl@0
    65
	DoRequest(ESuspend, aResumeSignal);
sl@0
    66
	}
sl@0
    67
sl@0
    68
/**
sl@0
    69
Cancel the outstanding permission to suspend.
sl@0
    70
*/
sl@0
    71
void RUsbInterface::CancelPermitSuspend()
sl@0
    72
	{
sl@0
    73
	DoCancel(ECancelSuspend);
sl@0
    74
	}
sl@0
    75
sl@0
    76
/**
sl@0
    77
Cancel the outstanding PermitSuspendAndWaitForResume request with KErrCancel
sl@0
    78
*/
sl@0
    79
void RUsbInterface::CancelWaitForResume()
sl@0
    80
	{
sl@0
    81
	DoCancel(ECancelWaitForResume);
sl@0
    82
	}
sl@0
    83
sl@0
    84
/**
sl@0
    85
Request or clear the interface's remote wakeup flag.  If any interface on the device
sl@0
    86
has this flag set, suspending the device will cause it to have remote wakeup capability
sl@0
    87
enabled.  This function may only be called when the interface is active -- the device will
sl@0
    88
not be woken to change the status if it is currently suspended.
sl@0
    89
Note that clearing this flag will not prevent a device from using remote wakeup -- this
sl@0
    90
will happen only if all interfaces on the device do not require it.
sl@0
    91
By default the device will not have remote wakeup enabled.
sl@0
    92
sl@0
    93
@param aAllowed ETrue if remote wakeup should be permitted, EFalse if this interface does
sl@0
    94
not require it.
sl@0
    95
sl@0
    96
@return KErrNotReady if two calls have been made in succession with the same parameter.
sl@0
    97
KErrUsbDeviceSuspended if the interface is currently marked as suspended.
sl@0
    98
*/
sl@0
    99
TInt RUsbInterface::PermitRemoteWakeup(TBool aAllowed)
sl@0
   100
	{
sl@0
   101
	return DoControl(EPermitRemoteWakeup, (TAny*)aAllowed);
sl@0
   102
	}
sl@0
   103
sl@0
   104
sl@0
   105
/**
sl@0
   106
Select the specified alternate interface.
sl@0
   107
sl@0
   108
Asserts that all open pipes have been closed.
sl@0
   109
sl@0
   110
@param [in] aAlternateInterface The alternate interface to select.
sl@0
   111
sl@0
   112
@return KErrArgument if the specified alternate interface does not exist.
sl@0
   113
@return KErrOverflow if selecting this alternate interface would overcommit the bus' bandwidth.
sl@0
   114
*/
sl@0
   115
TInt RUsbInterface::SelectAlternateInterface(TInt aAlternateInterface)
sl@0
   116
	{
sl@0
   117
	TInt err = DoControl(ESelectAlternateInterface, (TAny*)aAlternateInterface);
sl@0
   118
	if(err == KErrNone)
sl@0
   119
		{
sl@0
   120
		iAlternateSetting = aAlternateInterface;
sl@0
   121
		}
sl@0
   122
	return err;
sl@0
   123
	}
sl@0
   124
sl@0
   125
TInt RUsbInterface::GetStringDescriptor(TDes8& aStringDescriptor, TUint8 aIndex, TUint16 aLangId)
sl@0
   126
	{
sl@0
   127
	TUint32 params;
sl@0
   128
	params = aIndex | (aLangId << 16);
sl@0
   129
	return DoControl(EGetStringDescriptor, &aStringDescriptor, &params);
sl@0
   130
	}
sl@0
   131
sl@0
   132
sl@0
   133
/**  
sl@0
   134
Performs an Endpoint 0 transfer.
sl@0
   135
*/
sl@0
   136
void RUsbInterface::Ep0Transfer(TUsbTransferRequestDetails& aDetails, const TDesC8& aSend, TDes8& aRecv, TRequestStatus& aRequest)
sl@0
   137
	{
sl@0
   138
	aDetails.iSend         = &aSend;
sl@0
   139
	aDetails.iRecv         = &aRecv;
sl@0
   140
	DoRequest(EEp0Transfer, aRequest, (TAny*)&aDetails);
sl@0
   141
	}
sl@0
   142
sl@0
   143
/**  
sl@0
   144
Cancel an Endpoint 0 transfer.
sl@0
   145
*/
sl@0
   146
void RUsbInterface::CancelEP0Transfer()
sl@0
   147
	{
sl@0
   148
	DoCancel(ECancelEp0Transfer);
sl@0
   149
	}
sl@0
   150
sl@0
   151
/**
sl@0
   152
Establish a pipe between host and device.  The RUsbPipe object returned is ready for use.
sl@0
   153
sl@0
   154
@param aPipe The pipe to connect to the remote endpoint. [out]
sl@0
   155
@param aEndpoint The endpoint on the remote device to connect to. [in]
sl@0
   156
@param aUseDMA In future implementations where DMA is supported this flag indicates DMA must be used. The Open attempt will fail if DMA cannot be offered on the pipe. [in]
sl@0
   157
sl@0
   158
@return KErrArgument if the specified endpoint does not exist.
sl@0
   159
@see SelectAlternateInterface
sl@0
   160
*/
sl@0
   161
TInt RUsbInterface::OpenPipeForEndpoint(RUsbPipe& aPipe, TInt aEndpoint, TBool /*aUseDMA*/)
sl@0
   162
	{
sl@0
   163
	if(aPipe.iHandle)
sl@0
   164
		{
sl@0
   165
		return KErrInUse;
sl@0
   166
		}
sl@0
   167
sl@0
   168
	TInt err = GetEndpointDescriptor(iAlternateSetting, aEndpoint, aPipe.iHeadEndpointDescriptor);
sl@0
   169
	// Allow KErrNotFound as audio endpoint descriptors are not valid endpoint descriptors
sl@0
   170
	if ((err == KErrNone) || (err == KErrNotFound))
sl@0
   171
		{
sl@0
   172
		TUint32 pipeHandle;
sl@0
   173
		err = DoControl(EOpenPipe, &pipeHandle, reinterpret_cast<TAny*>(aEndpoint));
sl@0
   174
		if (err == KErrNone)
sl@0
   175
			{
sl@0
   176
			aPipe.iHandle = pipeHandle;
sl@0
   177
			aPipe.iInterface = this;
sl@0
   178
			}
sl@0
   179
		}
sl@0
   180
sl@0
   181
	return err;
sl@0
   182
	}
sl@0
   183
sl@0
   184
/**
sl@0
   185
@internalComponent
sl@0
   186
*/
sl@0
   187
TInt RUsbInterface::AllocateSharedChunk(RChunk& aChunk, TInt aSize, TInt& aOffset)
sl@0
   188
	{
sl@0
   189
	TInt chunkHandle = 0;
sl@0
   190
	RUsbInterface::TChunkRequestDetails details;
sl@0
   191
	details.iRequestSize = aSize;
sl@0
   192
	details.iChunkHandle = &chunkHandle;
sl@0
   193
	details.iOffset = &aOffset;
sl@0
   194
	TInt err = DoControl(EAllocChunk, &details);
sl@0
   195
	if(err == KErrNone)
sl@0
   196
		{
sl@0
   197
		aChunk.SetHandle(chunkHandle);
sl@0
   198
		}
sl@0
   199
	return err;
sl@0
   200
	}
sl@0
   201
sl@0
   202
/**
sl@0
   203
Return the section of the USB Configuration Descriptor under this interface, including any alternate
sl@0
   204
interfaces.
sl@0
   205
sl@0
   206
Note: the supplied TUsbInterfaceDescriptor is owned by the caller, but any descriptor objects linked to it
sl@0
   207
remain the property of the RUsbInterface object.  Memory leaks will result if the head pointer is not
sl@0
   208
cleaned up, but the pointed to objects should not be destroyed.
sl@0
   209
sl@0
   210
@param [out] aDescriptor The supplied TUsbInterfaceDescriptor object will be populated from the data retrieved from
sl@0
   211
the	device.  Note that the caller owns the head of the list, but not any children or peers.
sl@0
   212
sl@0
   213
@return System wide error code.
sl@0
   214
*/
sl@0
   215
TInt RUsbInterface::GetInterfaceDescriptor(TUsbInterfaceDescriptor& aDescriptor)
sl@0
   216
	{
sl@0
   217
	if (!iHeadInterfaceDescriptor)
sl@0
   218
		{
sl@0
   219
		return KErrNotReady;
sl@0
   220
		}
sl@0
   221
sl@0
   222
	aDescriptor = *iHeadInterfaceDescriptor;
sl@0
   223
	return KErrNone;
sl@0
   224
	}
sl@0
   225
sl@0
   226
/**
sl@0
   227
Find and return the section of the USB Configuration Descriptor under the supplied alternate interface.
sl@0
   228
sl@0
   229
Note: the supplied TUsbInterfaceDescriptor is owned by the caller, but any descriptor objects linked to it
sl@0
   230
remain the property of the RUsbInterface object.  Memory leaks will result if the head pointer is not
sl@0
   231
cleaned up, but the pointed to objects should not be destroyed.
sl@0
   232
sl@0
   233
@param aAlternateInterface The alternate interface number to return the descriptor for. [in]
sl@0
   234
@param aDescriptor The supplied TUsbInterfaceDescriptor object will be populated from the data retrieved from
sl@0
   235
the	device.  Note that the caller owns the head of the list, but not any children or peers. [out]
sl@0
   236
sl@0
   237
@return KErrArgument if the specified alternate interface does not exist.
sl@0
   238
*/
sl@0
   239
TInt RUsbInterface::GetAlternateInterfaceDescriptor(TInt aAlternateInterface, TUsbInterfaceDescriptor& aDescriptor)
sl@0
   240
	{
sl@0
   241
	if (!iHeadInterfaceDescriptor)
sl@0
   242
		{
sl@0
   243
		return KErrNotReady;
sl@0
   244
		}
sl@0
   245
sl@0
   246
	TUsbGenericDescriptor* descriptor = iHeadInterfaceDescriptor;
sl@0
   247
	while (descriptor)
sl@0
   248
		{
sl@0
   249
		TUsbInterfaceDescriptor* interface = TUsbInterfaceDescriptor::Cast(descriptor);
sl@0
   250
		if (interface)
sl@0
   251
			{
sl@0
   252
			if (interface->AlternateSetting() == aAlternateInterface)
sl@0
   253
				{
sl@0
   254
				aDescriptor = *interface;
sl@0
   255
				return KErrNone;
sl@0
   256
				}
sl@0
   257
			}
sl@0
   258
        // we must check any Interface Association Descriptors for
sl@0
   259
        // Alternate Interface settings.  The spec is abiguous on how these may be organised so we
sl@0
   260
        // presume the worst and do a full search
sl@0
   261
		TUsbInterfaceAssociationDescriptor* iad = TUsbInterfaceAssociationDescriptor::Cast(descriptor);
sl@0
   262
		if (iad)
sl@0
   263
			{
sl@0
   264
			TUsbGenericDescriptor* assocDes = iad->iFirstChild;
sl@0
   265
			while (assocDes)
sl@0
   266
				{
sl@0
   267
				interface = TUsbInterfaceDescriptor::Cast(assocDes);
sl@0
   268
				if (interface)
sl@0
   269
					{
sl@0
   270
					if (interface->AlternateSetting() == aAlternateInterface)
sl@0
   271
						{
sl@0
   272
						aDescriptor = *interface;
sl@0
   273
						return KErrNone;
sl@0
   274
						}
sl@0
   275
					}
sl@0
   276
				assocDes = assocDes->iNextPeer;
sl@0
   277
				}
sl@0
   278
			}
sl@0
   279
		descriptor = descriptor->iNextPeer;
sl@0
   280
		}
sl@0
   281
sl@0
   282
	return KErrArgument;
sl@0
   283
	}
sl@0
   284
sl@0
   285
/**
sl@0
   286
Find and return the section of the USB Configuration Descriptor under the supplied endpoint.
sl@0
   287
sl@0
   288
Note: the supplied TUsbEndpointDescriptor is owned by the caller, but any descriptor objects linked to it
sl@0
   289
remain the property of the RUsbInterface object.  Memory leaks will result if the head pointer is not
sl@0
   290
cleaned up, but the pointed to objects should not be destroyed.
sl@0
   291
sl@0
   292
@param aAlternateInterface The alternate interface number to return the descriptor for. [in]
sl@0
   293
@param aEndpoint The endpoint number to return the descriptor for. [in]
sl@0
   294
@param aDescriptor The supplied TUsbEndpointDescriptor object will be populated from the data retrieved from
sl@0
   295
the	device.  Note that the caller owns the head of the list, but not any children or peers. [out]
sl@0
   296
sl@0
   297
@return KErrArgument if the specified alternate interface does not exist, or KErrNotFound if the specified
sl@0
   298
endpoint cannot be found on the alternate interface.
sl@0
   299
*/
sl@0
   300
TInt RUsbInterface::GetEndpointDescriptor(TInt aAlternateInterface, TInt aEndpoint, TUsbEndpointDescriptor& aDescriptor)
sl@0
   301
	{
sl@0
   302
	TUsbEndpointDescriptor* descriptor = &aDescriptor;
sl@0
   303
	TInt err = GetEndpointDescriptor(aAlternateInterface, aEndpoint, descriptor);
sl@0
   304
    if ((err == KErrNone) && descriptor)
sl@0
   305
		{
sl@0
   306
		aDescriptor = *descriptor;
sl@0
   307
		}
sl@0
   308
	return err;
sl@0
   309
	}
sl@0
   310
sl@0
   311
TInt RUsbInterface::GetEndpointDescriptor(TInt aAlternateInterface, TInt aEndpoint, TUsbEndpointDescriptor*& aDescriptor)
sl@0
   312
	{
sl@0
   313
	aDescriptor = NULL;
sl@0
   314
sl@0
   315
	TUsbInterfaceDescriptor alternate;
sl@0
   316
	TInt err = GetAlternateInterfaceDescriptor(aAlternateInterface, alternate);
sl@0
   317
	if (err != KErrNone)
sl@0
   318
		{
sl@0
   319
		return err;
sl@0
   320
		}
sl@0
   321
sl@0
   322
	TUsbGenericDescriptor* descriptor = alternate.iFirstChild;
sl@0
   323
	while (descriptor)
sl@0
   324
		{
sl@0
   325
		TUsbEndpointDescriptor* endpoint = TUsbEndpointDescriptor::Cast(descriptor);
sl@0
   326
		if (endpoint && (endpoint->EndpointAddress() == aEndpoint))
sl@0
   327
			{
sl@0
   328
			aDescriptor = endpoint;
sl@0
   329
			return KErrNone;
sl@0
   330
			}
sl@0
   331
sl@0
   332
		descriptor = descriptor->iNextPeer;
sl@0
   333
		}
sl@0
   334
sl@0
   335
	return KErrNotFound;
sl@0
   336
	}
sl@0
   337
sl@0
   338
/**
sl@0
   339
@return Number of alternate interface options on this interface.
sl@0
   340
*/
sl@0
   341
TInt RUsbInterface::GetAlternateInterfaceCount()
sl@0
   342
	{
sl@0
   343
	if (!iHeadInterfaceDescriptor)
sl@0
   344
		{
sl@0
   345
		return KErrNotReady;
sl@0
   346
		}
sl@0
   347
sl@0
   348
	TInt count = 0;
sl@0
   349
sl@0
   350
	// Don't need to look for children of the interface -- all the alternates
sl@0
   351
    // must be peers.
sl@0
   352
	TUsbGenericDescriptor* descriptor = iHeadInterfaceDescriptor;
sl@0
   353
	while (descriptor)
sl@0
   354
		{
sl@0
   355
		TUsbInterfaceDescriptor* interface = TUsbInterfaceDescriptor::Cast(descriptor);
sl@0
   356
		if (interface)
sl@0
   357
			{
sl@0
   358
			++count;
sl@0
   359
			}
sl@0
   360
		else
sl@0
   361
            {
sl@0
   362
            // we must check any Interface Association Descriptors for
sl@0
   363
            // Alternate Interface settings.  The spec is abiguous on how these may be organised so we
sl@0
   364
            // presume the worst and do a full search
sl@0
   365
            TUsbInterfaceAssociationDescriptor* iad = TUsbInterfaceAssociationDescriptor::Cast(descriptor);
sl@0
   366
            if (iad)
sl@0
   367
                {
sl@0
   368
                TUsbGenericDescriptor* assocDes = iad->iFirstChild;
sl@0
   369
                while (assocDes)
sl@0
   370
                    {
sl@0
   371
                    interface = TUsbInterfaceDescriptor::Cast(assocDes);
sl@0
   372
                    if (interface)
sl@0
   373
                        {
sl@0
   374
                        ++count;
sl@0
   375
                        }
sl@0
   376
                    assocDes = assocDes->iNextPeer;
sl@0
   377
                    }
sl@0
   378
                }
sl@0
   379
            }
sl@0
   380
		descriptor = descriptor->iNextPeer;
sl@0
   381
		}
sl@0
   382
sl@0
   383
	return count;
sl@0
   384
	}
sl@0
   385
sl@0
   386
/**
sl@0
   387
Count the endpoints on an alternate interface.
sl@0
   388
sl@0
   389
@param [in] aAlternateInterface The alternate interface to count endpoints on.
sl@0
   390
@return Number of endpoionts on the requested alternate interface or an error code.
sl@0
   391
*/
sl@0
   392
TInt RUsbInterface::EnumerateEndpointsOnInterface(TInt aAlternateInterface)
sl@0
   393
	{
sl@0
   394
	TUsbInterfaceDescriptor alternate;
sl@0
   395
	TInt err = GetAlternateInterfaceDescriptor(aAlternateInterface, alternate);
sl@0
   396
	if (err != KErrNone)
sl@0
   397
		{
sl@0
   398
		return err;
sl@0
   399
		}
sl@0
   400
sl@0
   401
	return alternate.NumEndpoints();
sl@0
   402
	}
sl@0
   403
	
sl@0
   404
/**
sl@0
   405
Returns an identifier that is unique for the bus that the device that provides this interface is on.
sl@0
   406
@param aBusId On success provides an identifier that is unique for the bus this interface is on.
sl@0
   407
@return KErrNone on success, otherwise a system-wide error code.
sl@0
   408
*/
sl@0
   409
TInt RUsbInterface::GetBusId(TUsbBusId& aBusId)
sl@0
   410
	{
sl@0
   411
	return DoControl(EGetBusId, &aBusId);
sl@0
   412
	}
sl@0
   413
sl@0
   414
/**
sl@0
   415
Returns the size of pages used by the HCD.
sl@0
   416
@internalComponent
sl@0
   417
@return The HCD's page size.
sl@0
   418
*/
sl@0
   419
TInt RUsbInterface::HcdPageSize()
sl@0
   420
	{
sl@0
   421
	return DoControl(EHcdPageSize);
sl@0
   422
	}
sl@0
   423
sl@0
   424
/**
sl@0
   425
Returns the speed the remote device is connected at.
sl@0
   426
@param aDeviceSpeed On sucess an enumeration value describing the current speed of the remote device.
sl@0
   427
@return KErrNone on success, otherwise a system-wide error code.
sl@0
   428
*/
sl@0
   429
TInt RUsbInterface::GetDeviceSpeed(RUsbInterface::TDeviceSpeed& aDeviceSpeed)
sl@0
   430
	{
sl@0
   431
	return DoControl(EGetDeviceSpeed, &aDeviceSpeed);
sl@0
   432
	}
sl@0
   433
sl@0
   434
sl@0
   435
sl@0
   436
sl@0
   437
sl@0
   438
RUsbPipe::RUsbPipe()
sl@0
   439
	: iHandle(0)
sl@0
   440
	, iInterface(NULL)
sl@0
   441
	{
sl@0
   442
	}
sl@0
   443
sl@0
   444
TUint32 RUsbPipe::Handle() const
sl@0
   445
	{
sl@0
   446
	return iHandle;
sl@0
   447
	}
sl@0
   448
sl@0
   449
/**
sl@0
   450
Close a pipe to a remote device.
sl@0
   451
*/
sl@0
   452
void RUsbPipe::Close()
sl@0
   453
	{
sl@0
   454
	if (iInterface)
sl@0
   455
		{
sl@0
   456
		static_cast<void>(iInterface->DoControl(EClose, (TAny*)iHandle));
sl@0
   457
		}
sl@0
   458
	iHeadEndpointDescriptor = NULL;
sl@0
   459
	iInterface = NULL;
sl@0
   460
	iHandle = 0;
sl@0
   461
	}
sl@0
   462
sl@0
   463
/**
sl@0
   464
Clear a stall on the remote endpoint.
sl@0
   465
sl@0
   466
@return System-wide error code.
sl@0
   467
*/
sl@0
   468
TInt RUsbPipe::ClearRemoteStall()
sl@0
   469
	{
sl@0
   470
	__ASSERT_ALWAYS(iHandle, User::Panic(UsbdiPanics::KUsbdiPanicCat, UsbdiPanics::EPipeRequestMadeWhileClosed));
sl@0
   471
	__ASSERT_DEBUG(iInterface, User::Panic(UsbdiFaults::KUsbdiFaultCat, UsbdiFaults::EUsbPipeHasHandleButNoInterface));
sl@0
   472
	return iInterface->DoControl(EClearRemoteStall, (TAny*)iHandle);
sl@0
   473
	}
sl@0
   474
sl@0
   475
/**
sl@0
   476
Cancel all queued transfers
sl@0
   477
*/
sl@0
   478
void RUsbPipe::CancelAllTransfers()
sl@0
   479
	{
sl@0
   480
	__ASSERT_ALWAYS(iHandle, User::Panic(UsbdiPanics::KUsbdiPanicCat, UsbdiPanics::EPipeRequestMadeWhileClosed));
sl@0
   481
	__ASSERT_DEBUG(iInterface, User::Panic(UsbdiFaults::KUsbdiFaultCat, UsbdiFaults::EUsbPipeHasHandleButNoInterface));
sl@0
   482
	static_cast<void>(iInterface->DoControl(EAbort, (TAny*)iHandle));
sl@0
   483
	}
sl@0
   484
sl@0
   485
/**
sl@0
   486
Issues a transfer.
sl@0
   487
@internalComponent
sl@0
   488
*/
sl@0
   489
void RUsbPipe::IssueTransfer(TInt aTransferHandle, TRequestStatus& aRequest)
sl@0
   490
	{
sl@0
   491
	__ASSERT_ALWAYS(iHandle, User::Panic(UsbdiPanics::KUsbdiPanicCat, UsbdiPanics::EPipeRequestMadeWhileClosed));
sl@0
   492
	__ASSERT_DEBUG(iInterface, User::Panic(UsbdiFaults::KUsbdiFaultCat, UsbdiFaults::EUsbPipeHasHandleButNoInterface));
sl@0
   493
	iInterface->DoRequest(EIssueTransfer, aRequest, (TAny*)iHandle, (TAny*)aTransferHandle);
sl@0
   494
	}
sl@0
   495
sl@0
   496
/**
sl@0
   497
Get endpoint ID
sl@0
   498
*/
sl@0
   499
TInt RUsbPipe::GetEndpointId(TUsbEndpointId& aEndpointId)
sl@0
   500
	{
sl@0
   501
	__ASSERT_ALWAYS(iHandle, User::Panic(UsbdiPanics::KUsbdiPanicCat, UsbdiPanics::EPipeRequestMadeWhileClosed));
sl@0
   502
	__ASSERT_DEBUG(iInterface, User::Panic(UsbdiFaults::KUsbdiFaultCat, UsbdiFaults::EUsbPipeHasHandleButNoInterface));
sl@0
   503
	return iInterface->DoControl(EGetEndpointId, reinterpret_cast<TAny*>(iHandle), &aEndpointId);
sl@0
   504
	}
sl@0
   505
sl@0
   506
/**
sl@0
   507
Get Bus ID
sl@0
   508
*/
sl@0
   509
TInt RUsbPipe::GetBusId(TUsbBusId& aBusId)
sl@0
   510
	{
sl@0
   511
	__ASSERT_ALWAYS(iHandle, User::Panic(UsbdiPanics::KUsbdiPanicCat, UsbdiPanics::EPipeRequestMadeWhileClosed));
sl@0
   512
	__ASSERT_DEBUG(iInterface, User::Panic(UsbdiFaults::KUsbdiFaultCat, UsbdiFaults::EUsbPipeHasHandleButNoInterface));
sl@0
   513
	return iInterface->GetBusId(aBusId);
sl@0
   514
	}
sl@0
   515
sl@0
   516
/**
sl@0
   517
Return the section of the USB Configuration Descriptor under the supplied endpoint.
sl@0
   518
sl@0
   519
@param [out] aDescriptor The descriptor tree for this endpoint.
sl@0
   520
@return System-wide error code.
sl@0
   521
*/
sl@0
   522
TInt RUsbPipe::GetEndpointDescriptor(TUsbEndpointDescriptor& aDescriptor)
sl@0
   523
	{
sl@0
   524
    __ASSERT_ALWAYS(iHandle, User::Panic(UsbdiPanics::KUsbdiPanicCat, UsbdiPanics::EPipeRequestMadeWhileClosed));
sl@0
   525
    __ASSERT_DEBUG(iInterface, User::Panic(UsbdiFaults::KUsbdiFaultCat, UsbdiFaults::EUsbPipeHasHandleButNoInterface));
sl@0
   526
sl@0
   527
	if (iHeadEndpointDescriptor)
sl@0
   528
		{
sl@0
   529
		aDescriptor = *iHeadEndpointDescriptor;
sl@0
   530
		return KErrNone;
sl@0
   531
		}
sl@0
   532
	else
sl@0
   533
		{
sl@0
   534
		return KErrNotFound;
sl@0
   535
		}
sl@0
   536
	}
sl@0
   537
sl@0
   538
#endif