Lines Matching refs:hid
329 struct hid_dev_s *hid;
344 hid = (struct hid_dev_s *)ep->priv;
345 spin_lock(&hid->hid_lock);
349 hid->read_len = req->xfrd;
350 ret = memcpy_s(hid->read_buf, HID_OUT_DATA_SIZE, req->buf, req->xfrd);
353 spin_unlock(&hid->hid_lock);
357 spin_unlock(&hid->hid_lock);
359 ret_event = LOS_EventWrite(&hid->read_event, USB_HID_READ_EVENT);
365 (void)EP_SUBMIT(hid->out_ep, req);
370 struct hid_dev_s *hid = (struct hid_dev_s *)ep->priv;
373 spin_lock(&hid->hid_lock);
374 atomic_set(&hid->busy_flag, 0);
378 hid_queue_free(hid);
379 spin_unlock(&hid->hid_lock);
383 if (hid->cur_node != NULL)
385 node_temp = hid->cur_node;
389 hid->cur_node = NULL;
393 hid_send_data_sub(hid);
394 spin_unlock(&hid->hid_lock);
399 if (!list_empty(&hid->hid_queue))
401 node_temp = list_first_entry(&hid->hid_queue, struct hid_queue_node, irqqueue);
402 hid->cur_node = node_temp;
404 hid->hid_queue_len--;
405 hid_send_data_sub(hid);
407 spin_unlock(&hid->hid_lock);
410 static void fhid_source_free(struct hid_dev_s *hid, struct usbdev_s *dev)
412 if (hid != NULL)
414 DEV_FREEEP(dev, hid->out_ep);
415 DEV_FREEEP(dev, hid->in_ep);
424 struct hid_dev_s *hid;
436 hid = drvr->dev;
437 if (hid == NULL)
442 INIT_LIST_HEAD(&hid->hid_queue);
443 hid->busy_flag = 0;
444 hid->hid_queue_len = 0;
445 hid->cur_node = NULL;
462 (void)memset_s(&(hid->outputreq), sizeof(struct usbdev_req_s), 0, sizeof(struct usbdev_req_s));
463 hid->outputreq.callback = fhid_output_request_complete;
464 hid->outputreq.priv = (void *)hid;
465 hid->outputreq.buf = NULL;
466 ep->priv = (void *)hid;
467 ep->handle_req = &hid->outputreq;
468 hid->out_ep = ep;
471 (VOID)LOS_EventInit(&hid->read_event);
472 spin_lock_init(&hid->hid_lock);
473 hid->read_len = 0;
474 hid->read_buf = memalign(USB_CACHE_ALIGN_SIZE, HID_OUT_DATA_SIZE);
475 if (hid->read_buf == NULL)
489 (void)memset_s(&hid->inputreq, sizeof(struct usbdev_req_s), 0, sizeof(struct usbdev_req_s));
490 hid->inputreq.callback = fhid_input_req_complete;
491 hid->inputreq.priv = (void *)hid;
492 hid->inputreq.buf = NULL;
493 ep->priv = (void *)hid;
494 ep->handle_req = &hid->inputreq;
495 hid->in_ep = ep;
500 ret = hid_fops_init(hid);
518 struct hid_dev_s *hid;
526 hid = drvr->dev;
528 if (atomic_read(&hid->open_flag))
534 (void)hid_fops_deinit(hid);
540 (VOID)LOS_EventDestroy(&hid->read_event);
541 if (hid->read_buf != NULL)
543 free(hid->read_buf);
544 hid->read_buf = NULL;
547 fhid_source_free(hid, dev);
565 struct hid_dev_s *hid;
569 hid = drvr->dev;
571 hid->busy_flag = 0;
572 if (hid->in_ep_enabled == true)
574 (void)EP_DISABLE(hid->in_ep);
575 hid->in_ep_enabled = false;
578 ret = EP_CONFIGURE(hid->in_ep, (const usb_endpoint_descriptor_t *)&g_fhid_in_ep_desc, 0);
584 hid->in_ep_enabled = true;
586 if (hid->out_ep_enabled == true)
588 (void)EP_DISABLE(hid->out_ep);
589 hid->out_ep_enabled = false;
592 ret = EP_CONFIGURE(hid->out_ep, (const usb_endpoint_descriptor_t *)&g_fhid_out_ep_desc, 0);
598 hid->out_ep_enabled = true;
600 req = hid->out_ep->handle_req;
601 req->buf = (uint8_t *)hid->read_buf;
603 ret = EP_SUBMIT(hid->out_ep, req);
637 struct hid_dev_s *hid;
651 hid = drvr->dev;
652 if (hid == NULL)
660 req->priv = hid;
1036 PRINTK(" ** hid device initialized successfully! **\n");