blob: 02b1c4c2d221b1420e78aaa7164a7de1395aea5e [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),
27 };
Benjamin Walsh8cf56bc2016-11-04 15:47:32 -040028
Peter Bigotdc34e7c2020-10-28 11:24:05 -050029 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 Walsh8cf56bc2016-11-04 15:47:32 -040033 return 0;
34}
35
Benjamin Walshe0ca2102016-12-16 18:01:13 -050036SYS_INIT(k_sys_work_q_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);