display_work_q.c 903 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2020 Actions Technology Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include <kernel.h>
  7. #include <init.h>
  8. #include "os_common_api.h"
  9. #ifdef CONFIG_DISPLAY_WORK_Q
  10. static K_THREAD_STACK_DEFINE(display_workq_stack, CONFIG_DISPLAY_WORK_Q_STACK_SIZE);
  11. static struct k_work_q display_workq;
  12. static int display_work_q_init(const struct device *dev)
  13. {
  14. ARG_UNUSED(dev);
  15. k_work_queue_start(&display_workq, display_workq_stack,
  16. K_THREAD_STACK_SIZEOF(display_workq_stack),
  17. CONFIG_DISPLAY_WORK_Q_PRIORITY, NULL);
  18. k_thread_name_set(&display_workq.thread, "displayworkq");
  19. return 0;
  20. }
  21. os_work_q *os_get_display_work_queue(void)
  22. {
  23. return &display_workq;
  24. }
  25. SYS_INIT(display_work_q_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
  26. #else /* CONFIG_DISPLAY_WORK_Q */
  27. os_work_q *os_get_display_work_queue(void)
  28. {
  29. return NULL;
  30. }
  31. #endif /* CONFIG_DISPLAY_WORK_Q */