mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Add support of NimBLE host in ESP-BLE-Mesh - v3.3
This commit is contained in:
parent
a03b9c7465
commit
cf6f1e8246
@ -6,6 +6,8 @@ if(CONFIG_BT_ENABLED)
|
||||
if(CONFIG_BLUEDROID_ENABLED)
|
||||
|
||||
list(APPEND COMPONENT_PRIV_INCLUDEDIRS
|
||||
common/btc/include
|
||||
common/include
|
||||
bluedroid/bta/include
|
||||
bluedroid/bta/ar/include
|
||||
bluedroid/bta/av/include
|
||||
@ -18,7 +20,6 @@ if(CONFIG_BT_ENABLED)
|
||||
bluedroid/bta/sys/include
|
||||
bluedroid/device/include
|
||||
bluedroid/hci/include
|
||||
bluedroid/osi/include
|
||||
bluedroid/external/sbc/decoder/include
|
||||
bluedroid/external/sbc/encoder/include
|
||||
bluedroid/btc/profile/esp/blufi/include
|
||||
@ -38,11 +39,29 @@ if(CONFIG_BT_ENABLED)
|
||||
bluedroid/stack/a2dp/include
|
||||
bluedroid/stack/rfcomm/include
|
||||
bluedroid/stack/include
|
||||
bluedroid/common/include)
|
||||
bluedroid/common/include
|
||||
common/btc/include
|
||||
common/include)
|
||||
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS bluedroid/api/include/api)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS bluedroid/api/include/api
|
||||
common/osi/include)
|
||||
|
||||
list(APPEND COMPONENT_SRCS "bluedroid/api/esp_a2dp_api.c"
|
||||
list(APPEND COMPONENT_SRCS "common/btc/core/btc_alarm.c"
|
||||
"common/btc/core/btc_manage.c"
|
||||
"common/btc/core/btc_task.c"
|
||||
"common/osi/alarm.c"
|
||||
"common/osi/allocator.c"
|
||||
"common/osi/buffer.c"
|
||||
"common/osi/config.c"
|
||||
"common/osi/fixed_queue.c"
|
||||
"common/osi/future.c"
|
||||
"common/osi/hash_functions.c"
|
||||
"common/osi/hash_map.c"
|
||||
"common/osi/list.c"
|
||||
"common/osi/mutex.c"
|
||||
"common/osi/osi.c"
|
||||
"common/osi/semaphore.c"
|
||||
"bluedroid/api/esp_a2dp_api.c"
|
||||
"bluedroid/api/esp_avrc_api.c"
|
||||
"bluedroid/api/esp_blufi_api.c"
|
||||
"bluedroid/api/esp_bt_device.c"
|
||||
@ -109,18 +128,15 @@ if(CONFIG_BT_ENABLED)
|
||||
"bluedroid/bta/sys/bta_sys_conn.c"
|
||||
"bluedroid/bta/sys/bta_sys_main.c"
|
||||
"bluedroid/bta/sys/utl.c"
|
||||
"bluedroid/btc/core/btc_alarm.c"
|
||||
"bluedroid/btc/core/btc_ble_storage.c"
|
||||
"bluedroid/btc/core/btc_config.c"
|
||||
"bluedroid/btc/core/btc_dev.c"
|
||||
"bluedroid/btc/core/btc_dm.c"
|
||||
"bluedroid/btc/core/btc_main.c"
|
||||
"bluedroid/btc/core/btc_manage.c"
|
||||
"bluedroid/btc/core/btc_profile_queue.c"
|
||||
"bluedroid/btc/core/btc_sec.c"
|
||||
"bluedroid/btc/core/btc_sm.c"
|
||||
"bluedroid/btc/core/btc_storage.c"
|
||||
"bluedroid/btc/core/btc_task.c"
|
||||
"bluedroid/btc/core/btc_util.c"
|
||||
"bluedroid/btc/profile/esp/blufi/blufi_prf.c"
|
||||
"bluedroid/btc/profile/esp/blufi/blufi_protocol.c"
|
||||
@ -173,18 +189,6 @@ if(CONFIG_BT_ENABLED)
|
||||
"bluedroid/hci/packet_fragmenter.c"
|
||||
"bluedroid/main/bte_init.c"
|
||||
"bluedroid/main/bte_main.c"
|
||||
"bluedroid/osi/alarm.c"
|
||||
"bluedroid/osi/allocator.c"
|
||||
"bluedroid/osi/buffer.c"
|
||||
"bluedroid/osi/config.c"
|
||||
"bluedroid/osi/fixed_queue.c"
|
||||
"bluedroid/osi/future.c"
|
||||
"bluedroid/osi/hash_functions.c"
|
||||
"bluedroid/osi/hash_map.c"
|
||||
"bluedroid/osi/list.c"
|
||||
"bluedroid/osi/mutex.c"
|
||||
"bluedroid/osi/osi.c"
|
||||
"bluedroid/osi/semaphore.c"
|
||||
"bluedroid/stack/a2dp/a2d_api.c"
|
||||
"bluedroid/stack/a2dp/a2d_sbc.c"
|
||||
"bluedroid/stack/avct/avct_api.c"
|
||||
@ -281,7 +285,6 @@ if(CONFIG_BT_ENABLED)
|
||||
"bluedroid/stack/smp/smp_utils.c")
|
||||
|
||||
if(CONFIG_BLE_MESH)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS bluedroid/osi/include)
|
||||
list(APPEND COMPONENT_SRCS "esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c")
|
||||
endif()
|
||||
|
||||
@ -362,6 +365,35 @@ if(CONFIG_BT_ENABLED)
|
||||
"esp_ble_mesh/mesh_models/server/state_transition.c"
|
||||
"esp_ble_mesh/mesh_models/server/time_scene_server.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_NIMBLE_ENABLED)
|
||||
|
||||
if (CONFIG_BLE_MESH)
|
||||
list(APPEND COMPONENT_PRIV_INCLUDEDIRS
|
||||
common/btc/include
|
||||
common/include)
|
||||
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS common/osi/include)
|
||||
|
||||
list(APPEND COMPONENT_SRCS "esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c"
|
||||
"common/btc/core/btc_alarm.c"
|
||||
"common/btc/core/btc_manage.c"
|
||||
"common/btc/core/btc_task.c"
|
||||
"common/osi/alarm.c"
|
||||
"common/osi/allocator.c"
|
||||
"common/osi/buffer.c"
|
||||
"common/osi/config.c"
|
||||
"common/osi/fixed_queue.c"
|
||||
"common/osi/future.c"
|
||||
"common/osi/hash_functions.c"
|
||||
"common/osi/hash_map.c"
|
||||
"common/osi/list.c"
|
||||
"common/osi/mutex.c"
|
||||
"common/osi/osi.c"
|
||||
"common/osi/semaphore.c")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# requirements can't depend on config
|
||||
|
@ -1341,7 +1341,7 @@ menu Bluetooth
|
||||
config NIMBLE_MAX_CONNECTIONS
|
||||
int "Maximum number of concurrent connections"
|
||||
range 1 9
|
||||
default 1
|
||||
default BTDM_CONTROLLER_BLE_MAX_CONN
|
||||
depends on NIMBLE_ENABLED
|
||||
help
|
||||
Defines maximum number of concurrent BLE connections
|
||||
@ -1392,6 +1392,7 @@ menu Bluetooth
|
||||
config NIMBLE_TASK_STACK_SIZE
|
||||
int "NimBLE Host task stack size"
|
||||
depends on NIMBLE_ENABLED
|
||||
default 5120 if BLE_MESH
|
||||
default 4096
|
||||
help
|
||||
This configures stack size of NimBLE host task
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "esp_bt_main.h"
|
||||
#include "esp_gap_bt_api.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc/btc_manage.h"
|
||||
#include "btc_gap_bt.h"
|
||||
#include "btc/btc_storage.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#define __BTC_GAP_BT_H__
|
||||
|
||||
#include "common/bt_target.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gap_bt_api.h"
|
||||
#include "btc/btc_task.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "common/bt_trace.h"
|
||||
#include "bt_common.h"
|
||||
#include "common/bt_target.h"
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
@ -65,31 +65,6 @@ typedef struct {
|
||||
uint8_t uu[16];
|
||||
} bt_uuid_t;
|
||||
|
||||
/** Bluetooth Error Status */
|
||||
/** We need to build on this */
|
||||
|
||||
/* relate to ESP_BT_STATUS_xxx in esp_bt_defs.h */
|
||||
typedef enum {
|
||||
BT_STATUS_SUCCESS = 0,
|
||||
BT_STATUS_FAIL,
|
||||
BT_STATUS_NOT_READY,
|
||||
BT_STATUS_NOMEM,
|
||||
BT_STATUS_BUSY,
|
||||
BT_STATUS_DONE, /* request already completed */
|
||||
BT_STATUS_UNSUPPORTED,
|
||||
BT_STATUS_PARM_INVALID,
|
||||
BT_STATUS_UNHANDLED,
|
||||
BT_STATUS_AUTH_FAILURE,
|
||||
BT_STATUS_RMT_DEV_DOWN,
|
||||
BT_STATUS_AUTH_REJECTED,
|
||||
BT_STATUS_INVALID_STATIC_RAND_ADDR,
|
||||
BT_STATUS_PENDING,
|
||||
BT_STATUS_UNACCEPT_CONN_INTERVAL,
|
||||
BT_STATUS_PARAM_OUT_OF_RANGE,
|
||||
BT_STATUS_TIMEOUT,
|
||||
BT_STATUS_MEMORY_FULL,
|
||||
} bt_status_t;
|
||||
|
||||
#ifndef CPU_LITTLE_ENDIAN
|
||||
#define CPU_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef BT_TARGET_H
|
||||
#define BT_TARGET_H
|
||||
|
||||
#include "bt_common.h"
|
||||
|
||||
#ifndef BUILDCFG
|
||||
#define BUILDCFG
|
||||
#endif
|
||||
@ -349,10 +351,6 @@
|
||||
#define BTA_AV_CO_CP_SCMS_T FALSE//FALSE
|
||||
#endif
|
||||
|
||||
#ifndef QUEUE_CONGEST_SIZE
|
||||
#define QUEUE_CONGEST_SIZE 40
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK
|
||||
#define SCAN_QUEUE_CONGEST_CHECK FALSE
|
||||
#else
|
||||
|
@ -23,38 +23,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "stack/bt_types.h"
|
||||
|
||||
#ifndef LOG_LOCAL_LEVEL
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
|
||||
#else
|
||||
#define LOG_LOCAL_LEVEL CONFIG_LOG_BOOTLOADER_LEVEL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
// Mapping between ESP_LOG_LEVEL and BT_TRACE_LEVEL
|
||||
#if (LOG_LOCAL_LEVEL >= 4)
|
||||
#define LOG_LOCAL_LEVEL_MAPPING (LOG_LOCAL_LEVEL+1)
|
||||
#else
|
||||
#define LOG_LOCAL_LEVEL_MAPPING LOG_LOCAL_LEVEL
|
||||
#endif
|
||||
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define BT_LOG_LEVEL_CHECK(LAYER, LEVEL) (MAX(LAYER##_INITIAL_TRACE_LEVEL, LOG_LOCAL_LEVEL_MAPPING) >= BT_TRACE_LEVEL_##LEVEL)
|
||||
|
||||
//#define TAG "BT"
|
||||
|
||||
#define BT_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
|
||||
#ifndef assert
|
||||
#define assert(x) do { if (!(x)) BT_PRINT_E("bt host error %s %u\n", __FILE__, __LINE__); } while (0)
|
||||
#endif
|
||||
#include "bt_common.h"
|
||||
|
||||
inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
|
||||
{
|
||||
@ -324,18 +293,6 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
|
||||
#define BTIF_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BTC_INITIAL_TRACE_LEVEL
|
||||
#define BTC_INITIAL_TRACE_LEVEL CONFIG_BTC_INITIAL_TRACE_LEVEL
|
||||
#else
|
||||
#define BTC_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_OSI_INITIAL_TRACE_LEVEL
|
||||
#define OSI_INITIAL_TRACE_LEVEL CONFIG_OSI_INITIAL_TRACE_LEVEL
|
||||
#else
|
||||
#define OSI_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BLUFI_INITIAL_TRACE_LEVEL
|
||||
#define BLUFI_INITIAL_TRACE_LEVEL CONFIG_BLUFI_INITIAL_TRACE_LEVEL
|
||||
#else
|
||||
@ -497,22 +454,6 @@ extern UINT8 btif_trace_level;
|
||||
#define HCI_TRACE_EVENT(fmt, args...) {if (HCI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(HCI,EVENT)) BT_PRINT_D("BT_HCI", fmt,## args);}
|
||||
#define HCI_TRACE_DEBUG(fmt, args...) {if (HCI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(HCI,DEBUG)) BT_PRINT_D("BT_HCI", fmt,## args);}
|
||||
|
||||
/* define traces for BTC */
|
||||
#define BTC_TRACE_ERROR(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(BTC, ERROR)) BT_PRINT_E("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_WARNING(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(BTC, WARNING)) BT_PRINT_W("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_API(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(BTC,API)) BT_PRINT_I("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_EVENT(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(BTC,EVENT)) BT_PRINT_D("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_DEBUG(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(BTC,DEBUG)) BT_PRINT_D("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_VERBOSE(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_VERBOSE && BT_LOG_LEVEL_CHECK(BTC,VERBOSE)) BT_PRINT_V("BT_BTC", fmt, ## args);}
|
||||
|
||||
/* define traces for OSI */
|
||||
#define OSI_TRACE_ERROR(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(OSI, ERROR)) BT_PRINT_E("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_WARNING(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(OSI, WARNING)) BT_PRINT_W("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_API(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(OSI,API)) BT_PRINT_I("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_EVENT(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(OSI,EVENT)) BT_PRINT_D("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_DEBUG(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(OSI,DEBUG)) BT_PRINT_D("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_VERBOSE(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_VERBOSE && BT_LOG_LEVEL_CHECK(OSI,VERBOSE)) BT_PRINT_V("BT_OSI", fmt, ## args);}
|
||||
|
||||
/* define traces for BLUFI */
|
||||
#define BLUFI_TRACE_ERROR(fmt, args...) {if (BLUFI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(BLUFI, ERROR)) BT_PRINT_E("BT_BLUFI", fmt, ## args);}
|
||||
#define BLUFI_TRACE_WARNING(fmt, args...) {if (BLUFI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(BLUFI, WARNING)) BT_PRINT_W("BT_BLUFI", fmt, ## args);}
|
||||
@ -671,22 +612,6 @@ extern UINT8 btif_trace_level;
|
||||
#define APPL_TRACE_DEBUG(fmt, args...)
|
||||
#define APPL_TRACE_VERBOSE(fmt, args...)
|
||||
|
||||
/* define traces for BTC */
|
||||
#define BTC_TRACE_ERROR(fmt, args...)
|
||||
#define BTC_TRACE_WARNING(fmt, args...)
|
||||
#define BTC_TRACE_API(fmt, args...)
|
||||
#define BTC_TRACE_EVENT(fmt, args...)
|
||||
#define BTC_TRACE_DEBUG(fmt, args...)
|
||||
#define BTC_TRACE_VERBOSE(fmt, args...)
|
||||
|
||||
/* define traces for OSI */
|
||||
#define OSI_TRACE_ERROR(fmt, args...)
|
||||
#define OSI_TRACE_WARNING(fmt, args...)
|
||||
#define OSI_TRACE_API(fmt, args...)
|
||||
#define OSI_TRACE_EVENT(fmt, args...)
|
||||
#define OSI_TRACE_DEBUG(fmt, args...)
|
||||
#define OSI_TRACE_VERBOSE(fmt, args...)
|
||||
|
||||
/* define traces for BLUFI */
|
||||
#define BLUFI_TRACE_ERROR(fmt, args...)
|
||||
#define BLUFI_TRACE_WARNING(fmt, args...)
|
||||
|
@ -240,7 +240,7 @@ UINT16 BTU_BleAclPktSize(void)
|
||||
bool BTU_check_queue_is_congest(void)
|
||||
{
|
||||
UBaseType_t wait_size = uxQueueMessagesWaiting(xBtuQueue);
|
||||
if(wait_size >= QUEUE_CONGEST_SIZE ) {
|
||||
if(wait_size >= BT_QUEUE_CONGEST_SIZE ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -21,14 +21,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE false
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE true
|
||||
#endif
|
||||
#include "bt_common.h"
|
||||
|
||||
typedef uint8_t UINT8;
|
||||
typedef uint16_t UINT16;
|
||||
@ -524,19 +517,6 @@ typedef struct {
|
||||
typedef UINT8 tBT_DEVICE_TYPE;
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/* Define trace levels */
|
||||
#define BT_TRACE_LEVEL_NONE 0 /* No trace messages to be generated */
|
||||
#define BT_TRACE_LEVEL_ERROR 1 /* Error condition trace messages */
|
||||
#define BT_TRACE_LEVEL_WARNING 2 /* Warning condition trace messages */
|
||||
#define BT_TRACE_LEVEL_API 3 /* API traces */
|
||||
#define BT_TRACE_LEVEL_EVENT 4 /* Debug messages for events */
|
||||
#define BT_TRACE_LEVEL_DEBUG 5 /* Full debug messages */
|
||||
#define BT_TRACE_LEVEL_VERBOSE 6 /* Verbose debug messages */
|
||||
|
||||
#define MAX_TRACE_LEVEL 6
|
||||
|
||||
|
||||
/* Define New Trace Type Definition */
|
||||
/* TRACE_CTRL_TYPE 0x^^000000*/
|
||||
#define TRACE_CTRL_MASK 0xff000000
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "btc/btc_task.h"
|
||||
#include "btc/btc_alarm.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
void btc_alarm_handler(btc_msg_t *msg)
|
||||
{
|
@ -14,10 +14,7 @@
|
||||
|
||||
|
||||
#include "btc/btc_task.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "osi/thread.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gatt_defs.h"
|
||||
|
||||
static void *btc_profile_cb_tab[BTC_PID_NUM] = {};
|
||||
|
@ -14,12 +14,14 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "common/bt_target.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "osi/thread.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "esp_log.h"
|
||||
#include "bt_common.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "btc/btc_alarm.h"
|
||||
#ifdef CONFIG_BLUEDROID_ENABLED
|
||||
#include "common/bt_target.h"
|
||||
#include "btc/btc_main.h"
|
||||
#include "btc/btc_dev.h"
|
||||
#include "btc_gatts.h"
|
||||
@ -28,7 +30,6 @@
|
||||
#include "btc_gap_ble.h"
|
||||
#include "btc_blufi_prf.h"
|
||||
#include "btc/btc_dm.h"
|
||||
#include "btc/btc_alarm.h"
|
||||
#include "bta/bta_gatt_api.h"
|
||||
#if CONFIG_CLASSIC_BT_ENABLED
|
||||
#include "btc/btc_profile_queue.h"
|
||||
@ -46,6 +47,7 @@
|
||||
#include "btc_hf_client.h"
|
||||
#endif /* #if BTC_HF_CLIENT_INCLUDED */
|
||||
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
|
||||
#endif
|
||||
|
||||
#if CONFIG_BLE_MESH
|
||||
#include "btc_ble_mesh_prov.h"
|
||||
@ -61,6 +63,7 @@ static xTaskHandle xBtcTaskHandle = NULL;
|
||||
static xQueueHandle xBtcQueue = 0;
|
||||
|
||||
static btc_func_t profile_tab[BTC_PID_NUM] = {
|
||||
#ifdef CONFIG_BLUEDROID_ENABLED
|
||||
[BTC_PID_MAIN_INIT] = {btc_main_call_handler, NULL },
|
||||
[BTC_PID_DEV] = {btc_dev_call_handler, NULL },
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
@ -79,7 +82,9 @@ static btc_func_t profile_tab[BTC_PID_NUM] = {
|
||||
[BTC_PID_BLUFI] = {btc_blufi_call_handler, btc_blufi_cb_handler },
|
||||
#endif ///GATTS_INCLUDED == TRUE
|
||||
[BTC_PID_DM_SEC] = {NULL, btc_dm_sec_cb_handler },
|
||||
#endif
|
||||
[BTC_PID_ALARM] = {btc_alarm_handler, NULL },
|
||||
#ifdef CONFIG_BLUEDROID_ENABLED
|
||||
#if CONFIG_CLASSIC_BT_ENABLED
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
[BTC_PID_GAP_BT] = {btc_gap_bt_call_handler, btc_gap_bt_cb_handler },
|
||||
@ -96,6 +101,7 @@ static btc_func_t profile_tab[BTC_PID_NUM] = {
|
||||
[BTC_PID_HF_CLIENT] = {btc_hf_client_call_handler, btc_hf_client_cb_handler},
|
||||
#endif /* #if BTC_HF_CLIENT_INCLUDED */
|
||||
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
|
||||
#endif
|
||||
#if CONFIG_BLE_MESH
|
||||
[BTC_PID_PROV] = {btc_ble_mesh_prov_call_handler, btc_ble_mesh_prov_cb_handler },
|
||||
[BTC_PID_MODEL] = {btc_ble_mesh_model_call_handler, btc_ble_mesh_model_cb_handler },
|
||||
@ -194,7 +200,10 @@ int btc_init(void)
|
||||
if (xBtcTaskHandle == NULL || xBtcQueue == 0){
|
||||
return BT_STATUS_NOMEM;
|
||||
}
|
||||
#ifdef CONFIG_BLUEDROID_ENABLED
|
||||
btc_gap_callback_init();
|
||||
#endif
|
||||
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
btc_adv_list_init();
|
||||
#endif
|
||||
@ -216,7 +225,7 @@ void btc_deinit(void)
|
||||
bool btc_check_queue_is_congest(void)
|
||||
{
|
||||
UBaseType_t wait_size = uxQueueMessagesWaiting(xBtcQueue);
|
||||
if(wait_size >= QUEUE_CONGEST_SIZE) {
|
||||
if(wait_size >= BT_QUEUE_CONGEST_SIZE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
@ -15,9 +15,7 @@
|
||||
#ifndef __BTC_MANAGE_H__
|
||||
#define __BTC_MANAGE_H__
|
||||
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
/* reset gatt callback table */
|
||||
void esp_profile_cb_reset(void);
|
@ -16,10 +16,13 @@
|
||||
#define __BTC_TASK_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "common/bt_target.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "bt_common.h"
|
||||
#include "osi/thread.h"
|
||||
|
||||
#if CONFIG_BLUEDROID_ENABLED
|
||||
#include "common/bt_target.h"
|
||||
#endif
|
||||
|
||||
typedef struct btc_msg {
|
||||
uint8_t sig; //event signal
|
||||
uint8_t aid; //application id
|
169
components/bt/common/include/bt_common.h
Normal file
169
components/bt/common/include/bt_common.h
Normal file
@ -0,0 +1,169 @@
|
||||
|
||||
// Copyright 2019 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 _BT_COMMON_H_
|
||||
#define _BT_COMMON_H_
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE false
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE true
|
||||
#endif
|
||||
|
||||
#ifndef BT_QUEUE_CONGEST_SIZE
|
||||
#define BT_QUEUE_CONGEST_SIZE 40
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BTC_INITIAL_TRACE_LEVEL
|
||||
#define BTC_INITIAL_TRACE_LEVEL CONFIG_BTC_INITIAL_TRACE_LEVEL
|
||||
#else
|
||||
#define BTC_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_OSI_INITIAL_TRACE_LEVEL
|
||||
#define OSI_INITIAL_TRACE_LEVEL CONFIG_OSI_INITIAL_TRACE_LEVEL
|
||||
#else
|
||||
#define OSI_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY
|
||||
#define BT_BLE_DYNAMIC_ENV_MEMORY TRUE
|
||||
#else
|
||||
#define BT_BLE_DYNAMIC_ENV_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BLUEDROID_PINNED_TO_CORE
|
||||
#define TASK_PINNED_TO_CORE (CONFIG_BLUEDROID_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BLUEDROID_PINNED_TO_CORE : tskNO_AFFINITY)
|
||||
#define BTC_TASK_STACK_SIZE (CONFIG_BTC_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) //by menuconfig
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
#define TASK_PINNED_TO_CORE (CONFIG_NIMBLE_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_NIMBLE_PINNED_TO_CORE : tskNO_AFFINITY)
|
||||
#define BTC_TASK_STACK_SIZE 4096
|
||||
#endif
|
||||
|
||||
#define BTC_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define BTC_TASK_PRIO (configMAX_PRIORITIES - 6)
|
||||
#define BTC_TASK_QUEUE_LEN 60
|
||||
|
||||
/* Define trace levels */
|
||||
#define BT_TRACE_LEVEL_NONE 0 /* No trace messages to be generated */
|
||||
#define BT_TRACE_LEVEL_ERROR 1 /* Error condition trace messages */
|
||||
#define BT_TRACE_LEVEL_WARNING 2 /* Warning condition trace messages */
|
||||
#define BT_TRACE_LEVEL_API 3 /* API traces */
|
||||
#define BT_TRACE_LEVEL_EVENT 4 /* Debug messages for events */
|
||||
#define BT_TRACE_LEVEL_DEBUG 5 /* Full debug messages */
|
||||
#define BT_TRACE_LEVEL_VERBOSE 6 /* Verbose debug messages */
|
||||
|
||||
#define MAX_TRACE_LEVEL 6
|
||||
|
||||
#ifndef LOG_LOCAL_LEVEL
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
|
||||
#else
|
||||
#define LOG_LOCAL_LEVEL CONFIG_LOG_BOOTLOADER_LEVEL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Mapping between ESP_LOG_LEVEL and BT_TRACE_LEVEL
|
||||
#if (LOG_LOCAL_LEVEL >= 4)
|
||||
#define LOG_LOCAL_LEVEL_MAPPING (LOG_LOCAL_LEVEL+1)
|
||||
#else
|
||||
#define LOG_LOCAL_LEVEL_MAPPING LOG_LOCAL_LEVEL
|
||||
#endif
|
||||
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
#define BT_LOG_LEVEL_CHECK(LAYER, LEVEL) (MAX(LAYER##_INITIAL_TRACE_LEVEL, LOG_LOCAL_LEVEL_MAPPING) >= BT_TRACE_LEVEL_##LEVEL)
|
||||
|
||||
#define BT_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
|
||||
#ifndef assert
|
||||
#define assert(x) do { if (!(x)) BT_PRINT_E("BT", "bt host error %s %u\n", __FILE__, __LINE__); } while (0)
|
||||
#endif
|
||||
|
||||
|
||||
#if !CONFIG_BT_STACK_NO_LOG
|
||||
/* define traces for BTC */
|
||||
#define BTC_TRACE_ERROR(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(BTC, ERROR)) BT_PRINT_E("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_WARNING(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(BTC, WARNING)) BT_PRINT_W("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_API(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(BTC,API)) BT_PRINT_I("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_EVENT(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(BTC,EVENT)) BT_PRINT_D("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_DEBUG(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(BTC,DEBUG)) BT_PRINT_D("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_VERBOSE(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_VERBOSE && BT_LOG_LEVEL_CHECK(BTC,VERBOSE)) BT_PRINT_V("BT_BTC", fmt, ## args);}
|
||||
|
||||
/* define traces for OSI */
|
||||
#define OSI_TRACE_ERROR(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(OSI, ERROR)) BT_PRINT_E("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_WARNING(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(OSI, WARNING)) BT_PRINT_W("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_API(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(OSI,API)) BT_PRINT_I("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_EVENT(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(OSI,EVENT)) BT_PRINT_D("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_DEBUG(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(OSI,DEBUG)) BT_PRINT_D("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_VERBOSE(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_VERBOSE && BT_LOG_LEVEL_CHECK(OSI,VERBOSE)) BT_PRINT_V("BT_OSI", fmt, ## args);}
|
||||
|
||||
#else
|
||||
|
||||
/* define traces for BTC */
|
||||
#define BTC_TRACE_ERROR(fmt, args...)
|
||||
#define BTC_TRACE_WARNING(fmt, args...)
|
||||
#define BTC_TRACE_API(fmt, args...)
|
||||
#define BTC_TRACE_EVENT(fmt, args...)
|
||||
#define BTC_TRACE_DEBUG(fmt, args...)
|
||||
#define BTC_TRACE_VERBOSE(fmt, args...)
|
||||
|
||||
/* define traces for OSI */
|
||||
#define OSI_TRACE_ERROR(fmt, args...)
|
||||
#define OSI_TRACE_WARNING(fmt, args...)
|
||||
#define OSI_TRACE_API(fmt, args...)
|
||||
#define OSI_TRACE_EVENT(fmt, args...)
|
||||
#define OSI_TRACE_DEBUG(fmt, args...)
|
||||
#define OSI_TRACE_VERBOSE(fmt, args...)
|
||||
|
||||
#endif
|
||||
|
||||
/** Bluetooth Error Status */
|
||||
/** We need to build on this */
|
||||
|
||||
/* relate to ESP_BT_STATUS_xxx in esp_bt_defs.h */
|
||||
typedef enum {
|
||||
BT_STATUS_SUCCESS = 0,
|
||||
BT_STATUS_FAIL,
|
||||
BT_STATUS_NOT_READY,
|
||||
BT_STATUS_NOMEM,
|
||||
BT_STATUS_BUSY,
|
||||
BT_STATUS_DONE, /* request already completed */
|
||||
BT_STATUS_UNSUPPORTED,
|
||||
BT_STATUS_PARM_INVALID,
|
||||
BT_STATUS_UNHANDLED,
|
||||
BT_STATUS_AUTH_FAILURE,
|
||||
BT_STATUS_RMT_DEV_DOWN,
|
||||
BT_STATUS_AUTH_REJECTED,
|
||||
BT_STATUS_INVALID_STATIC_RAND_ADDR,
|
||||
BT_STATUS_PENDING,
|
||||
BT_STATUS_UNACCEPT_CONN_INTERVAL,
|
||||
BT_STATUS_PARAM_OUT_OF_RANGE,
|
||||
BT_STATUS_TIMEOUT,
|
||||
BT_STATUS_MEMORY_FULL,
|
||||
BT_STATUS_EIR_TOO_LARGE,
|
||||
} bt_status_t;
|
||||
|
||||
#endif /* _BT_COMMON_H_ */
|
@ -18,8 +18,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include "common/bt_defs.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "osi/alarm.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "osi/list.h"
|
||||
@ -27,6 +25,7 @@
|
||||
#include "btc/btc_task.h"
|
||||
#include "btc/btc_alarm.h"
|
||||
#include "osi/mutex.h"
|
||||
#include "bt_common.h"
|
||||
|
||||
typedef struct alarm_t {
|
||||
/* timer id point to here */
|
||||
@ -251,12 +250,12 @@ end:
|
||||
|
||||
osi_alarm_err_t osi_alarm_set(osi_alarm_t *alarm, period_ms_t timeout)
|
||||
{
|
||||
return alarm_set(alarm, timeout, false);
|
||||
return alarm_set(alarm, timeout, FALSE);
|
||||
}
|
||||
|
||||
osi_alarm_err_t osi_alarm_set_periodic(osi_alarm_t *alarm, period_ms_t period)
|
||||
{
|
||||
return alarm_set(alarm, period, true);
|
||||
return alarm_set(alarm, period, TRUE);
|
||||
}
|
||||
|
||||
osi_alarm_err_t osi_alarm_cancel(osi_alarm_t *alarm)
|
@ -18,7 +18,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common/bt_defs.h"
|
||||
#include "bt_common.h"
|
||||
#include "osi/allocator.h"
|
||||
|
||||
extern void *pvPortZalloc(size_t size);
|
@ -16,11 +16,9 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <stdint.h>
|
||||
#include "common/bt_trace.h"
|
||||
#include "bt_common.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "osi/buffer.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "common/bt_trace.h"
|
||||
|
||||
struct buffer_t {
|
||||
buffer_t *root;
|
@ -23,10 +23,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bt_common.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "osi/config.h"
|
||||
#include "osi/list.h"
|
||||
#include "common/bt_trace.h"
|
||||
|
||||
#define CONFIG_FILE_MAX_SIZE (1536)//1.5k
|
||||
#define CONFIG_FILE_DEFAULE_LENGTH (2048)
|
@ -16,12 +16,10 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "common/bt_defs.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "osi/fixed_queue.h"
|
||||
#include "osi/list.h"
|
||||
#include "osi/osi.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "osi/mutex.h"
|
||||
#include "osi/semaphore.h"
|
||||
|
@ -16,8 +16,7 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "common/bt_trace.h"
|
||||
|
||||
#include "bt_common.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "osi/future.h"
|
||||
#include "osi/osi.h"
|
@ -16,8 +16,7 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "common/bt_defs.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "bt_common.h"
|
||||
#include "osi/list.h"
|
||||
#include "osi/hash_map.h"
|
||||
#include "osi/allocator.h"
|
@ -21,7 +21,7 @@
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_task.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "bt_common.h"
|
||||
|
||||
#define portBASE_TYPE int
|
||||
|
||||
@ -57,8 +57,6 @@ typedef enum {
|
||||
SIG_BTU_NUM,
|
||||
} SIG_BTU_t;
|
||||
|
||||
#define TASK_PINNED_TO_CORE (CONFIG_BLUEDROID_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BLUEDROID_PINNED_TO_CORE : tskNO_AFFINITY)
|
||||
|
||||
#define HCI_HOST_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define HCI_HOST_TASK_STACK_SIZE (2048 + BT_TASK_EXTRA_STACK_SIZE)
|
||||
#define HCI_HOST_TASK_PRIO (configMAX_PRIORITIES - 3)
|
||||
@ -77,12 +75,6 @@ typedef enum {
|
||||
#define BTU_TASK_NAME "btuT"
|
||||
#define BTU_QUEUE_LEN 50
|
||||
|
||||
#define BTC_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define BTC_TASK_STACK_SIZE (CONFIG_BTC_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) //by menuconfig
|
||||
#define BTC_TASK_NAME "btcT"
|
||||
#define BTC_TASK_PRIO (configMAX_PRIORITIES - 6)
|
||||
#define BTC_TASK_QUEUE_LEN 60
|
||||
|
||||
#define BTC_A2DP_SINK_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||
#define BTC_A2DP_SINK_TASK_STACK_SIZE (CONFIG_A2DP_SINK_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
|
||||
#define BTC_A2DP_SINK_TASK_NAME "BtA2dSinkT"
|
@ -1,6 +1,5 @@
|
||||
|
||||
#include "common/bt_defs.h"
|
||||
|
||||
#include "bt_common.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "osi/list.h"
|
||||
#include "osi/osi.h"
|
@ -22,11 +22,11 @@ ifeq ($(GCC_NOT_5_2_0), 1)
|
||||
CFLAGS += -Wno-implicit-fallthrough
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
ifdef CONFIG_BLUEDROID_ENABLED
|
||||
|
||||
COMPONENT_SRCDIRS += common/osi \
|
||||
common/btc/core
|
||||
|
||||
COMPONENT_PRIV_INCLUDEDIRS += bluedroid/bta/include \
|
||||
bluedroid/bta/ar/include \
|
||||
bluedroid/bta/av/include \
|
||||
@ -41,7 +41,6 @@ COMPONENT_PRIV_INCLUDEDIRS += bluedroid/bta/include \
|
||||
bluedroid/device/include \
|
||||
bluedroid/gki/include \
|
||||
bluedroid/hci/include \
|
||||
bluedroid/osi/include \
|
||||
bluedroid/utils/include \
|
||||
bluedroid/external/sbc/decoder/include \
|
||||
bluedroid/external/sbc/encoder/include \
|
||||
@ -69,7 +68,10 @@ COMPONENT_PRIV_INCLUDEDIRS += bluedroid/bta/include \
|
||||
bluedroid/stack/rfcomm/include \
|
||||
bluedroid/stack/include \
|
||||
bluedroid/utils/include \
|
||||
bluedroid/common/include
|
||||
bluedroid/common/include \
|
||||
common/btc/include \
|
||||
common/osi/include \
|
||||
common/include
|
||||
|
||||
COMPONENT_ADD_INCLUDEDIRS += bluedroid/api/include/api
|
||||
|
||||
@ -128,11 +130,11 @@ bluedroid/stack/smp/smp_keys.o: CFLAGS += -Wno-unused-const-variable
|
||||
endif
|
||||
|
||||
ifdef CONFIG_BLE_MESH
|
||||
COMPONENT_ADD_INCLUDEDIRS += bluedroid/osi/include
|
||||
|
||||
COMPONENT_ADD_INCLUDEDIRS += common/osi/include
|
||||
COMPONENT_SRCDIRS += esp_ble_mesh/mesh_core/bluedroid_host
|
||||
endif
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_BLE_MESH
|
||||
@ -157,3 +159,18 @@ COMPONENT_SRCDIRS += esp_ble_mesh/mesh_common \
|
||||
esp_ble_mesh/api/core \
|
||||
esp_ble_mesh/api/models
|
||||
endif
|
||||
|
||||
ifdef CONFIG_NIMBLE_ENABLED
|
||||
ifdef CONFIG_BLE_MESH
|
||||
COMPONENT_PRIV_INCLUDEDIRS += common/btc/include \
|
||||
common/include
|
||||
|
||||
COMPONENT_SRCDIRS += common/osi \
|
||||
common/btc/core \
|
||||
esp_ble_mesh/mesh_core/nimble_host
|
||||
|
||||
COMPONENT_ADD_INCLUDEDIRS += common/osi/include
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "mesh_common.h"
|
||||
#include "provisioner_prov.h"
|
||||
#include "bt_common.h"
|
||||
|
||||
static bt_mesh_mutex_t bm_alarm_lock;
|
||||
static bt_mesh_mutex_t bm_list_lock;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "device/controller.h"
|
||||
|
||||
#include "mbedtls/aes.h"
|
||||
#include "bt_common.h"
|
||||
|
||||
#include "mesh_hci.h"
|
||||
#include "mesh_aes_encrypt.h"
|
||||
|
@ -23,11 +23,11 @@
|
||||
#define BLE_MESH_ADV_TASK_CORE TASK_PINNED_TO_CORE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#define BLE_MESH_MAX_CONN CONFIG_BT_NIMBLE_MAX_CONNECTIONS
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
#define BLE_MESH_MAX_CONN CONFIG_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)
|
||||
#ifdef CONFIG_NIMBLE_PINNED_TO_CORE
|
||||
#define BLE_MESH_ADV_TASK_CORE (CONFIG_NIMBLE_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_NIMBLE_PINNED_TO_CORE : tskNO_AFFINITY)
|
||||
#else
|
||||
#define BLE_MESH_ADV_TASK_CORE (0)
|
||||
#endif
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8326807c5e580c3bb8ad13d1e80819aa0029004e
|
||||
Subproject commit 5250d712a5454b2623bf92343c027d77477ca804
|
@ -415,6 +415,14 @@
|
||||
#define MYNEWT_VAL_BLE_HOST (1)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_ESP_BLE_MESH
|
||||
#ifdef CONFIG_BLE_MESH_HCI_5_0
|
||||
#define MYNEWT_VAL_ESP_BLE_MESH (1)
|
||||
#else
|
||||
#define MYNEWT_VAL_ESP_BLE_MESH (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_HS_DEBUG
|
||||
#ifdef CONFIG_NIMBLE_DEBUG
|
||||
#define MYNEWT_VAL_BLE_HS_DEBUG (1)
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "esp_bt_device.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
#include "esp_nimble_hci.h"
|
||||
#include "nimble/nimble_port.h"
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
@ -71,7 +71,7 @@ esp_err_t bluetooth_init(void)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
static SemaphoreHandle_t mesh_sem;
|
||||
static uint8_t own_addr_type;
|
||||
void ble_store_config_init(void);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "esp_bt_device.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
#include "esp_nimble_hci.h"
|
||||
#include "nimble/nimble_port.h"
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
@ -71,7 +71,7 @@ esp_err_t bluetooth_init(void)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
static SemaphoreHandle_t mesh_sem;
|
||||
static uint8_t own_addr_type;
|
||||
void ble_store_config_init(void);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "esp_bt_device.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
#include "esp_nimble_hci.h"
|
||||
#include "nimble/nimble_port.h"
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
@ -71,7 +71,7 @@ esp_err_t bluetooth_init(void)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
static SemaphoreHandle_t mesh_sem;
|
||||
static uint8_t own_addr_type;
|
||||
void ble_store_config_init(void);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "esp_bt_device.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
#include "esp_nimble_hci.h"
|
||||
#include "nimble/nimble_port.h"
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
@ -71,7 +71,7 @@ esp_err_t bluetooth_init(void)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
static SemaphoreHandle_t mesh_sem;
|
||||
static uint8_t own_addr_type;
|
||||
void ble_store_config_init(void);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "esp_bt_device.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
#include "esp_nimble_hci.h"
|
||||
#include "nimble/nimble_port.h"
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
@ -71,7 +71,7 @@ esp_err_t bluetooth_init(void)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
static SemaphoreHandle_t mesh_sem;
|
||||
static uint8_t own_addr_type;
|
||||
void ble_store_config_init(void);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "esp_bt_device.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
#include "esp_nimble_hci.h"
|
||||
#include "nimble/nimble_port.h"
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
@ -71,7 +71,7 @@ esp_err_t bluetooth_init(void)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#ifdef CONFIG_NIMBLE_ENABLED
|
||||
static SemaphoreHandle_t mesh_sem;
|
||||
static uint8_t own_addr_type;
|
||||
void ble_store_config_init(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user