obex/obexprotocol/obexusbtransport/src/usbconn.cpp
branchRCL_3
changeset 11 4843bb5893b6
parent 0 d0791faffa3f
--- a/obex/obexprotocol/obexusbtransport/src/usbconn.cpp	Fri Feb 19 23:40:44 2010 +0200
+++ b/obex/obexprotocol/obexusbtransport/src/usbconn.cpp	Fri Mar 12 15:46:41 2010 +0200
@@ -1056,6 +1056,15 @@
 				maxSize = maxPacketSize;
 				}
 			dataifc2().iEndpointData[KTransmitEndpoint - 1].iSize  = maxSize;
+			
+			// Allocate dma if requested and the device support resource allocation scheme version 2
+			// for resource allocation scheme version1, refer to AllocateDma()
+			if (iRequestDmaOnInEndpoint && 
+				((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0))
+				{
+				dataifc2().iEndpointData[KTransmitEndpoint - 1].iFeatureWord1 |= KUsbcEndpointInfoFeatureWord1_DMA;
+				}
+
 			foundIn = ETrue;
 			}
 		else if (!foundOut && (caps->iTypesAndDir & KBulkOutFlags) == KBulkOutFlags)
@@ -1068,6 +1077,15 @@
 				maxSize = maxPacketSize;
 				}
 			dataifc2().iEndpointData[KReceiveEndpoint - 1].iSize  = maxSize;
+			
+			//Allocate dma here if requested and the device support resource allocation scheme version 2
+			// for resource allocation scheme version1, refer to AllocateDma()
+			if (iRequestDmaOnOutEndpoint && 
+				((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0))
+				{
+				dataifc2().iEndpointData[KReceiveEndpoint - 1].iFeatureWord1 |= KUsbcEndpointInfoFeatureWord1_DMA;
+				}
+			
 			foundOut = ETrue;
 			}
 		}
@@ -1155,6 +1173,14 @@
 	{
 	LOG_FUNC
 
+	TUsbDeviceCaps dCaps;
+	iUsb.DeviceCaps(dCaps);
+	if ((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0)
+		{
+		// for resource allocation version2, refer to CObexUsbHandler::RegInterfacesL()
+		return;
+		}
+
 	if (iRequestDmaOnInEndpoint)
 		{
 		TInt err = iUsb.AllocateEndpointResource(KTransmitEndpoint, EUsbcEndpointResourceDMA);