398 if (!foundBulkIN && |
398 if (!foundBulkIN && |
399 (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirIn)) == (KUsbEpTypeBulk | KUsbEpDirIn)) |
399 (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirIn)) == (KUsbEpTypeBulk | KUsbEpDirIn)) |
400 { |
400 { |
401 // InEndpoint is going to be our TX (IN, write) endpoint |
401 // InEndpoint is going to be our TX (IN, write) endpoint |
402 ifc().iEndpointData[0].iType = KUsbEpTypeBulk; |
402 ifc().iEndpointData[0].iType = KUsbEpTypeBulk; |
|
403 if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) |
|
404 ifc().iEndpointData[0].iFeatureWord1 = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering; |
403 ifc().iEndpointData[0].iDir = KUsbEpDirIn; |
405 ifc().iEndpointData[0].iDir = KUsbEpDirIn; |
404 ifc().iEndpointData[0].iSize = maxPacketSize; |
406 ifc().iEndpointData[0].iSize = maxPacketSize; |
405 ifc().iEndpointData[0].iInterval_Hs = 0; |
407 ifc().iEndpointData[0].iInterval_Hs = 0; |
406 foundBulkIN = ETrue; |
408 foundBulkIN = ETrue; |
407 if (++ep_found == KRequiredNumberOfEndpoints) |
409 if (++ep_found == KRequiredNumberOfEndpoints) |
413 if (!foundBulkOUT && |
415 if (!foundBulkOUT && |
414 (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirOut)) == (KUsbEpTypeBulk | KUsbEpDirOut)) |
416 (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirOut)) == (KUsbEpTypeBulk | KUsbEpDirOut)) |
415 { |
417 { |
416 // OutEndpoint is going to be our RX (OUT, read) endpoint |
418 // OutEndpoint is going to be our RX (OUT, read) endpoint |
417 ifc().iEndpointData[1].iType = KUsbEpTypeBulk; |
419 ifc().iEndpointData[1].iType = KUsbEpTypeBulk; |
|
420 if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) |
|
421 ifc().iEndpointData[1].iFeatureWord1 = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering; |
418 ifc().iEndpointData[1].iDir = KUsbEpDirOut; |
422 ifc().iEndpointData[1].iDir = KUsbEpDirOut; |
419 ifc().iEndpointData[1].iSize = maxPacketSize; |
423 ifc().iEndpointData[1].iSize = maxPacketSize; |
420 ifc().iEndpointData[1].iInterval_Hs = 0; |
424 ifc().iEndpointData[1].iInterval_Hs = 0; |
421 foundBulkOUT = ETrue; |
425 foundBulkOUT = ETrue; |
422 if (++ep_found == KRequiredNumberOfEndpoints) |
426 if (++ep_found == KRequiredNumberOfEndpoints) |
484 iLdd.ReadCancel(OutEndpoint); |
488 iLdd.ReadCancel(OutEndpoint); |
485 } |
489 } |
486 |
490 |
487 void CBulkOnlyTransportUsbcLdd::AllocateEndpointResources() |
491 void CBulkOnlyTransportUsbcLdd::AllocateEndpointResources() |
488 { |
492 { |
489 // Set up DMA if possible (errors are non-critical) |
493 TUsbDeviceCaps d_caps; |
490 TInt err = iLdd.AllocateEndpointResource(OutEndpoint, EUsbcEndpointResourceDMA); |
494 TInt ret = iLdd.DeviceCaps(d_caps); |
491 if (err != KErrNone) |
495 if (ret == KErrNone) |
492 { |
496 { |
493 __PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err); |
497 if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) |
494 } |
498 { |
495 err = iLdd.AllocateEndpointResource(InEndpoint, EUsbcEndpointResourceDMA); |
499 // Set up DMA if possible (errors are non-critical) |
496 if (err != KErrNone) |
500 TInt err = iLdd.AllocateEndpointResource(OutEndpoint, EUsbcEndpointResourceDMA); |
497 { |
501 if (err != KErrNone) |
498 __PRINT1(_L("Set DMA on IN endpoint failed with error code: %d"), err); |
502 { |
499 } |
503 __PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err); |
500 |
504 } |
501 // Set up Double Buffering if possible (errors are non-critical) |
505 err = iLdd.AllocateEndpointResource(InEndpoint, EUsbcEndpointResourceDMA); |
502 err = iLdd.AllocateEndpointResource(OutEndpoint, EUsbcEndpointResourceDoubleBuffering); |
506 if (err != KErrNone) |
503 if (err != KErrNone) |
507 { |
504 { |
508 __PRINT1(_L("Set DMA on IN endpoint failed with error code: %d"), err); |
505 __PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err); |
509 } |
506 } |
510 |
507 err = iLdd.AllocateEndpointResource(InEndpoint, EUsbcEndpointResourceDoubleBuffering); |
511 // Set up Double Buffering if possible (errors are non-critical) |
508 if (err != KErrNone) |
512 err = iLdd.AllocateEndpointResource(OutEndpoint, EUsbcEndpointResourceDoubleBuffering); |
509 { |
513 if (err != KErrNone) |
510 __PRINT1(_L("Set Double Buffering on IN endpoint failed with error code: %d"), err); |
514 { |
|
515 __PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err); |
|
516 } |
|
517 err = iLdd.AllocateEndpointResource(InEndpoint, EUsbcEndpointResourceDoubleBuffering); |
|
518 if (err != KErrNone) |
|
519 { |
|
520 __PRINT1(_L("Set Double Buffering on IN endpoint failed with error code: %d"), err); |
|
521 } |
|
522 } |
511 } |
523 } |
512 } |
524 } |
513 |
525 |
514 TInt CBulkOnlyTransportUsbcLdd::GetDeviceStatus(TUsbcDeviceState& deviceStatus) |
526 TInt CBulkOnlyTransportUsbcLdd::GetDeviceStatus(TUsbcDeviceState& deviceStatus) |
515 { |
527 { |