1 /*
2  * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef _BLE_MESH_MUTEX_H_
8 #define _BLE_MESH_MUTEX_H_
9 
10 #include "mesh_kernel.h"
11 #include "mesh_slist.h"
12 #include "mesh_atomic.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 typedef struct {
19     SemaphoreHandle_t mutex;
20 #if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
21     StaticQueue_t *buffer;
22 #endif
23 } bt_mesh_mutex_t;
24 
25 void bt_mesh_mutex_create(bt_mesh_mutex_t *mutex);
26 void bt_mesh_mutex_free(bt_mesh_mutex_t *mutex);
27 void bt_mesh_mutex_lock(bt_mesh_mutex_t *mutex);
28 void bt_mesh_mutex_unlock(bt_mesh_mutex_t *mutex);
29 
30 void bt_mesh_alarm_lock(void);
31 void bt_mesh_alarm_unlock(void);
32 
33 void bt_mesh_list_lock(void);
34 void bt_mesh_list_unlock(void);
35 
36 void bt_mesh_buf_lock(void);
37 void bt_mesh_buf_unlock(void);
38 
39 void bt_mesh_atomic_lock(void);
40 void bt_mesh_atomic_unlock(void);
41 
42 void bt_mesh_mutex_init(void);
43 void bt_mesh_mutex_deinit(void);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif /* _BLE_MESH_MUTEX_H_ */
50