lvgl_display_workq.c 805 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2020 Actions Technology Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include <os_common_api.h>
  7. #if CONFIG_LVGL_DISPLAY_FLUSH_WORKQ_STACKSIZE > 0
  8. static OS_THREAD_STACK_DEFINE(lvgl_workq_stack, CONFIG_LVGL_DISPLAY_FLUSH_WORKQ_STACKSIZE);
  9. static os_work_q lvgl_workq;
  10. static bool lvgl_workq_inited = false;
  11. os_work_q * lvgl_display_get_flush_workq(void)
  12. {
  13. if (lvgl_workq_inited == false) {
  14. lvgl_workq_inited = true;
  15. k_work_queue_start(&lvgl_workq, lvgl_workq_stack,
  16. K_KERNEL_STACK_SIZEOF(lvgl_workq_stack),
  17. CONFIG_UISRV_PRIORITY - 1, NULL);
  18. os_thread_name_set(&lvgl_workq.thread, "lvglworkq");
  19. }
  20. return &lvgl_workq;
  21. }
  22. #else
  23. os_work_q * lvgl_display_get_flush_workq(void)
  24. {
  25. return NULL;
  26. }
  27. #endif /* CONFIG_LVGL_DISPLAY_FLUSH_WORKQ_STACKSIZE > 0 */