usb_workq.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * @file usb_workq.h
  3. * @brief
  4. *
  5. * Copyright (c) 2022 sakumisu
  6. *
  7. * Licensed to the Apache Software Foundation (ASF) under one or more
  8. * contributor license agreements. See the NOTICE file distributed with
  9. * this work for additional information regarding copyright ownership. The
  10. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  11. * "License"); you may not use this file except in compliance with the
  12. * License. You may obtain a copy of the License at
  13. *
  14. * http://www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  18. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  19. * License for the specific language governing permissions and limitations
  20. * under the License.
  21. *
  22. */
  23. #ifndef _USB_WORKQUEUE_H
  24. #define _USB_WORKQUEUE_H
  25. /* Defines the work callback */
  26. typedef void (*usb_worker_t)(void *arg);
  27. struct usb_work
  28. {
  29. usb_dlist_t list;
  30. usb_worker_t worker;
  31. void *arg;
  32. };
  33. struct usb_workqueue
  34. {
  35. usb_dlist_t work_list;
  36. usb_dlist_t delay_work_list;
  37. usb_osal_sem_t sem;
  38. usb_osal_thread_t thread;
  39. };
  40. extern struct usb_workqueue g_hpworkq;
  41. extern struct usb_workqueue g_lpworkq;
  42. void usb_workqueue_submit(struct usb_workqueue *queue, struct usb_work *work, usb_worker_t worker, void *arg, uint32_t ticks);
  43. int usbh_workq_initialize();
  44. #endif