obex/obexprotocol/obexusbtransport/src/usbconn.cpp
changeset 17 aabe5387f5ce
parent 0 d0791faffa3f
equal deleted inserted replaced
0:d0791faffa3f 17:aabe5387f5ce
  1054 			if (maxSize > maxPacketSize)
  1054 			if (maxSize > maxPacketSize)
  1055 				{
  1055 				{
  1056 				maxSize = maxPacketSize;
  1056 				maxSize = maxPacketSize;
  1057 				}
  1057 				}
  1058 			dataifc2().iEndpointData[KTransmitEndpoint - 1].iSize  = maxSize;
  1058 			dataifc2().iEndpointData[KTransmitEndpoint - 1].iSize  = maxSize;
       
  1059 			
       
  1060 			// Allocate dma if requested and the device support resource allocation scheme version 2
       
  1061 			// for resource allocation scheme version1, refer to AllocateDma()
       
  1062 			if (iRequestDmaOnInEndpoint && 
       
  1063 				((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0))
       
  1064 				{
       
  1065 				dataifc2().iEndpointData[KTransmitEndpoint - 1].iFeatureWord1 |= KUsbcEndpointInfoFeatureWord1_DMA;
       
  1066 				}
       
  1067 
  1059 			foundIn = ETrue;
  1068 			foundIn = ETrue;
  1060 			}
  1069 			}
  1061 		else if (!foundOut && (caps->iTypesAndDir & KBulkOutFlags) == KBulkOutFlags)
  1070 		else if (!foundOut && (caps->iTypesAndDir & KBulkOutFlags) == KBulkOutFlags)
  1062 			{
  1071 			{
  1063 			dataifc2().iEndpointData[KReceiveEndpoint - 1].iType = KUsbEpTypeBulk;
  1072 			dataifc2().iEndpointData[KReceiveEndpoint - 1].iType = KUsbEpTypeBulk;
  1066 			if (maxSize > maxPacketSize)
  1075 			if (maxSize > maxPacketSize)
  1067 				{
  1076 				{
  1068 				maxSize = maxPacketSize;
  1077 				maxSize = maxPacketSize;
  1069 				}
  1078 				}
  1070 			dataifc2().iEndpointData[KReceiveEndpoint - 1].iSize  = maxSize;
  1079 			dataifc2().iEndpointData[KReceiveEndpoint - 1].iSize  = maxSize;
       
  1080 			
       
  1081 			//Allocate dma here if requested and the device support resource allocation scheme version 2
       
  1082 			// for resource allocation scheme version1, refer to AllocateDma()
       
  1083 			if (iRequestDmaOnOutEndpoint && 
       
  1084 				((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0))
       
  1085 				{
       
  1086 				dataifc2().iEndpointData[KReceiveEndpoint - 1].iFeatureWord1 |= KUsbcEndpointInfoFeatureWord1_DMA;
       
  1087 				}
       
  1088 			
  1071 			foundOut = ETrue;
  1089 			foundOut = ETrue;
  1072 			}
  1090 			}
  1073 		}
  1091 		}
  1074 		
  1092 		
  1075 	if (!(foundIn && foundOut)) 
  1093 	if (!(foundIn && foundOut)) 
  1152 panic with either EDmaAllocationFailedEndpointIn or EDmaAllocationFailedEndpointOut. 
  1170 panic with either EDmaAllocationFailedEndpointIn or EDmaAllocationFailedEndpointOut. 
  1153 */
  1171 */
  1154 void CObexUsbHandler::AllocateDma()
  1172 void CObexUsbHandler::AllocateDma()
  1155 	{
  1173 	{
  1156 	LOG_FUNC
  1174 	LOG_FUNC
       
  1175 
       
  1176 	TUsbDeviceCaps dCaps;
       
  1177 	iUsb.DeviceCaps(dCaps);
       
  1178 	if ((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0)
       
  1179 		{
       
  1180 		// for resource allocation version2, refer to CObexUsbHandler::RegInterfacesL()
       
  1181 		return;
       
  1182 		}
  1157 
  1183 
  1158 	if (iRequestDmaOnInEndpoint)
  1184 	if (iRequestDmaOnInEndpoint)
  1159 		{
  1185 		{
  1160 		TInt err = iUsb.AllocateEndpointResource(KTransmitEndpoint, EUsbcEndpointResourceDMA);
  1186 		TInt err = iUsb.AllocateEndpointResource(KTransmitEndpoint, EUsbcEndpointResourceDMA);
  1161 		// The following log message is checked for in the test code - change with caution!
  1187 		// The following log message is checked for in the test code - change with caution!