ble_mesh: Split mesh os related into a separate file
This commit is contained in:
parent
8ab29292ab
commit
2f40c4449f
9 changed files with 74 additions and 45 deletions
|
@ -347,6 +347,7 @@ if(CONFIG_BT_ENABLED)
|
|||
"esp_ble_mesh/mesh_common/mesh_atomic.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_buf.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_common.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_kernel.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_mutex.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_timer.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_util.c"
|
||||
|
|
|
@ -15,10 +15,8 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#include "adv.h"
|
||||
#include "mesh_kernel.h"
|
||||
#include "mesh_proxy.h"
|
||||
#include "mesh.h"
|
||||
#include "access.h"
|
||||
|
|
54
components/bt/esp_ble_mesh/mesh_common/include/mesh_kernel.h
Normal file
54
components/bt/esp_ble_mesh/mesh_common/include/mesh_kernel.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Wind River Systems, Inc.
|
||||
* Additional Copyright (c) 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _BLE_MESH_KERNEL_H_
|
||||
#define _BLE_MESH_KERNEL_H_
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#include "mesh_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#define BLE_MESH_ADV_TASK_CORE TASK_PINNED_TO_CORE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_BT_NIMBLE_PINNED_TO_CORE
|
||||
#define BLE_MESH_ADV_TASK_CORE (CONFIG_BT_NIMBLE_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BT_NIMBLE_PINNED_TO_CORE : tskNO_AFFINITY)
|
||||
#else
|
||||
#define BLE_MESH_ADV_TASK_CORE (0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define BLE_MESH_ADV_TASK_STACK_SIZE 3072
|
||||
|
||||
/**
|
||||
* @brief Put the current thread to sleep.
|
||||
*
|
||||
* This routine puts the current thread to sleep for @a duration
|
||||
* milliseconds.
|
||||
*
|
||||
* @param duration Number of milliseconds to sleep.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void k_sleep(s32_t duration);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BLE_MESH_KERNEL_H_ */
|
||||
|
|
@ -15,12 +15,7 @@
|
|||
#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_kernel.h"
|
||||
#include "mesh_slist.h"
|
||||
#include "mesh_atomic.h"
|
||||
|
||||
|
|
|
@ -256,18 +256,6 @@ void k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler);
|
|||
*/
|
||||
s64_t k_uptime_get(void);
|
||||
|
||||
/**
|
||||
* @brief Put the current thread to sleep.
|
||||
*
|
||||
* This routine puts the current thread to sleep for @a duration
|
||||
* milliseconds.
|
||||
*
|
||||
* @param duration Number of milliseconds to sleep.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void k_sleep(s32_t duration);
|
||||
|
||||
void bt_mesh_timer_init(void);
|
||||
void bt_mesh_timer_deinit(void);
|
||||
|
||||
|
|
14
components/bt/esp_ble_mesh/mesh_common/mesh_kernel.c
Normal file
14
components/bt/esp_ble_mesh/mesh_common/mesh_kernel.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
* Copyright (c) 2016 Wind River Systems, Inc.
|
||||
* Additional Copyright (c) 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "mesh_kernel.h"
|
||||
|
||||
void k_sleep(s32_t duration)
|
||||
{
|
||||
vTaskDelay(duration / portTICK_PERIOD_MS);
|
||||
}
|
|
@ -43,12 +43,6 @@ u32_t k_uptime_get_32(void)
|
|||
return (u32_t)(esp_timer_get_time() / 1000);
|
||||
}
|
||||
|
||||
void k_sleep(s32_t duration)
|
||||
{
|
||||
vTaskDelay(duration / portTICK_PERIOD_MS);
|
||||
return;
|
||||
}
|
||||
|
||||
void bt_mesh_timer_init(void)
|
||||
{
|
||||
bm_alarm_hash_map = hash_map_new(BLE_MESH_GENERAL_ALARM_HASH_MAP_SIZE,
|
||||
|
|
|
@ -11,14 +11,11 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#include "osi/thread.h"
|
||||
#include "bt_common.h"
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLE_MESH_DEBUG_ADV)
|
||||
|
||||
#include "mesh_kernel.h"
|
||||
#include "mesh.h"
|
||||
#include "mesh_hci.h"
|
||||
#include "mesh_common.h"
|
||||
|
|
|
@ -21,25 +21,13 @@ extern "C" {
|
|||
|
||||
/* BLE Mesh Max Connection Count */
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#define BLE_MESH_MAX_CONN \
|
||||
MIN(CONFIG_BT_ACL_CONNECTIONS, CONFIG_BTDM_CTRL_BLE_MAX_CONN)
|
||||
|
||||
#define BLE_MESH_ADV_TASK_CORE TASK_PINNED_TO_CORE
|
||||
#define BLE_MESH_MAX_CONN MIN(CONFIG_BT_ACL_CONNECTIONS, CONFIG_BTDM_CTRL_BLE_MAX_CONN)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#define BLE_MESH_MAX_CONN CONFIG_BT_NIMBLE_MAX_CONNECTIONS
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_PINNED_TO_CORE
|
||||
#define BLE_MESH_ADV_TASK_CORE (CONFIG_BT_NIMBLE_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BT_NIMBLE_PINNED_TO_CORE : tskNO_AFFINITY)
|
||||
#else
|
||||
#define BLE_MESH_ADV_TASK_CORE (0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define BLE_MESH_ADV_TASK_STACK_SIZE 3072
|
||||
|
||||
#define BLE_MESH_GAP_ADV_MAX_LEN 31
|
||||
|
||||
#define BLE_MESH_GATT_DEF_MTU_SIZE 23
|
||||
|
|
Loading…
Reference in a new issue