blob: 5cc26fd82e14a865367fe36e4ca1a61bbd281abf [file] [log] [blame]
Benjamin Walsh8cf56bc2016-11-04 15:47:32 -04001/*
2 * Copyright (c) 2016 Wind River Systems, Inc.
3 * Copyright (c) 2016 Intel Corporation
4 *
David B. Kinderac74d8b2017-01-18 17:01:01 -08005 * SPDX-License-Identifier: Apache-2.0
Benjamin Walsh8cf56bc2016-11-04 15:47:32 -04006 */
7
8/**
9 * @file
10 *
11 * System workqueue.
12 */
13
Gerard Marull-Paretascffefc82022-05-06 11:04:23 +020014#include <zephyr/kernel.h>
15#include <zephyr/init.h>
Benjamin Walsh8cf56bc2016-11-04 15:47:32 -040016
Peter Bigotdc34e7c2020-10-28 11:24:05 -050017static K_KERNEL_STACK_DEFINE(sys_work_q_stack,
18 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE);
Benjamin Walsh8cf56bc2016-11-04 15:47:32 -040019
20struct k_work_q k_sys_work_q;
21
Gerard Marull-Paretasa5fd0d12022-10-19 09:33:44 +020022static int k_sys_work_q_init(void)
Benjamin Walsh8cf56bc2016-11-04 15:47:32 -040023{
Peter Bigotdc34e7c2020-10-28 11:24:05 -050024 struct k_work_queue_config cfg = {
25 .name = "sysworkq",
26 .no_yield = IS_ENABLED(CONFIG_SYSTEM_WORKQUEUE_NO_YIELD),
Mohamed ElShahawi70846622024-03-29 01:13:48 +010027 .essential = true,
Peter Bigotdc34e7c2020-10-28 11:24:05 -050028 };
Benjamin Walsh8cf56bc2016-11-04 15:47:32 -040029
Peter Bigotdc34e7c2020-10-28 11:24:05 -050030 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);
Benjamin Walsh8cf56bc2016-11-04 15:47:32 -040034 return 0;
35}
36
Benjamin Walshe0ca2102016-12-16 18:01:13 -050037SYS_INIT(k_sys_work_q_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);