mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
ble_mesh: Split mesh mutex into a separate file
This commit is contained in:
@@ -22,13 +22,9 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#include "esp_heap_caps.h"
|
||||
|
||||
#include "mesh_mutex.h"
|
||||
#include "mesh_access.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -76,21 +72,6 @@ void bt_mesh_free_buf(struct net_buf_simple *buf);
|
||||
*/
|
||||
u8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send);
|
||||
|
||||
typedef struct {
|
||||
SemaphoreHandle_t mutex;
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
StaticQueue_t *buffer;
|
||||
#endif
|
||||
} bt_mesh_mutex_t;
|
||||
|
||||
void bt_mesh_mutex_create(bt_mesh_mutex_t *mutex);
|
||||
|
||||
void bt_mesh_mutex_free(bt_mesh_mutex_t *mutex);
|
||||
|
||||
void bt_mesh_mutex_lock(bt_mesh_mutex_t *mutex);
|
||||
|
||||
void bt_mesh_mutex_unlock(bt_mesh_mutex_t *mutex);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
63
components/bt/esp_ble_mesh/mesh_common/include/mesh_mutex.h
Normal file
63
components/bt/esp_ble_mesh/mesh_common/include/mesh_mutex.h
Normal file
@@ -0,0 +1,63 @@
|
||||
// Copyright 2017-2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _BLE_MESH_MUTEX_H_
|
||||
#define _BLE_MESH_MUTEX_H_
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#include "mesh_types.h"
|
||||
#include "mesh_slist.h"
|
||||
#include "mesh_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
SemaphoreHandle_t mutex;
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
StaticQueue_t *buffer;
|
||||
#endif
|
||||
} bt_mesh_mutex_t;
|
||||
|
||||
void bt_mesh_mutex_create(bt_mesh_mutex_t *mutex);
|
||||
void bt_mesh_mutex_free(bt_mesh_mutex_t *mutex);
|
||||
void bt_mesh_mutex_lock(bt_mesh_mutex_t *mutex);
|
||||
void bt_mesh_mutex_unlock(bt_mesh_mutex_t *mutex);
|
||||
|
||||
void bt_mesh_alarm_lock(void);
|
||||
void bt_mesh_alarm_unlock(void);
|
||||
|
||||
void bt_mesh_list_lock(void);
|
||||
void bt_mesh_list_unlock(void);
|
||||
|
||||
void bt_mesh_buf_lock(void);
|
||||
void bt_mesh_buf_unlock(void);
|
||||
|
||||
void bt_mesh_atomic_lock(void);
|
||||
void bt_mesh_atomic_unlock(void);
|
||||
|
||||
void bt_mesh_mutex_init(void);
|
||||
void bt_mesh_mutex_deinit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BLE_MESH_MUTEX_H_ */
|
||||
|
@@ -268,17 +268,8 @@ s64_t k_uptime_get(void);
|
||||
*/
|
||||
void k_sleep(s32_t duration);
|
||||
|
||||
void bt_mesh_list_lock(void);
|
||||
void bt_mesh_list_unlock(void);
|
||||
|
||||
void bt_mesh_buf_lock(void);
|
||||
void bt_mesh_buf_unlock(void);
|
||||
|
||||
void bt_mesh_atomic_lock(void);
|
||||
void bt_mesh_atomic_unlock(void);
|
||||
|
||||
void bt_mesh_k_init(void);
|
||||
void bt_mesh_k_deinit(void);
|
||||
void bt_mesh_timer_init(void);
|
||||
void bt_mesh_timer_deinit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user