Lines Matching defs:acm

59 static int32_t SerialBegin(struct AcmDevice *acm);
64 struct AcmDevice *acm = (struct AcmDevice *)data;
67 if (acm == NULL) {
68 HDF_LOGE("%{public}s:%{public}d acm is NULL", __func__, __LINE__);
73 if (acm->devHandle == NULL) {
74 HDF_LOGE("%{public}s:%{public}d acm->devHandle is NULL!", __func__, __LINE__);
79 ret = UsbRawHandleRequests(acm->devHandle);
102 struct AcmDevice *acm = (struct AcmDevice *)data;
107 if (SerialBegin(acm) != HDF_SUCCESS) {
115 static int32_t UsbStartIo(struct AcmDevice * const acm)
128 ret = OsalThreadCreate(&acm->ioThread, (OsalThreadEntry)UsbIoThread, (void *)acm);
134 ret = OsalThreadStart(&acm->ioThread, &threadCfg);
144 ret = OsalThreadCreate(&acm->ioSendThread, (OsalThreadEntry)UsbIoSendThread, (void *)acm);
150 ret = OsalThreadStart(&acm->ioSendThread, &threadCfg);
159 static int32_t UsbStopIo(struct AcmDevice * const acm)
181 ret = OsalThreadDestroy(&acm->ioThread);
187 ret = OsalThreadDestroy(&acm->ioSendThread);
228 static int32_t UsbGetBulkEndpoint(struct AcmDevice * const acm, const struct UsbRawEndpointDescriptor *endPoint)
232 acm->dataInEp = OsalMemAlloc(sizeof(struct UsbEndpoint));
233 if (acm->dataInEp == NULL) {
237 acm->dataInEp->addr = endPoint->endpointDescriptor.bEndpointAddress;
238 acm->dataInEp->interval = endPoint->endpointDescriptor.bInterval;
239 acm->dataInEp->maxPacketSize = endPoint->endpointDescriptor.wMaxPacketSize;
242 acm->dataOutEp = OsalMemAlloc(sizeof(struct UsbEndpoint));
243 if (acm->dataOutEp == NULL) {
247 acm->dataOutEp->addr = endPoint->endpointDescriptor.bEndpointAddress;
248 acm->dataOutEp->interval = endPoint->endpointDescriptor.bInterval;
249 acm->dataOutEp->maxPacketSize = endPoint->endpointDescriptor.wMaxPacketSize;
256 struct AcmDevice * const acm, const struct UsbRawInterface * const interface, uint8_t interfaceIndex)
263 acm->ctrlIface = interfaceIndex;
264 acm->notifyEp = OsalMemAlloc(sizeof(struct UsbEndpoint));
265 if (acm->notifyEp == NULL) {
270 acm->notifyEp->addr = interface->altsetting->endPoint[0].endpointDescriptor.bEndpointAddress;
271 acm->notifyEp->interval = interface->altsetting->endPoint[0].endpointDescriptor.bInterval;
272 acm->notifyEp->maxPacketSize = interface->altsetting->endPoint[0].endpointDescriptor.wMaxPacketSize;
275 acm->dataIface = interfaceIndex;
278 if (UsbGetBulkEndpoint(acm, endPoint) != HDF_SUCCESS) {
289 static int32_t UsbParseConfigDescriptor(struct AcmDevice * const acm, struct UsbRawConfigDescriptor * const config)
291 if (acm == NULL || config == NULL) {
292 HDF_LOGE("%{public}s:%{public}d acm or config is NULL", __func__, __LINE__);
296 for (uint8_t i = 0; i < acm->interfaceCnt; i++) {
297 uint8_t interfaceIndex = acm->interfaceIndex[i];
300 int32_t ret = UsbRawClaimInterface(acm->devHandle, interfaceIndex);
306 UsbParseConfigDescriptorProcess(acm, interface, interfaceIndex);
312 static int32_t UsbAllocDataRequests(struct AcmDevice * const acm)
315 struct AcmDb *snd = &acm->db[i];
316 snd->request = UsbRawAllocRequest(acm->devHandle, 0, acm->dataEp->maxPacketSize);
317 snd->instance = acm;
323 reqData.endPoint = acm->dataEp->addr;
329 reqData.length = acm->dataSize;
331 int32_t ret = UsbRawFillBulkRequest(snd->request, acm->devHandle, &reqData);
340 static int32_t UsbSerialDeviceAlloc(struct AcmDevice *acm)
344 if (acm == NULL) {
345 HDF_LOGE("%{public}s: acm null pointer", __func__);
362 acm->lineCoding = port->lineCoding;
363 acm->port = port;
364 port->acm = acm;
369 static int32_t AcmDbAlloc(struct AcmDevice * const acm)
375 db = &acm->db[i];
385 static int32_t AcmDbIsAvail(struct AcmDevice * const acm)
391 n -= acm->db[i].use;
396 static int32_t AcmStartdb(struct AcmDevice *acm, struct AcmDb * const db)
398 (void)acm;
408 static int32_t AcmDataBufAlloc(struct AcmDevice * const acm)
410 struct AcmDb *db = &acm->db[0];
414 db->buf = OsalMemCalloc(acm->dataEp->maxPacketSize);
424 memset_s(db->buf, acm->dataSize, 'b', acm->dataSize);
425 db->instance = acm;
473 static int32_t SerialBegin(struct AcmDevice *acm)
475 uint32_t size = acm->dataSize;
479 if (AcmDbIsAvail(acm) != 0) {
480 dbn = AcmDbAlloc(acm);
489 db = &acm->db[dbn];
490 db->len = acm->dataSize;
495 reqData.endPoint = acm->dataEp->addr;
501 reqData.length = acm->dataSize;
503 ret = UsbRawFillBulkRequest(db->request, acm->devHandle, &reqData);
509 ret = AcmStartdb(acm, db);
699 printf("please check whether usb drv so is existing or not,like acm,ecm,if not, remove it and test again!\n");