mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 14:14:11 +00:00 
			
		
		
		
	Merge branch 'bugfix/ble_tx_power_mapping_for_v4.3' into 'release/v4.3'
Bugfix/ble tx power mapping for v4.3 See merge request espressif/esp-idf!12870
This commit is contained in:
		@@ -126,10 +126,20 @@ config BT_CTRL_RX_ANTENNA_INDEX_EFF
 | 
			
		||||
 | 
			
		||||
choice BT_CTRL_DFT_TX_POWER_LEVEL
 | 
			
		||||
    prompt "BLE default Tx power level"
 | 
			
		||||
    default BT_CTRL_DFT_TX_POWER_LEVEL_P9
 | 
			
		||||
    default BT_CTRL_DFT_TX_POWER_LEVEL_P3
 | 
			
		||||
    help
 | 
			
		||||
        Specify default Tx power level
 | 
			
		||||
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_N27
 | 
			
		||||
        bool "-27dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_N24
 | 
			
		||||
        bool "-24dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_N21
 | 
			
		||||
        bool "-21dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_N18
 | 
			
		||||
        bool "-18dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_N15
 | 
			
		||||
        bool "-15dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_N12
 | 
			
		||||
        bool "-12dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_N9
 | 
			
		||||
@@ -146,18 +156,32 @@ choice BT_CTRL_DFT_TX_POWER_LEVEL
 | 
			
		||||
        bool "+6dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_P9
 | 
			
		||||
        bool "+9dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_P12
 | 
			
		||||
        bool "+12dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_P15
 | 
			
		||||
        bool "+15dBm"
 | 
			
		||||
    config BT_CTRL_DFT_TX_POWER_LEVEL_P18
 | 
			
		||||
        bool "+18dBm"
 | 
			
		||||
endchoice
 | 
			
		||||
 | 
			
		||||
config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
 | 
			
		||||
    int
 | 
			
		||||
    default 0 if BT_CTRL_DFT_TX_POWER_LEVEL_N12
 | 
			
		||||
    default 1 if BT_CTRL_DFT_TX_POWER_LEVEL_N9
 | 
			
		||||
    default 2 if BT_CTRL_DFT_TX_POWER_LEVEL_N6
 | 
			
		||||
    default 3 if BT_CTRL_DFT_TX_POWER_LEVEL_N3
 | 
			
		||||
    default 4 if BT_CTRL_DFT_TX_POWER_LEVEL_N0
 | 
			
		||||
    default 5 if BT_CTRL_DFT_TX_POWER_LEVEL_P3
 | 
			
		||||
    default 6 if BT_CTRL_DFT_TX_POWER_LEVEL_P6
 | 
			
		||||
    default 7 if BT_CTRL_DFT_TX_POWER_LEVEL_P9
 | 
			
		||||
    default 0 if BT_CTRL_DFT_TX_POWER_LEVEL_N27
 | 
			
		||||
    default 1 if BT_CTRL_DFT_TX_POWER_LEVEL_N24
 | 
			
		||||
    default 2 if BT_CTRL_DFT_TX_POWER_LEVEL_N21
 | 
			
		||||
    default 3 if BT_CTRL_DFT_TX_POWER_LEVEL_N18
 | 
			
		||||
    default 4 if BT_CTRL_DFT_TX_POWER_LEVEL_N15
 | 
			
		||||
    default 5 if BT_CTRL_DFT_TX_POWER_LEVEL_N12
 | 
			
		||||
    default 6 if BT_CTRL_DFT_TX_POWER_LEVEL_N9
 | 
			
		||||
    default 7 if BT_CTRL_DFT_TX_POWER_LEVEL_N6
 | 
			
		||||
    default 8 if BT_CTRL_DFT_TX_POWER_LEVEL_N3
 | 
			
		||||
    default 9 if BT_CTRL_DFT_TX_POWER_LEVEL_N0
 | 
			
		||||
    default 10 if BT_CTRL_DFT_TX_POWER_LEVEL_P3
 | 
			
		||||
    default 11 if BT_CTRL_DFT_TX_POWER_LEVEL_P6
 | 
			
		||||
    default 12 if BT_CTRL_DFT_TX_POWER_LEVEL_P9
 | 
			
		||||
    default 13 if BT_CTRL_DFT_TX_POWER_LEVEL_P12
 | 
			
		||||
    default 14 if BT_CTRL_DFT_TX_POWER_LEVEL_P15
 | 
			
		||||
    default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P18
 | 
			
		||||
    default 0
 | 
			
		||||
 | 
			
		||||
