Lines Matching refs:pExtra

843     PVUSBCTRLEXTRA  pExtra = pPipe->pCtrl;
844 PVUSBSETUP pSetup = pExtra->pMsg;
847 pUrb->pszDesc, pUrb->cbData, pSetup->wLength, pExtra->cbLeft, pPipe, g_apszCtlStates[pExtra->enmStage])); NOREF(pSetup);
848 pExtra->enmStage = CTLSTAGE_DATA;
862 PVUSBCTRLEXTRA pExtra = pPipe->pCtrl;
863 PVUSBSETUP pSetup = pExtra->pMsg;
866 pUrb->pszDesc, pUrb->cbData, pSetup->wLength, pExtra->cbLeft, pPipe)); NOREF(pSetup);
881 PVUSBCTRLEXTRA pExtra = pPipe->pCtrl;
883 if (pExtra->fOk)
895 pUrb->pszDesc, pDev, pDev->pUsbIns->pszName, pPipe, g_apszCtlStates[pExtra->enmStage]));
901 pUrb->pszDesc, pDev, pDev->pUsbIns->pszName, pPipe, g_apszCtlStates[pExtra->enmStage]));
908 pExtra->pbCur = NULL;
909 pExtra->enmStage = CTLSTAGE_SETUP;
922 PVUSBCTRLEXTRA pExtra = pPipe->pCtrl;
925 switch (pExtra->enmStage)
951 PVUSBCTRLEXTRA pExtra = pPipe->pCtrl;
957 Assert(&pExtra->Urb == pUrb);
961 pExtra->fOk = true;
963 pExtra->fOk = false;
964 pExtra->cbLeft = pUrb->cbData - sizeof(VUSBSETUP);
1257 PVUSBCTRLEXTRA pExtra = pPipe->pCtrl;
1258 PVUSBSETUP pSetup = pExtra->pMsg;
1261 uint8_t *pbData = (uint8_t *)pExtra->pMsg + sizeof(*pSetup);
1274 pExtra->fOk = true;
1279 pExtra->fOk = false;
1281 pExtra->cbLeft = cbData; /* used by IN only */
1289 pExtra->Urb.enmState = VUSBURBSTATE_ALLOCATED;
1295 void vusbMsgResetExtraData(PVUSBCTRLEXTRA pExtra)
1297 if (!pExtra)
1299 pExtra->enmStage = CTLSTAGE_SETUP;
1300 if (pExtra->Urb.enmState != VUSBURBSTATE_CANCELLED)
1301 pExtra->Urb.enmState = VUSBURBSTATE_ALLOCATED;
1336 PVUSBCTRLEXTRA pExtra = (PVUSBCTRLEXTRA)((uint8_t *)pUrb - RT_OFFSETOF(VUSBCTRLEXTRA, Urb));
1340 LogFlow(("vusbMsgFreeUrb: Freeing orphan: %p (pUrb=%p)\n", pExtra, pUrb));
1341 RTMemFree(pExtra);
1345 Assert(pUrb->VUsb.pvFreeCtx == &pExtra->Urb);
1353 * @param pExtra The data.
1355 void vusbMsgFreeExtraData(PVUSBCTRLEXTRA pExtra)
1357 if (!pExtra)
1359 if (pExtra->Urb.enmState != VUSBURBSTATE_CANCELLED)
1361 pExtra->Urb.u32Magic = 0;
1362 pExtra->Urb.enmState = VUSBURBSTATE_FREE;
1363 if (pExtra->Urb.pszDesc)
1364 RTStrFree(pExtra->Urb.pszDesc);
1365 RTMemFree(pExtra);
1368 pExtra->Urb.VUsb.pvFreeCtx = NULL; /* see vusbMsgFreeUrb */
1381 PVUSBCTRLEXTRA pExtra;
1382 const size_t cbMax = sizeof(pExtra->Urb.abData) + sizeof(VUSBSETUP);
1383 pExtra = (PVUSBCTRLEXTRA)RTMemAllocZ(RT_OFFSETOF(VUSBCTRLEXTRA, Urb.abData[cbMax]));
1384 if (pExtra)
1386 pExtra->enmStage = CTLSTAGE_SETUP;
1387 //pExtra->fOk = false;
1388 pExtra->pMsg = (PVUSBSETUP)pExtra->Urb.abData;
1389 pExtra->pbCur = (uint8_t *)(pExtra->pMsg + 1);
1390 //pExtra->cbLeft = 0;
1391 pExtra->cbMax = cbMax;
1393 //pExtra->Urb.Dev.pvProxyUrb = NULL;
1394 pExtra->Urb.u32Magic = VUSBURB_MAGIC;
1395 pExtra->Urb.enmState = VUSBURBSTATE_ALLOCATED;
1397 RTStrAPrintf(&pExtra->Urb.pszDesc, "URB %p msg->%p", &pExtra->Urb, pUrb);
1399 //pExtra->Urb.VUsb.pCtrlUrb = NULL;
1400 //pExtra->Urb.VUsb.pNext = NULL;
1401 //pExtra->Urb.VUsb.ppPrev = NULL;
1402 pExtra->Urb.VUsb.pDev = pUrb->VUsb.pDev;
1403 pExtra->Urb.VUsb.pfnFree = vusbMsgFreeUrb;
1404 pExtra->Urb.VUsb.pvFreeCtx = &pExtra->Urb;
1405 //pExtra->Urb.Hci = {0};
1406 //pExtra->Urb.Dev.pvProxyUrb = NULL;
1407 pExtra->Urb.pUsbIns = pUrb->pUsbIns;
1408 pExtra->Urb.DstAddress = pUrb->DstAddress;
1409 pExtra->Urb.EndPt = pUrb->EndPt;
1410 pExtra->Urb.enmType = VUSBXFERTYPE_MSG;
1411 pExtra->Urb.enmDir = VUSBDIRECTION_INVALID;
1412 //pExtra->Urb.fShortNotOk = false;
1413 pExtra->Urb.enmStatus = VUSBSTATUS_INVALID;
1414 //pExtra->Urb.cbData = 0;
1415 vusbUrbAssert(&pExtra->Urb);
1417 return pExtra;
1433 PVUSBCTRLEXTRA pExtra = pPipe->pCtrl;
1449 if (pExtra->Urb.enmState == VUSBURBSTATE_CANCELLED)
1451 void *pvNew = RTMemDup(pExtra, RT_OFFSETOF(VUSBCTRLEXTRA, Urb.abData[pExtra->cbMax]));
1454 Log(("vusbMsgSetup: out of memory!!! cbReq=%u\n", RT_OFFSETOF(VUSBCTRLEXTRA, Urb.abData[pExtra->cbMax])));
1457 pExtra->Urb.VUsb.pvFreeCtx = NULL;
1458 LogFlow(("vusbMsgSetup: Replacing canceled pExtra=%p with %p.\n", pExtra, pvNew));
1459 pPipe->pCtrl = pExtra = (PVUSBCTRLEXTRA)pvNew;
1460 pExtra->pMsg = (PVUSBSETUP)pExtra->Urb.abData;
1461 pExtra->Urb.enmState = VUSBURBSTATE_ALLOCATED;
1467 if (pExtra->cbMax < cbBuf + pSetupIn->wLength)
1470 PVUSBCTRLEXTRA pNew = (PVUSBCTRLEXTRA)RTMemRealloc(pExtra, RT_OFFSETOF(VUSBCTRLEXTRA, Urb.abData[cbReq]));
1477 if (pExtra != pNew)
1480 pExtra = pNew;
1482 pExtra->cbMax = cbReq;
1484 Assert(pExtra->Urb.enmState == VUSBURBSTATE_ALLOCATED);
1489 PVUSBSETUP pSetup = pExtra->pMsg;
1490 pExtra->fSubmitted = false;
1491 pExtra->Urb.enmState = VUSBURBSTATE_IN_FLIGHT;
1492 pExtra->pbCur = (uint8_t *)(pSetup + 1);
1510 static void vusbMsgDoTransfer(PVUSBURB pUrb, PVUSBSETUP pSetup, PVUSBCTRLEXTRA pExtra, PVUSBPIPE pPipe, PVUSBDEV pDev)
1515 Assert(!pExtra->fSubmitted);
1516 pExtra->fSubmitted = true;
1532 pUrb->pszDesc, pUrb->EndPt, &pExtra->Urb, pPipe, g_apszCtlStates[pExtra->enmStage]));
1533 Assert(pExtra->Urb.enmType == VUSBXFERTYPE_MSG);
1534 Assert(pExtra->Urb.EndPt == pUrb->EndPt);
1535 pExtra->Urb.enmDir = (pSetup->bmRequestType & VUSB_DIR_TO_HOST) ? VUSBDIRECTION_IN : VUSBDIRECTION_OUT;
1536 pExtra->Urb.cbData = pSetup->wLength + sizeof(*pSetup);
1537 pExtra->Urb.VUsb.pCtrlUrb = pUrb;
1538 int rc = vusbUrbQueueAsyncRh(&pExtra->Urb);
1550 pExtra->Urb.enmStatus = rc == VERR_VUSB_DEVICE_NOT_ATTACHED ? VUSBSTATUS_DNR : VUSBSTATUS_CRC;
1551 pExtra->Urb.enmState = VUSBURBSTATE_REAPED;
1552 vusbMsgCompletion(&pExtra->Urb);
1565 PVUSBCTRLEXTRA pExtra = pPipe->pCtrl;
1567 pUrb->pszDesc, pPipe, g_apszCtlStates[pExtra->enmStage]));
1569 pExtra->pbCur = NULL;
1570 pExtra->enmStage = CTLSTAGE_SETUP;
1599 PVUSBCTRLEXTRA pExtra = pPipe->pCtrl;
1601 if (!pExtra && !(pExtra = pPipe->pCtrl = vusbMsgAllocExtraData(pUrb)))
1606 PVUSBSETUP pSetup = pExtra->pMsg;
1623 pUrb->pszDesc, pPipe, g_apszCtlStates[pExtra->enmStage]));
1624 pExtra->enmStage = CTLSTAGE_SETUP;
1626 else if ( pExtra->enmStage == CTLSTAGE_DATA
1631 pUrb->pszDesc, pPipe, g_apszCtlStates[pExtra->enmStage]));
1632 pExtra->enmStage = CTLSTAGE_STATUS;
1638 switch (pExtra->enmStage)
1660 if (pPipe->pCtrl != pExtra)
1662 pExtra = pPipe->pCtrl;
1663 pSetup = pExtra->pMsg;
1668 vusbMsgDoTransfer(pUrb, pSetup, pExtra, pPipe, pDev);
1683 vusbMsgDoTransfer(pUrb, pSetup, pExtra, pPipe, pDev);
1694 uint8_t *pbData = (uint8_t *)(pExtra->pMsg + 1);
1695 if (&pExtra->pbCur[pUrb->cbData] > &pbData[pSetup->wLength])
1709 int cbLeft = pbEnd - pExtra->pbCur;
1724 const uint32_t cbRead = RT_MIN(pUrb->cbData, pExtra->cbLeft);
1725 memcpy(pUrb->abData, pExtra->pbCur, cbRead);
1728 pExtra->pbCur += cbRead;
1730 pExtra->cbLeft -= pUrb->cbData;
1735 pUrb->pszDesc, pUrb->cbData, pExtra->cbLeft));
1737 pExtra->cbLeft = 0;
1743 memcpy(pExtra->pbCur, pUrb->abData, pUrb->cbData);
1746 pExtra->pbCur += pUrb->cbData;
1752 if ( !pExtra->fSubmitted
1753 && pExtra->pbCur - pbData >= pSetup->wLength)
1756 vusbMsgDoTransfer(pUrb, pSetup, pExtra, pPipe, pDev);
1769 || pExtra->fSubmitted)
1771 Assert(pExtra->fSubmitted);
1779 vusbMsgDoTransfer(pUrb, pSetup, pExtra, pPipe, pDev);