182 sizeof(data)); |
182 sizeof(data)); |
183 |
183 |
184 User::LeaveIfError(iCommLdd.EndpointCaps(dataptr)); |
184 User::LeaveIfError(iCommLdd.EndpointCaps(dataptr)); |
185 |
185 |
186 TBool foundIntIN = EFalse; |
186 TBool foundIntIN = EFalse; |
|
187 const TUint KEndPointType = KUsbEpTypeInterrupt | KUsbEpDirIn; |
187 for (TInt i = 0; i < epNum; i++) |
188 for (TInt i = 0; i < epNum; i++) |
188 { |
189 { |
189 const TUsbcEndpointCaps* caps = &data[i].iCaps; |
190 const TUsbcEndpointData* epData = &data[i]; |
190 if ((caps->iTypesAndDir & (KUsbEpTypeInterrupt | KUsbEpDirIn)) |
191 if ((!epData->iInUse) && // Not in use |
191 == (KUsbEpTypeInterrupt | KUsbEpDirIn)) |
192 ((epData->iCaps.iTypesAndDir & KEndPointType) == KEndPointType)) |
192 { |
193 { |
193 // EEndpoint1 is going to be our INTERRUPT (IN, write) endpoint |
194 // EEndpoint1 is going to be our INTERRUPT (IN, write) endpoint |
194 ifc0().iEndpointData[0].iType = KUsbEpTypeInterrupt; |
195 ifc0().iEndpointData[0].iType = KUsbEpTypeInterrupt; |
195 ifc0().iEndpointData[0].iDir = KUsbEpDirIn; |
196 ifc0().iEndpointData[0].iDir = KUsbEpDirIn; |
196 ifc0().iEndpointData[0].iSize = caps->MinPacketSize(); |
197 ifc0().iEndpointData[0].iSize = epData->iCaps.MinPacketSize(); |
197 ifc0().iEndpointData[0].iInterval = 0x01; |
198 ifc0().iEndpointData[0].iInterval = 0x01; |
198 ifc0().iEndpointData[0].iInterval_Hs = 0x01; |
199 ifc0().iEndpointData[0].iInterval_Hs = 0x01; |
199 |
200 |
200 foundIntIN = ETrue; |
201 foundIntIN = ETrue; |
201 break; |
202 break; |
271 |
272 |
272 const TUint KNcmDataInterfaceEpNumber = 2; |
273 const TUint KNcmDataInterfaceEpNumber = 2; |
273 TBool foundBulkIN = EFalse; |
274 TBool foundBulkIN = EFalse; |
274 TBool foundBulkOUT = EFalse; |
275 TBool foundBulkOUT = EFalse; |
275 TInt maxPacketSize = 0; |
276 TInt maxPacketSize = 0; |
|
277 const TUint KEndPointBulkInType = KUsbEpTypeBulk | KUsbEpDirIn; |
|
278 const TUint KEndPointBulkOutType = KUsbEpTypeBulk | KUsbEpDirOut; |
276 for (TInt i = 0; i < epNum; i++) |
279 for (TInt i = 0; i < epNum; i++) |
277 { |
280 { |
278 const TUsbcEndpointCaps* caps = &data[i].iCaps; |
281 const TUsbcEndpointData* epData = &data[i]; |
279 maxPacketSize = caps->MaxPacketSize(); |
282 |
280 if (!foundBulkIN && (caps->iTypesAndDir & (KUsbEpTypeBulk |
283 // Check if this endpoint is in use |
281 | KUsbEpDirIn)) == (KUsbEpTypeBulk | KUsbEpDirIn)) |
284 if (epData->iInUse) |
|
285 { |
|
286 continue; |
|
287 } |
|
288 |
|
289 maxPacketSize = epData->iCaps.MaxPacketSize(); |
|
290 if (!foundBulkIN && |
|
291 ((epData->iCaps.iTypesAndDir & KEndPointBulkInType) == KEndPointBulkInType)) |
282 { |
292 { |
283 // EEndpoint1 is going to be our TX (IN, write) endpoint |
293 // EEndpoint1 is going to be our TX (IN, write) endpoint |
284 ifc1().iEndpointData[0].iType = KUsbEpTypeBulk; |
294 ifc1().iEndpointData[0].iType = KUsbEpTypeBulk; |
285 ifc1().iEndpointData[0].iDir = KUsbEpDirIn; |
295 ifc1().iEndpointData[0].iDir = KUsbEpDirIn; |
286 ifc1().iEndpointData[0].iSize = maxPacketSize; |
296 ifc1().iEndpointData[0].iSize = maxPacketSize; |
287 ifc1().iEndpointData[0].iInterval_Hs = 0x01; |
297 ifc1().iEndpointData[0].iInterval_Hs = 0x0; |
288 ifc1().iEndpointData[0].iBufferSize = KMaxScBufferSize; |
298 ifc1().iEndpointData[0].iBufferSize = KMaxScBufferSize; |
289 |
299 |
290 if (isResourceAllocationV2) |
300 if (isResourceAllocationV2) |
291 { |
301 { |
292 ifc1().iEndpointData[0].iFeatureWord1 |= |
302 ifc1().iEndpointData[0].iFeatureWord1 |= |
299 break; |
309 break; |
300 } |
310 } |
301 continue; |
311 continue; |
302 } |
312 } |
303 |
313 |
304 if (!foundBulkOUT && (caps->iTypesAndDir & (KUsbEpTypeBulk |
314 if (!foundBulkOUT && |
305 | KUsbEpDirOut)) == (KUsbEpTypeBulk | KUsbEpDirOut)) |
315 ((epData->iCaps.iTypesAndDir & KEndPointBulkOutType) == KEndPointBulkOutType)) |
306 { |
316 { |
307 // EEndpoint2 is going to be our RX (OUT, read) endpoint |
317 // EEndpoint2 is going to be our RX (OUT, read) endpoint |
308 ifc1().iEndpointData[1].iType = KUsbEpTypeBulk; |
318 ifc1().iEndpointData[1].iType = KUsbEpTypeBulk; |
309 ifc1().iEndpointData[1].iDir = KUsbEpDirOut; |
319 ifc1().iEndpointData[1].iDir = KUsbEpDirOut; |
310 ifc1().iEndpointData[1].iSize = maxPacketSize; |
320 ifc1().iEndpointData[1].iSize = maxPacketSize; |
311 ifc1().iEndpointData[1].iInterval_Hs = 0; |
321 ifc1().iEndpointData[1].iInterval_Hs = 0x1; |
312 ifc1().iEndpointData[1].iBufferSize = KMaxScBufferSize; |
322 ifc1().iEndpointData[1].iBufferSize = KMaxScBufferSize; |
313 ifc1().iEndpointData[1].iReadSize = KMaxScReadSize; |
323 ifc1().iEndpointData[1].iReadSize = KMaxScReadSize; |
314 |
324 |
315 if (isResourceAllocationV2) |
325 if (isResourceAllocationV2) |
316 { |
326 { |