Benjamin Walsh | 8cf56bc | 2016-11-04 15:47:32 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 Wind River Systems, Inc. |
| 3 | * Copyright (c) 2016 Intel Corporation |
| 4 | * |
David B. Kinder | ac74d8b | 2017-01-18 17:01:01 -0800 | [diff] [blame] | 5 | * SPDX-License-Identifier: Apache-2.0 |
Benjamin Walsh | 8cf56bc | 2016-11-04 15:47:32 -0400 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * @file |
| 10 | * |
| 11 | * System workqueue. |
| 12 | */ |
| 13 | |
Gerard Marull-Paretas | cffefc8 | 2022-05-06 11:04:23 +0200 | [diff] [blame] | 14 | #include <zephyr/kernel.h> |
| 15 | #include <zephyr/init.h> |
Benjamin Walsh | 8cf56bc | 2016-11-04 15:47:32 -0400 | [diff] [blame] | 16 | |
Peter Bigot | dc34e7c | 2020-10-28 11:24:05 -0500 | [diff] [blame] | 17 | static K_KERNEL_STACK_DEFINE(sys_work_q_stack, |
| 18 | CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE); |
Benjamin Walsh | 8cf56bc | 2016-11-04 15:47:32 -0400 | [diff] [blame] | 19 | |
| 20 | struct k_work_q k_sys_work_q; |
| 21 | |
Gerard Marull-Paretas | a5fd0d1 | 2022-10-19 09:33:44 +0200 | [diff] [blame] | 22 | static int k_sys_work_q_init(void) |
Benjamin Walsh | 8cf56bc | 2016-11-04 15:47:32 -0400 | [diff] [blame] | 23 | { |
Peter Bigot | dc34e7c | 2020-10-28 11:24:05 -0500 | [diff] [blame] | 24 | struct k_work_queue_config cfg = { |
| 25 | .name = "sysworkq", |
| 26 | .no_yield = IS_ENABLED(CONFIG_SYSTEM_WORKQUEUE_NO_YIELD), |
| 27 | }; |
Benjamin Walsh | 8cf56bc | 2016-11-04 15:47:32 -0400 | [diff] [blame] | 28 | |
Peter Bigot | dc34e7c | 2020-10-28 11:24:05 -0500 | [diff] [blame] | 29 | k_work_queue_start(&k_sys_work_q, |
| 30 | sys_work_q_stack, |
| 31 | K_KERNEL_STACK_SIZEOF(sys_work_q_stack), |
| 32 | CONFIG_SYSTEM_WORKQUEUE_PRIORITY, &cfg); |
Benjamin Walsh | 8cf56bc | 2016-11-04 15:47:32 -0400 | [diff] [blame] | 33 | return 0; |
| 34 | } |
| 35 | |
Benjamin Walsh | e0ca210 | 2016-12-16 18:01:13 -0500 | [diff] [blame] | 36 | SYS_INIT(k_sys_work_q_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); |