ble_mesh: Add ble mesh deinit functions

This commit is contained in:
lly
2019-12-18 21:18:59 +08:00
committed by baohongde
parent 5ef656af35
commit d33caa02c8
66 changed files with 2003 additions and 2 deletions

View File

@@ -45,6 +45,14 @@ static void bt_mesh_alarm_mutex_new(void)
}
}
static void bt_mesh_alarm_mutex_free(void)
{
if (bm_alarm_lock) {
osi_mutex_free(&bm_alarm_lock);
bm_alarm_lock = NULL;
}
}
static void bt_mesh_alarm_lock(void)
{
if (bm_alarm_lock) {
@@ -67,6 +75,14 @@ static void bt_mesh_list_mutex_new(void)
}
}
static void bt_mesh_list_mutex_free(void)
{
if (bm_list_lock) {
osi_mutex_free(&bm_list_lock);
bm_list_lock = NULL;
}
}
void bt_mesh_list_lock(void)
{
if (bm_list_lock) {
@@ -89,6 +105,14 @@ static void bt_mesh_buf_mutex_new(void)
}
}
static void bt_mesh_buf_mutex_free(void)
{
if (bm_buf_lock) {
osi_mutex_free(&bm_buf_lock);
bm_buf_lock = NULL;
}
}
void bt_mesh_buf_lock(void)
{
if (bm_buf_lock) {
@@ -111,6 +135,14 @@ static void bt_mesh_atomic_mutex_new(void)
}
}
static void bt_mesh_atomic_mutex_free(void)
{
if (bm_atomic_lock) {
osi_mutex_free(&bm_atomic_lock);
bm_atomic_lock = NULL;
}
}
void bt_mesh_atomic_lock(void)
{
if (bm_atomic_lock) {
@@ -159,6 +191,18 @@ void bt_mesh_k_init(void)
assert(bm_alarm_hash_map != NULL);
}
void bt_mesh_k_deinit(void)
{
bt_mesh_alarm_mutex_free();
bt_mesh_list_mutex_free();
bt_mesh_buf_mutex_free();
bt_mesh_atomic_mutex_free();
if (bm_alarm_hash_map) {
hash_map_free(bm_alarm_hash_map);
bm_alarm_hash_map = NULL;
}
}
void k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler)
{
osi_alarm_t *alarm = NULL;