Lines Matching defs:pUrb
331 * @param pUrb The URB to free.
333 static DECLCALLBACK(void) vusbRhFreeUrb(PVUSBURB pUrb)
338 vusbUrbAssert(pUrb);
339 PVUSBROOTHUB pRh = (PVUSBROOTHUB)pUrb->VUsb.pvFreeCtx;
345 if (pUrb->pszDesc)
347 RTStrFree(pUrb->pszDesc);
348 pUrb->pszDesc = NULL;
356 pUrb->enmState = VUSBURBSTATE_FREE;
357 pUrb->VUsb.ppPrev = NULL;
358 pUrb->VUsb.pNext = pRh->pFreeUrbs;
359 pRh->pFreeUrbs = pUrb;
380 PVUSBURB pUrb = pRh->pFreeUrbs;
381 while (pUrb)
383 if ( pUrb->VUsb.cbDataAllocated >= cbData
384 && pUrb->VUsb.cTdsAllocated >= cTds)
386 pUrbPrev = pUrb;
387 pUrb = pUrb->VUsb.pNext;
389 if (pUrb)
392 pUrbPrev->VUsb.pNext = pUrb->VUsb.pNext;
394 pRh->pFreeUrbs = pUrb->VUsb.pNext;
395 Assert(pUrb->u32Magic == VUSBURB_MAGIC);
396 Assert(pUrb->VUsb.pvFreeCtx == pRh);
397 Assert(pUrb->VUsb.pfnFree == vusbRhFreeUrb);
398 Assert(pUrb->enmState == VUSBURBSTATE_FREE);
399 Assert(!pUrb->VUsb.pNext || pUrb->VUsb.pNext->enmState == VUSBURBSTATE_FREE);
409 pUrb = (PVUSBURB)RTMemAlloc( RT_OFFSETOF(VUSBURB, abData[cbDataAllocated + 16])
410 + sizeof(pUrb->Hci.paTds[0]) * cTdsAllocated);
411 if (RT_UNLIKELY(!pUrb))
418 pUrb->u32Magic = VUSBURB_MAGIC;
419 pUrb->VUsb.pvFreeCtx = pRh;
420 pUrb->VUsb.pfnFree = vusbRhFreeUrb;
421 pUrb->VUsb.cbDataAllocated = cbDataAllocated;
422 pUrb->VUsb.cTdsAllocated = cTdsAllocated;
423 pUrb->Hci.paTds = (VUSBURB::VUSBURBHCI::VUSBURBHCITD *)(&pUrb->abData[cbDataAllocated + 16]);
430 pUrb->enmState = VUSBURBSTATE_ALLOCATED;
431 pUrb->pszDesc = NULL;
432 pUrb->VUsb.pNext = NULL;
433 pUrb->VUsb.ppPrev = NULL;
434 pUrb->VUsb.pCtrlUrb = NULL;
435 pUrb->VUsb.u64SubmitTS = 0;
436 pUrb->VUsb.pDev = vusbRhFindDevByAddress(pRh, DstAddress);
437 pUrb->Hci.EdAddr = ~0;
438 pUrb->Hci.cTds = cTds;
439 pUrb->Hci.pNext = NULL;
440 pUrb->Hci.u32FrameNo = 0;
441 pUrb->Hci.fUnlinked = false;
442 pUrb->Dev.pvPrivate = NULL;
443 pUrb->Dev.pNext = NULL;
444 pUrb->pUsbIns = pUrb->VUsb.pDev ? pUrb->VUsb.pDev->pUsbIns : NULL;
445 pUrb->DstAddress = DstAddress;
446 pUrb->EndPt = ~0;
447 pUrb->enmType = VUSBXFERTYPE_INVALID;
448 pUrb->enmDir = VUSBDIRECTION_INVALID;
449 pUrb->fShortNotOk = false;
450 pUrb->enmStatus = VUSBSTATUS_INVALID;
451 pUrb->cbData = cbData;
452 return pUrb;
465 static DECLCALLBACK(int) vusbRhSubmitUrb(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb, PPDMLED pLed)
474 Assert(pUrb->enmType >= 0 && pUrb->enmType < (int)RT_ELEMENTS(pRh->aTypes));
476 STAM_COUNTER_INC(&pRh->aTypes[pUrb->enmType].StatUrbsSubmitted);
478 STAM_COUNTER_ADD(&pRh->Total.StatReqBytes, pUrb->cbData);
479 STAM_COUNTER_ADD(&pRh->aTypes[pUrb->enmType].StatReqBytes, pUrb->cbData);
480 if (pUrb->enmDir == VUSBDIRECTION_IN)
482 STAM_COUNTER_ADD(&pRh->Total.StatReqReadBytes, pUrb->cbData);
483 STAM_COUNTER_ADD(&pRh->aTypes[pUrb->enmType].StatReqReadBytes, pUrb->cbData);
487 STAM_COUNTER_ADD(&pRh->Total.StatReqWriteBytes, pUrb->cbData);
488 STAM_COUNTER_ADD(&pRh->aTypes[pUrb->enmType].StatReqWriteBytes, pUrb->cbData);
491 if (pUrb->enmType == VUSBXFERTYPE_ISOC)
493 STAM_COUNTER_ADD(&pRh->StatIsocReqPkts, pUrb->cIsocPkts);
494 if (pUrb->enmDir == VUSBDIRECTION_IN)
495 STAM_COUNTER_ADD(&pRh->StatIsocReqReadPkts, pUrb->cIsocPkts);
497 STAM_COUNTER_ADD(&pRh->StatIsocReqWritePkts, pUrb->cIsocPkts);
504 int rc = VUSBSnifferRecordEvent(pRh->hSniffer, pUrb, VUSBSNIFFEREVENT_SUBMIT);
514 if ( pUrb->VUsb.pDev
515 && pUrb->pUsbIns)
517 switch (pUrb->enmDir)
521 rc = vusbUrbSubmit(pUrb);
526 rc = vusbUrbSubmit(pUrb);
530 rc = vusbUrbSubmit(pUrb);
536 LogFlow(("vusbRhSubmitUrb: freeing pUrb=%p\n", pUrb));
537 pUrb->VUsb.pfnFree(pUrb);
542 pUrb->VUsb.pDev = &pRh->Hub.Dev;
543 Log(("vusb: pRh=%p: SUBMIT: Address %i not found!!!\n", pRh, pUrb->DstAddress));
545 pUrb->enmState = VUSBURBSTATE_REAPED;
546 pUrb->enmStatus = VUSBSTATUS_DNR;
547 vusbUrbCompletionRh(pUrb);
590 static DECLCALLBACK(int) vusbRhCancelUrbsEp(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb)
594 AssertReturn(pUrb, VERR_INVALID_PARAMETER);
600 LogFlow(("vusbRhCancelUrbsEp: pRh=%p pUrb=%p\n", pRh));
602 vusbUrbCancelAsync(pUrb, CANCELMODE_UNDO);
624 PVUSBURB pUrb = pDev->pAsyncUrbHead;
626 while (pUrb)
628 PVUSBURB pNext = pUrb->VUsb.pNext;
630 vusbUrbCancelWorker(pUrb, CANCELMODE_FAIL);
631 pUrb = pNext;
666 PVUSBURB pUrb = pDev->pAsyncUrbHead;
667 while (pUrb)
669 PVUSBURB pNext = pUrb->VUsb.pNext;
671 Assert(pUrb->VUsb.pDev == pDev);
673 if (pUrb->EndPt == EndPt && pUrb->enmDir == enmDir)
675 LogFlow(("%s: vusbRhAbortEpWorker: CANCELING URB\n", pUrb->pszDesc));
676 int rc = vusbUrbCancelWorker(pUrb, CANCELMODE_UNDO);
679 pUrb = pNext;
936 PVUSBURB pUrb = pRh->pFreeUrbs;
937 pRh->pFreeUrbs = pUrb->VUsb.pNext;
939 pUrb->u32Magic = 0;
940 pUrb->enmState = VUSBURBSTATE_INVALID;
941 pUrb->VUsb.pNext = NULL;
942 RTMemFree(pUrb);