1 /*
2  * Copyright (c) 2016 Wind River Systems, Inc.
3  * Copyright (c) 2016 Intel Corporation
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 /**
9  * @file
10  *
11  * System workqueue.
12  */
13 
14 #include <kernel.h>
15 #include <init.h>
16 
17 static K_KERNEL_STACK_DEFINE(sys_work_q_stack,
18 			     CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE);
19 
20 struct k_work_q k_sys_work_q;
21 
k_sys_work_q_init(const struct device * dev)22 static int k_sys_work_q_init(const struct device *dev)
23 {
24 	ARG_UNUSED(dev);
25 	struct k_work_queue_config cfg = {
26 		.name = "sysworkq",
27 		.no_yield = IS_ENABLED(CONFIG_SYSTEM_WORKQUEUE_NO_YIELD),
28 	};
29 
30 	k_work_queue_start(&k_sys_work_q,
31 			    sys_work_q_stack,
32 			    K_KERNEL_STACK_SIZEOF(sys_work_q_stack),
33 			    CONFIG_SYSTEM_WORKQUEUE_PRIORITY, &cfg);
34 	return 0;
35 }
36 
37 SYS_INIT(k_sys_work_q_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
38