Lines Matching refs:ppUsbNet

73 static int32_t UsbGetBulkEndpoint(struct UsbnetHost **ppUsbNet, const struct UsbRawEndpointDescriptor *endPoint)
77 (*ppUsbNet)->dataInEp = OsalMemAlloc(sizeof(struct UsbEndpoint));
78 if ((*ppUsbNet)->dataInEp == NULL) {
82 (*ppUsbNet)->dataInEp->addr = endPoint->endpointDescriptor.bEndpointAddress;
83 (*ppUsbNet)->dataInEp->interval = endPoint->endpointDescriptor.bInterval;
84 (*ppUsbNet)->dataInEp->maxPacketSize = endPoint->endpointDescriptor.wMaxPacketSize;
86 (*ppUsbNet)->dataInEp->addr, (*ppUsbNet)->dataInEp->interval, (*ppUsbNet)->dataInEp->maxPacketSize);
89 (*ppUsbNet)->dataOutEp = OsalMemAlloc(sizeof(struct UsbEndpoint));
90 if ((*ppUsbNet)->dataOutEp == NULL) {
94 (*ppUsbNet)->dataOutEp->addr = endPoint->endpointDescriptor.bEndpointAddress;
95 (*ppUsbNet)->dataOutEp->interval = endPoint->endpointDescriptor.bInterval;
96 (*ppUsbNet)->dataOutEp->maxPacketSize = endPoint->endpointDescriptor.wMaxPacketSize;
98 (*ppUsbNet)->dataOutEp->addr, (*ppUsbNet)->dataOutEp->interval, (*ppUsbNet)->dataOutEp->maxPacketSize);
103 static void UsbParseConfigDescriptorProcess(struct UsbnetHost **ppUsbNet,
111 (*ppUsbNet)->ctrlIface = interfaceIndex;
113 (*ppUsbNet)->statusEp = OsalMemAlloc(sizeof(struct UsbEndpoint));
114 if ((*ppUsbNet)->statusEp == NULL) {
119 (*ppUsbNet)->statusEp->addr = interface->altsetting->endPoint[0].endpointDescriptor.bEndpointAddress;
120 (*ppUsbNet)->statusEp->interval = interface->altsetting->endPoint[0].endpointDescriptor.bInterval;
121 (*ppUsbNet)->statusEp->maxPacketSize = interface->altsetting->endPoint[0].endpointDescriptor.wMaxPacketSize;
124 (*ppUsbNet)->statusEp->addr, (*ppUsbNet)->statusEp->interval, (*ppUsbNet)->statusEp->maxPacketSize);
127 (*ppUsbNet)->dataIface = interfaceIndex;
131 if (UsbGetBulkEndpoint(ppUsbNet, endPoint) != HDF_SUCCESS) {
144 static int32_t UsbParseConfigDescriptor(struct UsbnetHost **ppUsbNet)
146 const struct UsbRawInterface *interface = (*ppUsbNet)->config->interface[0];
148 int32_t ret = UsbRawClaimInterface((*ppUsbNet)->devHandle, 0);
154 UsbParseConfigDescriptorProcess(ppUsbNet, interface, 0);
156 const struct UsbRawInterface *interface1 = (*ppUsbNet)->config->interface[1];
157 ret = UsbRawClaimInterface((*ppUsbNet)->devHandle, 1);
163 UsbParseConfigDescriptorProcess(ppUsbNet, interface1, 1);
390 static void HostRndisInitUsbnet(struct UsbnetHost **ppUsbNet, int32_t *retval)
403 (*ppUsbNet)->net.hardHeaderLen += sizeof(struct RndisDataHdr);
404 (*ppUsbNet)->net.hardMtu = (*ppUsbNet)->net.mtu + (*ppUsbNet)->net.hardHeaderLen;
406 (*ppUsbNet)->net.hardHeaderLen, (*ppUsbNet)->net.hardMtu);
407 (*ppUsbNet)->net.maxpacket = (*ppUsbNet)->dataOutEp->maxPacketSize;
409 HARCH_INFO_PRINT("maxpacket = %{public}d\n", (*ppUsbNet)->net.maxpacket);
410 if ((*ppUsbNet)->net.maxpacket == 0) {
416 (*ppUsbNet)->net.rxUrbSize = (*ppUsbNet)->net.hardMtu + ((*ppUsbNet)->net.maxpacket + 1);
417 (*ppUsbNet)->net.rxUrbSize &= ~((*ppUsbNet)->net.maxpacket - 1);
418 HARCH_INFO_PRINT("rxUrbSize = %{public}d\n", (*ppUsbNet)->net.rxUrbSize);
421 static void HostRndisUpdateMtu(struct UsbnetHost **ppUsbNet, int32_t *retval)
424 if (tmp < (*ppUsbNet)->net.hardMtu) {
425 if (tmp <= (*ppUsbNet)->net.hardHeaderLen) {
427 HDF_LOGE("usbNet can't take %{public}u byte packets (max %{public}u)", (*ppUsbNet)->net.hardMtu, tmp);
431 (*ppUsbNet)->net.hardMtu, tmp, tmp - (*ppUsbNet)->net.hardHeaderLen);
433 (*ppUsbNet)->net.hardMtu, tmp, tmp - (*ppUsbNet)->net.hardHeaderLen);
434 (*ppUsbNet)->net.hardMtu = tmp;
435 (*ppUsbNet)->net.mtu = (*ppUsbNet)->net.hardMtu - (*ppUsbNet)->net.hardHeaderLen;
438 (*ppUsbNet)->net.hardMtu, tmp, (*ppUsbNet)->net.rxUrbSize, 1 << CPU_TO_LE32(g_u.initC->packetAlignment));
441 static void HostRndisSetmacAddrByBp(struct UsbnetHost **ppUsbNet, int32_t *retval)
446 *retval = HostRndisQuery(*ppUsbNet, queryParam, (void **)&bp, &replyLen);
461 (*ppUsbNet)->net.isGetmacAddr = 0;
462 size_t macAddrLen = sizeof((*ppUsbNet)->net.macAddr) / sizeof((*ppUsbNet)->net.macAddr[0]);
463 if (memset_s((*ppUsbNet)->net.macAddr, macAddrLen, 0, macAddrLen) !=EOK) {
469 (*ppUsbNet)->net.isGetmacAddr = 1;
470 etherAddrCopy((*ppUsbNet)->net.macAddr, bp);
474 static void HostRndisSetmacAddr(struct UsbnetHost **ppUsbNet, int32_t *retval)
481 *retval = HostRndisQuery(*ppUsbNet, queryParam, (void **)&phym, &replyLen);
488 if (((*ppUsbNet)->flags & FLAG_RNDIS_PHYM_WIRELESS) &&
494 if (((*ppUsbNet)->flags & FLAG_RNDIS_PHYM_NOT_WIRELESS) &&
501 HostRndisSetmacAddrByBp(ppUsbNet, retval);