diff --git a/doc/zephyr.doxyfile.in b/doc/zephyr.doxyfile.in index 3ee6cee14e2..0297832cc55 100644 --- a/doc/zephyr.doxyfile.in +++ b/doc/zephyr.doxyfile.in @@ -1973,6 +1973,7 @@ PREDEFINED = "CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT" \ "CONFIG_FPU" \ "CONFIG_FPU_SHARING" \ "CONFIG_HEAP_MEM_POOL_SIZE" \ + "CONFIG_KERNEL_WORK1" \ "CONFIG_MMU" \ "CONFIG_NET_L2_ETHERNET_MGMT" \ "CONFIG_NET_MGMT_EVENT" \ diff --git a/include/kernel.h b/include/kernel.h index bb88570676a..83a262ba072 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -2482,6 +2482,8 @@ __syscall int k_stack_pop(struct k_stack *stack, stack_data_t *data, /** @} */ +#ifdef CONFIG_KERNEL_WORK1 + struct k_work; /** @@ -2954,6 +2956,9 @@ static inline int32_t k_delayed_work_remaining_get(const struct k_delayed_work * } /** @} */ + +#endif /* CONFIG_KERNEL_WORK1 */ + /** * @defgroup mutex_apis Mutex APIs * @ingroup kernel_apis diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 912a6a9716f..e12f66fa5e9 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -22,7 +22,6 @@ list(APPEND kernel_files system_work_q.c thread.c version.c - work_q.c condvar.c smp.c banner.c @@ -37,6 +36,7 @@ add_library(kernel ${kernel_files}) # Kernel files has the macro __ZEPHYR_SUPERVISOR__ set so that it # optimizes the code when userspace is enabled. + set_target_properties( kernel PROPERTIES @@ -44,6 +44,8 @@ set_target_properties( __ZEPHYR_SUPERVISOR__ ) +target_sources_ifdef(CONFIG_KERNEL_WORK1 kernel PRIVATE work_q.c) + target_sources_ifdef(CONFIG_STACK_CANARIES kernel PRIVATE compiler_stack_protect.c) target_sources_ifdef(CONFIG_SYS_CLOCK_EXISTS kernel PRIVATE timeout.c timer.c) target_sources_ifdef(CONFIG_ATOMIC_OPERATIONS_C kernel PRIVATE atomic_c.c) diff --git a/kernel/Kconfig b/kernel/Kconfig index dc0bae2ba58..230e1d2b9f2 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -875,4 +875,22 @@ config THREAD_LOCAL_STORAGE help This option enables thread local storage (TLS) support in kernel. +choice KERNEL_WORK + prompt "Which work queue implementation to use" + default KERNEL_WORK1 + +config KERNEL_WORK1 + bool "Select the original racy work API" + help + This selects the original k_work_* implementation, and excludes the + new simplementation. + +config KERNEL_WORK2 + bool "Select alternative work API" + help + This disables the original k_work_* implementation and replaces it + with a new one. + +endchoice # KERNEL_WORK + endmenu diff --git a/lib/os/CMakeLists.txt b/lib/os/CMakeLists.txt index d754e3376b1..923e83f0d3d 100644 --- a/lib/os/CMakeLists.txt +++ b/lib/os/CMakeLists.txt @@ -19,11 +19,12 @@ zephyr_sources( sem.c thread_entry.c timeutil.c - work_q.c heap.c heap-validate.c ) +zephyr_sources_ifdef(CONFIG_KERNEL_WORK1 work_q.c) + zephyr_sources_ifdef(CONFIG_CBPRINTF_COMPLETE cbprintf_complete.c) zephyr_sources_ifdef(CONFIG_CBPRINTF_NANO cbprintf_nano.c)