229 if (!foundBulkIN && |
229 if (!foundBulkIN && |
230 (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirIn)) == (KUsbEpTypeBulk | KUsbEpDirIn)) |
230 (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirIn)) == (KUsbEpTypeBulk | KUsbEpDirIn)) |
231 { |
231 { |
232 // KInEndpoint is going to be our TX (IN, write) endpoint |
232 // KInEndpoint is going to be our TX (IN, write) endpoint |
233 ifc().iEndpointData[0].iType = KUsbEpTypeBulk; |
233 ifc().iEndpointData[0].iType = KUsbEpTypeBulk; |
|
234 if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) |
|
235 ifc().iEndpointData[0].iFeatureWord1 = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering; |
234 ifc().iEndpointData[0].iDir = KUsbEpDirIn; |
236 ifc().iEndpointData[0].iDir = KUsbEpDirIn; |
235 ifc().iEndpointData[0].iSize = maxPacketSize; |
237 ifc().iEndpointData[0].iSize = maxPacketSize; |
236 ifc().iEndpointData[0].iInterval_Hs = 0; |
238 ifc().iEndpointData[0].iInterval_Hs = 0; |
237 foundBulkIN = ETrue; |
239 foundBulkIN = ETrue; |
238 if (++ep_found == KRequiredNumberOfEndpoints) |
240 if (++ep_found == KRequiredNumberOfEndpoints) |
244 if (!foundBulkOUT && |
246 if (!foundBulkOUT && |
245 (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirOut)) == (KUsbEpTypeBulk | KUsbEpDirOut)) |
247 (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirOut)) == (KUsbEpTypeBulk | KUsbEpDirOut)) |
246 { |
248 { |
247 // KOutEndpoint is going to be our RX (OUT, read) endpoint |
249 // KOutEndpoint is going to be our RX (OUT, read) endpoint |
248 ifc().iEndpointData[1].iType = KUsbEpTypeBulk; |
250 ifc().iEndpointData[1].iType = KUsbEpTypeBulk; |
|
251 if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) |
|
252 ifc().iEndpointData[1].iFeatureWord1 = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering; |
249 ifc().iEndpointData[1].iDir = KUsbEpDirOut; |
253 ifc().iEndpointData[1].iDir = KUsbEpDirOut; |
250 ifc().iEndpointData[1].iSize = maxPacketSize; |
254 ifc().iEndpointData[1].iSize = maxPacketSize; |
251 ifc().iEndpointData[1].iInterval_Hs = 0; |
255 ifc().iEndpointData[1].iInterval_Hs = 0; |
252 foundBulkOUT = ETrue; |
256 foundBulkOUT = ETrue; |
253 if (++ep_found == KRequiredNumberOfEndpoints) |
257 if (++ep_found == KRequiredNumberOfEndpoints) |
358 |
362 |
359 iCurrentState = ENone; |
363 iCurrentState = ENone; |
360 iDataTransferMan.Init(); |
364 iDataTransferMan.Init(); |
361 iStarted = ETrue; |
365 iStarted = ETrue; |
362 |
366 |
363 // Set up DMA if possible (errors are non-critical) |
367 TUsbDeviceCaps d_caps; |
364 TInt err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDMA); |
368 TInt ret = iLdd.DeviceCaps(d_caps); |
365 if (err != KErrNone) |
369 if (ret == KErrNone) |
366 { |
370 { |
367 __PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err); |
371 if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) |
368 } |
372 { |
369 err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDMA); |
373 // Set up DMA if possible (errors are non-critical) |
370 if (err != KErrNone) |
374 TInt err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDMA); |
371 { |
375 if (err != KErrNone) |
372 __PRINT1(_L("Set DMA on IN endpoint failed with error code: %d"), err); |
376 { |
373 } |
377 __PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err); |
374 |
378 } |
375 // Set up Double Buffering if possible (errors are non-critical) |
379 err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDMA); |
376 err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDoubleBuffering); |
380 if (err != KErrNone) |
377 if (err != KErrNone) |
381 { |
378 { |
382 __PRINT1(_L("Set DMA on IN endpoint failed with error code: %d"), err); |
379 __PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err); |
383 } |
380 } |
384 |
381 err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDoubleBuffering); |
385 // Set up Double Buffering if possible (errors are non-critical) |
382 if (err != KErrNone) |
386 err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDoubleBuffering); |
383 { |
387 if (err != KErrNone) |
384 __PRINT1(_L("Set Double Buffering on IN endpoint failed with error code: %d"), err); |
388 { |
|
389 __PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err); |
|
390 } |
|
391 err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDoubleBuffering); |
|
392 if (err != KErrNone) |
|
393 { |
|
394 __PRINT1(_L("Set Double Buffering on IN endpoint failed with error code: %d"), err); |
|
395 } |
|
396 } |
385 } |
397 } |
386 |
398 |
387 if (aDiscard) |
399 if (aDiscard) |
388 { |
400 { |
389 TInt bytes; |
401 TInt bytes; |