zephyr/subsys/bluetooth/host/long_wq.c
Fabio Baltieri 5591d2305e Bluetooth: host: tweak up the bluetooth thread names
Change the receive workque name to "BT RX WQ" to distinguish it from the
receive thread, and the long workque one to "BT LW WQ" to make the
format consistent with the other Bluetooth threads.

On an nRF52 now "kernel stacks" looks like:

0x200016c8 BT RX                    (real size  448):   unused  280    )
0x20001780 BT RX pri                (real size  448):   unused  224    )
0x200012c0 BT RX WQ                 (real size 2240):   unused 1360    )
0x20001208 BT TX                    (real size  768):   unused  408    )
0x20001130 BT LW WQ                 (real size 1344):   unused  408    )

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-04-02 21:01:00 -04:00

44 lines
1 KiB
C

/* long_work.c - Workqueue intended for long-running operations. */
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/init.h>
K_THREAD_STACK_DEFINE(bt_lw_stack_area, CONFIG_BT_LONG_WQ_STACK_SIZE);
static struct k_work_q bt_long_wq;
int bt_long_wq_schedule(struct k_work_delayable *dwork, k_timeout_t timeout)
{
return k_work_schedule_for_queue(&bt_long_wq, dwork, timeout);
}
int bt_long_wq_reschedule(struct k_work_delayable *dwork, k_timeout_t timeout)
{
return k_work_reschedule_for_queue(&bt_long_wq, dwork, timeout);
}
int bt_long_wq_submit(struct k_work *work)
{
return k_work_submit_to_queue(&bt_long_wq, work);
}
static int long_wq_init(void)
{
const struct k_work_queue_config cfg = {.name = "BT LW WQ"};
k_work_queue_init(&bt_long_wq);
k_work_queue_start(&bt_long_wq, bt_lw_stack_area,
K_THREAD_STACK_SIZEOF(bt_lw_stack_area),
CONFIG_BT_LONG_WQ_PRIO, &cfg);
return 0;
}
SYS_INIT(long_wq_init, POST_KERNEL, CONFIG_BT_LONG_WQ_INIT_PRIO);