1 /*
2  * Copyright (c) 2023 STMicroelectronics
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/kernel.h>
8 
9 #include <zephyr/logging/log.h>
10 #define LOG_LEVEL CONFIG_SOC_LOG_LEVEL
11 LOG_MODULE_REGISTER(ll_sys_if_adapt);
12 
13 #include "ll_sys.h"
14 
15 extern struct k_mutex ble_ctlr_stack_mutex;
16 extern struct k_work_q ll_work_q;
17 struct k_work ll_sys_work;
18 
ll_sys_schedule_bg_process(void)19 void ll_sys_schedule_bg_process(void)
20 {
21 	k_work_submit_to_queue(&ll_work_q, &ll_sys_work);
22 }
23 
ll_sys_schedule_bg_process_isr(void)24 void ll_sys_schedule_bg_process_isr(void)
25 {
26 	k_work_submit_to_queue(&ll_work_q, &ll_sys_work);
27 }
28 
ll_sys_bg_process_handler(struct k_work * work)29 static void ll_sys_bg_process_handler(struct k_work *work)
30 {
31 	k_mutex_lock(&ble_ctlr_stack_mutex, K_FOREVER);
32 	ll_sys_bg_process();
33 	k_mutex_unlock(&ble_ctlr_stack_mutex);
34 }
35 
ll_sys_bg_process_init(void)36 void ll_sys_bg_process_init(void)
37 {
38 	k_work_init(&ll_sys_work, &ll_sys_bg_process_handler);
39 }
40