config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
 | 
			
		||||
 
 | 
			
		||||
@@ -212,6 +212,7 @@ extern void btdm_controller_disable(void);
 | 
			
		||||
extern uint8_t btdm_controller_get_mode(void);
 | 
			
		||||
extern const char *btdm_controller_get_compile_version(void);
 | 
			
		||||
extern void btdm_rf_bb_init_phase2(void); // shall be called after PHY/RF is enabled
 | 
			
		||||
 | 
			
		||||
/* Sleep */
 | 
			
		||||
extern void btdm_controller_enable_sleep(bool enable);
 | 
			
		||||
extern uint8_t btdm_controller_get_sleep_mode(void);
 | 
			
		||||
@@ -1334,14 +1335,51 @@ esp_bt_controller_status_t esp_bt_controller_get_status(void)
 | 
			
		||||
/* extra functions */
 | 
			
		||||
esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_t power_level)
 | 
			
		||||
{
 | 
			
		||||
    ESP_LOGW(BTDM_LOG_TAG, "%s not implemented, return OK", __func__);
 | 
			
		||||
    return ESP_OK;
 | 
			
		||||
    esp_err_t stat = ESP_FAIL;
 | 
			
		||||
 | 
			
		||||
    switch (power_type) {
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_ADV:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_SCAN:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_DEFAULT:
 | 
			
		||||
        if (ble_txpwr_set(power_type, power_level) == 0) {
 | 
			
		||||
            stat = ESP_OK;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        stat = ESP_ERR_NOT_SUPPORTED;
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return stat;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type)
 | 
			
		||||
{
 | 
			
		||||
    ESP_LOGW(BTDM_LOG_TAG, "%s not implemented, return 0", __func__);
 | 
			
		||||
    return 0;
 | 
			
		||||
    esp_power_level_t lvl;
 | 
			
		||||
 | 
			
		||||
    switch (power_type) {
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_ADV:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_SCAN:
 | 
			
		||||
        lvl = (esp_power_level_t)ble_txpwr_get(power_type);
 | 
			
		||||
        break;
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_CONN_HDL0:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_CONN_HDL1:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_CONN_HDL2:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_CONN_HDL3:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_CONN_HDL4:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_CONN_HDL5:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_CONN_HDL6:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_CONN_HDL7:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_CONN_HDL8:
 | 
			
		||||
    case ESP_BLE_PWR_TYPE_DEFAULT:
 | 
			
		||||
        lvl = (esp_power_level_t)ble_txpwr_get(ESP_BLE_PWR_TYPE_DEFAULT);
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        lvl = ESP_PWR_LVL_INVALID;
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return lvl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
esp_err_t esp_bt_sleep_enable (void)
 | 
			
		||||
 
 | 
			
		||||
 Submodule components/bt/controller/lib updated: 5ba6226876...a0f8c35197
									
								
							@@ -1683,8 +1683,7 @@ static void bta_gattc_conn_cback(tGATT_IF gattc_if, BD_ADDR bda, UINT16 conn_id,
 | 
			
		||||
    tBTA_GATTC_DATA *p_buf;
 | 
			
		||||
 | 
			
		||||
    if (reason != 0) {
 | 
			
		||||
        APPL_TRACE_WARNING("%s() - cif=%d connected=%d conn_id=%d reason=0x%04x",
 | 
			
		||||
                           __FUNCTION__, gattc_if, connected, conn_id, reason);
 | 
			
		||||
        APPL_TRACE_WARNING("gattc_conn_cb: if=%d st=%d id=%d rsn=0x%x", gattc_if, connected, conn_id, reason);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bt_bdaddr_t bdaddr;
 | 
			
		||||
@@ -1702,7 +1701,7 @@ static void bta_gattc_conn_cback(tGATT_IF gattc_if, BD_ADDR bda, UINT16 conn_id,
 | 
			
		||||
                p_buf->int_conn.conn_params.latency = p_lcb->current_used_conn_latency;
 | 
			
		||||
                p_buf->int_conn.conn_params.timeout = p_lcb->current_used_conn_timeout;
 | 
			
		||||
            } else {
 | 
			
		||||
                APPL_TRACE_WARNING("%s not found connection parameters of the device ", __func__);
 | 
			
		||||
                APPL_TRACE_WARNING("gattc_conn_cb: conn params not found");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        p_buf->int_conn.hdr.layer_specific   = conn_id;
 | 
			
		||||
 
 | 
			
		||||
@@ -341,8 +341,7 @@ tBTM_STATUS BTM_BleSetExtendedAdvParams(UINT8 instance, tBTM_BLE_GAP_EXT_ADV_PAR
 | 
			
		||||
                                      params->peer_addr, params->filter_policy, params->tx_power,
 | 
			
		||||
                                      params->primary_phy, params->max_skip,
 | 
			
		||||
                                      params->secondary_phy, params->sid, params->scan_req_notif)) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE EA SetParams: cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
	goto end;
 | 
			
		||||
    }
 | 
			
		||||
@@ -390,14 +389,12 @@ tBTM_STATUS BTM_BleConfigExtendedAdvDataRaw(BOOLEAN is_scan_rsp, UINT8 instance,
 | 
			
		||||
        }
 | 
			
		||||
        if (!is_scan_rsp) {
 | 
			
		||||
            if ((err = btsnd_hcic_ble_set_ext_adv_data(instance, operation, 0, send_data_len, &data[data_offset])) != HCI_SUCCESS) {
 | 
			
		||||
                BTM_TRACE_ERROR("%s, line %d, fail to send the hci command, the error code = %s",
 | 
			
		||||
                                __func__, __LINE__, btm_ble_hci_status_to_str(err));
 | 
			
		||||
                BTM_TRACE_ERROR("LE EA SetAdvData: cmd err=0x%x", err);
 | 
			
		||||
                status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            if ((err = btsnd_hcic_ble_set_ext_adv_scan_rsp_data(instance, operation, 0, send_data_len, &data[data_offset])) != HCI_SUCCESS) {
 | 
			
		||||
                BTM_TRACE_ERROR("%s, line %d, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, __LINE__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
                BTM_TRACE_ERROR("LE EA SetScanRspData: cmd err=0x%x", err);
 | 
			
		||||
                status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -452,8 +449,7 @@ tBTM_STATUS BTM_BleStartExtAdv(BOOLEAN enable, UINT8 num, tBTM_BLE_EXT_ADV *ext_
 | 
			
		||||
 | 
			
		||||
        if ((err = btsnd_hcic_ble_ext_adv_enable(enable, num, instance,
 | 
			
		||||
                                      duration, max_events)) != HCI_SUCCESS) {
 | 
			
		||||
            BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                                 __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
            BTM_TRACE_ERROR("LE EA En=%d: cmd err=0x%x", enable, err);
 | 
			
		||||
            status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -464,8 +460,7 @@ tBTM_STATUS BTM_BleStartExtAdv(BOOLEAN enable, UINT8 num, tBTM_BLE_EXT_ADV *ext_
 | 
			
		||||
        // enable = false, num == 0 or ext_adv = NULL
 | 
			
		||||
 | 
			
		||||
        if ((err = btsnd_hcic_ble_ext_adv_enable(enable, num, NULL, NULL, NULL)) != HCI_SUCCESS) {
 | 
			
		||||
            BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
            BTM_TRACE_ERROR("LE EA En=%d: cmd err=0x%x", enable, err);
 | 
			
		||||
            status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
        }
 | 
			
		||||
        goto end;
 | 
			
		||||
@@ -504,8 +499,7 @@ tBTM_STATUS BTM_BleExtAdvSetRemove(UINT8 instance)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((err = btsnd_hcic_ble_remove_adv_set(instance)) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                                __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE EAS Rm: cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -527,8 +521,7 @@ tBTM_STATUS BTM_BleExtAdvSetClear(void)
 | 
			
		||||
    tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
 | 
			
		||||
 | 
			
		||||
    if ((err = btsnd_hcic_ble_clear_adv_set()) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                                __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE EAS Clr: cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -559,15 +552,14 @@ tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Pa
 | 
			
		||||
        extend_adv_cb.inst[instance].connetable ||
 | 
			
		||||
        extend_adv_cb.inst[instance].legacy_pdu) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, instance = %d, Before set the periodic adv parameters, please configure the the \
 | 
			
		||||
                extend adv to nonscannable and nonconnectable fisrt, and it shouldn't include the legacy bit.", __func__, instance);
 | 
			
		||||
                extend adv to nonscannable and nonconnectable first, and it shouldn't include the legacy bit.", __func__, instance);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
        goto end;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((err= btsnd_hcic_ble_set_periodic_adv_params(instance, params->interval_min,
 | 
			
		||||
                                               params->interval_max, params->properties)) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE PA SetParams: cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -619,8 +611,7 @@ tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ((err = btsnd_hcic_ble_set_periodic_adv_data(instance, operation, send_data_len, &data[data_offset])) != HCI_SUCCESS) {
 | 
			
		||||
            BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
            BTM_TRACE_ERROR("LE PA SetData: cmd err=0x%x", err);
 | 
			
		||||
            status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
        }
 | 
			
		||||
        rem_len -= send_data_len;
 | 
			
		||||
@@ -643,14 +634,13 @@ tBTM_STATUS BTM_BlePeriodicAdvEnable(UINT8 instance, BOOLEAN enable)
 | 
			
		||||
    tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
 | 
			
		||||
 | 
			
		||||
    if (instance >= MAX_BLE_ADV_INSTANCE) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, invalid insatnce %d", __func__, instance);
 | 
			
		||||
        BTM_TRACE_ERROR("%s, invalid instance %d", __func__, instance);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
        goto end;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((err = btsnd_hcic_ble_periodic_adv_enable(enable, instance)) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE PA En=%d: cmd err=0x%x", enable, err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -688,7 +678,7 @@ tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params)
 | 
			
		||||
 | 
			
		||||
    if (!btsnd_hcic_ble_periodic_adv_create_sync(params->filter_policy, params->sid, params->addr_type,
 | 
			
		||||
                                            params->addr, params->sync_timeout, 0)) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, send cmd failed", __func__);
 | 
			
		||||
        BTM_TRACE_ERROR("LE PA CreateSync cmd failed");
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -749,8 +739,7 @@ tBTM_STATUS BTM_BlePeriodicAdvSyncCancel(void)
 | 
			
		||||
    tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
 | 
			
		||||
 | 
			
		||||
    if ((err = btsnd_hcic_ble_periodic_adv_create_sync_cancel()) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE PA SyncCancel, cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -770,8 +759,7 @@ tBTM_STATUS BTM_BlePeriodicAdvSyncTerm(UINT16 sync_handle)
 | 
			
		||||
    tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
 | 
			
		||||
 | 
			
		||||
    if (( err = btsnd_hcic_ble_periodic_adv_term_sync(sync_handle)) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE PA SyncTerm: cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -797,8 +785,7 @@ tBTM_STATUS BTM_BlePeriodicAdvAddDevToList(tBLE_ADDR_TYPE addr_type, BD_ADDR add
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((err = btsnd_hcic_ble_add_dev_to_periodic_adv_list(addr_type, addr, sid)) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE PA AddDevToList: cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -824,8 +811,7 @@ tBTM_STATUS BTM_BlePeriodicAdvRemoveDevFromList(tBLE_ADDR_TYPE addr_type, BD_ADD
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((err = btsnd_hcic_ble_rm_dev_from_periodic_adv_list(addr_type, addr, sid)) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE PA RmDevFromList: cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -845,8 +831,7 @@ tBTM_STATUS BTM_BlePeriodicAdvClearDev(void)
 | 
			
		||||
    tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
 | 
			
		||||
 | 
			
		||||
    if ((err = btsnd_hcic_ble_clear_periodic_adv_list()) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE PA ClrDev: cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -894,8 +879,7 @@ tBTM_STATUS BTM_BleSetExtendedScanParams(tBTM_BLE_EXT_SCAN_PARAMS *params)
 | 
			
		||||
 | 
			
		||||
    if ((err = btsnd_hcic_ble_set_ext_scan_params(params->own_addr_type, params->filter_policy, phy_mask, phy_count,
 | 
			
		||||
                                      hci_params)) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE ES SetParams: cmd err=0x%x", err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -923,8 +907,7 @@ tBTM_STATUS BTM_BleExtendedScan(BOOLEAN enable, UINT16 duration, UINT16 period)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((err = btsnd_hcic_ble_ext_scan_enable(enable, extend_adv_cb.scan_duplicate, duration, period)) != HCI_SUCCESS) {
 | 
			
		||||
        BTM_TRACE_ERROR("%s, fail to send the hci command, the error code = %s(0x%x)",
 | 
			
		||||
                                             __func__, btm_ble_hci_status_to_str(err), err);
 | 
			
		||||
        BTM_TRACE_ERROR("LE ES En=%d: cmd err=0x%x", enable, err);
 | 
			
		||||
        status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -707,6 +707,10 @@ static void btu_hcif_disconnection_comp_evt (UINT8 *p)
 | 
			
		||||
 | 
			
		||||
    handle = HCID_GET_HANDLE (handle);
 | 
			
		||||
 | 
			
		||||
    if (reason != HCI_ERR_PEER_USER && reason != HCI_ERR_CONN_CAUSE_LOCAL_HOST) {
 | 
			
		||||
        HCI_TRACE_WARNING("DiscCmpl evt: hdl=%d, rsn=0x%x", handle, reason);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if BTM_SCO_INCLUDED == TRUE
 | 
			
		||||
    /* If L2CAP doesn't know about it, send it to SCO */
 | 
			
		||||
    if (!l2c_link_hci_disc_comp (handle, reason)) {
 | 
			
		||||
@@ -1126,7 +1130,7 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
 | 
			
		||||
        uint8_t status;
 | 
			
		||||
        STREAM_TO_UINT8  (status, p);
 | 
			
		||||
        if(status != HCI_SUCCESS) {
 | 
			
		||||
            HCI_TRACE_ERROR("%s opcode 0x%x status 0x%x", __func__, opcode, status);
 | 
			
		||||
            HCI_TRACE_ERROR("CC evt: op=0x%x, status=0x%x", opcode, status);
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
@@ -1259,7 +1263,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
 | 
			
		||||
    {
 | 
			
		||||
        uint8_t btm_status = BTM_SUCCESS;
 | 
			
		||||
        if(status != HCI_SUCCESS) {
 | 
			
		||||
            HCI_TRACE_ERROR("%s, Create sync error, the error code = 0x%x", __func__, status);
 | 
			
		||||
            HCI_TRACE_ERROR("CS evt: LE PA CreateSync status=0x%x", status);
 | 
			
		||||
            btm_status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
        }
 | 
			
		||||
        btm_create_sync_callback(btm_status);
 | 
			
		||||
@@ -1269,7 +1273,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
 | 
			
		||||
    {
 | 
			
		||||
        uint8_t btm_status = BTM_SUCCESS;
 | 
			
		||||
        if(status != HCI_SUCCESS) {
 | 
			
		||||
            HCI_TRACE_ERROR("%s, Set phy error, the error code = 0x%x", __func__, status);
 | 
			
		||||
            HCI_TRACE_ERROR("CS evt: LE SetPhy status=0x%x", status);
 | 
			
		||||
            btm_status = BTM_ILLEGAL_VALUE;
 | 
			
		||||
        }
 | 
			
		||||
        btm_set_phy_callback(btm_status);
 | 
			
		||||
 
 | 
			
		||||
@@ -591,7 +591,7 @@ void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_in
 | 
			
		||||
    /* See if we have a link control block for the remote device */
 | 
			
		||||
    p_lcb = l2cu_find_lcb_by_handle(handle);
 | 
			
		||||
    if (!p_lcb) {
 | 
			
		||||
        L2CAP_TRACE_WARNING("l2cble_process_conn_update_evt: Invalid handle: %d", handle);
 | 
			
		||||
        L2CAP_TRACE_WARNING("le con upd: inv hdl=%d", handle);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    if (status == HCI_SUCCESS){
 | 
			
		||||
@@ -599,7 +599,7 @@ void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_in
 | 
			
		||||
        p_lcb->current_used_conn_latency = conn_latency;
 | 
			
		||||
        p_lcb->current_used_conn_timeout = conn_timeout;
 | 
			
		||||
    }else{
 | 
			
		||||
        L2CAP_TRACE_WARNING("l2cble_process_conn_update_evt: Error status: %d", status);
 | 
			
		||||
        L2CAP_TRACE_WARNING("le con upd: err_stat=0x%x", status);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    p_lcb->conn_update_mask &= ~L2C_BLE_UPDATE_PENDING;
 | 
			
		||||
@@ -617,7 +617,7 @@ void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_in
 | 
			
		||||
 | 
			
		||||
    btu_stop_timer (&p_lcb->timer_entry);
 | 
			
		||||
 | 
			
		||||
    L2CAP_TRACE_DEBUG("l2cble_process_conn_update_evt: conn_update_mask=%d", p_lcb->conn_update_mask);
 | 
			
		||||
    L2CAP_TRACE_DEBUG("le con upd: conn_update_mask=%d", p_lcb->conn_update_mask);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define ESP_BT_CTRL_CONFIG_MAGIC_VAL    0x5A5AA5A5
 | 
			
		||||
#define ESP_BT_CTRL_CONFIG_VERSION      0x02101290
 | 
			
		||||
#define ESP_BT_CTRL_CONFIG_VERSION      0x02103080
 | 
			
		||||
 | 
			
		||||
#define ESP_BT_HCI_TL_MAGIC_VALUE   0xfadebead
 | 
			
		||||
#define ESP_BT_HCI_TL_VERSION       0x00010000
 | 
			
		||||
@@ -133,6 +133,8 @@ enum {
 | 
			
		||||
 | 
			
		||||
#define CFG_NASK      CFG_MASK_BIT_SCAN_DUPLICATE_OPTION
 | 
			
		||||
 | 
			
		||||
#define BLE_HW_TARGET_CODE_ESP32C3_CHIP_ECO0                      (0x01010000)
 | 
			
		||||
 | 
			
		||||
#define BT_CONTROLLER_INIT_CONFIG_DEFAULT() {                              \
 | 
			
		||||
    .magic = ESP_BT_CTRL_CONFIG_MAGIC_VAL,                                 \
 | 
			
		||||
    .version = ESP_BT_CTRL_CONFIG_VERSION,                                 \
 | 
			
		||||
@@ -158,6 +160,7 @@ enum {
 | 
			
		||||
    .normal_adv_size = NORMAL_SCAN_DUPLICATE_CACHE_SIZE,                   \
 | 
			
		||||
    .mesh_adv_size = MESH_DUPLICATE_SCAN_CACHE_SIZE,                       \
 | 
			
		||||
    .coex_phy_coded_tx_rx_time_limit = CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF, \
 | 
			
		||||
    .hw_target_code = BLE_HW_TARGET_CODE_ESP32C3_CHIP_ECO0,                \
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
@@ -221,6 +224,7 @@ typedef struct {
 | 
			
		||||
    uint16_t normal_adv_size;               /*!< Normal adv size for scan duplicate */
 | 
			
		||||
    uint16_t mesh_adv_size;                 /*!< Mesh adv size for scan duplicate */
 | 
			
		||||
    uint8_t coex_phy_coded_tx_rx_time_limit;  /*!< limit on max tx/rx time in case of connection using CODED-PHY with Wi-Fi coexistence */
 | 
			
		||||
    uint32_t hw_target_code;                /*!< hardware target */
 | 
			
		||||
} esp_bt_controller_config_t;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -263,22 +267,23 @@ typedef enum {
 | 
			
		||||
 * @brief Bluetooth TX power level(index), it's just a index corresponding to power(dbm).
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
    ESP_PWR_LVL_N12 = 0,                /*!< Corresponding to -12dbm */
 | 
			
		||||
    ESP_PWR_LVL_N9  = 1,                /*!< Corresponding to  -9dbm */
 | 
			
		||||
    ESP_PWR_LVL_N6  = 2,                /*!< Corresponding to  -6dbm */
 | 
			
		||||
    ESP_PWR_LVL_N3  = 3,                /*!< Corresponding to  -3dbm */
 | 
			
		||||
    ESP_PWR_LVL_N0  = 4,                /*!< Corresponding to   0dbm */
 | 
			
		||||
    ESP_PWR_LVL_P3  = 5,                /*!< Corresponding to  +3dbm */
 | 
			
		||||
    ESP_PWR_LVL_P6  = 6,                /*!< Corresponding to  +6dbm */
 | 
			
		||||
    ESP_PWR_LVL_P9  = 7,                /*!< Corresponding to  +9dbm */
 | 
			
		||||
    ESP_PWR_LVL_N14 = ESP_PWR_LVL_N12,  /*!< Backward compatibility! Setting to -14dbm will actually result to -12dbm */
 | 
			
		||||
    ESP_PWR_LVL_N11 = ESP_PWR_LVL_N9,   /*!< Backward compatibility! Setting to -11dbm will actually result to  -9dbm */
 | 
			
		||||
    ESP_PWR_LVL_N8  = ESP_PWR_LVL_N6,   /*!< Backward compatibility! Setting to  -8dbm will actually result to  -6dbm */
 | 
			
		||||
    ESP_PWR_LVL_N5  = ESP_PWR_LVL_N3,   /*!< Backward compatibility! Setting to  -5dbm will actually result to  -3dbm */
 | 
			
		||||
    ESP_PWR_LVL_N2  = ESP_PWR_LVL_N0,   /*!< Backward compatibility! Setting to  -2dbm will actually result to   0dbm */
 | 
			
		||||
    ESP_PWR_LVL_P1  = ESP_PWR_LVL_P3,   /*!< Backward compatibility! Setting to  +1dbm will actually result to  +3dbm */
 | 
			
		||||
    ESP_PWR_LVL_P4  = ESP_PWR_LVL_P6,   /*!< Backward compatibility! Setting to  +4dbm will actually result to  +6dbm */
 | 
			
		||||
    ESP_PWR_LVL_P7  = ESP_PWR_LVL_P9,   /*!< Backward compatibility! Setting to  +7dbm will actually result to  +9dbm */
 | 
			
		||||
    ESP_PWR_LVL_N27 = 0,              /*!< Corresponding to -27dbm */
 | 
			
		||||
    ESP_PWR_LVL_N24 = 1,              /*!< Corresponding to -24dbm */
 | 
			
		||||
    ESP_PWR_LVL_N21 = 2,              /*!< Corresponding to -21dbm */
 | 
			
		||||
    ESP_PWR_LVL_N18 = 3,              /*!< Corresponding to -18dbm */
 | 
			
		||||
    ESP_PWR_LVL_N15 = 4,              /*!< Corresponding to -15dbm */
 | 
			
		||||
    ESP_PWR_LVL_N12 = 5,              /*!< Corresponding to -12dbm */
 | 
			
		||||
    ESP_PWR_LVL_N9  = 6,              /*!< Corresponding to  -9dbm */
 | 
			
		||||
    ESP_PWR_LVL_N6  = 7,              /*!< Corresponding to  -6dbm */
 | 
			
		||||
    ESP_PWR_LVL_N3  = 8,              /*!< Corresponding to  -3dbm */
 | 
			
		||||
    ESP_PWR_LVL_N0  = 9,              /*!< Corresponding to   0dbm */
 | 
			
		||||
    ESP_PWR_LVL_P3  = 10,             /*!< Corresponding to  +3dbm */
 | 
			
		||||
    ESP_PWR_LVL_P6  = 11,             /*!< Corresponding to  +6dbm */
 | 
			
		||||
    ESP_PWR_LVL_P9  = 12,             /*!< Corresponding to  +9dbm */
 | 
			
		||||
    ESP_PWR_LVL_P12 = 13,             /*!< Corresponding to  +12dbm */
 | 
			
		||||
    ESP_PWR_LVL_P15 = 14,             /*!< Corresponding to  +15dbm */
 | 
			
		||||
    ESP_PWR_LVL_P18 = 15,             /*!< Corresponding to  +18dbm */
 | 
			
		||||
    ESP_PWR_LVL_INVALID = 0xFF,         /*!< Indicates an invalid value */
 | 
			
		||||
} esp_power_level_t;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user