return ESP_ERR_INVALID_STATE;
}
-#ifdef CONFIG_BT_BLUEDROID_MEM_DEBUG
+#if HEAP_MEMORY_DEBUG
osi_mem_dbg_init();
#endif
#include "btc/btc_dm.h"
#include "btc/btc_alarm.h"
#include "bta/bta_gatt_api.h"
-#if CONFIG_BT_CLASSIC_ENABLED
+#if CLASSIC_BT_INCLUDED
#include "btc/btc_profile_queue.h"
#if (BTC_GAP_BT_INCLUDED == TRUE)
#include "btc_gap_bt.h"
#include "btc_av.h"
#include "btc_avrc.h"
#endif /* #if BTC_AV_INCLUDED */
-#if CONFIG_BT_SPP_ENABLED
+#if (BTC_SPP_INCLUDED == TRUE)
#include "btc_spp.h"
-#endif /* #if CONFIG_BT_SPP_ENABLED */
+#endif /* #if (BTC_SPP_INCLUDED == TRUE) */
#if BTC_HF_CLIENT_INCLUDED
#include "btc_hf_client.h"
#endif /* #if BTC_HF_CLIENT_INCLUDED */
-#endif /* #if CONFIG_BT_CLASSIC_ENABLED */
+#endif /* #if CLASSIC_BT_INCLUDED */
#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_STACK_SIZE (BT_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_TASK_PRIO (BT_TASK_MAX_PRIORITIES - 6)
static osi_thread_t *btc_thread;
#endif ///GATTS_INCLUDED == TRUE
[BTC_PID_DM_SEC] = {NULL, btc_dm_sec_cb_handler },
[BTC_PID_ALARM] = {btc_alarm_handler, NULL },
-#if CONFIG_BT_CLASSIC_ENABLED
+#if CLASSIC_BT_INCLUDED
#if (BTC_GAP_BT_INCLUDED == TRUE)
[BTC_PID_GAP_BT] = {btc_gap_bt_call_handler, btc_gap_bt_cb_handler },
#endif /* (BTC_GAP_BT_INCLUDED == TRUE) */
[BTC_PID_AVRC_CT] = {btc_avrc_ct_call_handler, NULL },
[BTC_PID_AVRC_TG] = {btc_avrc_tg_call_handler, NULL },
#endif /* #if BTC_AV_INCLUDED */
-#if CONFIG_BT_SPP_ENABLED
+#if (BTC_SPP_INCLUDED == TRUE)
[BTC_PID_SPP] = {btc_spp_call_handler, btc_spp_cb_handler },
-#endif /* #if CONFIG_BT_SPP_ENABLED */
+#endif /* #if (BTC_SPP_INCLUDED == TRUE) */
#if BTC_HF_CLIENT_INCLUDED
[BTC_PID_HF_CLIENT] = {btc_hf_client_call_handler, btc_hf_client_cb_handler},
#endif /* #if BTC_HF_CLIENT_INCLUDED */
-#endif /* #if CONFIG_BT_CLASSIC_ENABLED */
+#endif /* #if CLASSIC_BT_INCLUDED */
};
/*****************************************************************************
osi_free(msg);
}
-static bt_status_t btc_task_post(btc_msg_t *msg, osi_thread_blocking_t blocking)
+static bt_status_t btc_task_post(btc_msg_t *msg, osi_thread_blocking_t blocking)
{
btc_msg_t *lmsg;
BTC_PID_BLUFI,
BTC_PID_DM_SEC,
BTC_PID_ALARM,
-#if CONFIG_BT_CLASSIC_ENABLED
+#if (CLASSIC_BT_INCLUDED == TRUE)
BTC_PID_GAP_BT,
BTC_PID_PRF_QUE,
BTC_PID_A2DP,
BTC_PID_AVRC_CT,
BTC_PID_AVRC_TG,
BTC_PID_SPP,
-#if BTC_HF_CLIENT_INCLUDED
+#if (BTC_HF_CLIENT_INCLUDED == TRUE)
BTC_PID_HF_CLIENT,
#endif /* BTC_HF_CLIENT_INCLUDED */
-#endif /* CONFIG_BT_CLASSIC_ENABLED */
+#endif /* CLASSIC_BT_INCLUDED */
BTC_PID_NUM,
} btc_pid_t; //btc profile id
/* Macro */
#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_STACK_SIZE (A2DP_SINK_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
#define BTC_A2DP_SINK_TASK_NAME "BtA2dSinkT"
-#define BTC_A2DP_SINK_TASK_PRIO (configMAX_PRIORITIES - 3)
+#define BTC_A2DP_SINK_TASK_PRIO (BT_TASK_MAX_PRIORITIES - 3)
/*****************************************************************************
/* Macro */
#define BTC_A2DP_SOURCE_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
-#define BTC_A2DP_SOURCE_TASK_STACK_SIZE (CONFIG_A2DP_SOURCE_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
+#define BTC_A2DP_SOURCE_TASK_STACK_SIZE (A2DP_SOURCE_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
#define BTC_A2DP_SOURCE_TASK_NAME "BtA2dSourceT"
-#define BTC_A2DP_SOURCE_TASK_PRIO (configMAX_PRIORITIES - 3)
+#define BTC_A2DP_SOURCE_TASK_PRIO (BT_TASK_MAX_PRIORITIES - 3)
/*****************************************************************************
btc_hf_client_cb.initialized = true;
-#if CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI
+#if BTM_SCO_HCI_INCLUDED
data_path = ESP_SCO_DATA_PATH_HCI;
#else
data_path = ESP_SCO_DATA_PATH_PCM;
#include "bdroid_buildcfg.h"
#endif
-#include "sdkconfig.h"
+#include "bt_user_config.h"
#include "stack/bt_types.h" /* This must be defined AFTER buildcfg.h */
#include "stack/dyn_mem.h" /* defines static and/or dynamic memory for components */
/* OS Configuration from User config (eg: sdkconfig) */
-#if CONFIG_BLUEDROID_PINNED_TO_CORE
-#define TASK_PINNED_TO_CORE (CONFIG_BLUEDROID_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BLUEDROID_PINNED_TO_CORE : tskNO_AFFINITY)
-#else
-#define TASK_PINNED_TO_CORE (0)
-#endif
+#define TASK_PINNED_TO_CORE UC_TASK_PINNED_TO_CORE
+#define BT_TASK_MAX_PRIORITIES configMAX_PRIORITIES
+#define BT_BTC_TASK_STACK_SIZE UC_BTC_TASK_STACK_SIZE
+#define A2DP_SINK_TASK_STACK_SIZE UC_A2DP_SINK_TASK_STACK_SIZE
+#define A2DP_SOURCE_TASK_STACK_SIZE UC_A2DP_SOURCE_TASK_STACK_SIZE
/******************************************************************************
**
** Classic BT features
**
******************************************************************************/
-#if CONFIG_BT_CLASSIC_ENABLED
+#if (UC_BT_CLASSIC_ENABLED == TRUE)
#define CLASSIC_BT_INCLUDED TRUE
#define BTC_SM_INCLUDED TRUE
#define BTC_PRF_QUEUE_INCLUDED TRUE
#define BTA_DM_PM_INCLUDED TRUE
#define SDP_INCLUDED TRUE
-#if CONFIG_BT_A2DP_ENABLE
+#if (UC_BT_A2DP_ENABLED == TRUE)
#define BTA_AR_INCLUDED TRUE
#define BTA_AV_INCLUDED TRUE
#define AVDT_INCLUDED TRUE
#define SBC_DEC_INCLUDED TRUE
#define BTC_AV_SRC_INCLUDED TRUE
#define SBC_ENC_INCLUDED TRUE
-#endif /* CONFIG_BT_A2DP_ENABLE */
+#endif /* UC_BT_A2DP_ENABLED */
-#if CONFIG_BT_SPP_ENABLED
+#if (UC_BT_SPP_ENABLED == TRUE)
#define RFCOMM_INCLUDED TRUE
#define BTA_JV_INCLUDED TRUE
#define BTC_SPP_INCLUDED TRUE
-#endif /* CONFIG_BT_SPP_ENABLED */
+#endif /* UC_BT_SPP_ENABLED */
-#if CONFIG_BT_HFP_CLIENT_ENABLE
+#if (UC_BT_HFP_CLIENT_ENABLED == TRUE)
#define BTC_HF_CLIENT_INCLUDED TRUE
#define BTA_HF_INCLUDED TRUE
#define PLC_INCLUDED TRUE
#ifndef BTM_MAX_SCO_LINKS
#define BTM_MAX_SCO_LINKS (1)
#endif
+
#ifndef SBC_DEC_INCLUDED
#define SBC_DEC_INCLUDED TRUE
#endif
#ifndef SBC_ENC_INCLUDED
#define SBC_ENC_INCLUDED TRUE
#endif
-#endif /* CONFIG_HFP_HF_ENABLE */
+#endif /* UC_BT_HFP_CLIENT_ENABLED */
-#if CONFIG_BT_SSP_ENABLED
+#if UC_BT_SSP_ENABLED
#define BT_SSP_INCLUDED TRUE
-#endif /* CONFIG_BT_SSP_ENABLED */
+#endif /* UC_BT_SSP_ENABLED */
-#endif /* #if CONFIG_BT_CLASSIC_ENABLED */
+#endif /* UC_BT_CLASSIC_ENABLED */
#ifndef CLASSIC_BT_INCLUDED
#define CLASSIC_BT_INCLUDED FALSE
#endif /* CLASSIC_BT_INCLUDED */
-#ifndef CONFIG_BT_GATTC_CACHE_NVS_FLASH
-#define CONFIG_BT_GATTC_CACHE_NVS_FLASH FALSE
-#endif /* CONFIG_BT_GATTC_CACHE_NVS_FLASH */
-
/******************************************************************************
**
** BLE features
**
******************************************************************************/
-#if (CONFIG_BT_GATTS_ENABLE)
+#if (UC_BT_GATTS_ENABLE)
#define GATTS_INCLUDED TRUE
#else
#define GATTS_INCLUDED FALSE
-#endif /* CONFIG_BT_GATTS_ENABLE */
+#endif /* UC_BT_GATTS_ENABLE */
-#if (CONFIG_BT_GATTC_ENABLE)
+#if (UC_BT_GATTC_ENABLE)
#define GATTC_INCLUDED TRUE
#else
#define GATTC_INCLUDED FALSE
-#endif /* CONFIG_BT_GATTC_ENABLE */
+#endif /* UC_BT_GATTC_ENABLE */
-#if (CONFIG_BT_GATTC_ENABLE && CONFIG_BT_GATTC_CACHE_NVS_FLASH)
-#define GATTC_CACHE_NVS TRUE
+#if (UC_BT_GATTC_ENABLE && UC_BT_GATTC_CACHE_NVS_FLASH_ENABLED)
+#define GATTC_CACHE_NVS TRUE
#else
-#define GATTC_CACHE_NVS FALSE
-#endif /* CONFIG_BT_GATTC_CACHE_NVS_FLASH */
+#define GATTC_CACHE_NVS FALSE
+#endif /* UC_BT_GATTC_ENABLE && UC_BT_GATTC_CACHE_NVS_FLASH_ENABLED */
-#if (CONFIG_BT_SMP_ENABLE)
-#define SMP_INCLUDED TRUE
-#define BLE_PRIVACY_SPT TRUE
+#if (UC_BT_SMP_ENABLE)
+#define SMP_INCLUDED TRUE
+#define BLE_PRIVACY_SPT TRUE
#else
-#define SMP_INCLUDED FALSE
-#define BLE_PRIVACY_SPT FALSE
-#endif /* CONFIG_BT_SMP_ENABLE */
+#define SMP_INCLUDED FALSE
+#define BLE_PRIVACY_SPT FALSE
+#endif /* UC_BT_SMP_ENABLE */
-#ifdef CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE
-#if(CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE)
-#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE TRUE
-#else
-#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE FALSE
-#endif
+#if(UC_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE)
+#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE TRUE
#else
-#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE FALSE
-#endif
+#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE FALSE
+#endif /* UC_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE */
-#ifndef CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
-#define BLE_ADV_REPORT_FLOW_CONTROL FALSE
-#else
-#define BLE_ADV_REPORT_FLOW_CONTROL CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
-#endif /* CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP */
+#ifdef UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
+#define BLE_ADV_REPORT_FLOW_CONTROL UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
+#endif /* UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP */
-#ifndef CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
-#define BLE_ADV_REPORT_FLOW_CONTROL_NUM 100
-#else
-#define BLE_ADV_REPORT_FLOW_CONTROL_NUM CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
-#endif /* CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM */
+#ifdef UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
+#define BLE_ADV_REPORT_FLOW_CONTROL_NUM UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
+#endif /* UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM */
-#ifndef CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
-#define BLE_ADV_REPORT_DISCARD_THRSHOLD 20
-#else
-#define BLE_ADV_REPORT_DISCARD_THRSHOLD CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
-#endif /* CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD */
+#ifdef UC_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
+#define BLE_ADV_REPORT_DISCARD_THRSHOLD UC_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
+#endif /* UC_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD */
-#if (CONFIG_BT_ACL_CONNECTIONS)
-#define MAX_ACL_CONNECTIONS CONFIG_BT_ACL_CONNECTIONS
-#define GATT_MAX_PHY_CHANNEL CONFIG_BT_ACL_CONNECTIONS
-#endif /* CONFIG_BT_ACL_CONNECTIONS */
+#ifdef UC_BT_ACL_CONNECTIONS
+#define MAX_ACL_CONNECTIONS UC_BT_ACL_CONNECTIONS
+#define GATT_MAX_PHY_CHANNEL UC_BT_ACL_CONNECTIONS
+#endif /* UC_BT_ACL_CONNECTIONS */
-#if(CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT)
-#define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT
-#else
-#define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT 30
+#ifdef UC_BT_BLE_ESTAB_LINK_CONN_TOUT
+#define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT UC_BT_BLE_ESTAB_LINK_CONN_TOUT
#endif
//------------------Added from bdroid_buildcfg.h---------------------
#endif
#ifndef BTA_AVRCP_FF_RW_SUPPORT
-#define BTA_AVRCP_FF_RW_SUPPORT FALSE//TRUE
+#define BTA_AVRCP_FF_RW_SUPPORT FALSE
#endif
#ifndef BTA_AG_SCO_PKT_TYPES
#endif
#ifndef BTA_AV_CO_CP_SCMS_T
-#define BTA_AV_CO_CP_SCMS_T FALSE//FALSE
+#define BTA_AV_CO_CP_SCMS_T FALSE
#endif
#ifndef QUEUE_CONGEST_SIZE
#define QUEUE_CONGEST_SIZE 40
#endif
-#ifndef CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK
-#define SCAN_QUEUE_CONGEST_CHECK FALSE
+#if UC_BT_BLE_HOST_QUEUE_CONGESTION_CHECK
+#define SCAN_QUEUE_CONGEST_CHECK TRUE
#else
-#define SCAN_QUEUE_CONGEST_CHECK CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK
+#define SCAN_QUEUE_CONGEST_CHECK FALSE
#endif
-#ifndef CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE
-#define GATTS_SEND_SERVICE_CHANGE_MODE GATTS_SEND_SERVICE_CHANGE_AUTO
-#else
-#define GATTS_SEND_SERVICE_CHANGE_MODE CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE
+#ifdef UC_BT_GATTS_SEND_SERVICE_CHANGE_MODE
+#define GATTS_SEND_SERVICE_CHANGE_MODE UC_BT_GATTS_SEND_SERVICE_CHANGE_MODE
#endif
-#ifndef CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN
-#define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY FALSE
-#else
-#define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN
+#ifdef UC_BT_BLE_ACT_SCAN_REP_ADV_SCAN
+#define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY UC_BT_BLE_ACT_SCAN_REP_ADV_SCAN
#endif
/* This feature is used to eanble interleaved scan*/
#ifndef BTA_HOST_INTERLEAVE_SEARCH
-#define BTA_HOST_INTERLEAVE_SEARCH FALSE//FALSE
+#define BTA_HOST_INTERLEAVE_SEARCH FALSE
#endif
#ifndef BT_USE_TRACES
#endif
#ifndef BTIF_DM_OOB_TEST
-#define BTIF_DM_OOB_TEST FALSE//TRUE
+#define BTIF_DM_OOB_TEST FALSE
#endif
// How long to wait before activating sniff mode after entering the
/* Includes SCO if TRUE */
#ifndef BTM_SCO_HCI_INCLUDED
-#if CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI
+#if UC_BT_HFP_AUDIO_DATA_PATH_HCI
#define BTM_SCO_HCI_INCLUDED TRUE /* TRUE includes SCO over HCI code */
#else
#define BTM_SCO_HCI_INCLUDED FALSE
-#endif /* CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI */
+#endif /* UC_HFP_AUDIO_DATA_PATH_HCI */
#endif
/* Includes WBS if TRUE */
#endif
#ifndef ATT_DEBUG
-#define ATT_DEBUG FALSE//TRUE
+#define ATT_DEBUG FALSE
#endif
#ifndef BLE_PERIPHERAL_MODE_SUPPORT
******************************************************************************/
#ifndef BNEP_INCLUDED
-#define BNEP_INCLUDED FALSE//TRUE
+#define BNEP_INCLUDED FALSE
#endif
/* BNEP status API call is used mainly to get the L2CAP handle */
#ifndef BNEP_SUPPORTS_STATUS_API
-#define BNEP_SUPPORTS_STATUS_API FALSE//TRUE
+#define BNEP_SUPPORTS_STATUS_API FALSE
#endif
/*
** we will do an authentication check again on the new role
*/
#ifndef BNEP_DO_AUTH_FOR_ROLE_SWITCH
-#define BNEP_DO_AUTH_FOR_ROLE_SWITCH FALSE//TRUE
+#define BNEP_DO_AUTH_FOR_ROLE_SWITCH FALSE
#endif
/* This will enable the PANU role */
#ifndef PAN_SUPPORTS_ROLE_PANU
-#define PAN_SUPPORTS_ROLE_PANU FALSE//TRUE
+#define PAN_SUPPORTS_ROLE_PANU FALSE
#endif
/* This will enable the GN role */
#ifndef PAN_SUPPORTS_ROLE_GN
-#define PAN_SUPPORTS_ROLE_GN FALSE//TRUE
+#define PAN_SUPPORTS_ROLE_GN FALSE
#endif
/* This will enable the NAP role */
#ifndef PAN_SUPPORTS_ROLE_NAP
-#define PAN_SUPPORTS_ROLE_NAP FALSE//TRUE
+#define PAN_SUPPORTS_ROLE_NAP FALSE
#endif
/* This is just for debugging purposes */
#ifndef PAN_SUPPORTS_DEBUG_DUMP
-#define PAN_SUPPORTS_DEBUG_DUMP FALSE//TRUE
+#define PAN_SUPPORTS_DEBUG_DUMP FALSE
#endif
/* Maximum number of PAN connections allowed */
******************************************************************************/
#ifndef HCILP_INCLUDED
-#define HCILP_INCLUDED FALSE//TRUE
+#define HCILP_INCLUDED FALSE
#endif
/******************************************************************************
#endif
#ifndef BTA_DM_AVOID_A2DP_ROLESWITCH_ON_INQUIRY
-#define BTA_DM_AVOID_A2DP_ROLESWITCH_ON_INQUIRY FALSE//TRUE
+#define BTA_DM_AVOID_A2DP_ROLESWITCH_ON_INQUIRY FALSE
#endif
/******************************************************************************
/* Enable/disable BTSnoop memory logging */
#ifndef BTSNOOP_MEM
-#define BTSNOOP_MEM FALSE//TRUE
+#define BTSNOOP_MEM FALSE
+#endif
+
+#if UC_BT_BLUEDROID_MEM_DEBUG
+#define HEAP_MEMORY_DEBUG TRUE
+#else
+#define HEAP_MEMORY_DEBUG FALSE
+#endif
+
+#if UC_HEAP_ALLOCATION_FROM_SPIRAM_FIRST
+#define HEAP_ALLOCATION_FROM_SPIRAM_FIRST TRUE
+#else
+#define HEAP_ALLOCATION_FROM_SPIRAM_FIRST FALSE
+#endif
+
+#if UC_BT_BLE_DYNAMIC_ENV_MEMORY
+#define BT_BLE_DYNAMIC_ENV_MEMORY TRUE
+#else
+#define BT_BLE_DYNAMIC_ENV_MEMORY FALSE
#endif
#include "common/bt_trace.h"
#ifndef _BT_TRACE_H_
#define _BT_TRACE_H_
-#include "sdkconfig.h"
-
#include <assert.h>
#include <stdio.h>
+#include "bt_user_config.h"
#include "stack/bt_types.h"
#ifndef LOG_LOCAL_LEVEL
#ifndef BOOTLOADER_BUILD
-#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
+#define LOG_LOCAL_LEVEL UC_LOG_DEFAULT_LEVEL
#else
-#define LOG_LOCAL_LEVEL CONFIG_BOOTLOADER_LOG_LEVEL
+#define LOG_LOCAL_LEVEL UC_BOOTLOADER_LOG_LEVEL
#endif
#endif
// btla-specific ++
/* Core Stack default trace levels */
-#ifdef CONFIG_BT_LOG_HCI_TRACE_LEVEL
-#define HCI_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_HCI_TRACE_LEVEL
-#else
-#define HCI_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_BTM_TRACE_LEVEL
-#define BTM_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_BTM_TRACE_LEVEL
-#else
-#define BTM_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_L2CAP_TRACE_LEVEL
-#define L2CAP_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_L2CAP_TRACE_LEVEL
-#else
-#define L2CAP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL
-#define RFCOMM_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL
-#else
-#define RFCOMM_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_SDP_INITIAL_TRACE_LEVEL
-#define SDP_INITIAL_TRACE_LEVEL CONFIG_SDP_INITIAL_TRACE_LEVEL
-#else
-#define SDP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_GAP_TRACE_LEVEL
-#define GAP_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_GAP_TRACE_LEVEL
-#else
-#define GAP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_BNEP_TRACE_LEVEL
-#define BNEP_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_BNEP_TRACE_LEVEL
-#else
-#define BNEP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_PAN_TRACE_LEVEL
-#define PAN_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_PAN_TRACE_LEVEL
-#else
-#define PAN_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_A2D_TRACE_LEVEL
-#define A2D_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_A2D_TRACE_LEVEL
-#else
-#define A2D_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_AVDT_TRACE_LEVEL
-#define AVDT_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_AVDT_TRACE_LEVEL
-#else
-#define AVDT_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_AVCT_TRACE_LEVEL
-#define AVCT_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_AVCT_TRACE_LEVEL
-#else
-#define AVCT_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_AVRC_TRACE_LEVEL
-#define AVRC_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_AVRC_TRACE_LEVEL
-#else
-#define AVRC_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_MCA_TRACE_LEVEL
-#define MCA_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_MCA_TRACE_LEVEL
-#else
-#define MCA_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_HID_TRACE_LEVEL
-#define HID_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_HID_TRACE_LEVEL
-#else
-#define HID_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_APPL_TRACE_LEVEL
-#define APPL_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_APPL_TRACE_LEVEL
-#else
-#define APPL_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_GATT_TRACE_LEVEL
-#define GATT_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_GATT_TRACE_LEVEL
-#else
-#define GATT_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_SMP_TRACE_LEVEL
-#define SMP_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_SMP_TRACE_LEVEL
-#else
-#define SMP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_BTIF_TRACE_LEVEL
-#define BTIF_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_BTIF_TRACE_LEVEL
-#else
-#define BTIF_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_BTC_TRACE_LEVEL
-#define BTC_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_BTC_TRACE_LEVEL
-#else
-#define BTC_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_OSI_TRACE_LEVEL
-#define OSI_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_OSI_TRACE_LEVEL
-#else
-#define OSI_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
-
-#ifdef CONFIG_BT_LOG_BLUFI_TRACE_LEVEL
-#define BLUFI_INITIAL_TRACE_LEVEL CONFIG_BT_LOG_BLUFI_TRACE_LEVEL
-#else
-#define BLUFI_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
-#endif
+#define HCI_INITIAL_TRACE_LEVEL UC_BT_LOG_HCI_TRACE_LEVEL
+#define BTM_INITIAL_TRACE_LEVEL UC_BT_LOG_BTM_TRACE_LEVEL
+#define L2CAP_INITIAL_TRACE_LEVEL UC_BT_LOG_L2CAP_TRACE_LEVEL
+#define RFCOMM_INITIAL_TRACE_LEVEL UC_BT_LOG_RFCOMM_TRACE_LEVEL
+#define SDP_INITIAL_TRACE_LEVEL UC_BT_LOG_SDP_TRACE_LEVEL
+#define GAP_INITIAL_TRACE_LEVEL UC_BT_LOG_GAP_TRACE_LEVEL
+#define BNEP_INITIAL_TRACE_LEVEL UC_BT_LOG_BNEP_TRACE_LEVEL
+#define PAN_INITIAL_TRACE_LEVEL UC_BT_LOG_PAN_TRACE_LEVEL
+#define A2D_INITIAL_TRACE_LEVEL UC_BT_LOG_A2D_TRACE_LEVEL
+#define AVDT_INITIAL_TRACE_LEVEL UC_BT_LOG_AVDT_TRACE_LEVEL
+#define AVCT_INITIAL_TRACE_LEVEL UC_BT_LOG_AVCT_TRACE_LEVEL
+#define AVRC_INITIAL_TRACE_LEVEL UC_BT_LOG_AVRC_TRACE_LEVEL
+#define MCA_INITIAL_TRACE_LEVEL UC_BT_LOG_MCA_TRACE_LEVEL
+#define HID_INITIAL_TRACE_LEVEL UC_BT_LOG_HID_TRACE_LEVEL
+#define APPL_INITIAL_TRACE_LEVEL UC_BT_LOG_APPL_TRACE_LEVEL
+#define GATT_INITIAL_TRACE_LEVEL UC_BT_LOG_GATT_TRACE_LEVEL
+#define SMP_INITIAL_TRACE_LEVEL UC_BT_LOG_SMP_TRACE_LEVEL
+#define BTIF_INITIAL_TRACE_LEVEL UC_BT_LOG_BTIF_TRACE_LEVEL
+#define BTC_INITIAL_TRACE_LEVEL UC_BT_LOG_BTC_TRACE_LEVEL
+#define OSI_INITIAL_TRACE_LEVEL UC_BT_LOG_OSI_TRACE_LEVEL
+#define BLUFI_INITIAL_TRACE_LEVEL UC_BT_LOG_BLUFI_TRACE_LEVEL
// btla-specific --
-#if !CONFIG_BT_STACK_NO_LOG
+#if !UC_BT_STACK_NO_LOG
#define LOG_ERROR(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) esp_log_write(ESP_LOG_ERROR, "BT_LOG", LOG_FORMAT(E, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
#define LOG_WARN(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) esp_log_write(ESP_LOG_WARN, "BT_LOG", LOG_FORMAT(W, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
#define LOG_INFO(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) esp_log_write(ESP_LOG_INFO, "BT_LOG", LOG_FORMAT(I, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
#define BLUFI_TRACE_EVENT(fmt, args...)
#define BLUFI_TRACE_DEBUG(fmt, args...)
#define BLUFI_TRACE_VERBOSE(fmt, args...)
-#endif ///CONFIG_BT_STACK_NO_LOG
+#endif ///!UC_BT_STACK_NO_LOG
/* Simplified Trace Helper Macro
--- /dev/null
+// Copyright 2015-2016 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_USER_CONFIG_H__
+#define __BT_USER_CONFIG_H__
+
+
+
+
+/* All the configuration from SDK defined here */
+
+#include "sdkconfig.h"
+#include "esp_task.h"
+
+
+/**********************************************************
+ * Thread/Task reference
+ **********************************************************/
+#ifdef CONFIG_BLUEDROID_PINNED_TO_CORE
+#define UC_TASK_PINNED_TO_CORE (CONFIG_BLUEDROID_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BLUEDROID_PINNED_TO_CORE : tskNO_AFFINITY)
+#else
+#define UC_TASK_PINNED_TO_CORE (0)
+#endif
+
+#ifdef CONFIG_BTC_TASK_STACK_SIZE
+#define UC_BTC_TASK_STACK_SIZE CONFIG_BTC_TASK_STACK_SIZE
+#else
+#define UC_BTC_TASK_STACK_SIZE 3072
+#endif
+
+#ifdef CONFIG_A2DP_SINK_TASK_STACK_SIZE
+#define UC_A2DP_SINK_TASK_STACK_SIZE CONFIG_A2DP_SINK_TASK_STACK_SIZE
+#else
+#define UC_A2DP_SINK_TASK_STACK_SIZE 2048
+#endif
+#ifdef CONFIG_A2DP_SOURCE_TASK_STACK_SIZE
+#define UC_A2DP_SOURCE_TASK_STACK_SIZE CONFIG_A2DP_SOURCE_TASK_STACK_SIZE
+#else
+#define UC_A2DP_SOURCE_TASK_STACK_SIZE 2048
+#endif
+
+/**********************************************************
+ * Profile reference
+ **********************************************************/
+//Classic BT reference
+#ifdef CONFIG_BT_CLASSIC_ENABLED
+#define UC_BT_CLASSIC_ENABLED CONFIG_BT_CLASSIC_ENABLED
+#else
+#define UC_BT_CLASSIC_ENABLED FALSE
+#endif
+
+//A2DP
+#ifdef CONFIG_BT_A2DP_ENABLE
+#define UC_BT_A2DP_ENABLED CONFIG_BT_A2DP_ENABLE
+#else
+#define UC_BT_A2DP_ENABLED FALSE
+#endif
+
+//SPP
+#ifdef CONFIG_BT_SPP_ENABLED
+#define UC_BT_SPP_ENABLED CONFIG_BT_SPP_ENABLED
+#else
+#define UC_BT_SPP_ENABLED FALSE
+#endif
+
+//HFP
+#ifdef CONFIG_BT_HFP_CLIENT_ENABLE
+#define UC_BT_HFP_CLIENT_ENABLED CONFIG_BT_HFP_CLIENT_ENABLE
+#else
+#define UC_BT_HFP_CLIENT_ENABLED FALSE
+#endif
+
+//SSP
+#ifdef CONFIG_BT_SSP_ENABLED
+#define UC_BT_SSP_ENABLED CONFIG_BT_SSP_ENABLED
+#else
+#define UC_BT_SSP_ENABLED FALSE
+#endif
+
+//GATTS
+#ifdef CONFIG_BT_GATTS_ENABLE
+#define UC_BT_GATTS_ENABLED CONFIG_BT_GATTS_ENABLE
+#else
+#define UC_BT_GATTS_ENABLED FALSE
+#endif
+
+//GATTC
+#ifdef CONFIG_BT_GATTC_ENABLE
+#define UC_BT_GATTC_ENABLED CONFIG_BT_GATTC_ENABLE
+#else
+#define UC_BT_GATTC_ENABLED FALSE
+#endif
+
+//GATTC CACHE
+#ifdef CONFIG_BT_GATTC_CACHE_NVS_FLASH
+#define UC_BT_GATTC_CACHE_NVS_FLASH_ENABLED CONFIG_BT_GATTC_CACHE_NVS_FLASH
+#else
+#define UC_BT_GATTC_CACHE_NVS_FLASH_ENABLED FALSE
+#endif
+
+//SMP
+#ifdef CONFIG_BT_SMP_ENABLE
+#define UC_BT_SMP_ENABLED CONFIG_BT_SMP_ENABLE
+#else
+#define UC_BT_SMP_ENABLED FALSE
+#endif
+
+//SMP_SLAVE_CON_PARAMS_UPD_ENABLE
+#ifdef CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE
+#define UC_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE
+#else
+#define UC_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE FALSE
+#endif
+
+//BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
+#ifdef CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
+#define UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
+#else
+#define UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP FALSE
+#endif
+
+//SMP_SLAVE_CON_PARAMS_UPD_ENABLE
+#ifdef CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
+#define UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
+#else
+#define UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM 100
+#endif
+
+//BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
+#ifdef CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
+#define UC_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
+#else
+#define UC_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD 20
+#endif
+
+//BT ACL CONNECTIONS
+#ifdef CONFIG_BT_ACL_CONNECTIONS
+#define UC_BT_ACL_CONNECTIONS CONFIG_BT_ACL_CONNECTIONS
+#else
+#define UC_BT_ACL_CONNECTIONS 5
+#endif
+
+//BT_BLE_ESTAB_LINK_CONN_TOUT
+#ifdef CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT
+#define UC_BT_BLE_ESTAB_LINK_CONN_TOUT CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT
+#else
+#define UC_BT_BLE_ESTAB_LINK_CONN_TOUT 30
+#endif
+
+
+//HOST QUEUE CONGEST CHECK
+#ifdef CONFIG_BT_BLE_HOST_QUEUE_CONGESTION_CHECK
+#define UC_BT_BLE_HOST_QUEUE_CONGESTION_CHECK CONFIG_BT_BLE_HOST_QUEUE_CONGESTION_CHECK
+#else
+#define UC_BT_BLE_HOST_QUEUE_CONGESTION_CHECK FALSE
+#endif
+
+#ifdef CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE
+#define UC_BT_GATTS_SEND_SERVICE_CHANGE_MODE CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE
+#else
+#define UC_BT_GATTS_SEND_SERVICE_CHANGE_MODE 0
+#endif
+
+#ifdef CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN
+#define UC_BT_BLE_ACT_SCAN_REP_ADV_SCAN CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN
+#else
+#define UC_BT_BLE_ACT_SCAN_REP_ADV_SCAN FALSE
+#endif
+
+//SCO VOICE OVER HCI
+#ifdef CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI
+#define UC_BT_HFP_AUDIO_DATA_PATH_HCI CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI
+#else
+#define UC_BT_HFP_AUDIO_DATA_PATH_HCI FALSE
+#endif
+
+
+/**********************************************************
+ * Memory reference
+ **********************************************************/
+//DYNAMIC ENV ALLOCATOR
+#ifdef CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY
+#define UC_BT_BLE_DYNAMIC_ENV_MEMORY CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY
+#else
+#define UC_BT_BLE_DYNAMIC_ENV_MEMORY FALSE
+#endif
+
+//MEMORY ALLOCATOR
+#ifdef CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
+#define UC_HEAP_ALLOCATION_FROM_SPIRAM_FIRST CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
+#else
+#define UC_HEAP_ALLOCATION_FROM_SPIRAM_FIRST FALSE
+#endif
+
+//MEMORY DEBUG
+#ifdef CONFIG_BT_BLUEDROID_MEM_DEBUG
+#define UC_BT_BLUEDROID_MEM_DEBUG CONFIG_BT_BLUEDROID_MEM_DEBUG
+#else
+#define UC_BT_BLUEDROID_MEM_DEBUG FALSE
+#endif
+
+
+/**********************************************************
+ * Trace reference
+ **********************************************************/
+#ifdef CONFIG_LOG_DEFAULT_LEVEL
+#define UC_LOG_DEFAULT_LEVEL CONFIG_LOG_DEFAULT_LEVEL
+#else
+#define UC_LOG_DEFAULT_LEVEL 3
+#endif
+#ifdef CONFIG_BOOTLOADER_LOG_LEVEL
+#define UC_BOOTLOADER_LOG_LEVEL CONFIG_BOOTLOADER_LOG_LEVEL
+#else
+#define UC_BOOTLOADER_LOG_LEVEL 3
+#endif
+
+#ifdef CONFIG_BT_STACK_NO_LOG
+#define UC_BT_STACK_NO_LOG CONFIG_BT_STACK_NO_LOG
+#else
+#define UC_BT_STACK_NO_LOG FALSE
+#endif
+
+#define UC_TRACE_LEVEL_NONE 0 /* No trace messages to be generated */
+#define UC_TRACE_LEVEL_ERROR 1 /* Error condition trace messages */
+#define UC_TRACE_LEVEL_WARNING 2 /* Warning condition trace messages */
+#define UC_TRACE_LEVEL_API 3 /* API traces */
+#define UC_TRACE_LEVEL_EVENT 4 /* Debug messages for events */
+#define UC_TRACE_LEVEL_DEBUG 5 /* Full debug messages */
+#define UC_TRACE_LEVEL_VERBOSE 6 /* Verbose debug messages */
+
+#ifdef CONFIG_BT_LOG_HCI_TRACE_LEVEL
+#define UC_BT_LOG_HCI_TRACE_LEVEL CONFIG_BT_LOG_HCI_TRACE_LEVEL
+#else
+#define UC_BT_LOG_HCI_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_BTM_TRACE_LEVEL
+#define UC_BT_LOG_BTM_TRACE_LEVEL CONFIG_BT_LOG_BTM_TRACE_LEVEL
+#else
+#define UC_BT_LOG_BTM_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_L2CAP_TRACE_LEVEL
+#define UC_BT_LOG_L2CAP_TRACE_LEVEL CONFIG_BT_LOG_L2CAP_TRACE_LEVEL
+#else
+#define UC_BT_LOG_L2CAP_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL
+#define UC_BT_LOG_RFCOMM_TRACE_LEVEL CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL
+#else
+#define UC_BT_LOG_RFCOMM_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_SDP_TRACE_LEVEL
+#define UC_BT_LOG_SDP_TRACE_LEVEL CONFIG_BT_LOG_SDP_TRACE_LEVEL
+#else
+#define UC_BT_LOG_SDP_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_GAP_TRACE_LEVEL
+#define UC_BT_LOG_GAP_TRACE_LEVEL CONFIG_BT_LOG_GAP_TRACE_LEVEL
+#else
+#define UC_BT_LOG_GAP_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_BNEP_TRACE_LEVEL
+#define UC_BT_LOG_BNEP_TRACE_LEVEL CONFIG_BT_LOG_BNEP_TRACE_LEVEL
+#else
+#define UC_BT_LOG_BNEP_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_PAN_TRACE_LEVEL
+#define UC_BT_LOG_PAN_TRACE_LEVEL CONFIG_BT_LOG_PAN_TRACE_LEVEL
+#else
+#define UC_BT_LOG_PAN_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_A2D_TRACE_LEVEL
+#define UC_BT_LOG_A2D_TRACE_LEVEL CONFIG_BT_LOG_A2D_TRACE_LEVEL
+#else
+#define UC_BT_LOG_A2D_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_AVDT_TRACE_LEVEL
+#define UC_BT_LOG_AVDT_TRACE_LEVEL CONFIG_BT_LOG_AVDT_TRACE_LEVEL
+#else
+#define UC_BT_LOG_AVDT_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_AVCT_TRACE_LEVEL
+#define UC_BT_LOG_AVCT_TRACE_LEVEL CONFIG_BT_LOG_AVCT_TRACE_LEVEL
+#else
+#define UC_BT_LOG_AVCT_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_AVRC_TRACE_LEVEL
+#define UC_BT_LOG_AVRC_TRACE_LEVEL CONFIG_BT_LOG_AVRC_TRACE_LEVEL
+#else
+#define UC_BT_LOG_AVRC_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_MCA_TRACE_LEVEL
+#define UC_BT_LOG_MCA_TRACE_LEVEL CONFIG_BT_LOG_MCA_TRACE_LEVEL
+#else
+#define UC_BT_LOG_MCA_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_HID_TRACE_LEVEL
+#define UC_BT_LOG_HID_TRACE_LEVEL CONFIG_BT_LOG_HID_TRACE_LEVEL
+#else
+#define UC_BT_LOG_HID_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_APPL_TRACE_LEVEL
+#define UC_BT_LOG_APPL_TRACE_LEVEL CONFIG_BT_LOG_APPL_TRACE_LEVEL
+#else
+#define UC_BT_LOG_APPL_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_GATT_TRACE_LEVEL
+#define UC_BT_LOG_GATT_TRACE_LEVEL CONFIG_BT_LOG_GATT_TRACE_LEVEL
+#else
+#define UC_BT_LOG_GATT_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_SMP_TRACE_LEVEL
+#define UC_BT_LOG_SMP_TRACE_LEVEL CONFIG_BT_LOG_SMP_TRACE_LEVEL
+#else
+#define UC_BT_LOG_SMP_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_BTIF_TRACE_LEVEL
+#define UC_BT_LOG_BTIF_TRACE_LEVEL CONFIG_BT_LOG_BTIF_TRACE_LEVEL
+#else
+#define UC_BT_LOG_BTIF_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_BTC_TRACE_LEVEL
+#define UC_BT_LOG_BTC_TRACE_LEVEL CONFIG_BT_LOG_BTC_TRACE_LEVEL
+#else
+#define UC_BT_LOG_BTC_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_OSI_TRACE_LEVEL
+#define UC_BT_LOG_OSI_TRACE_LEVEL CONFIG_BT_LOG_OSI_TRACE_LEVEL
+#else
+#define UC_BT_LOG_OSI_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+#ifdef CONFIG_BT_LOG_BLUFI_TRACE_LEVEL
+#define UC_BT_LOG_BLUFI_TRACE_LEVEL CONFIG_BT_LOG_BLUFI_TRACE_LEVEL
+#else
+#define UC_BT_LOG_BLUFI_TRACE_LEVEL UC_TRACE_LEVEL_WARNING
+#endif
+
+
+#endif /* __BT_USER_CONFIG_H__ */
+
+
+
#define HCI_H4_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
#define HCI_H4_TASK_STACK_SIZE (2048 + BT_TASK_EXTRA_STACK_SIZE)
-#define HCI_H4_TASK_PRIO (configMAX_PRIORITIES - 4)
+#define HCI_H4_TASK_PRIO (BT_TASK_MAX_PRIORITIES - 4)
#define HCI_H4_TASK_NAME "hciH4T"
-#define HCI_H4_QUEUE_LEN 1
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
#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)
+#define HCI_HOST_TASK_PRIO (BT_TASK_MAX_PRIORITIES - 3)
#define HCI_HOST_TASK_NAME "hciHostT"
-#define HCI_HOST_QUEUE_LEN 40
typedef struct {
uint16_t opcode;
extern void *pvPortZalloc(size_t size);
extern void vPortFree(void *pv);
-#ifdef CONFIG_BT_BLUEDROID_MEM_DEBUG
+
+#if HEAP_MEMORY_DEBUG
#define OSI_MEM_DBG_INFO_MAX 1024*3
typedef struct {
void *osi_malloc_func(size_t size)
{
-#ifdef CONFIG_BT_BLUEDROID_MEM_DEBUG
+#if HEAP_MEMORY_DEBUG
void *p;
-#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
+#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST
p = heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
#else
p = malloc(size);
-#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */
+#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */
osi_mem_dbg_record(p, size, __func__, __LINE__);
return p;
#else
-#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
+#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
#else
return malloc(size);
-#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */
-#endif /* #ifdef CONFIG_BT_BLUEDROID_MEM_DEBUG */
+#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */
+#endif /* #if HEAP_MEMORY_DEBUG */
}
void *osi_calloc_func(size_t size)
{
-#ifdef CONFIG_BT_BLUEDROID_MEM_DEBUG
+#if HEAP_MEMORY_DEBUG
void *p;
-#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
+#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST
p = heap_caps_calloc_prefer(1, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
#else
p = calloc(1, size);
-#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */
+#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */
osi_mem_dbg_record(p, size, __func__, __LINE__);
return p;
#else
-#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
+#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST
return heap_caps_calloc_prefer(1, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
#else
return calloc(1, size);
-#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */
-#endif /* #ifdef CONFIG_BT_BLUEDROID_MEM_DEBUG */
+#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */
+#endif /* #if HEAP_MEMORY_DEBUG */
}
void osi_free_func(void *ptr)
{
-#ifdef CONFIG_BT_BLUEDROID_MEM_DEBUG
- osi_mem_dbg_clean(ptr, __func__, __LINE__);
+#if HEAP_MEMORY_DEBUG
+ osi_mem_dbg_clean(ptr, __func__, __LINE__);
#endif
free(ptr);
}
#include <stddef.h>
#include <stdlib.h>
#include "esp_heap_caps.h"
-#include "sdkconfig.h"
char *osi_strdup(const char *str);
void *osi_calloc_func(size_t size);
void osi_free_func(void *ptr);
-#ifdef CONFIG_BT_BLUEDROID_MEM_DEBUG
+#if HEAP_MEMORY_DEBUG
void osi_mem_dbg_init(void);
void osi_mem_dbg_record(void *p, int size, const char *func, int line);
void osi_mem_dbg_clean(void *p, const char *func, int line);
void osi_mem_dbg_show(void);
-#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
+#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST
#define osi_malloc(size) \
({ \
void *p; \
(void *)p; \
})
-#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */
+#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */
#if 0
do { \
void *p; \
\
-#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST \
+#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST \
p = heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); \
#else \
p = malloc((size)); \
-#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */ \
+#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */ \
osi_mem_dbg_record(p, size, __func__, __LINE__); \
(void *)p; \
}while(0)
do { \
void *p; \
\
-#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST \
+#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST \
p = heap_caps_calloc_prefer(1, size, 2, \
MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, \
MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); \
#else \
p = calloc(1, (size)); \
-#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */ \
+#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */ \
osi_mem_dbg_record(p, size, __func__, __LINE__); \
(void *)p; \
} while(0)
#else
-#if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
+#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST
#define osi_malloc(size) heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
#define osi_calloc(size) heap_caps_calloc_prefer(1, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
#else
#define osi_malloc(size) malloc((size))
#define osi_calloc(size) calloc(1, (size))
-#endif /* #if CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST */
+#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */
#define osi_free(p) free((p))
-#endif /* CONFIG_BT_BLUEDROID_MEM_DEBUG */
+#endif /* HEAP_MEMORY_DEBUG */
#define FREE_AND_RESET(a) \
do { \
return len;
}
-/*******************************************************************************
-**
-** Function BTM_BothEndsSupportSecureConnections
-**
-** Description This function is called to check if both the local device and the peer device
-** specified by bd_addr support BR/EDR Secure Connections.
-**
-** Parameters: bd_addr - address of the peer
-**
-** Returns TRUE if BR/EDR Secure Connections are supported by both local
-** and the remote device.
-** else FALSE.
-**
-*******************************************************************************/
-BOOLEAN BTM_BothEndsSupportSecureConnections(BD_ADDR bd_addr)
-{
- return ((controller_get_interface()->supports_secure_connections()) &&
- (BTM_PeerSupportsSecureConnections(bd_addr)));
-}
-
-/*******************************************************************************
-**
-** Function BTM_PeerSupportsSecureConnections
-**
-** Description This function is called to check if the peer supports
-** BR/EDR Secure Connections.
-**
-** Parameters: bd_addr - address of the peer
-**
-** Returns TRUE if BR/EDR Secure Connections are supported by the peer,
-** else FALSE.
-**
-*******************************************************************************/
-BOOLEAN BTM_PeerSupportsSecureConnections(BD_ADDR bd_addr)
-{
- tBTM_SEC_DEV_REC *p_dev_rec;
-
- if ((p_dev_rec = btm_find_dev(bd_addr)) == NULL) {
- BTM_TRACE_WARNING("%s: unknown BDA: %08x%04x\n", __FUNCTION__,
- (bd_addr[0] << 24) + (bd_addr[1] << 16) + (bd_addr[2] << 8) + bd_addr[3],
- (bd_addr[4] << 8) + bd_addr[5]);
- return FALSE;
- }
-
- return (p_dev_rec->remote_supports_secure_connections);
-}
-
/*******************************************************************************
**
** Function BTM_ReadOobData
}
#endif ///BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
+#if (CLASSIC_BT_INCLUDED == TRUE)
+/*******************************************************************************
+**
+** Function BTM_BothEndsSupportSecureConnections
+**
+** Description This function is called to check if both the local device and the peer device
+** specified by bd_addr support BR/EDR Secure Connections.
+**
+** Parameters: bd_addr - address of the peer
+**
+** Returns TRUE if BR/EDR Secure Connections are supported by both local
+** and the remote device.
+** else FALSE.
+**
+*******************************************************************************/
+BOOLEAN BTM_BothEndsSupportSecureConnections(BD_ADDR bd_addr)
+{
+ return ((controller_get_interface()->supports_secure_connections()) &&
+ (BTM_PeerSupportsSecureConnections(bd_addr)));
+}
+
+/*******************************************************************************
+**
+** Function BTM_PeerSupportsSecureConnections
+**
+** Description This function is called to check if the peer supports
+** BR/EDR Secure Connections.
+**
+** Parameters: bd_addr - address of the peer
+**
+** Returns TRUE if BR/EDR Secure Connections are supported by the peer,
+** else FALSE.
+**
+*******************************************************************************/
+BOOLEAN BTM_PeerSupportsSecureConnections(BD_ADDR bd_addr)
+{
+ tBTM_SEC_DEV_REC *p_dev_rec;
+
+ if ((p_dev_rec = btm_find_dev(bd_addr)) == NULL) {
+ BTM_TRACE_WARNING("%s: unknown BDA: %08x%04x\n", __FUNCTION__,
+ (bd_addr[0] << 24) + (bd_addr[1] << 16) + (bd_addr[2] << 8) + bd_addr[3],
+ (bd_addr[4] << 8) + bd_addr[5]);
+ return FALSE;
+ }
+
+ return (p_dev_rec->remote_supports_secure_connections);
+}
+
/*******************************************************************************
**
** Function BTM_SetOutService
** Returns void
**
*******************************************************************************/
-#if (CLASSIC_BT_INCLUDED == TRUE)
void BTM_SetOutService(BD_ADDR bd_addr, UINT8 service_id, UINT32 mx_chan_id)
{
tBTM_SEC_DEV_REC *p_dev_rec;
#define BTU_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
#define BTU_TASK_STACK_SIZE (4096 + BT_TASK_EXTRA_STACK_SIZE)
-#define BTU_TASK_PRIO (configMAX_PRIORITIES - 5)
+#define BTU_TASK_PRIO (BT_TASK_MAX_PRIORITIES - 5)
#define BTU_TASK_NAME "btuT"
-#define BTU_QUEUE_LEN 50
hash_map_t *btu_general_alarm_hash_map;
osi_mutex_t btu_general_alarm_lock;
btu_thread = NULL;
}
- btu_general_alarm_hash_map = NULL;
+ btu_general_alarm_hash_map = NULL;
btu_oneshot_alarm_hash_map = NULL;
btu_l2cap_alarm_hash_map = NULL;
}
#ifndef DYN_MEM_H
#define DYN_MEM_H
-#include "sdkconfig.h"
-#if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY
+#include "common/bt_target.h"
+#if BT_BLE_DYNAMIC_ENV_MEMORY
#define BTU_DYNAMIC_MEMORY TRUE
#define BTM_DYNAMIC_MEMORY TRUE
#define L2C_DYNAMIC_MEMORY TRUE
#define BTC_SBC_DEC_DYNAMIC_MEMORY TRUE
#define BTC_SBC_ENC_DYNAMIC_MEMORY TRUE
-#else /* #if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY */
+#else /* #if BT_BLE_DYNAMIC_ENV_MEMORY */
#define SDP_DYNAMIC_MEMORY FALSE
#define RFC_DYNAMIC_MEMORY FALSE
#define BTC_SBC_DEC_DYNAMIC_MEMORY FALSE
#define BTC_SBC_ENC_DYNAMIC_MEMORY FALSE
-#endif /* #if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY */
+#endif /* #if BT_BLE_DYNAMIC_ENV_MEMORY */
/****************************************************************************
** Define memory usage for each CORE component (if not defined in bdroid_buildcfg.h)
** The default for each component is to use static memory allocations.