Compare commits

..

43 Commits

Author SHA1 Message Date
Roland Dobai
284120b0f4 Merge branch 'fix/docker_qemu_seg_v5.3' into 'release/v5.3'
CI: Fixed docker build

See merge request espressif/esp-idf!37366
2025-02-27 20:13:29 +08:00
Roland Dobai
73b6a8c263 ci(github): Fixed docker build caused by Qemu segmentation fault
Works around issue from
https://github.com/espressif/esp-idf/actions/runs/13531037397/job/37813060700
caused by Qemu segmentation fault.

    Errors were encountered while processing: libc-bin

The workaround is from https://github.com/docker/setup-qemu-action/issues/198.
2025-02-27 12:45:15 +01:00
morris
ae09425178 Merge branch 'fix/spi_master_halt_using_rc_fast_v5.3' into 'release/v5.3'
fix(spi_master): fix spi halt when remove device who using rc_fast (v5.3)

See merge request espressif/esp-idf!37004
2025-02-27 16:48:23 +08:00
Shu Chen
5c06d62702 Merge branch 'fix/fix_ot_uart_init_bug_v5.3' into 'release/v5.3'
fix(openthread): fix a bug of openthread uart init port (v5.3)

See merge request espressif/esp-idf!37323
2025-02-27 15:36:18 +08:00
morris
195d7f47a4 Merge branch 'feat/add_temperature_calib_v5.3' into 'release/v5.3'
feat(temperature_sensor): Add temperature sensor calibration support(backport v5.3)

See merge request espressif/esp-idf!37314
2025-02-27 14:28:06 +08:00
Jiang Jiang Jian
9c5aefac91 Merge branch 'docs/fix_some_coexist_doc_issue_v5.3' into 'release/v5.3'
docs(coex): update rf coexistence documents (v5.3)

See merge request espressif/esp-idf!37345
2025-02-27 14:03:31 +08:00
Jiang Jiang Jian
b2f08a80dc Merge branch 'bugfix/ifdef_cplusplus_bracket_v5.3' into 'release/v5.3'
bugfix(wifi): Add missing brackets in the C++ guard (Backport v5.3)

See merge request espressif/esp-idf!36845
2025-02-27 13:41:24 +08:00
Mahavir Jain
eb9019a1eb Merge branch 'feature/enable_ota_resumption_support_for_release5.3' into 'release/v5.3'
feat(app_update): enabled ota resumption support for release/v5.3

See merge request espressif/esp-idf!37212
2025-02-27 13:41:07 +08:00
wanlei
b43104538b fix(spi_master): fix spi halt when remove device who using rc_fast 2025-02-27 11:42:15 +08:00
Jiang Jiang Jian
e40304b2ec Merge branch 'bugfix/fix_some_wifi_bugs_250226_v5.3' into 'release/v5.3'
fix(wifi): fix some wifi bugs 250226(Bbackport v5.3)

See merge request espressif/esp-idf!37308
2025-02-27 11:38:10 +08:00
akshat
f8c552b560 bugfix(wifi): Fix header file errors and remove esp_supplicant from check_public_headers_exceptions.txt 2025-02-27 11:09:30 +08:00
akshat
1c231b4401 bugfix(wifi): Add missing brackets in the C++ guard
Closes https://github.com/espressif/esp-idf/issues/14991
2025-02-27 11:09:30 +08:00
linruihao
5da35cadb6 docs(coex): update rf coexistence documents
- remove BLE connecting state in coexistence scenario
- remove WIFI section in H2 docs
2025-02-27 11:07:55 +08:00
Shu Chen
eadfab049f docs(coex): add the supported coexistence scenario for Wi-Fi and 802.15.4 2025-02-27 11:07:45 +08:00
Island
a71e0aac53 Merge branch 'feat/add_save_debug_context_250226_v5.3' into 'release/v5.3'
Feat/add save debug context 250226 (v5.3)

See merge request espressif/esp-idf!37296
2025-02-27 10:40:05 +08:00
Martin Vychodil
313c3406f9 Merge branch 'fix/esp_vfs_register_fd_range_warning_message_v5.3' into 'release/v5.3'
fix(storage/vfs): incorrect log level in esp_vfs_register_fd_range (v5.3)

See merge request espressif/esp-idf!36319
2025-02-26 21:39:04 +08:00
Xu Si Yu
3b770e7307 fix(openthread): fix a bug of openthread uart init port 2025-02-26 19:22:20 +08:00
morris
70e8021aa7 Merge branch 'bugfix/gpio_rom_patch_fix_v5.3' into 'release/v5.3'
fix(gpio): fix esp_rom_gpio_connect_out_signal for gpio num over 31 on esp32/s2 (v5.3)

See merge request espressif/esp-idf!36866
2025-02-26 19:09:11 +08:00
C.S.M
77e69fa036 feat(temperature_sensor): Add temperature sensor calibration support 2025-02-26 17:54:36 +08:00
Island
af4ad22e9a Merge branch 'feat/optimize_ble_config_reduce_bin_v5.3' into 'release/v5.3'
Feat/optimize bluedroid host config and reduce bin size (v5.3)

See merge request espressif/esp-idf!37260
2025-02-26 17:23:29 +08:00
muhaidong
2e5099261f fix(wifi): fix some wifi bugs 250226
1. fix(wifi): fix some esp32p4 host issues
2. fix(wifi): fix wep shared auth connect fail issue
3. fix(coex): fix disable external coex fail issue
2025-02-26 17:09:43 +08:00
morris
67c6ae91ab Merge branch 'feat/allow_setting_rmt_group_prescale_v5.3' into 'release/v5.3'
refactor(rmt): set group clock prescale dynamically (v5.3)

See merge request espressif/esp-idf!36738
2025-02-26 17:03:16 +08:00
Alexey Gerenkov
d0f9dc4b80 Merge branch 'update_usb_jtag_doc_v5.3' into 'release/v5.3'
docs(jtag): add esp32p4 usb jtag pin numbers (v5.3)

See merge request espressif/esp-idf!37242
2025-02-26 16:39:26 +08:00
muhaidong
810a9149e7 feat(phy): add gpio cmd for cert test 2025-02-26 16:04:47 +08:00
morris
53ecffa92f Merge branch 'refactor/gptimer_isr_logs_opt_int_v5.3' into 'release/v5.3'
feat(gptimer): make start and stop function idempotent (v5.3)

See merge request espressif/esp-idf!37249
2025-02-26 15:51:24 +08:00
Jiang Jiang Jian
709c9221e9 Merge branch 'feature/c3_libphy_20250120_v5.3' into 'release/v5.3'
feat(phy): update libphy for RXDC cal opt, no antenna current opt, add cca api(Backport v5.3)

See merge request espressif/esp-idf!37225
2025-02-26 15:05:55 +08:00
Zhao Wei Liang
be9de2b50e feat(ble): add a debug way to retain scene on ESP32-C6
(cherry picked from commit bc299e784cd4ffd08abd2e6727c478bec79a7a14)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-02-26 15:03:37 +08:00
Zhao Wei Liang
bcbaa93cf7 fix(ble): fixed common kconfig error when controller enable only
(cherry picked from commit 5b8ac71ace864a7bb9100a68dc650b8502315411)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-02-26 15:03:34 +08:00
Island
4aa1a3712f Merge branch 'bugfix/fix_ble_report_len_v5.3' into 'release/v5.3'
fix(ble/bluedroid): Fix adv data and scan rsp data not reported together in BLE active scan (v5.3)

See merge request espressif/esp-idf!37202
2025-02-26 14:12:00 +08:00
Chen Jichang
e98ded4e7b refactor(rmt): set group clock prescale dynamically
Closes https://github.com/espressif/esp-idf/issues/14760
2025-02-26 11:22:51 +08:00
zhiweijian
5f389f7270 feat(ble/bluedroid): reduce bluedrois host bin size and disable BLE_HOST_BG_CONNECT_EN 2025-02-25 17:59:11 +08:00
Wang Meng Yang
73d6bd722f Merge branch 'bugfix/fix_hid_reconnect_issue_v5.3' into 'release/v5.3'
feat(bt/bluedroid): Add Kconfig option to keep device bonding info when HID unplugging (v5.3)

See merge request espressif/esp-idf!37182
2025-02-25 17:51:06 +08:00
zhiweijian
27fa98772a feat(ble/bluedroid): disable bluedroid host unused functions 2025-02-25 16:48:38 +08:00
zhiweijian
b0725698e2 feat(bt/bluedroid): optimize bluedroid menuconfig 2025-02-25 16:48:29 +08:00
zhiweijian
386f94a807 feat(bt/bluedroid): delete unused host congest check 2025-02-25 16:48:17 +08:00
Song Ruo Jing
dfa95bfe6e fix(gpio): fix esp_rom_gpio_connect_out_signal for gpio num over 31 on esp32/s2
Closes https://github.com/espressif/esp-idf/issues/15209
2025-02-25 16:23:08 +08:00
morris
509b9d9a54 feat(gptimer): make start and stop function idempotent
Closes https://github.com/espressif/esp-idf/issues/12325
Closes https://github.com/espressif/esp-idf/issues/13486
2025-02-25 11:45:01 +08:00
Erhan Kurubas
9f9ddd246f docs(jtag): add esp32p4 usb jtag pin numbers 2025-02-24 14:44:35 +01:00
muhaidong
42bd89e725 feat(phy): update libphy for RXDC cal opt, no antenna current opt, add cca api 2025-02-24 14:23:35 +08:00
nilesh.kale
a64afccafc feat(app_update): enabled ota resumption support for release/v5.3 2025-02-21 15:28:21 +05:30
Zhang Hai Peng
18973c0c61 fix(ble/bluedroid): Fix adv data and scan rsp data not reported together in BLE active scan
(cherry picked from commit 7f2cedc0488fe30316b7c6a45be1c8933ad36952)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-02-21 16:13:46 +08:00
linruihao
5d8955ebac feat(bt/bluedroid): Add Kconfig option to keep device bonding info when HID unplugging 2025-02-21 11:53:08 +08:00
Tomáš Rohlínek
090c895f00 fix(storage/vfs): incorrect log level in esp_vfs_register_fd_range
Closes https://github.com/espressif/esp-idf/issues/14327
2025-01-22 21:21:40 +08:00
125 changed files with 2267 additions and 1433 deletions

View File

@ -60,7 +60,9 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU for multiarch builds
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v7.0.0-28
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -41,6 +41,7 @@ typedef struct ota_ops_entry_ {
bool need_erase;
uint32_t wrote_size;
uint8_t partial_bytes;
bool ota_resumption;
WORD_ALIGNED_ATTR uint8_t partial_data[16];
LIST_ENTRY(ota_ops_entry_) entries;
} ota_ops_entry_t;
@ -111,6 +112,22 @@ static esp_ota_img_states_t set_new_state_otadata(void)
#endif
}
static ota_ops_entry_t* esp_ota_init_entry(const esp_partition_t *partition)
{
ota_ops_entry_t *new_entry = (ota_ops_entry_t *) calloc(1, sizeof(ota_ops_entry_t));
if (new_entry == NULL) {
return NULL;
}
LIST_INSERT_HEAD(&s_ota_ops_entries_head, new_entry, entries);
new_entry->part = partition;
new_entry->handle = ++s_ota_ops_last_handle;
return new_entry;
}
esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp_ota_handle_t *out_handle)
{
ota_ops_entry_t *new_entry;
@ -144,6 +161,13 @@ esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp
}
#endif
new_entry = esp_ota_init_entry(partition);
if (new_entry == NULL) {
return ESP_ERR_NO_MEM;
}
new_entry->need_erase = (image_size == OTA_WITH_SEQUENTIAL_WRITES);
*out_handle = new_entry->handle;
if (image_size != OTA_WITH_SEQUENTIAL_WRITES) {
// If input image size is 0 or OTA_SIZE_UNKNOWN, erase entire partition
if ((image_size == 0) || (image_size == OTA_SIZE_UNKNOWN)) {
@ -157,16 +181,44 @@ esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp
}
}
new_entry = (ota_ops_entry_t *) calloc(sizeof(ota_ops_entry_t), 1);
return ESP_OK;
}
esp_err_t esp_ota_resume(const esp_partition_t *partition, const size_t erase_size, const size_t image_offset, esp_ota_handle_t *out_handle)
{
ota_ops_entry_t *new_entry;
if ((partition == NULL) || (out_handle == NULL)) {
return ESP_ERR_INVALID_ARG;
}
if (image_offset > partition->size) {
return ESP_ERR_INVALID_ARG;
}
partition = esp_partition_verify(partition);
if (partition == NULL) {
return ESP_ERR_NOT_FOUND;
}
// The staging partition cannot be of type Factory, but the final partition can be.
if (!is_ota_partition(partition)) {
return ESP_ERR_INVALID_ARG;
}
const esp_partition_t* running_partition = esp_ota_get_running_partition();
if (partition == running_partition) {
return ESP_ERR_OTA_PARTITION_CONFLICT;
}
new_entry = esp_ota_init_entry(partition);
if (new_entry == NULL) {
return ESP_ERR_NO_MEM;
}
LIST_INSERT_HEAD(&s_ota_ops_entries_head, new_entry, entries);
new_entry->part = partition;
new_entry->handle = ++s_ota_ops_last_handle;
new_entry->need_erase = (image_size == OTA_WITH_SEQUENTIAL_WRITES);
new_entry->ota_resumption = true;
new_entry->wrote_size = image_offset;
new_entry->need_erase = (erase_size == OTA_WITH_SEQUENTIAL_WRITES);
*out_handle = new_entry->handle;
return ESP_OK;
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -99,6 +99,32 @@ int esp_ota_get_app_elf_sha256(char* dst, size_t size) __attribute__((deprecated
*/
esp_err_t esp_ota_begin(const esp_partition_t* partition, size_t image_size, esp_ota_handle_t* out_handle);
/**
* @brief Resume an interrupted OTA update by continuing to write to the specified partition.
*
* This function is used when an OTA update was previously started and needs to be resumed after an interruption.
* It continues the OTA process from the specified offset within the partition.
*
* Unlike esp_ota_begin(), this function does not erase the partition which receives the OTA update, but rather expects that part of the image
* has already been written correctly, and it resumes writing from the given offset.
*
* @param partition Pointer to info for the partition which is receiving the OTA update. Required.
* @param erase_size Specifies how much flash memory to erase before resuming OTA, depending on whether a sequential write or a bulk erase is being used.
* @param image_offset Offset from where to resume the OTA process. Should be set to the number of bytes already written.
* @param out_handle On success, returns a handle that should be used for subsequent esp_ota_write() and esp_ota_end() calls.
*
* @return
* - ESP_OK: OTA operation resumed successfully.
* - ESP_ERR_INVALID_ARG: partition, out_handle were NULL or image_offset arguments is negative, or partition doesn't point to an OTA app partition.
* - ESP_ERR_NO_MEM: Cannot allocate memory for OTA operation.
* - ESP_ERR_OTA_PARTITION_CONFLICT: Partition holds the currently running firmware, cannot update in place.
* - ESP_ERR_NOT_FOUND: Partition argument not found in partition table.
* - ESP_ERR_OTA_SELECT_INFO_INVALID: The OTA data partition contains invalid data.
* - ESP_ERR_INVALID_SIZE: Partition doesn't fit in configured flash size.
* - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
*/
esp_err_t esp_ota_resume(const esp_partition_t *partition, const size_t erase_size, const size_t image_offset, esp_ota_handle_t *out_handle);
/**
* @brief Write OTA update data to partition
*

View File

@ -872,12 +872,27 @@ if(CONFIG_BT_ENABLED)
endif()
set(bt_priv_requires
nvs_flash
soc
esp_pm
esp_phy
esp_coex
mbedtls
esp_driver_uart
vfs
esp_ringbuf
esp_driver_spi
esp_driver_gpio
esp_gdbstub
)
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES esp_timer esp_wifi
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy esp_coex mbedtls esp_driver_uart vfs esp_ringbuf
esp_driver_spi esp_driver_gpio
PRIV_REQUIRES "${bt_priv_requires}"
LDFRAGMENTS "${ldscripts}")
if(CONFIG_BT_ENABLED)

View File

@ -81,8 +81,6 @@ menu "Bluetooth"
So this option will disable the PMP (ESP_SYSTEM_PMP_IDRAM_SPLIT)
menu "Common Options"
visible if (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED)
source "$IDF_PATH/components/bt/common/Kconfig.in"
endmenu

View File

@ -1,6 +1,7 @@
config BT_ALARM_MAX_NUM
int "Maximum number of Bluetooth alarms"
default 50
depends on (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED)
help
This option decides the maximum number of alarms which
could be used by Bluetooth host.

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -383,6 +383,7 @@ static void btc_deinit_mem(void) {
}
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
if (gl_bta_adv_data_ptr) {
osi_free(gl_bta_adv_data_ptr);
gl_bta_adv_data_ptr = NULL;
@ -392,6 +393,7 @@ static void btc_deinit_mem(void) {
osi_free(gl_bta_scan_rsp_data_ptr);
gl_bta_scan_rsp_data_ptr = NULL;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // BLE_42_FEATURE_SUPPORT
#if GATTS_INCLUDED == TRUE && GATT_DYNAMIC_MEMORY == TRUE
@ -446,6 +448,7 @@ static bt_status_t btc_init_mem(void) {
#if BTC_DYNAMIC_MEMORY == TRUE
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
if ((gl_bta_adv_data_ptr = (tBTA_BLE_ADV_DATA *)osi_malloc(sizeof(tBTA_BLE_ADV_DATA))) == NULL) {
goto error_exit;
}
@ -455,6 +458,7 @@ static bt_status_t btc_init_mem(void) {
goto error_exit;
}
memset((void *)gl_bta_scan_rsp_data_ptr, 0, sizeof(tBTA_BLE_ADV_DATA));
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // (BLE_42_FEATURE_SUPPORT == TRUE)
#endif // BTC_DYNAMIC_MEMORY == TRUE
@ -524,9 +528,6 @@ bt_status_t btc_init(void)
btc_gap_ble_init();
#endif ///BLE_INCLUDED == TRUE
#if SCAN_QUEUE_CONGEST_CHECK
btc_adv_list_init();
#endif
/* TODO: initial the profile_tab */
return BT_STATUS_SUCCESS;
}
@ -542,18 +543,6 @@ void btc_deinit(void)
#if (BLE_INCLUDED == TRUE)
btc_gap_ble_deinit();
#endif ///BLE_INCLUDED == TRUE
#if SCAN_QUEUE_CONGEST_CHECK
btc_adv_list_deinit();
#endif
}
bool btc_check_queue_is_congest(void)
{
if (osi_thread_queue_wait_size(btc_thread, 0) >= BT_QUEUE_CONGEST_SIZE) {
return true;
}
return false;
}
int get_btc_work_queue_size(void)

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -123,8 +123,8 @@ extern "C" {
/**
* transfer an message to another module in the different task.
* @param msg message
* @param arg paramter
* @param arg_len length of paramter
* @param arg parameter
* @param arg_len length of parameter
* @param copy_func deep copy function
* @param free_func deep free function
* @return BT_STATUS_SUCCESS: success
@ -134,7 +134,7 @@ bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg
btc_arg_deep_free_t free_func);
/**
* transfer an message to another module in tha same task.
* transfer an message to another module in the same task.
* @param msg message
* @return BT_STATUS_SUCCESS: success
* others: fail
@ -143,7 +143,6 @@ bt_status_t btc_inter_profile_call(btc_msg_t *msg);
bt_status_t btc_init(void);
void btc_deinit(void);
bool btc_check_queue_is_congest(void);
int get_btc_work_queue_size(void);
/**

View File

@ -76,4 +76,8 @@ void fixed_pkt_queue_unregister_dequeue(fixed_pkt_queue_t *queue);
void fixed_pkt_queue_process(fixed_pkt_queue_t *queue);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -428,6 +428,12 @@ menu "Controller debug features"
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
default n
config BT_LE_DEBUG_REMAIN_SCENE_ENABLED
bool "Remain scene with GDB to capture relevant status info(Experimental)"
default n
help
Retain scene with GDB to capture info, requires disabling WDT (CONFIG_ESP_INT_WDT, CONFIG_ESP_TASK_WDT_EN).
endmenu
config BT_LE_LL_RESOLV_LIST_SIZE

View File

@ -1656,6 +1656,10 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
#include "esp_gdbstub.h"
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
int IRAM_ATTR
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
{
@ -1666,7 +1670,11 @@ ble_capture_info_user_handler(uint8_t type, uint32_t reason)
for (i = 0; i < 2; i++) {
esp_ble_controller_info_capture(0x010101);
}
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
uintptr_t sp;
__asm__ volatile ("mv %0, sp" : "=r" (sp));
esp_gdbstub_panic_handler(&sp);
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
break;
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
case 1:

View File

@ -419,6 +419,12 @@ menu "Controller debug features"
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
default n
config BT_LE_DEBUG_REMAIN_SCENE_ENABLED
bool "Remain scene with GDB to capture relevant status info(Experimental)"
default n
help
Retain scene with GDB to capture info, requires disabling WDT (CONFIG_ESP_INT_WDT, CONFIG_ESP_TASK_WDT_EN).
endmenu
config BT_LE_LL_RESOLV_LIST_SIZE

View File

@ -1633,6 +1633,9 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
#include "esp_gdbstub.h"
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
int IRAM_ATTR
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
@ -1644,7 +1647,11 @@ ble_capture_info_user_handler(uint8_t type, uint32_t reason)
for (i = 0; i < 2; i++) {
esp_ble_controller_info_capture(0x010101);
}
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
uintptr_t sp;
__asm__ volatile ("mv %0, sp" : "=r" (sp));
esp_gdbstub_panic_handler(&sp);
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
break;
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
case 1:

View File

@ -184,6 +184,14 @@ config BT_HID_DEVICE_ENABLED
help
This enables the BT HID Device
config BT_HID_REMOVE_DEVICE_BONDING_ENABLED
bool "Remove Device Bonding Information when HID Virtual Cable Unplugging"
depends on BT_HID_ENABLED
default y
help
This enables the BT HID to remove device bonding information when virtual cable unplugging,
removing device bonding information is optional in HID 1.0 but mandatory in HID 1.1
config BT_BLE_ENABLED
bool "Bluetooth Low Energy"
depends on BT_BLUEDROID_ENABLED
@ -191,7 +199,7 @@ config BT_BLE_ENABLED
help
This enables Bluetooth Low Energy
config BT_GATTS_ENABLE
menuconfig BT_GATTS_ENABLE
bool "Include GATT server module(GATTS)"
depends on BT_BLE_ENABLED
default y
@ -203,8 +211,9 @@ config BT_GATTS_PPCP_CHAR_GAP
depends on BT_GATTS_ENABLE
default n
help
This enables "Peripheral Preferred Connection Parameters" characteristic (UUID: 0x2A04) in GAP service that has
connection parameters like min/max connection interval, slave latency and supervision timeout multiplier
This enables "Peripheral Preferred Connection Parameters" characteristic (UUID: 0x2A04)
in GAP service that has connection parameters like min/max connection interval, slave
latency and supervision timeout multiplier
config BT_BLE_BLUFI_ENABLE
bool "Include blufi function"
@ -280,7 +289,7 @@ config BT_GATTS_APPEARANCE_WRITABLE
help
Enabling this option allows remote GATT clients to write appearance
config BT_GATTC_ENABLE
menuconfig BT_GATTC_ENABLE
bool "Include GATT client module(GATTC)"
depends on BT_BLE_ENABLED
default y
@ -318,7 +327,16 @@ config BT_GATTC_CONNECT_RETRY_COUNT
help
The number of attempts to reconnect if the connection establishment failed
config BT_BLE_SMP_ENABLE
config BT_BLE_ESTAB_LINK_CONN_TOUT
int "Timeout of BLE connection establishment"
depends on BT_GATTC_ENABLE
range 1 60
default 30
help
Bluetooth Connection establishment maximum time, if connection time exceeds this value, the connection
establishment fails, ESP_GATTC_OPEN_EVT or ESP_GATTS_OPEN_EVT is triggered.
menuconfig BT_BLE_SMP_ENABLE
bool "Include BLE security module(SMP)"
depends on BT_BLE_ENABLED
default y
@ -351,6 +369,23 @@ config BT_BLE_SMP_BOND_NVS_FLASH
help
This select can save SMP bonding keys to nvs flash
config BT_BLE_RPA_SUPPORTED
bool "Update RPA to Controller"
depends on (BT_BLE_SMP_ENABLE && ((BT_CONTROLLER_ENABLED && !SOC_BLE_DEVICE_PRIVACY_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
default n if (BT_CONTROLLER_ENABLED && !SOC_BLE_DEVICE_PRIVACY_SUPPORTED)
default y if BT_CONTROLLER_DISABLED
help
This enables controller RPA list function.
For ESP32, ESP32 only support network privacy mode. If this option is enabled, ESP32 will only accept
advertising packets from peer devices that contain private address, HW will not receive the advertising
packets contain identity address after IRK changed. If this option is disabled, address resolution will
be performed in the host, so the functions that require controller to resolve address in the white list
cannot be used. This option is disabled by default on ESP32, please enable or disable this option according
to your own needs.
For other BLE chips, devices support network privacy mode and device privacy mode,
users can switch the two modes according to their own needs. So this option is enabled by default.
config BT_STACK_NO_LOG
bool "Disable BT debug logs (minimize bin size)"
depends on BT_BLUEDROID_ENABLED
@ -1131,15 +1166,6 @@ config BT_BLE_DYNAMIC_ENV_MEMORY
help
This select can make the allocation of memory will become more flexible
config BT_BLE_HOST_QUEUE_CONG_CHECK
bool "BLE queue congestion check"
depends on BT_BLE_ENABLED
default n
help
When scanning and scan duplicate is not enabled, if there are a lot of adv packets around
or application layer handling adv packets is slow, it will cause the controller memory
to run out. if enabled, adv packets will be lost when host queue is congested.
config BT_SMP_ENABLE
bool
depends on BT_BLUEDROID_ENABLED
@ -1164,15 +1190,6 @@ config BT_BLE_ACT_SCAN_REP_ADV_SCAN
# Memory reserved at start of DRAM for Bluetooth stack
config BT_BLE_ESTAB_LINK_CONN_TOUT
int "Timeout of BLE connection establishment"
depends on BT_BLE_ENABLED
range 1 60
default 30
help
Bluetooth Connection establishment maximum time, if connection time exceeds this value, the connection
establishment fails, ESP_GATTC_OPEN_EVT or ESP_GATTS_OPEN_EVT is triggered.
config BT_MAX_DEVICE_NAME_LEN
int "length of bluetooth device name"
depends on BT_BLUEDROID_ENABLED
@ -1183,23 +1200,6 @@ config BT_MAX_DEVICE_NAME_LEN
the complete device name, then only the shortname will be displayed, the rest parts that can't fit in
will be truncated.
config BT_BLE_RPA_SUPPORTED
bool "Update RPA to Controller"
depends on (BT_BLUEDROID_ENABLED && ((BT_CONTROLLER_ENABLED && !SOC_BLE_DEVICE_PRIVACY_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
default n if (BT_CONTROLLER_ENABLED && !SOC_BLE_DEVICE_PRIVACY_SUPPORTED)
default y if BT_CONTROLLER_DISABLED
help
This enables controller RPA list function.
For ESP32, ESP32 only support network privacy mode. If this option is enabled, ESP32 will only accept
advertising packets from peer devices that contain private address, HW will not receive the advertising
packets contain identity address after IRK changed. If this option is disabled, address resolution will
be performed in the host, so the functions that require controller to resolve address in the white list
cannot be used. This option is disabled by default on ESP32, please enable or disable this option according
to your own needs.
For other BLE chips, devices support network privacy mode and device privacy mode,
users can switch the two modes according to their own needs. So this option is enabled by default.
config BT_BLE_RPA_TIMEOUT
int "Timeout of resolvable private address"
depends on BT_BLE_ENABLED
@ -1209,7 +1209,7 @@ config BT_BLE_RPA_TIMEOUT
This set RPA timeout of Controller and Host.
Default is 900 s (15 minutes). Range is 1 s to 1 hour (3600 s).
config BT_BLE_50_FEATURES_SUPPORTED
menuconfig BT_BLE_50_FEATURES_SUPPORTED
bool "Enable BLE 5.0 features(please disable BLE 4.2 if enable BLE 5.0)"
depends on (BT_BLE_ENABLED && ((BT_CONTROLLER_ENABLED && SOC_BLE_50_SUPPORTED) || BT_CONTROLLER_DISABLED))
default y
@ -1218,15 +1218,40 @@ config BT_BLE_50_FEATURES_SUPPORTED
This option is universally supported in chips that support BLE, except for ESP32.
BLE 4.2 and BLE 5.0 cannot be used simultaneously.
config BT_BLE_42_FEATURES_SUPPORTED
bool "Enable BLE 4.2 features(please disable BLE 5.0 if enable BLE 4.2)"
depends on (BT_BLE_ENABLED && ((BT_CONTROLLER_ENABLED && SOC_BLE_50_SUPPORTED) || BT_CONTROLLER_DISABLED))
default n
config BT_BLE_50_EXTEND_ADV_EN
bool "Enable BLE extend advertising"
depends on BT_BLE_50_FEATURES_SUPPORTED
default y
help
This enables BLE 4.2 features.
This option is universally supported by all ESP chips with BLE capabilities.
BLE 4.2 and BLE 5.0 cannot be used simultaneously.
This enables BLE extend advertising
config BT_BLE_50_PERIODIC_ADV_EN
bool "Enable BLE periodic advertising"
depends on BT_BLE_50_FEATURES_SUPPORTED
default y
help
This enables BLE periodic advertising
config BT_BLE_50_EXTEND_SCAN_EN
bool "Enable BLE extend scan"
depends on BT_BLE_50_FEATURES_SUPPORTED
default y
help
This enables BLE extend scan
config BT_BLE_50_EXTEND_SYNC_EN
bool "Enable BLE periodic advertising sync"
depends on BT_BLE_50_FEATURES_SUPPORTED
default y
help
This enables BLE periodic advertising sync
config BT_BLE_50_DTM_TEST_EN
bool "Enable BLE 5.0 DTM test"
depends on BT_BLE_50_FEATURES_SUPPORTED
default y
help
This enables BLE 5.0 direct test mode
config BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER
bool "Enable BLE periodic advertising sync transfer feature"
@ -1249,6 +1274,37 @@ config BT_BLE_FEAT_CREATE_SYNC_ENH
help
Enable the create sync enhancements
menuconfig BT_BLE_42_FEATURES_SUPPORTED
bool "Enable BLE 4.2 features(please disable BLE 5.0 if enable BLE 4.2)"
depends on BT_BLE_ENABLED
default y if IDF_TARGET_ESP32
default n
help
This enables BLE 4.2 features.
This option is universally supported by all ESP chips with BLE capabilities.
BLE 4.2 and BLE 5.0 cannot be used simultaneously.
config BT_BLE_42_DTM_TEST_EN
bool "Enable BLE 4.2 DTM test"
depends on BT_BLE_42_FEATURES_SUPPORTED
default y
help
This enables BLE 4.2 direct test mode
config BT_BLE_42_ADV_EN
bool "Enable BLE 4.2 advertising"
depends on BT_BLE_42_FEATURES_SUPPORTED
default y
help
This enables BLE v4.2 advertising
config BT_BLE_42_SCAN_EN
bool "Enable BLE 4.2 scan"
depends on BT_BLE_42_FEATURES_SUPPORTED
default y
help
This enables BLE v4.2 scan
config BT_BLE_HIGH_DUTY_ADV_INTERVAL
bool "Enable BLE high duty advertising interval feature"
depends on BT_BLE_ENABLED

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -28,6 +28,7 @@ esp_gap_ble_cb_t esp_ble_gap_get_callback(void)
}
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
esp_err_t esp_ble_gap_config_adv_data(esp_ble_adv_data_t *adv_data)
{
btc_msg_t msg = {0};
@ -51,8 +52,9 @@ esp_err_t esp_ble_gap_config_adv_data(esp_ble_adv_data_t *adv_data)
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy,
btc_gap_ble_arg_deep_free)== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
esp_err_t esp_ble_gap_set_scan_params(esp_ble_scan_params_t *scan_params)
{
btc_msg_t msg = {0};
@ -99,7 +101,9 @@ esp_err_t esp_ble_gap_stop_scanning(void)
msg.act = BTC_GAP_BLE_ACT_STOP_SCAN;
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_42_ADV_EN == TRUE)
esp_err_t esp_ble_gap_start_advertising(esp_ble_adv_params_t *adv_params)
{
btc_msg_t msg = {0};
@ -140,6 +144,7 @@ esp_err_t esp_ble_gap_clear_advertising(void)
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
esp_err_t esp_ble_gap_update_conn_params(esp_ble_conn_update_params_t *params)
@ -536,6 +541,7 @@ uint8_t *esp_ble_resolve_adv_data( uint8_t *adv_data, uint8_t type, uint8_t *len
}
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_len)
{
btc_msg_t msg = {0};
@ -557,6 +563,7 @@ esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_l
btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr)
{
@ -933,7 +940,7 @@ esp_err_t esp_gap_ble_set_authorization(esp_bd_addr_t bd_addr, bool authorize)
return ESP_FAIL;
}
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_DTM_TEST_EN == TRUE)
esp_err_t esp_ble_dtm_tx_start(const esp_ble_dtm_tx_t *tx_params)
{
btc_msg_t msg = {0};
@ -973,9 +980,9 @@ esp_err_t esp_ble_dtm_rx_start(const esp_ble_dtm_rx_t *rx_params)
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
esp_err_t esp_ble_dtm_enh_tx_start(const esp_ble_dtm_enh_tx_t *tx_params)
{
btc_msg_t msg = {0};
@ -1015,8 +1022,9 @@ esp_err_t esp_ble_dtm_enh_rx_start(const esp_ble_dtm_enh_rx_t *rx_params)
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
esp_err_t esp_ble_dtm_stop(void)
{
btc_msg_t msg = {0};
@ -1029,6 +1037,7 @@ esp_err_t esp_ble_dtm_stop(void)
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_addr_t addr, esp_ble_privacy_mode_t mode)
{
@ -1125,6 +1134,7 @@ esp_err_t esp_ble_gap_set_preferred_phy(esp_bd_addr_t bd_addr,
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#if (BLE_50_EXTEND_ADV_EN == TRUE)
esp_err_t esp_ble_gap_ext_adv_set_rand_addr(uint8_t instance, esp_bd_addr_t rand_addr)
{
btc_msg_t msg;
@ -1280,7 +1290,9 @@ esp_err_t esp_ble_gap_ext_adv_set_clear(void)
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
esp_err_t esp_ble_gap_periodic_adv_set_params(uint8_t instance, const esp_ble_gap_periodic_adv_params_t *params)
{
btc_msg_t msg;
@ -1375,7 +1387,9 @@ esp_err_t esp_ble_gap_periodic_adv_stop(uint8_t instance)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
esp_err_t esp_ble_gap_periodic_adv_create_sync(const esp_ble_gap_periodic_adv_sync_params_t *params)
{
btc_msg_t msg;
@ -1488,7 +1502,9 @@ esp_err_t esp_ble_gap_periodic_adv_clear_dev(void)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
esp_err_t esp_ble_gap_set_ext_scan_params(const esp_ble_ext_scan_params_t *params)
{
btc_msg_t msg;
@ -1540,6 +1556,7 @@ esp_err_t esp_ble_gap_stop_ext_scan(void)
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
esp_err_t esp_ble_gap_prefer_ext_connect_params_set(esp_bd_addr_t addr,
esp_ble_gap_phy_mask_t phy_mask,

View File

@ -1291,6 +1291,7 @@ typedef union {
struct ble_set_perf_phy_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate perf phy set status */
} set_perf_phy; /*!< Event parameter of ESP_GAP_BLE_SET_PREFERRED_PHY_COMPLETE_EVT */
#if (BLE_50_EXTEND_ADV_EN == TRUE)
/**
* @brief ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT
*/
@ -1349,6 +1350,7 @@ typedef union {
esp_bt_status_t status; /*!< Indicate advertising stop operation success status */
uint8_t instance; /*!< extend advertising handle */
} ext_adv_clear; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_SET_CLEAR_COMPLETE_EVT */
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
/**
* @brief ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT
*/

View File

@ -616,8 +616,10 @@ void bta_dm_disable (tBTA_DM_MSG *p_data)
#endif
#if BLE_INCLUDED == TRUE
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
// btm_ble_multi_adv_init is called when the host is enabled, so btm_ble_multi_adv_cleanup is called when the host is disabled.
btm_ble_multi_adv_cleanup();
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#endif
}
@ -970,7 +972,7 @@ void bta_dm_clear_white_list(tBTA_DM_MSG *p_data)
BTM_BleClearWhitelist(p_data->white_list.update_wl_cb);
#endif
}
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data)
{
#if (BLE_INCLUDED == TRUE)
@ -981,6 +983,7 @@ void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data)
}
#endif ///BLE_INCLUDED == TRUE
}
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
void bta_dm_read_rssi(tBTA_DM_MSG *p_data)
{
@ -991,6 +994,7 @@ void bta_dm_read_rssi(tBTA_DM_MSG *p_data)
}
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_set_visibility
@ -1080,6 +1084,7 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
}
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
@ -1211,6 +1216,7 @@ void bta_dm_add_device (tBTA_DM_MSG *p_data)
}
}
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_close_acl
@ -1256,7 +1262,9 @@ void bta_dm_close_acl(tBTA_DM_MSG *p_data)
/* otherwise, no action needed */
}
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_remove_all_acl
@ -1285,7 +1293,7 @@ void bta_dm_remove_all_acl(tBTA_DM_MSG *p_data)
}
}
}
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
/*******************************************************************************
**
@ -4589,6 +4597,7 @@ void bta_dm_eir_update_uuid(tBT_UUID uuid, BOOLEAN adding)
}
#endif
#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_enable_test_mode
@ -4620,7 +4629,9 @@ void bta_dm_disable_test_mode(tBTA_DM_MSG *p_data)
UNUSED(p_data);
BTM_DeviceReset(NULL);
}
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_execute_callback
@ -4640,6 +4651,7 @@ void bta_dm_execute_callback(tBTA_DM_MSG *p_data)
p_data->exec_cback.p_exec_cback(p_data->exec_cback.p_param);
}
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
/*******************************************************************************
**
@ -5164,6 +5176,7 @@ void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data)
p_data->ble_set_conn_params.slave_latency, p_data->ble_set_conn_params.supervision_tout);
}
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_set_conn_scan_params
@ -5181,7 +5194,9 @@ void bta_dm_ble_set_scan_params(tBTA_DM_MSG *p_data)
p_data->ble_set_scan_params.scan_mode,
p_data->ble_set_scan_params.scan_param_setup_cback);
}
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_set_scan_fil_params
@ -5213,8 +5228,9 @@ void bta_dm_ble_set_scan_fil_params(tBTA_DM_MSG *p_data)
}
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_set_conn_scan_params
@ -5229,6 +5245,8 @@ void bta_dm_ble_set_conn_scan_params (tBTA_DM_MSG *p_data)
BTM_BleSetConnScanParams(p_data->ble_set_conn_scan_params.scan_int,
p_data->ble_set_conn_scan_params.scan_window);
}
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_update_conn_params
@ -5295,6 +5313,7 @@ void bta_dm_ble_clear_rand_address(tBTA_DM_MSG *p_data)
BTM_BleClearRandAddress();
}
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_stop_advertising
@ -5309,10 +5328,11 @@ void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data)
if (p_data->hdr.event != BTA_DM_API_BLE_STOP_ADV_EVT) {
APPL_TRACE_ERROR("Invalid BTA event,can't stop the BLE adverting\n");
}
#if (BLE_42_ADV_EN == TRUE)
btm_ble_stop_adv();
#endif // #if (BLE_42_ADV_EN == TRUE)
}
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
#if BLE_PRIVACY_SPT == TRUE
@ -5344,6 +5364,7 @@ void bta_dm_ble_config_local_icon (tBTA_DM_MSG *p_data)
BTM_BleConfigLocalIcon (p_data->ble_local_icon.icon);
}
#if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_observe
@ -5383,6 +5404,7 @@ void bta_dm_ble_observe (tBTA_DM_MSG *p_data)
}
}
}
#endif // #if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
/*******************************************************************************
**
@ -5428,23 +5450,7 @@ void bta_dm_ble_scan (tBTA_DM_MSG *p_data)
}
}
/*******************************************************************************
**
** Function bta_dm_ble_set_adv_params
**
** Description This function set the adv parameters.
**
** Parameters:
**
*******************************************************************************/
void bta_dm_ble_set_adv_params (tBTA_DM_MSG *p_data)
{
BTM_BleSetAdvParams(p_data->ble_set_adv_params.adv_int_min,
p_data->ble_set_adv_params.adv_int_max,
p_data->ble_set_adv_params.p_dir_bda,
BTA_DM_BLE_ADV_CHNL_MAP);
}
#if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_set_adv_params_all
@ -5482,6 +5488,7 @@ void bta_dm_ble_set_adv_params_all (tBTA_DM_MSG *p_data)
(*p_data->ble_set_adv_params_all.p_start_adv_cback)(status);
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
@ -5499,6 +5506,7 @@ void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data)
p_data->ble_duplicate_exceptional_list.exceptional_list_cb);
}
#if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_set_adv_config
@ -5522,29 +5530,6 @@ void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data)
}
}
/*******************************************************************************
**
** Function bta_dm_ble_set_long_adv
**
** Description This function set the long ADV data
**
** Parameters:
**
*******************************************************************************/
void bta_dm_ble_set_long_adv (tBTA_DM_MSG *p_data)
{
tBTA_STATUS status = BTA_FAILURE;
if (BTM_BleWriteLongAdvData(p_data->ble_set_long_adv_data.adv_data,
p_data->ble_set_long_adv_data.adv_data_len) == BTM_SUCCESS) {
status = BTA_SUCCESS;
}
if (p_data->ble_set_adv_data.p_adv_data_cback) {
(*p_data->ble_set_adv_data.p_adv_data_cback)(status);
}
}
/*******************************************************************************
**
** Function bta_dm_ble_set_adv_config_raw
@ -5568,7 +5553,6 @@ void bta_dm_ble_set_adv_config_raw (tBTA_DM_MSG *p_data)
}
}
/*******************************************************************************
**
** Function bta_dm_ble_set_scan_rsp
@ -5614,7 +5598,7 @@ void bta_dm_ble_set_scan_rsp_raw (tBTA_DM_MSG *p_data)
(*p_data->ble_set_adv_data_raw.p_adv_data_cback)(status);
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_set_data_length
@ -5671,6 +5655,7 @@ void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
}
#if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_broadcast
@ -5696,7 +5681,9 @@ void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data)
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_multi_adv_enb
@ -5804,7 +5791,9 @@ void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data)
p_data->ble_multi_adv_disable.inst_id, p_ref, BTA_FAILURE);
}
}
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#if (BLE_42_DTM_TEST_EN == TRUE)
void bta_dm_ble_gap_dtm_tx_start(tBTA_DM_MSG *p_data)
{
BTM_BleTransmitterTest(p_data->dtm_tx_start.tx_channel, p_data->dtm_tx_start.len_of_data, p_data->dtm_tx_start.pkt_payload, p_data->dtm_tx_start.p_dtm_cmpl_cback);
@ -5814,11 +5803,14 @@ void bta_dm_ble_gap_dtm_rx_start(tBTA_DM_MSG *p_data)
{
BTM_BleReceiverTest(p_data->dtm_rx_start.rx_channel, p_data->dtm_rx_start.p_dtm_cmpl_cback);
}
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data)
{
BTM_BleTestEnd(p_data->dtm_stop.p_dtm_cmpl_cback);
}
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data)
{
@ -5857,7 +5849,8 @@ void bta_dm_ble_gap_set_csa_support(tBTA_DM_MSG *p_data)
BTM_BleSetCsaSupport(p_data->ble_set_csa_support.csa_select, p_data->ble_set_csa_support.p_cback);
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data)
{
BTM_BleEnhancedTransmitterTest(p_data->dtm_enh_tx_start.tx_channel, p_data->dtm_enh_tx_start.len_of_data,
@ -5869,7 +5862,8 @@ void bta_dm_ble_gap_dtm_enhance_rx_start(tBTA_DM_MSG *p_data)
BTM_BleEnhancedReceiverTest(p_data->dtm_enh_rx_start.rx_channel, p_data->dtm_enh_rx_start.phy,
p_data->dtm_enh_rx_start.modulation_index, p_data->dtm_enh_rx_start.p_dtm_cmpl_cback);
}
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
void bta_dm_ble_gap_read_phy(tBTA_DM_MSG *p_data)
{
//tBTM_STATUS btm_status = 0;
@ -5895,6 +5889,7 @@ void bta_dm_ble_gap_set_prefer_phy(tBTA_DM_MSG *p_data)
p_data->ble_set_per_phy.phy_options);
}
#if (BLE_50_EXTEND_ADV_EN == TRUE)
void bta_dm_ble_gap_ext_adv_set_rand_addr(tBTA_DM_MSG *p_data)
{
BTM_BleSetExtendedAdvRandaddr(p_data->ble_set_ext_adv_rand_addr.instance, p_data->ble_set_ext_adv_rand_addr.rand_addr);
@ -5935,7 +5930,9 @@ void bta_dm_ble_gap_ext_adv_set_clear(tBTA_DM_MSG *p_data)
{
BTM_BleExtAdvSetClear();
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
void bta_dm_ble_gap_periodic_adv_set_params(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s, instance = %d", __func__, p_data->ble_set_periodic_adv_params.instance);
@ -5962,7 +5959,9 @@ void bta_dm_ble_gap_periodic_adv_enable(tBTA_DM_MSG *p_data)
BTM_BlePeriodicAdvEnable(p_data->ble_enable_periodic_adv.instance,
p_data->ble_enable_periodic_adv.enable);
}
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
void bta_dm_ble_gap_periodic_adv_create_sync(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
@ -6007,8 +6006,9 @@ void bta_dm_ble_gap_periodic_adv_clear_dev(tBTA_DM_MSG *p_data)
APPL_TRACE_API("%s", __func__);
BTM_BlePeriodicAdvClearDev();
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
void bta_dm_ble_gap_set_ext_scan_params(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
@ -6022,14 +6022,14 @@ void bta_dm_ble_gap_ext_scan(tBTA_DM_MSG *p_data)
BTM_BleExtendedScan(p_data->ble_ext_scan.start, p_data->ble_ext_scan.duration,
p_data->ble_ext_scan.period);
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
void bta_dm_ble_gap_set_prefer_ext_conn_params(tBTA_DM_MSG *p_data)
{
tBTM_EXT_CONN_PARAMS conn_params;
conn_params.phy_mask = p_data->ble_set_per_ext_conn_params.phy_mask;
APPL_TRACE_API("%s, start = %d, duration = %d, period = %d", __func__, p_data->ble_ext_scan.start, p_data->ble_ext_scan.duration,
p_data->ble_ext_scan.period);
APPL_TRACE_API("%s, phy_mask %d", __func__, p_data->ble_set_per_ext_conn_params.phy_mask);
if (conn_params.phy_mask & BTA_PHY_1M_MASK) {
memcpy(&conn_params.phy_1m_conn_params, &p_data->ble_set_per_ext_conn_params.phy_1m_conn_params,
@ -6081,6 +6081,7 @@ void bta_dm_ble_gap_set_periodic_adv_sync_trans_params(tBTA_DM_MSG *p_data)
p_data->ble_set_past_params.params.cte_type);
}
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_setup_storage
@ -6112,7 +6113,9 @@ void bta_dm_ble_setup_storage (tBTA_DM_MSG *p_data)
btm_status);
}
}
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_enable_batch_scan
@ -6170,7 +6173,9 @@ void bta_dm_ble_disable_batch_scan (tBTA_DM_MSG *p_data)
btm_status);
}
}
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_read_scan_reports
@ -6197,7 +6202,9 @@ void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data)
btm_status);
}
}
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_ble_track_advertiser
@ -6230,6 +6237,7 @@ void bta_dm_ble_track_advertiser(tBTA_DM_MSG *p_data)
p_data->ble_track_advert.p_track_adv_cback(&track_adv_data);
}
}
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
/*******************************************************************************
**
@ -6406,6 +6414,7 @@ void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data)
}
#endif
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
/*******************************************************************************
**
** Function bta_ble_enable_scan_cmpl
@ -6453,6 +6462,7 @@ void bta_dm_ble_get_energy_info(tBTA_DM_MSG *p_data)
bta_ble_energy_info_cmpl(0, 0, 0, 0, btm_status);
}
}
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
#ifndef BTA_DM_GATT_CLOSE_DELAY_TOUT

View File

@ -110,7 +110,7 @@ tBTA_STATUS BTA_DisableBluetooth(void)
return BTA_SUCCESS;
}
#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
/*******************************************************************************
**
** Function BTA_EnableTestMode
@ -156,6 +156,7 @@ void BTA_DisableTestMode(void)
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
/*******************************************************************************
**
@ -487,6 +488,7 @@ void BTA_DmClearWhiteList(tBTA_UPDATE_WHITELIST_CBACK *update_wl_cb)
}
}
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb)
{
tBTA_DM_API_READ_ADV_TX_POWER *p_msg;
@ -496,6 +498,8 @@ void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb)
bta_sys_sendmsg(p_msg);
}
}
#endif // BLE_HOST_READ_TX_POWER_EN
#endif ///BLE_INCLUDED == TRUE
void BTA_DmReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb)
@ -510,6 +514,7 @@ void BTA_DmReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB
}
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function BTA_DmSetVisibility
@ -539,6 +544,7 @@ void BTA_DmSetVisibility(tBTA_DM_DISC disc_mode, tBTA_DM_CONN conn_mode, UINT8 p
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
@ -1149,6 +1155,8 @@ tBTA_STATUS BTA_DmRemoveLocalDiRecord(UINT32 handle)
return status;
}
#endif ///SDP_INCLUDED == TRUE
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
/*******************************************************************************
**
** Function bta_dmexecutecallback
@ -1171,6 +1179,7 @@ void bta_dmexecutecallback (tBTA_DM_EXEC_CBACK *p_callback, void *p_param)
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
/*******************************************************************************
**
@ -1381,6 +1390,7 @@ void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr,
#endif
}
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmSetBleConnScanParams
@ -1405,7 +1415,9 @@ void BTA_DmSetBleConnScanParams(UINT32 scan_interval, UINT32 scan_window)
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
/*******************************************************************************
**
** Function BTA_DmSetBleScanParams
@ -1439,8 +1451,9 @@ void BTA_DmSetBleScanParams(tGATT_IF client_if, UINT32 scan_interval,
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmSetBleScanFilterParams
@ -1480,46 +1493,9 @@ void BTA_DmSetBleScanFilterParams(tGATT_IF client_if, UINT32 scan_interval,
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmSetBleAdvParams
**
** Description This function sets the advertising parameters BLE functionality.
** It is to be called when device act in peripheral or broadcaster
** role.
**
**
** Returns void
**
*******************************************************************************/
void BTA_DmSetBleAdvParams (UINT16 adv_int_min, UINT16 adv_int_max,
tBLE_BD_ADDR *p_dir_bda)
{
#if BLE_INCLUDED == TRUE
tBTA_DM_API_BLE_ADV_PARAMS *p_msg;
APPL_TRACE_API ("BTA_DmSetBleAdvParam: %d, %d\n", adv_int_min, adv_int_max);
if ((p_msg = (tBTA_DM_API_BLE_ADV_PARAMS *) osi_malloc(sizeof(tBTA_DM_API_BLE_ADV_PARAMS)
+ sizeof(tBLE_BD_ADDR))) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_ADV_PARAMS) + sizeof(tBLE_BD_ADDR));
p_msg->hdr.event = BTA_DM_API_BLE_ADV_PARAM_EVT;
p_msg->adv_int_min = adv_int_min;
p_msg->adv_int_max = adv_int_max;
if (p_dir_bda != NULL) {
p_msg->p_dir_bda = (tBLE_BD_ADDR *)(p_msg + 1);
memcpy(p_msg->p_dir_bda, p_dir_bda, sizeof(tBLE_BD_ADDR));
}
bta_sys_sendmsg(p_msg);
}
#endif
}
#if (BLE_42_ADV_EN == TRUE)
void BTA_DmSetBleAdvParamsAll (UINT16 adv_int_min, UINT16 adv_int_max,
UINT8 adv_type, tBLE_ADDR_TYPE addr_type_own,
tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP adv_fil_pol,
@ -1553,6 +1529,8 @@ void BTA_DmSetBleAdvParamsAll (UINT16 adv_int_min, UINT16 adv_int_max,
}
#endif
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif ///BLE_INCLUDED == TRUE
@ -1561,6 +1539,7 @@ void BTA_DmSetBleAdvParamsAll (UINT16 adv_int_min, UINT16 adv_int_max,
********************************************************************************/
#if BLE_INCLUDED == TRUE
#if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleSetAdvConfig
@ -1622,35 +1601,6 @@ void BTA_DmBleSetAdvConfigRaw (UINT8 *p_raw_adv, UINT32 raw_adv_len,
}
}
/*******************************************************************************
**
** Function BTA_DmBleSetLongAdv
**
** Description This function is called to set long Advertising data
**
** Parameters adv_data : long advertising data.
** adv_data_len : long advertising data length.
** p_adv_data_cback : set long adv data complete callback.
**
** Returns None
**
*******************************************************************************/
void BTA_DmBleSetLongAdv (UINT8 *adv_data, UINT32 adv_data_len,
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback)
{
tBTA_DM_API_SET_LONG_ADV *p_msg;
if ((p_msg = (tBTA_DM_API_SET_LONG_ADV *)
osi_malloc(sizeof(tBTA_DM_API_SET_LONG_ADV))) != NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_SET_LONG_ADV_EVT;
p_msg->p_adv_data_cback = p_adv_data_cback;
p_msg->adv_data = adv_data;
p_msg->adv_data_len = adv_data_len;
bta_sys_sendmsg(p_msg);
}
}
/*******************************************************************************
**
** Function BTA_DmBleSetScanRsp
@ -1707,6 +1657,7 @@ void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len,
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
@ -1735,7 +1686,7 @@ void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type, BD_ADDR de
bta_sys_sendmsg(p_msg);
}
}
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleSetStorageParams
@ -1776,7 +1727,9 @@ extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max,
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleEnableBatchScan
@ -1835,7 +1788,9 @@ extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value)
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleReadScanReports
@ -1861,7 +1816,9 @@ extern void BTA_DmBleReadScanReports(tBTA_BLE_BATCH_SCAN_MODE scan_type,
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleTrackAdvertiser
@ -1887,6 +1844,7 @@ extern void BTA_DmBleTrackAdvertiser(tBTA_DM_BLE_REF_VALUE ref_value,
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#endif
@ -1894,7 +1852,7 @@ extern void BTA_DmBleTrackAdvertiser(tBTA_DM_BLE_REF_VALUE ref_value,
** BLE ADV data management API
********************************************************************************/
#if BLE_INCLUDED == TRUE
#if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleBroadcast
@ -1948,6 +1906,8 @@ void BTA_DmBleClearAdv (tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback)
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif
/*******************************************************************************
**
@ -2221,6 +2181,7 @@ void BTA_DmBleConfigLocalIcon(uint16_t icon)
}
}
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTA_BleEnableAdvInstance
@ -2354,6 +2315,7 @@ void BTA_BleDisableAdvInstance (UINT8 inst_id) //this function just used fo
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************
**
@ -2536,6 +2498,7 @@ void BTA_DmBleScanFilterSetup(UINT8 action, tBTA_DM_BLE_PF_FILT_INDEX filt_index
#endif
}
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleGetEnergyInfo
@ -2561,6 +2524,7 @@ void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK *p_cmpl_cback)
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
/*******************************************************************************
**
@ -2682,6 +2646,7 @@ void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length, tBTA_S
}
}
#if (BLE_42_DTM_TEST_EN == TRUE)
void BTA_DmBleDtmTxStart(uint8_t tx_channel, uint8_t len_of_data, uint8_t pkt_payload, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
{
tBTA_DM_API_BLE_DTM_TX_START *p_msg;
@ -2711,7 +2676,9 @@ void BTA_DmBleDtmRxStart(uint8_t rx_channel, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
void BTA_DmBleDtmStop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
{
tBTA_DM_API_BLE_DTM_STOP *p_msg;
@ -2724,6 +2691,7 @@ void BTA_DmBleDtmStop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
bta_sys_sendmsg(p_msg);
}
}
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
void BTA_DmBleSetPrivacyMode(uint8_t addr_type, BD_ADDR addr, uint8_t privacy_mode, tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback)
{
@ -2786,6 +2754,7 @@ void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_DM_ENCR
}
#endif ///SMP_INCLUDED == TRUE
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmCloseACL
@ -2817,8 +2786,10 @@ void BTA_DmCloseACL(BD_ADDR bd_addr, BOOLEAN remove_dev, tBTA_TRANSPORT transpor
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
#if BLE_INCLUDED == TRUE
#if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleObserve
@ -2859,7 +2830,9 @@ extern void BTA_DmBleObserve(BOOLEAN start, UINT32 duration,
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleScan
@ -2900,7 +2873,9 @@ extern void BTA_DmBleScan(BOOLEAN start, UINT32 duration,
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleStopAdvertising
@ -2925,7 +2900,7 @@ extern void BTA_DmBleStopAdvertising(void)
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
/*******************************************************************************
**
@ -3141,7 +3116,7 @@ void BTA_DmBleGapSetPreferedPHY(BD_ADDR addr,
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
#if (BLE_50_EXTEND_ADV_EN == TRUE)
void BTA_DmBleGapExtAdvSetRandaddr(UINT16 instance, BD_ADDR addr)
{
tBTA_DM_API_EXT_ADV_SET_RAND_ADDR *p_msg;
@ -3247,7 +3222,9 @@ void BTA_DmBleGapExtAdvSetClear(void)
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
void BTA_DmBleGapPeriodicAdvSetParams(UINT8 instance,
tBTA_DM_BLE_Periodic_Adv_Params *params)
{
@ -3304,7 +3281,9 @@ void BTA_DmBleGapPeriodicAdvEnable(UINT8 enable, UINT8 instance)
}
}
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
void BTA_DmBleGapPeriodicAdvCreateSync(tBTA_DM_BLE_Periodic_Sync_Params *params)
{
tBTA_DM_API_PERIODIC_ADV_SYNC *p_msg;
@ -3406,7 +3385,9 @@ void BTA_DmBleGapPeriodicAdvClearDev(void)
}
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
void BTA_DmBleGapSetExtScanParams(tBTA_DM_BLE_EXT_SCAN_PARAMS *params)
{
tBTA_DM_API_SET_EXT_SCAN_PARAMS *p_msg;
@ -3440,6 +3421,7 @@ void BTA_DmBleGapExtScan(BOOLEAN start, UINT32 duration, UINT16 period)
}
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
void BTA_DmBleGapPreferExtConnectParamsSet(BD_ADDR bd_addr,
UINT8 phy_mask,
@ -3493,7 +3475,9 @@ void BTA_DmBleGapExtConnect(tBLE_ADDR_TYPE own_addr_type, const BD_ADDR peer_add
}
}
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
void BTA_DmBleDtmEnhTxStart(uint8_t tx_channel, uint8_t len_of_data, uint8_t pkt_payload, uint8_t phy, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
{
tBTA_DM_API_BLE_DTM_ENH_TX_START *p_msg;
@ -3526,8 +3510,7 @@ void BTA_DmBleDtmEnhRxStart(uint8_t rx_channel, uint8_t phy, uint8_t modulation_
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
void BTA_DmBleGapPeriodicAdvRecvEnable(UINT16 sync_handle, UINT8 enable)

View File

@ -76,15 +76,18 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
bta_dm_set_min_enc_key_size, /* BTA_DM_API_SET_MIN_ENC_KEY_SIZE_EVT */
#endif
#endif
bta_dm_set_afh_channels, /* BTA_DM_API_SET_AFH_CHANNELS_EVT */
#if (SDP_INCLUDED == TRUE)
bta_dm_read_rmt_name, /* BTA_DM_API_GET_REMOTE_NAME_EVT*/
#endif
bta_dm_set_visibility, /* BTA_DM_API_SET_VISIBILITY_EVT */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
bta_dm_acl_change, /* BTA_DM_ACL_CHANGE_EVT */
bta_dm_add_device, /* BTA_DM_API_ADD_DEVICE_EVT */
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
bta_dm_close_acl, /* BTA_DM_API_REMOVE_ACL_EVT */
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
#if (SMP_INCLUDED == TRUE)
/* security API events */
bta_dm_bond, /* BTA_DM_API_BOND_EVT */
@ -130,11 +133,21 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
#endif ///SMP_INCLUDED == TRUE
bta_dm_ble_set_bg_conn_type,
bta_dm_ble_set_conn_params, /* BTA_DM_API_BLE_CONN_PARAM_EVT */
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
bta_dm_ble_set_conn_scan_params, /* BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT */
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
bta_dm_ble_set_scan_params, /* BTA_DM_API_BLE_SCAN_PARAM_EVT */
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
bta_dm_ble_set_scan_fil_params, /* BTA_DM_API_BLE_SCAN_FIL_PARAM_EVT */
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
bta_dm_ble_observe, /* BTA_DM_API_BLE_OBSERVE_EVT */
#endif // #if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
bta_dm_ble_scan, /* BTA_DM_API_BLE_SCAN_EVT */
#endif // #if (BLE_42_SCAN_EN == TRUE)
bta_dm_ble_update_conn_params, /* BTA_DM_API_UPDATE_CONN_PARAM_EVT */
/* This handler function added by
Yulong at 2016/9/9 to support the
@ -145,12 +158,14 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
Yulong at 2016/10/19 to support
stop the ble advertising setting
by the APP */
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
bta_dm_ble_stop_advertising, /* BTA_DM_API_BLE_STOP_ADV_EVT */
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
#if BLE_PRIVACY_SPT == TRUE
bta_dm_ble_config_local_privacy, /* BTA_DM_API_LOCAL_PRIVACY_EVT */
#endif
bta_dm_ble_config_local_icon, /* BTA_DM_API_LOCAL_ICON_EVT */
bta_dm_ble_set_adv_params, /* BTA_DM_API_BLE_ADV_PARAM_EVT */
#if (BLE_42_ADV_EN == TRUE)
bta_dm_ble_set_adv_params_all, /* BTA_DM_API_BLE_ADV_PARAM_All_EVT */
bta_dm_ble_set_adv_config, /* BTA_DM_API_BLE_SET_ADV_CONFIG_EVT */
/* New function to allow set raw adv
@ -161,36 +176,54 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
response data to HCI */
bta_dm_ble_set_scan_rsp_raw, /* BTA_DM_API_BLE_SET_SCAN_RSP_RAW_EVT */
bta_dm_ble_broadcast, /* BTA_DM_API_BLE_BROADCAST_EVT */
#endif // #if (BLE_42_ADV_EN == TRUE)
bta_dm_ble_set_data_length, /* BTA_DM_API_SET_DATA_LENGTH_EVT */
bta_dm_ble_set_long_adv, /* BTA_DM_API_BLE_SET_LONG_ADV_EVT */
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
bta_dm_cfg_filter_cond, /* BTA_DM_API_CFG_FILTER_COND_EVT */
bta_dm_scan_filter_param_setup, /* BTA_DM_API_SCAN_FILTER_SETUP_EVT */
bta_dm_enable_scan_filter, /* BTA_DM_API_SCAN_FILTER_ENABLE_EVT */
#endif
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
bta_dm_ble_multi_adv_enb, /* BTA_DM_API_BLE_MULTI_ADV_ENB_EVT */
bta_dm_ble_multi_adv_upd_param, /* BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT */
bta_dm_ble_multi_adv_data, /* BTA_DM_API_BLE_MULTI_ADV_DATA_EVT */
btm_dm_ble_multi_adv_disable, /* BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT */
#endif // BLE_HOST_BLE_MULTI_ADV_EN
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
bta_dm_ble_setup_storage, /* BTA_DM_API_BLE_SETUP_STORAGE_EVT */
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
bta_dm_ble_enable_batch_scan, /* BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT */
bta_dm_ble_disable_batch_scan, /* BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT */
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
bta_dm_ble_read_scan_reports, /* BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT */
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
bta_dm_ble_track_advertiser, /* BTA_DM_API_BLE_TRACK_ADVERTISER_EVT */
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
bta_dm_ble_get_energy_info, /* BTA_DM_API_BLE_ENERGY_INFO_EVT */
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
bta_dm_ble_disconnect, /* BTA_DM_API_BLE_DISCONNECT_EVT */
#endif
#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
bta_dm_enable_test_mode, /* BTA_DM_API_ENABLE_TEST_MODE_EVT */
bta_dm_disable_test_mode, /* BTA_DM_API_DISABLE_TEST_MODE_EVT */
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
bta_dm_execute_callback, /* BTA_DM_API_EXECUTE_CBACK_EVT */
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
bta_dm_remove_all_acl, /* BTA_DM_API_REMOVE_ALL_ACL_EVT */
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
bta_dm_remove_device, /* BTA_DM_API_REMOVE_DEVICE_EVT */
bta_dm_ble_set_channels, /* BTA_DM_API_BLE_SET_CHANNELS_EVT */
bta_dm_update_white_list, /* BTA_DM_API_UPDATE_WHITE_LIST_EVT */
bta_dm_clear_white_list, /* BTA_DM_API_CLEAR_WHITE_LIST_EVT */
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
bta_dm_ble_read_adv_tx_power, /* BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT */
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
bta_dm_read_rssi, /* BTA_DM_API_READ_RSSI_EVT */
#if BLE_INCLUDED == TRUE
bta_dm_ble_update_duplicate_exceptional_list,/* BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT */
@ -199,28 +232,38 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
bta_dm_ble_gap_read_phy, /* BTA_DM_API_READ_PHY_EVT */
bta_dm_ble_gap_set_prefer_default_phy, /* BTA_DM_API_SET_PER_DEF_PHY_EVT */
bta_dm_ble_gap_set_prefer_phy, /* BTA_DM_API_SET_PER_PHY_EVT */
#if (BLE_50_EXTEND_ADV_EN == TRUE)
bta_dm_ble_gap_ext_adv_set_rand_addr, /* BTA_DM_API_SET_EXT_ADV_RAND_ADDR_EVT */
bta_dm_ble_gap_ext_adv_set_params, /* BTA_DM_API_SET_EXT_ADV_PARAMS_EVT */
bta_dm_ble_gap_config_ext_adv_data_raw, /* BTA_DM_API_CFG_ADV_DATA_RAW_EVT */
bta_dm_ble_gap_start_ext_adv, /* BTA_DM_API_EXT_ADV_ENABLE_EVT */
bta_dm_ble_gap_ext_adv_set_remove, /* BTA_DM_API_EXT_ADV_SET_REMOVE_EVT */
bta_dm_ble_gap_ext_adv_set_clear, /* BTA_DM_API_EXT_ADV_SET_CLEAR_EVT */
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
bta_dm_ble_gap_periodic_adv_set_params, /* BTA_DM_API_PERIODIC_ADV_SET_PARAMS_EVT */
bta_dm_ble_gap_periodic_adv_cfg_data_raw, /* BTA_DM_API_PERIODIC_ADV_CFG_DATA_EVT */
bta_dm_ble_gap_periodic_adv_enable, /* BTA_DM_API_PERIODIC_ADV_ENABLE_EVT */
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
bta_dm_ble_gap_periodic_adv_create_sync, /* BTA_DM_API_PERIODIC_ADV_SYNC_EVT */
bta_dm_ble_gap_periodic_adv_sync_cancel, /* BTA_DM_API_PERIODIC_ADV_SYNC_CANCEL_EVT */
bta_dm_ble_gap_periodic_adv_sync_terminate, /* BTA_DM_API_PERIODIC_ADV_SYNC_TERMINATE_EVT */
bta_dm_ble_gap_periodic_adv_add_dev_to_list, /* BTA_DM_API_PERIODIC_ADV_ADD_DEV_TO_LSIT_EVT */
bta_dm_ble_gap_periodic_adv_remove_dev_from_list, /* BTA_DM_API_PERIODIC_ADV_REMOVE_DEV_FROM_LSIT_EVT */
bta_dm_ble_gap_periodic_adv_clear_dev, /* BTA_DM_API_PERIODIC_ADV_CLEAR_DEV_EVT */
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
bta_dm_ble_gap_set_ext_scan_params, /* BTA_DM_API_SET_EXT_SCAN_PARAMS_EVT */
bta_dm_ble_gap_ext_scan, /* BTA_DM_API_START_EXT_SCAN_EVT */
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
bta_dm_ble_gap_set_prefer_ext_conn_params, /* BTA_DM_API_SET_PERF_EXT_CONN_PARAMS_EVT */
NULL, /* BTA_DM_API_EXT_CONN_EVT */
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
bta_dm_ble_gap_dtm_enhance_tx_start, /* BTA_DM_API_DTM_ENH_TX_START_EVT */
bta_dm_ble_gap_dtm_enhance_rx_start, /* BTA_DM_API_DTM_ENH_RX_START_EVT */
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
bta_dm_ble_gap_periodic_adv_recv_enable, /* BTA_DM_API_PERIODIC_ADV_RECV_ENABLE_EVT */
bta_dm_ble_gap_periodic_adv_sync_trans, /* BTA_DM_API_PERIODIC_ADV_SYNC_TRANS_EVT */
@ -228,10 +271,16 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
bta_dm_ble_gap_set_periodic_adv_sync_trans_params, /* BTA_DM_API_SET_PERIODIC_ADV_SYNC_TRANS_PARAMS_EVT */
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if BLE_INCLUDED == TRUE
#if (BLE_42_DTM_TEST_EN == TRUE)
bta_dm_ble_gap_dtm_tx_start, /* BTA_DM_API_DTM_TX_START_EVT */
bta_dm_ble_gap_dtm_rx_start, /* BTA_DM_API_DTM_RX_START_EVT */
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
bta_dm_ble_gap_dtm_stop, /* BTA_DM_API_DTM_STOP_EVT */
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
#if (BLE_42_ADV_EN == TRUE)
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
#endif // #if (BLE_42_ADV_EN == TRUE)
bta_dm_ble_gap_set_rpa_timeout, /* BTA_DM_API_SET_RPA_TIMEOUT_EVT */
bta_dm_ble_gap_add_dev_to_resolving_list, /* BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT */
bta_dm_ble_gap_set_privacy_mode, /* BTA_DM_API_SET_PRIVACY_MODE_EVT */

View File

@ -65,17 +65,19 @@ enum {
BTA_DM_API_SET_ACL_PKT_TYPES_EVT,
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
BTA_DM_API_SET_MIN_ENC_KEY_SIZE_EVT,
#endif
#endif
BTA_DM_API_SET_AFH_CHANNELS_EVT,
#if (SDP_INCLUDED == TRUE)
BTA_DM_API_GET_REMOTE_NAME_EVT,
#endif
BTA_DM_API_SET_VISIBILITY_EVT,
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
BTA_DM_ACL_CHANGE_EVT,
BTA_DM_API_ADD_DEVICE_EVT,
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
BTA_DM_API_REMOVE_ACL_EVT,
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
#if (SMP_INCLUDED == TRUE)
/* security API events */
BTA_DM_API_BOND_EVT,
@ -121,13 +123,23 @@ enum {
#endif ///SMP_INCLUDED == TRUE
BTA_DM_API_BLE_SET_BG_CONN_TYPE,
BTA_DM_API_BLE_CONN_PARAM_EVT,
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT,
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
BTA_DM_API_BLE_SCAN_PARAM_EVT,
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
/*******This event added by Yulong at 2016/10/25 to
support the scan filter setting for the APP******/
#if (BLE_42_SCAN_EN == TRUE)
BTA_DM_API_BLE_SCAN_FIL_PARAM_EVT,
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
BTA_DM_API_BLE_OBSERVE_EVT,
#endif // #if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
BTA_DM_API_BLE_SCAN_EVT,
#endif // #if (BLE_42_SCAN_EN == TRUE)
BTA_DM_API_UPDATE_CONN_PARAM_EVT,
/*******This event added by Yulong at 2016/9/9 to
support the random address setting for the APP******/
@ -135,15 +147,17 @@ enum {
BTA_DM_API_CLEAR_RAND_ADDR_EVT,
/*******This event added by Yulong at 2016/10/19 to
support stop the ble advertising setting by the APP******/
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
BTA_DM_API_BLE_STOP_ADV_EVT,
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
#if BLE_PRIVACY_SPT == TRUE
BTA_DM_API_LOCAL_PRIVACY_EVT,
#endif
BTA_DM_API_LOCAL_ICON_EVT,
BTA_DM_API_BLE_ADV_PARAM_EVT,
/*******This event added by Yulong at 2016/10/20 to
support setting the ble advertising param by the APP******/
#if (BLE_42_ADV_EN == TRUE)
BTA_DM_API_BLE_ADV_PARAM_All_EVT,
BTA_DM_API_BLE_SET_ADV_CONFIG_EVT,
/* Add for set raw advertising data */
@ -152,36 +166,55 @@ enum {
/* Add for set raw scan response data */
BTA_DM_API_BLE_SET_SCAN_RSP_RAW_EVT,
BTA_DM_API_BLE_BROADCAST_EVT,
#endif // #if (BLE_42_ADV_EN == TRUE)
BTA_DM_API_SET_DATA_LENGTH_EVT,
BTA_DM_API_BLE_SET_LONG_ADV_EVT,
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
BTA_DM_API_CFG_FILTER_COND_EVT,
BTA_DM_API_SCAN_FILTER_SETUP_EVT,
BTA_DM_API_SCAN_FILTER_ENABLE_EVT,
#endif
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
BTA_DM_API_BLE_MULTI_ADV_ENB_EVT,
BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT,
BTA_DM_API_BLE_MULTI_ADV_DATA_EVT,
BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT,
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
BTA_DM_API_BLE_SETUP_STORAGE_EVT,
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT,
BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT,
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT,
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
BTA_DM_API_BLE_TRACK_ADVERTISER_EVT,
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
BTA_DM_API_BLE_ENERGY_INFO_EVT,
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
BTA_DM_API_BLE_DISCONNECT_EVT,
#endif
#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
BTA_DM_API_ENABLE_TEST_MODE_EVT,
BTA_DM_API_DISABLE_TEST_MODE_EVT,
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
BTA_DM_API_EXECUTE_CBACK_EVT,
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
BTA_DM_API_REMOVE_ALL_ACL_EVT,
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
BTA_DM_API_REMOVE_DEVICE_EVT,
BTA_DM_API_BLE_SET_CHANNELS_EVT,
BTA_DM_API_UPDATE_WHITE_LIST_EVT,
BTA_DM_API_CLEAR_WHITE_LIST_EVT,
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT,
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
BTA_DM_API_READ_RSSI_EVT,
#if BLE_INCLUDED == TRUE
BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT,
@ -190,28 +223,38 @@ enum {
BTA_DM_API_READ_PHY_EVT,
BTA_DM_API_SET_PER_DEF_PHY_EVT,
BTA_DM_API_SET_PER_PHY_EVT,
#if (BLE_50_EXTEND_ADV_EN == TRUE)
BTA_DM_API_SET_EXT_ADV_RAND_ADDR_EVT,
BTA_DM_API_SET_EXT_ADV_PARAMS_EVT,
BTA_DM_API_CFG_ADV_DATA_RAW_EVT,
BTA_DM_API_EXT_ADV_ENABLE_EVT,
BTA_DM_API_EXT_ADV_SET_REMOVE_EVT,
BTA_DM_API_EXT_ADV_SET_CLEAR_EVT,
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
BTA_DM_API_PERIODIC_ADV_SET_PARAMS_EVT,
BTA_DM_API_PERIODIC_ADV_CFG_DATA_EVT,
BTA_DM_API_PERIODIC_ADV_ENABLE_EVT,
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
BTA_DM_API_PERIODIC_ADV_SYNC_EVT,
BTA_DM_API_PERIODIC_ADV_SYNC_CANCEL_EVT,
BTA_DM_API_PERIODIC_ADV_SYNC_TERMINATE_EVT,
BTA_DM_API_PERIODIC_ADV_ADD_DEV_TO_LSIT_EVT,
BTA_DM_API_PERIODIC_ADV_REMOVE_DEV_FROM_LSIT_EVT,
BTA_DM_API_PERIODIC_ADV_CLEAR_DEV_EVT,
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
BTA_DM_API_SET_EXT_SCAN_PARAMS_EVT,
BTA_DM_API_START_EXT_SCAN_EVT,
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
BTA_DM_API_SET_PERF_EXT_CONN_PARAMS_EVT,
BTA_DM_API_EXT_CONN_EVT,
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
BTA_DM_API_DTM_ENH_TX_START_EVT,
BTA_DM_API_DTM_ENH_RX_START_EVT,
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
BTA_DM_API_PERIODIC_ADV_RECV_ENABLE_EVT,
BTA_DM_API_PERIODIC_ADV_SYNC_TRANS_EVT,
@ -219,10 +262,16 @@ enum {
BTA_DM_API_SET_PERIODIC_ADV_SYNC_TRANS_PARAMS_EVT,
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if BLE_INCLUDED == TRUE
#if (BLE_42_DTM_TEST_EN == TRUE)
BTA_DM_API_DTM_TX_START_EVT,
BTA_DM_API_DTM_RX_START_EVT,
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
BTA_DM_API_DTM_STOP_EVT,
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
#if (BLE_42_ADV_EN == TRUE)
BTA_DM_API_BLE_CLEAR_ADV_EVT,
#endif // #if (BLE_42_ADV_EN == TRUE)
BTA_DM_API_SET_RPA_TIMEOUT_EVT,
BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT,
BTA_DM_API_SET_PRIVACY_MODE_EVT,
@ -368,10 +417,13 @@ typedef struct {
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *exceptional_list_cb;
}tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST;
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
typedef struct {
BT_HDR hdr;
tBTA_CMPL_CB *read_tx_power_cb;
}tBTA_DM_API_READ_ADV_TX_POWER;
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
#endif ///BLE_INCLUDED == TRUE
typedef struct {
@ -627,12 +679,14 @@ typedef struct {
UINT8 transport;
} tBTA_DM_API_REMOVE_DEVICE;
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
/* data type for BTA_DM_API_EXECUTE_CBACK_EVT */
typedef struct {
BT_HDR hdr;
void *p_param;
tBTA_DM_EXEC_CBACK *p_exec_cback;
} tBTA_DM_API_EXECUTE_CBACK;
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
/* data type for tBTA_DM_API_SET_ENCRYPTION */
typedef struct {
@ -738,13 +792,14 @@ typedef struct {
tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback;
} tBTA_DM_API_BLE_SCAN_FILTER_PARAMS;
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
/* set scan parameter for BLE connections */
typedef struct {
BT_HDR hdr;
UINT16 scan_int;
UINT16 scan_window;
} tBTA_DM_API_BLE_CONN_SCAN_PARAMS;
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
/* Data type for start/stop observe */
typedef struct {
@ -802,14 +857,6 @@ typedef struct {
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback; // Callback function pointer
} tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST;
/* set adv parameter for BLE advertising */
typedef struct {
BT_HDR hdr;
UINT16 adv_int_min;
UINT16 adv_int_max;
tBLE_BD_ADDR *p_dir_bda;
} tBTA_DM_API_BLE_ADV_PARAMS;
/* set adv parameter for BLE advertising */
typedef struct {
BT_HDR hdr;
@ -830,6 +877,7 @@ typedef struct {
} tBTA_DM_API_BLE_FEATURE;
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/* multi adv data structure */
typedef struct {
BT_HDR hdr;
@ -856,6 +904,7 @@ typedef struct {
BT_HDR hdr;
UINT8 inst_id;
} tBTA_DM_API_BLE_MULTI_ADV_DISABLE;
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
typedef struct {
BT_HDR hdr;
@ -873,13 +922,7 @@ typedef struct {
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback;
} tBTA_DM_API_SET_ADV_CONFIG_RAW;
typedef struct {
BT_HDR hdr;
UINT8 *adv_data;
UINT8 adv_data_len;
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback;
} tBTA_DM_API_SET_LONG_ADV;
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
typedef struct {
BT_HDR hdr;
UINT8 batch_scan_full_max;
@ -890,7 +933,9 @@ typedef struct {
tBTA_BLE_SCAN_REP_CBACK *p_read_rep_cback;
tBTA_DM_BLE_REF_VALUE ref_value;
} tBTA_DM_API_SET_STORAGE_CONFIG;
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
typedef struct {
BT_HDR hdr;
tBTA_BLE_BATCH_SCAN_MODE scan_mode;
@ -905,29 +950,37 @@ typedef struct {
BT_HDR hdr;
tBTA_DM_BLE_REF_VALUE ref_value;
} tBTA_DM_API_DISABLE_SCAN;
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
typedef struct {
BT_HDR hdr;
tBTA_BLE_BATCH_SCAN_MODE scan_type;
tBTA_DM_BLE_REF_VALUE ref_value;
} tBTA_DM_API_READ_SCAN_REPORTS;
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
typedef struct {
BT_HDR hdr;
tBTA_DM_BLE_REF_VALUE ref_value;
tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback;
} tBTA_DM_API_TRACK_ADVERTISER;
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
typedef struct {
BT_HDR hdr;
tBTA_BLE_ENERGY_INFO_CBACK *p_energy_info_cback;
} tBTA_DM_API_ENERGY_INFO;
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
typedef struct {
BT_HDR hdr;
BD_ADDR remote_bda;
} tBTA_DM_API_BLE_DISCONNECT;
#if (BLE_42_DTM_TEST_EN == TRUE)
typedef struct {
BT_HDR hdr;
UINT8 tx_channel;
@ -941,6 +994,7 @@ typedef struct {
UINT8 rx_channel;
tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback;
} tBTA_DM_API_BLE_DTM_RX_START;
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
typedef struct {
BT_HDR hdr;
@ -968,6 +1022,7 @@ typedef struct {
#endif /* BLE_INCLUDED */
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
/* data type for BTA_DM_API_REMOVE_ACL_EVT */
typedef struct {
BT_HDR hdr;
@ -976,13 +1031,17 @@ typedef struct {
tBTA_TRANSPORT transport;
} tBTA_DM_API_REMOVE_ACL;
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
/* data type for BTA_DM_API_REMOVE_ALL_ACL_EVT */
typedef struct {
BT_HDR hdr;
tBTA_DM_LINK_TYPE link_type;
} tBTA_DM_API_REMOVE_ALL_ACL;
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
typedef struct {
BT_HDR hdr;
BD_ADDR bd_addr;
@ -1020,8 +1079,8 @@ typedef struct {
tBTA_DM_BLE_REF_VALUE ref_value;
} tBTA_DM_API_SCAN_FILTER_PARAM_SETUP;
#endif
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
typedef struct {
BT_HDR hdr;
UINT8 tx_channel;
@ -1037,7 +1096,9 @@ typedef struct {
UINT8 modulation_index;
tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback;
} tBTA_DM_API_BLE_DTM_ENH_RX_START;
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#define BTA_PHY_1M_MASK (1 << 0)
#define BTA_PHY_2M_MASK (1 << 1)
#define BTA_PHY_CODED_MASK (1 << 2)
@ -1234,7 +1295,9 @@ typedef union {
#if (BLE_INCLUDED == TRUE)
tBTA_DM_API_BLE_SET_CHANNELS ble_set_channels;
tBTA_DM_API_UPDATE_WHITE_LIST white_list;
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
tBTA_DM_API_READ_ADV_TX_POWER read_tx_power;
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
#endif ///BLE_INCLUDED == TRUE
tBTA_DM_API_READ_RSSI rssi;
@ -1285,9 +1348,9 @@ typedef union {
#endif /* #if (BTA_DM_QOS_INCLUDED == TRUE) */
tBTA_DM_API_DI_DISC di_disc;
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
tBTA_DM_API_EXECUTE_CBACK exec_cback;
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
tBTA_DM_API_SET_ENCRYPTION set_encryption;
#if BLE_INCLUDED == TRUE
@ -1298,19 +1361,21 @@ typedef union {
tBTA_DM_API_BLE_SEC_GRANT ble_sec_grant;
tBTA_DM_API_BLE_SET_BG_CONN_TYPE ble_set_bd_conn_type;
tBTA_DM_API_BLE_CONN_PARAMS ble_set_conn_params;
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
tBTA_DM_API_BLE_CONN_SCAN_PARAMS ble_set_conn_scan_params;
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
tBTA_DM_API_BLE_SCAN_PARAMS ble_set_scan_params;
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
tBTA_DM_API_BLE_SCAN_FILTER_PARAMS ble_set_scan_fil_params;
tBTA_DM_API_BLE_OBSERVE ble_observe;
tBTA_DM_API_BLE_SCAN ble_scan;
tBTA_DM_API_ENABLE_PRIVACY ble_remote_privacy;
tBTA_DM_API_LOCAL_PRIVACY ble_local_privacy;
tBTA_DM_API_LOCAL_ICON ble_local_icon;
tBTA_DM_API_BLE_ADV_PARAMS ble_set_adv_params;
tBTA_DM_API_BLE_ADV_PARAMS_ALL ble_set_adv_params_all;
tBTA_DM_API_SET_ADV_CONFIG ble_set_adv_data;
tBTA_DM_API_SET_ADV_CONFIG_RAW ble_set_adv_data_raw;
tBTA_DM_API_SET_LONG_ADV ble_set_long_adv_data;
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
tBTA_DM_API_SCAN_FILTER_PARAM_SETUP ble_scan_filt_param_setup;
tBTA_DM_API_CFG_FILTER_COND ble_cfg_filter_cond;
@ -1322,61 +1387,89 @@ typedef union {
tBTA_DM_APT_CLEAR_ADDR clear_addr;
tBTA_DM_API_SET_RPA_TIMEOUT set_rpa_timeout;
tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST add_dev_to_resolving_list;
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
tBTA_DM_API_BLE_MULTI_ADV_ENB ble_multi_adv_enb;
tBTA_DM_API_BLE_MULTI_ADV_PARAM ble_multi_adv_param;
tBTA_DM_API_BLE_MULTI_ADV_DATA ble_multi_adv_data;
tBTA_DM_API_BLE_MULTI_ADV_DISABLE ble_multi_adv_disable;
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
tBTA_DM_API_SET_STORAGE_CONFIG ble_set_storage;
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
tBTA_DM_API_ENABLE_SCAN ble_enable_scan;
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
tBTA_DM_API_READ_SCAN_REPORTS ble_read_reports;
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
tBTA_DM_API_DISABLE_SCAN ble_disable_scan;
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
tBTA_DM_API_TRACK_ADVERTISER ble_track_advert;
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
tBTA_DM_API_ENERGY_INFO ble_energy_info;
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
tBTA_DM_API_BLE_DISCONNECT ble_disconnect;
tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST ble_duplicate_exceptional_list;
#if (BLE_50_FEATURE_SUPPORT == TRUE)
tBTA_DM_API_READ_PHY ble_read_phy;
tBTA_DM_API_SET_PER_DEF_PHY ble_set_per_def_phy;
tBTA_DM_API_SET_PER_PHY ble_set_per_phy;
#if (BLE_50_EXTEND_ADV_EN == TRUE)
tBTA_DM_API_EXT_ADV_SET_RAND_ADDR ble_set_ext_adv_rand_addr;
tBTA_DM_API_EXT_ADV_SET_PARAMS ble_set_ext_adv_params;
tBTA_DM_API_CFG_EXT_ADV_DATA ble_cfg_ext_adv_data;
tBTA_DM_API_BLE_EXT_ADV ble_start_ext_adv;
tBTA_DM_API_BLE_EXT_ADV_SET_REMOVE ble_ext_adv_set_remove;
tBTA_DM_API_BLE_EXT_ADV_SET_CLEAR ble_ext_adv_set_clear;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
tBTA_DM_API_BLE_PERIODIC_ADV_SET_PARAMS ble_set_periodic_adv_params;
tBTA_DM_API_CFG_PERIODIC_ADV_DATA ble_cfg_periodic_adv_data;
tBTA_DM_API_ENABLE_PERIODIC_ADV ble_enable_periodic_adv;
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
tBTA_DM_API_PERIODIC_ADV_SYNC ble_periodic_adv_sync;
tBTA_DM_API_PERIODIC_ADV_SYNC_CANCEL ble_periodic_adv_sync_cancel;
tBTA_DM_API_PERIODIC_ADV_SYNC_TERM ble_periodic_adv_sync_term;
tBTA_DM_API_PERIODIC_ADV_ADD_DEV_TO_LIST ble_periodic_adv_add_dev_to_list;
tBTA_DM_API_PERIODIC_ADV_REMOVE_DEV_FROM_LIST ble_periodic_adv_remove_dev_from_list;
tBTA_DM_API_PERIODIC_ADV_DEV_CLEAR ble_periodic_adv_clear_dev;
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
tBTA_DM_API_SET_EXT_SCAN_PARAMS ble_set_ext_scan_params;
tBTA_DM_API_EXT_SCAN ble_ext_scan;
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
tBTA_DM_API_SET_PER_EXT_CONN_PARAMS ble_set_per_ext_conn_params;
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
tBTA_DM_API_BLE_DTM_ENH_TX_START dtm_enh_tx_start;
tBTA_DM_API_BLE_DTM_ENH_RX_START dtm_enh_rx_start;
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
tBTA_DM_API_PERIODIC_ADV_RECV_ENABLE ble_periodic_adv_recv_enable;
tBTA_DM_API_PERIODIC_ADV_SYNC_TRANS ble_periodic_adv_sync_trans;
tBTA_DM_API_PERIODIC_ADV_SET_INFO_TRANS ble_periodic_adv_set_info_trans;
tBTA_DM_API_SET_PAST_PARAMS ble_set_past_params;
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_42_DTM_TEST_EN == TRUE)
tBTA_DM_API_BLE_DTM_TX_START dtm_tx_start;
tBTA_DM_API_BLE_DTM_RX_START dtm_rx_start;
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
tBTA_DM_API_BLE_DTM_STOP dtm_stop;
tBTA_DM_API_CLEAR_ADV ble_clear_adv;
tBTA_DM_API_SET_PRIVACY_MODE ble_set_privacy_mode;
tBTA_DM_API_BLE_SET_CSA_SUPPORT ble_set_csa_support;
#endif
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
tBTA_DM_API_REMOVE_ACL remove_acl;
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
tBTA_DM_API_REMOVE_ALL_ACL remove_all_acl;
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
} tBTA_DM_MSG;
@ -1491,8 +1584,12 @@ typedef struct {
tBTA_DM_BLE_PF_CFG_CBACK *p_scan_filt_cfg_cback;
tBTA_DM_BLE_PF_STATUS_CBACK *p_scan_filt_status_cback;
tBTA_DM_BLE_PF_PARAM_CBACK *p_scan_filt_param_cback;
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
tBTA_BLE_MULTI_ADV_CBACK *p_multi_adv_cback;
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
tBTA_BLE_ENERGY_INFO_CBACK *p_energy_info_cback;
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
#endif
UINT16 state;
BOOLEAN disabling;
@ -1757,7 +1854,9 @@ extern void bta_dm_update_white_list(tBTA_DM_MSG *p_data);
extern void bta_dm_clear_white_list(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data);
extern void bta_dm_read_rssi(tBTA_DM_MSG *p_data);
#if (CLASSIC_BT_INCLUDED == TRUE)
extern void bta_dm_set_visibility (tBTA_DM_MSG *p_data);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
extern void bta_dm_set_scan_config(tBTA_DM_MSG *p_data);
extern void bta_dm_vendor_spec_command(tBTA_DM_MSG *p_data);
@ -1783,7 +1882,9 @@ extern void bta_dm_ble_set_bg_conn_type (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_params(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_fil_params(tBTA_DM_MSG *p_data);
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
extern void bta_dm_ble_set_conn_scan_params (tBTA_DM_MSG *p_data);
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE)
extern void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data);
#endif /* ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE) */
@ -1793,13 +1894,13 @@ extern void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_disconnect (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_clear_rand_address(tBTA_DM_MSG *p_data);
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
extern void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data);
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
extern void bta_dm_ble_config_local_privacy (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_config_local_icon (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_adv_params (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_adv_params_all(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_long_adv (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_adv_config_raw (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_rsp_raw (tBTA_DM_MSG *p_data);
@ -1818,17 +1919,21 @@ extern void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_multi_adv_data(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_multi_adv_upd_param(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_multi_adv_enb(tBTA_DM_MSG *p_data);
#if (BLE_42_DTM_TEST_EN == TRUE)
extern void bta_dm_ble_gap_dtm_tx_start(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_dtm_rx_start(tBTA_DM_MSG *p_data);
#endif// #if (BLE_42_DTM_TEST_EN == TRUE)
extern void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_csa_support(tBTA_DM_MSG *p_data);
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
extern void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_dtm_enhance_rx_start(tBTA_DM_MSG *p_data);
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
extern void bta_dm_ble_gap_read_phy(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_prefer_default_phy(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_prefer_phy(tBTA_DM_MSG *p_data);
@ -1839,12 +1944,20 @@ extern void bta_dm_ble_gap_set_ext_scan_params(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_ext_scan(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_prefer_ext_conn_params(tBTA_DM_MSG *p_data);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
extern void bta_dm_ble_setup_storage(tBTA_DM_MSG *p_data);
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
extern void bta_dm_ble_enable_batch_scan(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_disable_batch_scan(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data);
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
extern void bta_dm_ble_track_advertiser(tBTA_DM_MSG *p_data);
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
extern void bta_dm_ble_get_energy_info(tBTA_DM_MSG *p_data);
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
#endif
extern void bta_dm_set_encryption(tBTA_DM_MSG *p_data);

View File

@ -2326,92 +2326,6 @@ void bta_gattc_process_listen_all(UINT8 cif)
}
}
}
/*******************************************************************************
**
** Function bta_gattc_listen
**
** Description Start or stop a listen for connection
**
** Returns void
**
********************************************************************************/
void bta_gattc_listen(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
{
tBTA_GATTC_RCB *p_clreg = bta_gattc_cl_get_regcb(p_msg->api_listen.client_if);
tBTA_GATTC cb_data;
UNUSED(p_cb);
cb_data.reg_oper.status = BTA_GATT_ERROR;
cb_data.reg_oper.client_if = p_msg->api_listen.client_if;
if (p_clreg == NULL) {
APPL_TRACE_ERROR("bta_gattc_listen failed, unknown client_if: %d",
p_msg->api_listen.client_if);
return;
}
/* mark bg conn record */
if (bta_gattc_mark_bg_conn(p_msg->api_listen.client_if,
(BD_ADDR_PTR) p_msg->api_listen.remote_bda,
p_msg->api_listen.start,
TRUE)) {
if (!GATT_Listen(p_msg->api_listen.client_if,
p_msg->api_listen.start,
p_msg->api_listen.remote_bda)) {
APPL_TRACE_ERROR("Listen failure");
(*p_clreg->p_cback)(BTA_GATTC_LISTEN_EVT, &cb_data);
} else {
cb_data.status = BTA_GATT_OK;
(*p_clreg->p_cback)(BTA_GATTC_LISTEN_EVT, &cb_data);
if (p_msg->api_listen.start) {
/* if listen to a specific target */
if (p_msg->api_listen.remote_bda != NULL) {
/* if is a connected remote device */
if (L2CA_GetBleConnRole(p_msg->api_listen.remote_bda) == HCI_ROLE_SLAVE &&
bta_gattc_find_clcb_by_cif(p_msg->api_listen.client_if,
p_msg->api_listen.remote_bda,
BTA_GATT_TRANSPORT_LE) == NULL) {
bta_gattc_init_clcb_conn(p_msg->api_listen.client_if,
p_msg->api_listen.remote_bda);
}
}
/* if listen to all */
else {
APPL_TRACE_DEBUG("Listen For All now");
/* go through all connected device and send
callback for all connected slave connection */
bta_gattc_process_listen_all(p_msg->api_listen.client_if);
}
}
}
}
}
/*******************************************************************************
**
** Function bta_gattc_broadcast
**
** Description Start or stop broadcasting
**
** Returns void
**
********************************************************************************/
void bta_gattc_broadcast(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
{
tBTA_GATTC_RCB *p_clreg = bta_gattc_cl_get_regcb(p_msg->api_listen.client_if);
tBTA_GATTC cb_data;
UNUSED(p_cb);
cb_data.reg_oper.client_if = p_msg->api_listen.client_if;
cb_data.reg_oper.status = BTM_BleBroadcast(p_msg->api_listen.start, NULL);
//TODO need modify callback if used
if (p_clreg && p_clreg->p_cback) {
(*p_clreg->p_cback)(BTA_GATTC_LISTEN_EVT, &cb_data);
}
}
/*******************************************************************************
**

View File

@ -1090,66 +1090,6 @@ void BTA_GATTC_Clean(BD_ADDR remote_bda)
}
return;
}
/*******************************************************************************
**
** Function BTA_GATTC_Listen
**
** Description Start advertisement to listen for connection request for a GATT
** client application.
**
** Parameters client_if: server interface.
** start: to start or stop listening for connection
** remote_bda: remote device BD address, if listen to all device
** use NULL.
**
** Returns void
**
*******************************************************************************/
void BTA_GATTC_Listen(tBTA_GATTC_IF client_if, BOOLEAN start, BD_ADDR_PTR target_bda)
{
tBTA_GATTC_API_LISTEN *p_buf;
if ((p_buf = (tBTA_GATTC_API_LISTEN *) osi_malloc((UINT16)(sizeof(tBTA_GATTC_API_LISTEN) + BD_ADDR_LEN))) != NULL) {
p_buf->hdr.event = BTA_GATTC_API_LISTEN_EVT;
p_buf->client_if = client_if;
p_buf->start = start;
if (target_bda) {
p_buf->remote_bda = (UINT8 *)(p_buf + 1);
memcpy(p_buf->remote_bda, target_bda, BD_ADDR_LEN);
} else {
p_buf->remote_bda = NULL;
}
bta_sys_sendmsg(p_buf);
}
return;
}
/*******************************************************************************
**
** Function BTA_GATTC_Broadcast
**
** Description Start broadcasting (non-connectable advertisements)
**
** Parameters client_if: client interface.
** start: to start or stop listening for connection
**
** Returns void
**
*******************************************************************************/
void BTA_GATTC_Broadcast(tBTA_GATTC_IF client_if, BOOLEAN start)
{
tBTA_GATTC_API_LISTEN *p_buf;
if ((p_buf = (tBTA_GATTC_API_LISTEN *) osi_malloc((UINT16)(sizeof(tBTA_GATTC_API_LISTEN) + BD_ADDR_LEN))) != NULL) {
p_buf->hdr.event = BTA_GATTC_API_BROADCAST_EVT;
p_buf->client_if = client_if;
p_buf->start = start;
bta_sys_sendmsg(p_buf);
}
return;
}
/* Add For BLE PTS */
uint8_t BTA_GATTC_AutoDiscoverEnable(uint8_t enable)

View File

@ -381,15 +381,6 @@ BOOLEAN bta_gattc_hdl_event(BT_HDR *p_msg)
case BTA_GATTC_API_CACHE_CLEAN_EVT:
bta_gattc_process_api_cache_clean(p_cb, (tBTA_GATTC_DATA *) p_msg);
break;
#if BLE_INCLUDED == TRUE
case BTA_GATTC_API_LISTEN_EVT:
bta_gattc_listen(p_cb, (tBTA_GATTC_DATA *) p_msg);
break;
case BTA_GATTC_API_BROADCAST_EVT:
bta_gattc_broadcast(p_cb, (tBTA_GATTC_DATA *) p_msg);
break;
#endif
case BTA_GATTC_ENC_CMPL_EVT:
bta_gattc_process_enc_cmpl(p_cb, (tBTA_GATTC_DATA *) p_msg);
break;
@ -485,8 +476,6 @@ static char *gattc_evt_code(tBTA_GATTC_INT_EVT evt_code)
return "BTA_GATTC_API_REFRESH_EVT";
case BTA_GATTC_API_CACHE_CLEAN_EVT:
return "BTA_GATTC_API_CACHE_CLEAN_EVT";
case BTA_GATTC_API_LISTEN_EVT:
return "BTA_GATTC_API_LISTEN_EVT";
case BTA_GATTC_API_DISABLE_EVT:
return "BTA_GATTC_API_DISABLE_EVT";
case BTA_GATTC_API_CFG_MTU_EVT:

View File

@ -882,41 +882,6 @@ void bta_gatts_send_service_change_indication (tBTA_GATTS_DATA *p_msg)
}
}
/*******************************************************************************
**
** Function bta_gatts_listen
**
** Description Start or stop listening for LE connection on a GATT server
**
** Returns none.
**
*******************************************************************************/
void bta_gatts_listen(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
{
tBTA_GATTS_RCB *p_rcb = bta_gatts_find_app_rcb_by_app_if(p_msg->api_listen.server_if);
tBTA_GATTS cb_data;
UNUSED(p_cb);
cb_data.reg_oper.status = BTA_GATT_OK;
cb_data.reg_oper.server_if = p_msg->api_listen.server_if;
if (p_rcb == NULL) {
APPL_TRACE_ERROR("Unknown GATTS application");
return;
}
if (!GATT_Listen(p_msg->api_listen.server_if,
p_msg->api_listen.start,
p_msg->api_listen.remote_bda)) {
cb_data.status = BTA_GATT_ERROR;
APPL_TRACE_ERROR("bta_gatts_listen Listen failed");
}
if (p_rcb->p_cback) {
(*p_rcb->p_cback)(BTA_GATTS_LISTEN_EVT, &cb_data);
}
}
/*******************************************************************************
**
** Function bta_gatts_show_local_database

View File

@ -603,43 +603,6 @@ void BTA_GATTS_SendServiceChangeIndication(tBTA_GATTS_IF server_if, BD_ADDR remo
}
/*******************************************************************************
**
** Function BTA_GATTS_Listen
**
** Description Start advertisement to listen for connection request for a
** GATT server
**
** Parameters server_if: server interface.
** start: to start or stop listening for connection
** remote_bda: remote device BD address, if listen to all device
** use NULL.
**
** Returns void
**
*******************************************************************************/
void BTA_GATTS_Listen(tBTA_GATTS_IF server_if, BOOLEAN start, BD_ADDR_PTR target_bda)
{
tBTA_GATTS_API_LISTEN *p_buf;
if ((p_buf = (tBTA_GATTS_API_LISTEN *) osi_malloc((UINT16)(sizeof(tBTA_GATTS_API_LISTEN) + BD_ADDR_LEN))) != NULL) {
p_buf->hdr.event = BTA_GATTS_API_LISTEN_EVT;
p_buf->server_if = server_if;
p_buf->start = start;
if (target_bda) {
p_buf->remote_bda = (UINT8 *)(p_buf + 1);
memcpy(p_buf->remote_bda, target_bda, BD_ADDR_LEN);
} else {
p_buf->remote_bda = NULL;
}
bta_sys_sendmsg(p_buf);
}
return;
}
uint8_t BTA_GATTS_SetServiceChangeMode(uint8_t mode)
{
tGATT_STATUS status;

View File

@ -112,9 +112,6 @@ BOOLEAN bta_gatts_hdl_event(BT_HDR *p_msg)
bta_gatts_set_attr_value(p_srvc_cb, (tBTA_GATTS_DATA *) p_msg);
break;
}
case BTA_GATTS_API_LISTEN_EVT:
bta_gatts_listen(p_cb, (tBTA_GATTS_DATA *) p_msg);
break;
case BTA_GATTS_API_ADD_INCL_SRVC_EVT:
case BTA_GATTS_API_ADD_CHAR_EVT:
case BTA_GATTS_API_ADD_DESCR_EVT:

View File

@ -66,8 +66,6 @@ enum {
BTA_GATTC_INT_START_IF_EVT,
BTA_GATTC_API_REG_EVT,
BTA_GATTC_API_DEREG_EVT,
BTA_GATTC_API_LISTEN_EVT,
BTA_GATTC_API_BROADCAST_EVT,
BTA_GATTC_API_DISABLE_EVT,
BTA_GATTC_ENC_CMPL_EVT,
BTA_GATTC_API_CACHE_ASSOC_EVT,
@ -201,14 +199,6 @@ typedef struct {
tBTA_GATTC_EVT cmpl_evt;
}tBTA_GATTC_API_READ_MULTI;
typedef struct {
BT_HDR hdr;
BD_ADDR_PTR remote_bda;
tBTA_GATTC_IF client_if;
BOOLEAN start;
} tBTA_GATTC_API_LISTEN;
typedef struct {
BT_HDR hdr;
} tBTA_GATTC_API_CFG_MTU;
@ -278,8 +268,6 @@ typedef union {
tBTA_GATTC_INT_START_IF int_start_if;
tBTA_GATTC_INT_DEREG int_dereg;
/* if peripheral role is supported */
tBTA_GATTC_API_LISTEN api_listen;
} tBTA_GATTC_DATA;
@ -507,10 +495,6 @@ extern void bta_gattc_process_api_cache_clean(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DA
extern void bta_gattc_process_api_cache_assoc(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
extern void bta_gattc_process_api_cache_get_addr_list(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
extern void bta_gattc_cfg_mtu(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
#if BLE_INCLUDED == TRUE
extern void bta_gattc_listen(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
extern void bta_gattc_broadcast(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
#endif
/* utility functions */
extern tBTA_GATTC_CLCB *bta_gattc_find_clcb_by_cif (UINT8 client_if, BD_ADDR remote_bda, tBTA_TRANSPORT transport);
extern tBTA_GATTC_CLCB *bta_gattc_find_clcb_by_conn_id (UINT16 conn_id);

View File

@ -51,7 +51,6 @@ enum {
BTA_GATTS_API_OPEN_EVT,
BTA_GATTS_API_CANCEL_OPEN_EVT,
BTA_GATTS_API_CLOSE_EVT,
BTA_GATTS_API_LISTEN_EVT,
BTA_GATTS_API_DISABLE_EVT,
BTA_GATTS_API_SEND_SERVICE_CHANGE_EVT,
BTA_GATTS_API_SHOW_LOCAL_DATABASE_EVT
@ -64,7 +63,7 @@ typedef UINT16 tBTA_GATTS_INT_EVT;
/* max number of services allowed in the device */
#define BTA_GATTS_MAX_SRVC_NUM GATT_MAX_SR_PROFILES
/* internal strucutre for GATTC register API */
/* internal structure for GATTC register API */
typedef struct {
BT_HDR hdr;
tBT_UUID app_uuid;
@ -148,13 +147,6 @@ typedef struct {
typedef tBTA_GATTS_API_OPEN tBTA_GATTS_API_CANCEL_OPEN;
typedef struct {
BT_HDR hdr;
BD_ADDR_PTR remote_bda;
tBTA_GATTS_IF server_if;
BOOLEAN start;
} tBTA_GATTS_API_LISTEN;
typedef struct {
BT_HDR hdr;
tBTA_GATTS_IF server_if;
@ -177,8 +169,6 @@ typedef union {
tBTA_GATTS_API_CANCEL_OPEN api_cancel_open;
tBTA_GATTS_INT_START_IF int_start_if;
/* if peripheral role is supported */
tBTA_GATTS_API_LISTEN api_listen;
tBTA_GATTS_API_SEND_SERVICE_CHANGE api_send_service_change;
} tBTA_GATTS_DATA;
@ -250,7 +240,6 @@ extern void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_m
extern void bta_gatts_open (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
extern void bta_gatts_cancel_open (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
extern void bta_gatts_close (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
extern void bta_gatts_listen(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
extern void bta_gatts_send_service_change_indication (tBTA_GATTS_DATA *p_msg);
extern void bta_gatts_show_local_database (void);

View File

@ -539,7 +539,9 @@ enum {
};
typedef tBTM_BLE_BATCH_SCAN_EVT tBTA_BLE_BATCH_SCAN_EVT;
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
typedef tBTM_BLE_TRACK_ADV_ACTION tBTA_BLE_TRACK_ADV_ACTION;
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
// #endif
/* BLE customer specific feature function type definitions */
@ -1047,6 +1049,7 @@ typedef union {
/* Security callback */
typedef void (tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data);
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#define BTA_BLE_MULTI_ADV_ILLEGAL 0
/* multi adv callback event */
@ -1060,6 +1063,8 @@ typedef UINT8 tBTA_BLE_MULTI_ADV_EVT;
/* multi adv callback */
typedef void (tBTA_BLE_MULTI_ADV_CBACK)(tBTA_BLE_MULTI_ADV_EVT event,
UINT8 inst_id, void *p_ref, tBTA_STATUS status);
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
typedef UINT32 tBTA_DM_BLE_REF_VALUE;
#define BTA_DM_BLE_PF_ENABLE_EVT BTM_BLE_PF_ENABLE
@ -1252,8 +1257,9 @@ typedef UINT8 tBTA_DM_BLE_ADV_STATE;
typedef UINT8 tBTA_DM_BLE_ADV_INFO_PRESENT;
typedef UINT8 tBTA_DM_BLE_RSSI_VALUE;
typedef UINT16 tBTA_DM_BLE_ADV_INFO_TIMESTAMP;
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
typedef tBTM_BLE_TRACK_ADV_DATA tBTA_DM_BLE_TRACK_ADV_DATA;
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
typedef void (tBTA_BLE_SCAN_THRESHOLD_CBACK)(tBTA_DM_BLE_REF_VALUE ref_value);
@ -1271,18 +1277,22 @@ typedef void (tBTA_START_STOP_ADV_CMPL_CBACK) (tBTA_STATUS status);
typedef void (tBTA_CLEAR_ADV_CMPL_CBACK) (tBTA_STATUS status);
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
typedef void (tBTA_BLE_TRACK_ADV_CMPL_CBACK)(int action, tBTA_STATUS status,
tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
tBTA_DM_BLE_REF_VALUE ref_value);
typedef void (tBTA_BLE_TRACK_ADV_CBACK)(tBTA_DM_BLE_TRACK_ADV_DATA *p_adv_data);
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
typedef void (tBTA_BLE_ENERGY_INFO_CBACK)(tBTA_DM_BLE_TX_TIME_MS tx_time,
tBTA_DM_BLE_RX_TIME_MS rx_time,
tBTA_DM_BLE_IDLE_TIME_MS idle_time,
tBTA_DM_BLE_ENERGY_USED energy_used,
tBTA_DM_CONTRL_STATE ctrl_state,
tBTA_STATUS status);
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
#else
typedef UINT8 tBTA_DM_BLE_SEC_ACT;
@ -1615,6 +1625,7 @@ typedef struct {
#define BTA_DM_BLE_5_GAP_READ_PHY_COMPLETE_EVT BTM_BLE_5_GAP_READ_PHY_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT BTM_BLE_5_GAP_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_SET_PREFERED_PHY_COMPLETE_EVT BTM_BLE_5_GAP_SET_PREFERED_PHY_COMPLETE_EVT
#if (BLE_50_EXTEND_ADV_EN == TRUE)
#define BTA_DM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_EXT_ADV_SET_PARAMS_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_SET_PARAMS_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_EXT_ADV_DATA_SET_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_DATA_SET_COMPLETE_EVT
@ -1623,29 +1634,42 @@ typedef struct {
#define BTA_DM_BLE_5_GAP_EXT_ADV_STOP_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_STOP_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_EXT_ADV_SET_REMOVE_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_SET_REMOVE_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_EXT_ADV_SET_CLEAR_COMPLETE_EVT BTM_BLE_5_GAP_EXT_ADV_SET_CLEAR_COMPLETE_EVT
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
#define BTA_DM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT BTM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_EXT_SCAN_STOP_COMPLETE_EVT BTM_BLE_5_GAP_EXT_SCAN_STOP_COMPLETE_EVT
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#define BTA_DM_BLE_5_GAP_PREFER_EXT_CONN_PARAMS_SET_COMPLETE_EVT BTM_BLE_5_GAP_PREFER_EXT_CONN_PARAMS_SET_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PHY_UPDATE_COMPLETE_EVT BTM_BLE_5_GAP_PHY_UPDATE_COMPLETE_EVT
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
#define BTA_DM_BLE_5_GAP_EXT_ADV_REPORT_EVT BTM_BLE_5_GAP_EXT_ADV_REPORT_EVT
#define BTA_DM_BLE_5_GAP_SCAN_TIMEOUT_EVT BTM_BLE_5_GAP_SCAN_TIMEOUT_EVT
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
#define BTA_DM_BLE_5_GAP_ADV_TERMINATED_EVT BTM_BLE_5_GAP_ADV_TERMINATED_EVT
#define BTA_DM_BLE_5_GAP_SCAN_REQ_RECEIVED_EVT BTM_BLE_5_GAP_SCAN_REQ_RECEIVED_EVT
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#define BTA_DM_BLE_5_GAP_CHANNEL_SELETE_ALGORITHM_EVT BTM_BLE_5_GAP_CHANNEL_SELETE_ALGORITHM_EVT
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_REPORT_EVT BTM_BLE_5_GAP_PERIODIC_ADV_REPORT_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_LOST_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_LOST_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_ESTAB_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_ESTAB_EVT
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#define BTA_BLE_GAP_PERIODIC_ADV_RECV_ENABLE_COMPLETE_EVT BTM_BLE_GAP_PERIODIC_ADV_RECV_ENABLE_COMPLETE_EVT
#define BTA_BLE_GAP_PERIODIC_ADV_SYNC_TRANS_COMPLETE_EVT BTM_BLE_GAP_PERIODIC_ADV_SYNC_TRANS_COMPLETE_EVT
@ -2492,24 +2516,6 @@ extern void BTA_DmSetBleScanFilterParams(tGATT_IF client_if, UINT32 scan_interva
UINT8 addr_type_own, UINT8 scan_duplicate_filter, tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback);
/*******************************************************************************
**
** Function BTA_DmSetBleAdvParams
**
** Description This function sets the advertising parameters BLE functionality.
** It is to be called when device act in peripheral or broadcaster
** role.
**
** Parameters: adv_int_min - adv interval minimum
** adv_int_max - adv interval max
** p_dir_bda - directed adv initiator address
**
** Returns void
**
*******************************************************************************/
extern void BTA_DmSetBleAdvParams (UINT16 adv_int_min, UINT16 adv_int_max,
tBLE_BD_ADDR *p_dir_bda);
extern void BTA_DmSetBleAdvParamsAll (UINT16 adv_int_min, UINT16 adv_int_max,
UINT8 adv_type, tBLE_ADDR_TYPE addr_type_own,
tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP adv_fil_pol,
@ -2640,7 +2646,9 @@ extern void BTA_DmBleScan(BOOLEAN start, UINT32 duration,
tBTA_DM_SEARCH_CBACK *p_results_cb,
tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_stop_scan_cb);
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
extern void BTA_DmBleStopAdvertising(void);
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback);
extern void BTA_DmClearRandAddress(void);
@ -2725,21 +2733,6 @@ extern void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask,
extern void BTA_DmBleSetAdvConfigRaw (UINT8 *p_raw_adv, UINT32 raw_adv_len,
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
/*******************************************************************************
**
** Function BTA_DmBleSetLongAdv
**
** Description This function is called to set long Advertising data
**
** Parameters adv_data : long advertising data.
** adv_data_len : long advertising data length.
** p_adv_data_cback : set long adv data complete callback.
**
** Returns None
**
*******************************************************************************/
void BTA_DmBleSetLongAdv (UINT8 *adv_data, UINT32 adv_data_len,
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
/*******************************************************************************
**
@ -2817,7 +2810,7 @@ extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
*******************************************************************************/
extern void BTA_DmBleBroadcast (BOOLEAN start, tBTA_START_STOP_ADV_CMPL_CBACK *p_start_stop_adv_cb);
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTA_BleEnableAdvInstance
@ -2876,6 +2869,7 @@ extern void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
**
*******************************************************************************/
extern void BTA_BleDisableAdvInstance(UINT8 inst_id);
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************
**
@ -2916,9 +2910,11 @@ extern void BTA_DmBleDisconnect(BD_ADDR bd_addr);
**
*******************************************************************************/
extern void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length, tBTA_SET_PKT_DATA_LENGTH_CBACK *p_set_pkt_data_cback);
#if (BLE_42_DTM_TEST_EN == TRUE)
extern void BTA_DmBleDtmTxStart(uint8_t tx_channel, uint8_t len_of_data, uint8_t pkt_payload, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback);
extern void BTA_DmBleDtmRxStart(uint8_t rx_channel, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback);
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
extern void BTA_DmBleDtmStop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback);
extern void BTA_DmBleSetPrivacyMode(uint8_t addr_type, BD_ADDR addr, uint8_t privacy_mode, tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback);
@ -3065,7 +3061,7 @@ extern void BTA_DmBleCfgFilterCondition(tBTA_DM_BLE_SCAN_COND_OP action,
tBTA_DM_BLE_PF_CFG_CBACK *p_cmpl_cback,
tBTA_DM_BLE_REF_VALUE ref_value);
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleTrackAdvertiser
@ -3080,7 +3076,9 @@ extern void BTA_DmBleCfgFilterCondition(tBTA_DM_BLE_SCAN_COND_OP action,
*******************************************************************************/
extern void BTA_DmBleTrackAdvertiser(tBTA_DM_BLE_REF_VALUE ref_value,
tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback);
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
/*******************************************************************************
**
** Function BTA_DmBleGetEnergyInfo
@ -3093,6 +3091,7 @@ extern void BTA_DmBleTrackAdvertiser(tBTA_DM_BLE_REF_VALUE ref_value,
**
*******************************************************************************/
extern void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK *p_cmpl_cback);
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
/*******************************************************************************
**
@ -3179,11 +3178,13 @@ extern void BTA_DmBleGapPreferExtConnectParamsSet(BD_ADDR bd_addr,
const tBTA_DM_BLE_CONN_PARAMS *phy_coded_conn_params);
extern void BTA_DmBleGapExtConnect(tBLE_ADDR_TYPE own_addr_type, const BD_ADDR peer_addr);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
extern void BTA_DmBleDtmEnhTxStart(uint8_t tx_channel, uint8_t len_of_data, uint8_t pkt_payload, uint8_t phy, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback);
extern void BTA_DmBleDtmEnhRxStart(uint8_t rx_channel, uint8_t phy, uint8_t modulation_index, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
extern void BTA_DmBleGapPeriodicAdvRecvEnable(UINT16 sync_handle, UINT8 enable);

View File

@ -18,7 +18,7 @@
/******************************************************************************
*
* This is the public interface file for the simulatenous advanced
* This is the public interface file for the simultaneous advanced
* audio/video streaming (AV) source and sink of BTA, Broadcom's Bluetooth
* application layer for mobile phones.
*
@ -35,6 +35,10 @@
#if (BTA_AR_INCLUDED == TRUE)
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
** Constants and data types
*****************************************************************************/

View File

@ -1203,37 +1203,6 @@ extern void BTA_GATTC_CacheGetAddrList(tBTA_GATTC_IF client_if);
*******************************************************************************/
extern void BTA_GATTC_Clean(BD_ADDR remote_bda);
/*******************************************************************************
**
** Function BTA_GATTC_Listen
**
** Description Start advertisement to listen for connection request.
**
** Parameters client_if: server interface.
** start: to start or stop listening for connection
** remote_bda: remote device BD address, if listen to all device
** use NULL.
**
** Returns void
**
*******************************************************************************/
extern void BTA_GATTC_Listen(tBTA_GATTC_IF client_if, BOOLEAN start, BD_ADDR_PTR target_bda);
/*******************************************************************************
**
** Function BTA_GATTC_Broadcast
**
** Description Start broadcasting (non-connectable advertisements)
**
** Parameters client_if: client interface.
** start: to start or stop listening for connection
**
** Returns void
**
*******************************************************************************/
extern void BTA_GATTC_Broadcast(tBTA_GATTC_IF client_if, BOOLEAN start);
/*******************************************************************************
**
** Function BTA_GATTC_ConfigureMTU
@ -1559,24 +1528,6 @@ extern void BTA_GATTS_Close(UINT16 conn_id);
void BTA_GATTS_SendServiceChangeIndication(tBTA_GATTS_IF server_if, BD_ADDR remote_bda);
/*******************************************************************************
**
** Function BTA_GATTS_Listen
**
** Description Start advertisement to listen for connection request for a
** GATT server
**
** Parameters server_if: server interface.
** start: to start or stop listening for connection
** remote_bda: remote device BD address, if listen to all device
** use NULL.
**
** Returns void
**
*******************************************************************************/
extern void BTA_GATTS_Listen(tBTA_GATTS_IF server_if, BOOLEAN start,
BD_ADDR_PTR target_bda);
/*******************************************************************************
**
** Function BTA_GATTS_ShowLocalDatabase

View File

@ -334,6 +334,7 @@ static void btc_dm_link_up_evt(tBTA_DM_LINK_UP *p_link_up)
}
}
#if (SMP_INCLUDED == TRUE)
static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
{
/* Save link key, if not temporary */
@ -493,6 +494,7 @@ static void btc_dm_pin_req_evt(tBTA_DM_PIN_REQ *p_pin_req)
}
#endif /// BTC_GAP_BT_INCLUDED == TRUE
}
#endif // #if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btc_dm_sp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_cfm_req)
@ -814,6 +816,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
btc_disable_bluetooth_evt();
break;
}
#if (SMP_INCLUDED == TRUE)
case BTA_DM_PIN_REQ_EVT:
BTC_TRACE_DEBUG("BTA_DM_PIN_REQ_EVT");
btc_dm_pin_req_evt(&p_data->pin_req);
@ -827,6 +830,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
case BTA_DM_BOND_CANCEL_CMPL_EVT:
BTC_TRACE_DEBUG("BTA_DM_BOND_CANCEL_CMPL_EVT");
break;
#endif // #if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
case BTA_DM_SP_CFM_REQ_EVT:
btc_dm_sp_cfm_req_evt(&p_data->cfm_req);

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -30,6 +30,7 @@
#if (BLE_INCLUDED == TRUE)
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
#if BTC_DYNAMIC_MEMORY == FALSE
static tBTA_BLE_ADV_DATA gl_bta_adv_data;
static tBTA_BLE_ADV_DATA gl_bta_scan_rsp_data;
@ -37,33 +38,22 @@ static tBTA_BLE_ADV_DATA gl_bta_scan_rsp_data;
tBTA_BLE_ADV_DATA *gl_bta_adv_data_ptr;
tBTA_BLE_ADV_DATA *gl_bta_scan_rsp_data_ptr;
#endif
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
#if SCAN_QUEUE_CONGEST_CHECK
static list_t *adv_filter_list;
static osi_mutex_t adv_list_lock;
bool btc_check_adv_list(uint8_t * addr, uint8_t addr_type);
uint32_t btc_get_adv_list_length(void);
void btc_adv_list_refresh(void);
void btc_adv_list_lock(void);
void btc_adv_list_unlock(void);
static uint16_t btc_adv_list_count = 0;
#define BTC_ADV_LIST_MAX_LENGTH 50
#define BTC_ADV_LIST_MAX_COUNT 200
#endif
#define BTC_GAP_BLE_ADV_RPT_QUEUE_IDX (1)
#define BTC_GAP_BLE_ADV_RPT_BATCH_SIZE (10)
#define BTC_GAP_BLE_ADV_RPT_QUEUE_LEN_MAX (200)
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
typedef struct {
struct pkt_queue *adv_rpt_queue;
struct osi_event *adv_rpt_ready;
} btc_gap_ble_env_t;
static btc_gap_ble_env_t btc_gap_ble_env;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif
static inline void btc_gap_ble_cb_to_app(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
@ -102,6 +92,7 @@ static void btc_gap_ble_get_dev_name_callback(UINT8 status, char *name)
}
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
static void btc_gap_adv_point_cleanup(void **buf)
{
if (NULL == *buf) {
@ -495,6 +486,7 @@ static void btc_clear_adv_callback(uint8_t status)
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info)
{
@ -525,6 +517,7 @@ static void btc_ble_update_duplicate_exceptional_list(uint8_t subcode, uint32_t
BTA_DmUpdateDuplicateExceptionalList(subcode, info_type, device_info, p_update_duplicate_ignore_list_cback);
}
#if (BLE_42_ADV_EN == TRUE)
static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBTA_START_ADV_CMPL_CBACK start_adv_cback)
{
tBLE_BD_ADDR peer_addr;
@ -575,8 +568,9 @@ static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBT
&peer_addr,
start_adv_cback);
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
static void btc_scan_params_callback(tGATT_IF gatt_if, tBTM_STATUS status)
{
esp_ble_gap_cb_param_t param;
@ -641,20 +635,6 @@ static void btc_gap_ble_adv_pkt_handler(void *arg)
static void btc_process_adv_rpt_pkt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data)
{
#if SCAN_QUEUE_CONGEST_CHECK
if(btc_check_queue_is_congest()) {
BTC_TRACE_DEBUG("BtcQueue is congested");
if(btc_get_adv_list_length() > BTC_ADV_LIST_MAX_LENGTH || btc_adv_list_count > BTC_ADV_LIST_MAX_COUNT) {
btc_adv_list_refresh();
btc_adv_list_count = 0;
}
if(btc_check_adv_list(p_data->inq_res.bd_addr, p_data->inq_res.ble_addr_type)) {
return;
}
}
btc_adv_list_count ++;
#endif
// drop ADV packets if data queue length goes above threshold
btc_gap_ble_env_t *p_env = &btc_gap_ble_env;
if (pkt_queue_length(p_env->adv_rpt_queue) >= BTC_GAP_BLE_ADV_RPT_QUEUE_LEN_MAX) {
@ -770,10 +750,8 @@ static void btc_stop_scan_callback(tBTA_STATUS status)
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
#if SCAN_QUEUE_CONGEST_CHECK
btc_adv_list_refresh();
#endif
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
void btc_update_conn_param_callback (UINT8 status, BD_ADDR bd_addr, tBTM_LE_UPDATE_CONN_PRAMS *update_conn_params)
{
@ -986,6 +964,7 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
param.set_perf_phy.status = btc_btm_status_to_esp_status(params->set_perf_phy.status);
break;
}
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case BTA_DM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT:
msg.act = ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT;
param.ext_adv_set_rand_addr.status = btc_btm_status_to_esp_status(params->set_ext_rand_addr.status);
@ -1036,6 +1015,9 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
msg.act = ESP_GAP_BLE_EXT_ADV_SET_CLEAR_COMPLETE_EVT;
param.ext_adv_clear.status = btc_btm_status_to_esp_status(params->adv_start.status);
break;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT;
param.peroid_adv_set_params.status = btc_btm_status_to_esp_status(params->per_adv_set_params.status);
@ -1060,6 +1042,8 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
param.period_adv_stop.instance = params->per_adv_stop.instance;
break;
}
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT;
param.period_adv_create_sync.status = btc_btm_status_to_esp_status(params->per_adv_sync_create.status);
@ -1090,6 +1074,9 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
param.period_adv_clear_dev.status = btc_btm_status_to_esp_status(params->per_adv_clear_dev.status);
break;
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
case BTA_DM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_SET_EXT_SCAN_PARAMS_COMPLETE_EVT;
param.set_ext_scan_params.status = btc_btm_status_to_esp_status(params->ext_scan.status);
@ -1105,6 +1092,7 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
param.ext_scan_stop.status = btc_btm_status_to_esp_status(params->scan_stop.status);
break;
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
case BTA_DM_BLE_5_GAP_PREFER_EXT_CONN_PARAMS_SET_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_PREFER_EXT_CONN_PARAMS_SET_COMPLETE_EVT;
param.ext_conn_params_set.status = btc_btm_status_to_esp_status(params->ext_conn_set_params.status);
@ -1117,6 +1105,7 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
param.phy_update.tx_phy = params->phy_update.tx_phy;
param.phy_update.rx_phy = params->phy_update.rx_phy;
break;
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
case BTA_DM_BLE_5_GAP_EXT_ADV_REPORT_EVT:
msg.act = ESP_GAP_BLE_EXT_ADV_REPORT_EVT;
memcpy(&param.ext_adv_report.params, &params->ext_adv_report, sizeof(esp_ble_gap_ext_adv_report_t));
@ -1128,6 +1117,8 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
case BTA_DM_BLE_5_GAP_SCAN_TIMEOUT_EVT:
msg.act = ESP_GAP_BLE_SCAN_TIMEOUT_EVT;
break;
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case BTA_DM_BLE_5_GAP_ADV_TERMINATED_EVT: {
param.adv_terminate.status = params->adv_term.status;
param.adv_terminate.adv_instance = params->adv_term.adv_handle;
@ -1143,12 +1134,14 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
memcpy(param.scan_req_received.scan_addr, params->scan_req.scan_addr, sizeof(BD_ADDR));
break;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
case BTA_DM_BLE_5_GAP_CHANNEL_SELETE_ALGORITHM_EVT: {
msg.act = ESP_GAP_BLE_CHANNEL_SELECT_ALGORITHM_EVT;
param.channel_sel_alg.conn_handle = params->channel_sel.conn_handle;
param.channel_sel_alg.channel_sel_alg = params->channel_sel.channel_sel_alg;
break;
}
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_REPORT_EVT: {
msg.act = ESP_GAP_BLE_PERIODIC_ADV_REPORT_EVT;
memcpy(&param.period_adv_report, &params->period_adv_report,
@ -1177,6 +1170,8 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
param.periodic_adv_sync_estab.adv_clk_accuracy = params->sync_estab.adv_clk_accuracy;
break;
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
case BTA_BLE_GAP_PERIODIC_ADV_RECV_ENABLE_COMPLETE_EVT:
msg.act = ESP_GAP_BLE_PERIODIC_ADV_RECV_ENABLE_COMPLETE_EVT;
@ -1224,6 +1219,7 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
}
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
void btc_dtm_tx_start_callback(void *p1)
{
UINT8 status;
@ -1278,7 +1274,9 @@ void btc_dtm_rx_start_callback(void *p1)
}
}
}
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
void btc_dtm_stop_callback(void *p1)
{
UINT8 status;
@ -1307,6 +1305,7 @@ void btc_dtm_stop_callback(void *p1)
}
}
}
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
static void btc_ble_vendor_hci_cmd_complete_callback(tBTA_VSC_CMPL *p_param)
{
@ -1388,14 +1387,12 @@ void btc_get_whitelist_size(uint16_t *length)
return;
}
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
static void btc_ble_start_scanning(uint32_t duration,
tBTA_DM_SEARCH_CBACK *results_cb,
tBTA_START_STOP_SCAN_CMPL_CBACK *start_scan_cb)
{
if ((results_cb != NULL) && (start_scan_cb != NULL)) {
#if SCAN_QUEUE_CONGEST_CHECK
btc_adv_list_refresh();
#endif
//Start scan the device
BTA_DmBleScan(true, duration, results_cb, start_scan_cb);
} else {
@ -1408,7 +1405,9 @@ static void btc_ble_stop_scanning(tBTA_START_STOP_SCAN_CMPL_CBACK *stop_scan_cb)
uint8_t duration = 0;
BTA_DmBleScan(false, duration, NULL, stop_scan_cb);
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_42_ADV_EN == TRUE)
static void btc_ble_stop_advertising(tBTA_START_STOP_ADV_CMPL_CBACK *stop_adv_cb)
{
bool stop_adv = false;
@ -1420,6 +1419,8 @@ static void btc_ble_clear_advertising(tBTA_CLEAR_ADV_CMPL_CBACK *clear_adv_cb)
{
BTA_DmBleClearAdv(clear_adv_cb);
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
static void btc_ble_update_conn_params(BD_ADDR bd_addr, uint16_t min_int,
uint16_t max_int, uint16_t latency, uint16_t timeout)
@ -1528,7 +1529,7 @@ static void btc_gap_ble_set_channels(esp_gap_ble_channels channels)
BTA_DmBleSetChannels(channels, btc_gap_ble_set_channels_cmpl_callback);
}
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_DTM_TEST_EN == TRUE)
static void btc_ble_dtm_tx_start(uint8_t tx_channel, uint8_t len_of_data, uint8_t pkt_payload, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
{
BTA_DmBleDtmTxStart(tx_channel, len_of_data, pkt_payload, p_dtm_cmpl_cback);
@ -1539,9 +1540,9 @@ static void btc_ble_dtm_rx_start(uint8_t rx_channel, tBTA_DTM_CMD_CMPL_CBACK *p_
BTA_DmBleDtmRxStart(rx_channel, p_dtm_cmpl_cback);
}
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
static void btc_ble_dtm_enhance_tx_start(uint8_t tx_channel, uint8_t len_of_data, uint8_t pkt_payload, uint8_t phy, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
{
BTA_DmBleDtmEnhTxStart(tx_channel, len_of_data, pkt_payload, phy, p_dtm_cmpl_cback);
@ -1552,14 +1553,15 @@ static void btc_ble_dtm_enhance_rx_start(uint8_t rx_channel, uint8_t phy, uint8_
BTA_DmBleDtmEnhRxStart(rx_channel, phy, modulation_index, p_dtm_cmpl_cback);
}
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
static void btc_ble_dtm_stop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
{
BTA_DmBleDtmStop(p_dtm_cmpl_cback);
}
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
static void btc_ble_set_privacy_mode(uint8_t addr_type,
BD_ADDR addr,
uint8_t privacy_mode,
@ -1586,6 +1588,7 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
switch (msg->act) {
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
case BTC_GAP_BLE_ACT_CFG_ADV_DATA: {
btc_ble_gap_args_t *src = (btc_ble_gap_args_t *)p_src;
btc_ble_gap_args_t *dst = (btc_ble_gap_args_t *) p_dest;
@ -1631,6 +1634,7 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
}
break;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
case BTC_GAP_BLE_SET_SECURITY_PARAM_EVT: {
btc_ble_gap_args_t *src = (btc_ble_gap_args_t *)p_src;
@ -1684,6 +1688,7 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
break;
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case BTC_GAP_BLE_CFG_EXT_ADV_DATA_RAW:
case BTC_GAP_BLE_CFG_EXT_SCAN_RSP_DATA_RAW: {
btc_ble_5_gap_args_t *src = (btc_ble_5_gap_args_t *)p_src;
@ -1701,6 +1706,8 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
}
break;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
case BTC_GAP_BLE_CFG_PERIODIC_ADV_DATA_RAW: {
btc_ble_5_gap_args_t *src = (btc_ble_5_gap_args_t *)p_src;
btc_ble_5_gap_args_t *dst = (btc_ble_5_gap_args_t *)p_dest;
@ -1717,6 +1724,8 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
}
break;
}
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case BTC_GAP_BLE_EXT_ADV_START: {
btc_ble_5_gap_args_t *src = (btc_ble_5_gap_args_t *)p_src;
btc_ble_5_gap_args_t *dst = (btc_ble_5_gap_args_t *)p_dest;
@ -1743,6 +1752,7 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
}
break;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
case BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT: {
btc_ble_gap_args_t *src = (btc_ble_gap_args_t *)p_src;
@ -1804,6 +1814,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
BTC_TRACE_DEBUG("%s \n", __func__);
switch (msg->act) {
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
case BTC_GAP_BLE_ACT_CFG_ADV_DATA: {
esp_ble_adv_data_t *adv = &((btc_ble_gap_args_t *)msg->arg)->cfg_adv_data.adv_data;
if (adv->p_service_data) {
@ -1833,6 +1844,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
}
break;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
case BTC_GAP_BLE_SET_SECURITY_PARAM_EVT: {
uint8_t *value = ((btc_ble_gap_args_t *)msg->arg)->set_security_param.value;
@ -1860,6 +1872,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
break;
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case BTC_GAP_BLE_CFG_EXT_ADV_DATA_RAW:
case BTC_GAP_BLE_CFG_EXT_SCAN_RSP_DATA_RAW: {
uint8_t *value = ((btc_ble_5_gap_args_t *)msg->arg)->ext_adv_cfg_data.data;
@ -1868,6 +1881,8 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
}
break;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
case BTC_GAP_BLE_CFG_PERIODIC_ADV_DATA_RAW: {
uint8_t *value = ((btc_ble_5_gap_args_t *)msg->arg)->periodic_adv_cfg_data.data;
if (value) {
@ -1875,6 +1890,8 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
}
break;
}
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case BTC_GAP_BLE_EXT_ADV_START: {
esp_ble_gap_ext_adv_t *value = ((btc_ble_5_gap_args_t *)msg->arg)->ext_adv_start.ext_adv;
if (value) {
@ -1889,6 +1906,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
}
break;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
case BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT: {
uint8_t *p_param_buf = ((btc_ble_gap_args_t *)msg->arg)->vendor_cmd_send.p_param_buf;
@ -1946,6 +1964,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
switch (msg->act) {
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
case BTC_GAP_BLE_ACT_CFG_ADV_DATA: {
if (arg->cfg_adv_data.adv_data.set_scan_rsp == false) {
btc_ble_set_adv_data(&arg->cfg_adv_data.adv_data, btc_adv_data_callback);
@ -1954,6 +1973,8 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
}
break;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
case BTC_GAP_BLE_ACT_SET_SCAN_PARAM:
btc_ble_set_scan_params(&arg->set_scan_param.scan_params, btc_scan_params_callback);
break;
@ -1963,6 +1984,8 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
case BTC_GAP_BLE_ACT_STOP_SCAN:
btc_ble_stop_scanning(btc_stop_scan_callback);
break;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_42_ADV_EN == TRUE)
case BTC_GAP_BLE_ACT_START_ADV:
btc_ble_start_advertising(&arg->start_adv.adv_params, btc_start_adv_callback);
break;
@ -1972,6 +1995,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
case BTC_GAP_BLE_ACT_CLEAR_ADV:
btc_ble_clear_advertising(btc_clear_adv_callback);
break;
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
case BTC_GAP_BLE_ACT_UPDATE_CONN_PARAM:
btc_ble_update_conn_params(arg->conn_update_params.conn_params.bda,
@ -2033,6 +2057,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
BTA_DmGetDeviceName(btc_gap_ble_get_dev_name_callback, BT_DEVICE_TYPE_BLE);
break;
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
case BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW:
btc_ble_set_adv_data_raw(arg->cfg_adv_data_raw.raw_adv,
arg->cfg_adv_data_raw.raw_adv_len,
@ -2043,6 +2068,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
arg->cfg_scan_rsp_data_raw.raw_scan_rsp_len,
btc_scan_rsp_data_raw_callback);
break;
#endif // #if (BLE_42_ADV_EN == TRUE)
case BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST:
btc_ble_update_duplicate_exceptional_list(arg->update_duplicate_exceptional_list.subcode,
arg->update_duplicate_exceptional_list.info_type,
@ -2188,6 +2214,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
arg_5->set_def_phy.rx_phy_mask,
arg_5->set_def_phy.phy_options);
break;
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case BTC_GAP_BLE_SET_EXT_ADV_RAND_ADDR:
BTA_DmBleGapExtAdvSetRandaddr(arg_5->ext_adv_set_rand_addr.instance, arg_5->ext_adv_set_rand_addr.rand_addr);
break;
@ -2263,6 +2290,8 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
case BTC_GAP_BLE_EXT_ADV_SET_CLEAR:
BTA_DmBleGapExtAdvSetClear();
break;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
case BTC_GAP_BLE_SET_PERIODIC_ADV_PARAMS: {
tBTA_DM_BLE_Periodic_Adv_Params params = {0};
params.interval_min = arg_5->peridic_adv_set_params.params.interval_min;
@ -2288,6 +2317,8 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
BTC_TRACE_DEBUG("BTC_GAP_BLE_PERIODIC_ADV_STOP");
BTA_DmBleGapPeriodicAdvEnable(FALSE, arg_5->periodic_adv_stop.instance);
break;
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
case BTC_GAP_BLE_PERIODIC_ADV_CREATE_SYNC: {
tBTA_DM_BLE_Periodic_Sync_Params params = {0};
params.filter_policy = arg_5->periodic_adv_create_sync.params.filter_policy;
@ -2329,6 +2360,9 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
BTC_TRACE_DEBUG("BTC_GAP_BLE_PERIODIC_CLEAR_DEV");
BTA_DmBleGapPeriodicAdvClearDev();
break;
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
case BTC_GAP_BLE_SET_EXT_SCAN_PARAMS: {
tBTA_DM_BLE_EXT_SCAN_PARAMS params = {0};
params.own_addr_type = arg_5->set_ext_scan_params.params.own_addr_type;
@ -2359,6 +2393,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
BTC_TRACE_DEBUG("BTC_GAP_BLE_STOP_EXT_SCAN");
BTA_DmBleGapExtScan(FALSE, 0, 0);
break;
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
case BTC_GAP_BLE_SET_EXT_PEFER_CONNET_PARAMS:
BTC_TRACE_DEBUG("BTC_GAP_BLE_SET_EXT_PEFER_CONNET_PARAMS");
BTA_DmBleGapPreferExtConnectParamsSet(arg_5->set_ext_conn_params.addr,
@ -2392,25 +2427,27 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
(tBTA_DM_BLE_PAST_PARAMS *)&arg_5->set_periodic_adv_sync_trans_params.params);
break;
#endif
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_DTM_TEST_EN == TRUE)
case BTC_GAP_BLE_DTM_TX_START:
btc_ble_dtm_tx_start(arg->dtm_tx_start.tx_channel, arg->dtm_tx_start.len_of_data, arg->dtm_tx_start.pkt_payload, btc_dtm_tx_start_callback);
break;
case BTC_GAP_BLE_DTM_RX_START:
btc_ble_dtm_rx_start(arg->dtm_rx_start.rx_channel, btc_dtm_rx_start_callback);
break;
#endif // if (BLE_42_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
case BTC_GAP_BLE_DTM_STOP:
btc_ble_dtm_stop(btc_dtm_stop_callback);
break;
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
#if (BLE_50_DTM_TEST_EN == TRUE)
case BTC_GAP_BLE_DTM_ENH_TX_START:
btc_ble_dtm_enhance_tx_start(arg_5->dtm_enh_tx_start.tx_channel, arg_5->dtm_enh_tx_start.len_of_data, arg_5->dtm_enh_tx_start.pkt_payload, arg_5->dtm_enh_tx_start.phy, btc_dtm_tx_start_callback);
break;
case BTC_GAP_BLE_DTM_ENH_RX_START:
btc_ble_dtm_enhance_rx_start(arg_5->dtm_enh_rx_start.rx_channel, arg_5->dtm_enh_rx_start.phy, arg_5->dtm_enh_rx_start.modulation_index, btc_dtm_rx_start_callback);
break;
#endif // if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
case BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT:
BTA_DmsendVendorHciCmd(arg->vendor_cmd_send.opcode,
arg->vendor_cmd_send.param_len,
@ -2444,6 +2481,7 @@ void btc_gap_callback_init(void)
bool btc_gap_ble_init(void)
{
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
btc_gap_ble_env_t *p_env = &btc_gap_ble_env;
p_env->adv_rpt_queue = pkt_queue_create();
assert(p_env->adv_rpt_queue != NULL);
@ -2451,6 +2489,7 @@ bool btc_gap_ble_init(void)
p_env->adv_rpt_ready = osi_event_create(btc_gap_ble_adv_pkt_handler, NULL);
assert(p_env->adv_rpt_ready != NULL);
osi_event_bind(p_env->adv_rpt_ready, btc_get_current_thread(), BTC_GAP_BLE_ADV_RPT_QUEUE_IDX);
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif
return true;
}
@ -2458,6 +2497,7 @@ bool btc_gap_ble_init(void)
void btc_gap_ble_deinit(void)
{
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
btc_gap_ble_env_t *p_env = &btc_gap_ble_env;
osi_event_delete(p_env->adv_rpt_ready);
@ -2465,105 +2505,11 @@ void btc_gap_ble_deinit(void)
pkt_queue_destroy(p_env->adv_rpt_queue, NULL);
p_env->adv_rpt_queue = NULL;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_42_ADV_EN == TRUE)
btc_cleanup_adv_data(&gl_bta_adv_data);
btc_cleanup_adv_data(&gl_bta_scan_rsp_data);
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
}
#if SCAN_QUEUE_CONGEST_CHECK
void btc_adv_list_free(void *data)
{
osi_free(data);
}
void btc_adv_list_init(void)
{
osi_mutex_new(&adv_list_lock);
adv_filter_list = list_new(btc_adv_list_free);
}
void btc_adv_list_deinit(void)
{
osi_mutex_free(&adv_list_lock);
if(adv_filter_list) {
list_free(adv_filter_list);
adv_filter_list = NULL;
}
}
void btc_adv_list_add_packet(void * data)
{
if(!data) {
BTC_TRACE_ERROR("%s data is NULL", __func__);
return;
}
btc_adv_list_lock();
list_prepend(adv_filter_list, data);
btc_adv_list_unlock();
}
uint32_t btc_get_adv_list_length(void)
{
if(!adv_filter_list) {
BTC_TRACE_ERROR("%s adv_filter_list is NULL", __func__);
return 0;
}
btc_adv_list_lock();
size_t length = list_length(adv_filter_list);
btc_adv_list_unlock();
return length;
}
void btc_adv_list_refresh(void)
{
if(!adv_filter_list) {
BTC_TRACE_ERROR("%s adv_filter_list is NULL", __func__);
return ;
}
btc_adv_list_lock();
list_clear(adv_filter_list);
btc_adv_list_unlock();
}
bool btc_check_adv_list(uint8_t * addr, uint8_t addr_type)
{
bool found = false;
if(!adv_filter_list || !addr) {
BTC_TRACE_ERROR("%s adv_filter_list is NULL", __func__);
return found;
}
btc_adv_list_lock();
for (const list_node_t *node = list_begin(adv_filter_list); node != list_end(adv_filter_list); node = list_next(node)) {
btc_adv_packet_t *packet = (btc_adv_packet_t *)list_node(node);
if(!bdcmp(addr, packet->addr) && packet->addr_type == addr_type) {
found = true;
break;
}
}
btc_adv_list_unlock();
if(!found) {
btc_adv_packet_t *adv_packet = osi_malloc(sizeof(btc_adv_packet_t));
if(adv_packet) {
adv_packet->addr_type = addr_type;
bdcpy(adv_packet->addr, addr);
btc_adv_list_add_packet(adv_packet);
} else {
BTC_TRACE_ERROR("%s adv_packet malloc failed", __func__);
}
}
return found;
}
void btc_adv_list_lock(void)
{
osi_mutex_lock(&adv_list_lock, OSI_MUTEX_MAX_TIMEOUT);
}
void btc_adv_list_unlock(void)
{
osi_mutex_unlock(&adv_list_lock);
}
#endif
#endif ///BLE_INCLUDED == TRUE

View File

@ -903,14 +903,10 @@ void btc_hd_cb_handler(btc_msg_t *msg)
btc_hd_cb_to_app(ESP_HIDD_INTR_DATA_EVT, &param);
break;
case BTA_HD_VC_UNPLUG_EVT: {
bt_bdaddr_t *bd_addr = (bt_bdaddr_t *)&p_data->conn.bda;
if (bta_dm_check_if_only_hd_connected(p_data->conn.bda)) {
BTC_TRACE_DEBUG("%s: Removing bonding as only HID profile connected", __func__);
BTA_DmRemoveDevice((uint8_t *)&p_data->conn.bda, BT_TRANSPORT_BR_EDR);
} else {
BTC_TRACE_DEBUG("%s: Only removing HID data as some other profiles connected", __func__);
btc_hd_remove_device(*bd_addr);
}
#if BTC_HID_REMOVE_DEVICE_BONDING
BTC_TRACE_DEBUG("%s: Removing bonding information", __func__);
BTA_DmRemoveDevice((uint8_t *)&p_data->conn.bda, BT_TRANSPORT_BR_EDR);
#endif
if (btc_hd_cb.status == BTC_HD_DISCONNECTING || btc_hd_cb.status == BTC_HD_CONNECTING ||
btc_hd_cb.status == BTC_HD_CONNECTED) {

View File

@ -1372,7 +1372,10 @@ void btc_hh_cb_handler(btc_msg_t *msg)
*/
if (p_dev->local_vup) {
p_dev->local_vup = false;
#if BTC_HID_REMOVE_DEVICE_BONDING
BTA_DmRemoveDevice(p_dev->bd_addr, BT_TRANSPORT_BR_EDR);
#endif
btc_hh_remove_device(p_dev->bd_addr);
}
btc_hh_cb.status = (BTC_HH_STATUS)BTC_HH_DEV_DISCONNECTED;
@ -1406,8 +1409,9 @@ void btc_hh_cb_handler(btc_msg_t *msg)
// [boblane]
if (p_dev->local_vup) {
p_dev->local_vup = false;
#if BTC_HID_REMOVE_DEVICE_BONDING
BTA_DmRemoveDevice(p_dev->bd_addr, BT_TRANSPORT_BR_EDR);
} else {
#endif
btc_hh_remove_device(p_dev->bd_addr);
}
param.unplug.status = p_data->dev_status.status;

View File

@ -23,6 +23,9 @@
#include "stack/a2d_sbc.h"
#if (BTC_AV_INCLUDED == TRUE)
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
** Constants and data types
*****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -12,11 +12,13 @@
#if BTC_DYNAMIC_MEMORY == TRUE
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
#include "bta/bta_api.h"
extern tBTA_BLE_ADV_DATA *gl_bta_adv_data_ptr;
extern tBTA_BLE_ADV_DATA *gl_bta_scan_rsp_data_ptr;
#define gl_bta_adv_data (*gl_bta_adv_data_ptr)
#define gl_bta_scan_rsp_data (*gl_bta_scan_rsp_data_ptr)
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // BLE_42_FEATURE_SUPPORT
#endif
@ -64,6 +66,7 @@ typedef enum {
BTC_GAP_BLE_READ_PHY,
BTC_GAP_BLE_SET_PREFERED_DEF_PHY,
BTC_GAP_BLE_SET_DEF_PHY,
#if (BLE_50_EXTEND_ADV_EN == TRUE)
BTC_GAP_BLE_SET_EXT_ADV_RAND_ADDR,
BTC_GAP_BLE_SET_EXT_ADV_PARAMS,
BTC_GAP_BLE_CFG_EXT_ADV_DATA_RAW,
@ -72,23 +75,32 @@ typedef enum {
BTC_GAP_BLE_EXT_ADV_STOP,
BTC_GAP_BLE_EXT_ADV_SET_REMOVE,
BTC_GAP_BLE_EXT_ADV_SET_CLEAR,
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
BTC_GAP_BLE_SET_PERIODIC_ADV_PARAMS,
BTC_GAP_BLE_CFG_PERIODIC_ADV_DATA_RAW,
BTC_GAP_BLE_PERIODIC_ADV_START,
BTC_GAP_BLE_PERIODIC_ADV_STOP,
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
BTC_GAP_BLE_PERIODIC_ADV_CREATE_SYNC,
BTC_GAP_BLE_PERIODIC_ADV_SYNC_CANCEL,
BTC_GAP_BLE_PERIODIC_ADV_SYNC_TERMINATE,
BTC_GAP_BLE_PERIODIC_ADV_ADD_DEV_TO_LIST,
BTC_GAP_BLE_PERIODIC_REMOVE_ADD_DEV_FROM_LIST,
BTC_GAP_BLE_PERIODIC_CLEAR_DEV,
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
BTC_GAP_BLE_SET_EXT_SCAN_PARAMS,
BTC_GAP_BLE_START_EXT_SCAN,
BTC_GAP_BLE_STOP_EXT_SCAN,
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
BTC_GAP_BLE_SET_EXT_PEFER_CONNET_PARAMS,
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
BTC_GAP_BLE_DTM_ENH_TX_START,
BTC_GAP_BLE_DTM_ENH_RX_START,
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
BTC_GAP_BLE_ACT_GET_DEV_NAME,
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
BTC_GAP_BLE_PERIODIC_ADV_RECV_ENABLE,
@ -96,10 +108,10 @@ typedef enum {
BTC_GAP_BLE_PERIODIC_ADV_SET_INFO_TRANS,
BTC_GAP_BLE_SET_PERIODIC_ADV_SYNC_TRANS_PARAMS,
#endif //#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_DTM_TEST_EN == TRUE)
BTC_GAP_BLE_DTM_TX_START,
BTC_GAP_BLE_DTM_RX_START,
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
BTC_GAP_BLE_DTM_STOP,
#if (BLE_42_FEATURE_SUPPORT == TRUE)
BTC_GAP_BLE_ACT_CLEAR_ADV,
@ -257,6 +269,7 @@ typedef union {
struct set_channels_args {
esp_gap_ble_channels channels;
} set_channels;
#if (BLE_42_DTM_TEST_EN == TRUE)
struct dtm_tx_start_args {
uint8_t tx_channel;
uint8_t len_of_data;
@ -265,6 +278,7 @@ typedef union {
struct dtm_rx_start_args {
uint8_t rx_channel;
} dtm_rx_start;
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
//BTC_DEV_VENDOR_HCI_CMD_EVT
struct vendor_cmd_send_args {
uint16_t opcode;
@ -301,7 +315,7 @@ typedef union {
esp_ble_gap_phy_mask_t rx_phy_mask;
uint16_t phy_options;
} set_def_phy;
#if (BLE_50_EXTEND_ADV_EN == TRUE)
struct ext_adv_set_rand_addr_args {
uint8_t instance;
esp_bd_addr_t rand_addr;
@ -337,7 +351,9 @@ typedef union {
struct ext_adv_set_remove_args {
uint8_t instance;
} ext_adv_set_remove;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
struct peridic_adv_set_params_args {
uint8_t instance;
esp_ble_gap_periodic_adv_params_t params;
@ -358,6 +374,7 @@ typedef union {
struct periodic_adv_stop_args {
uint8_t instance;
} periodic_adv_stop;
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
struct periodic_adv_create_sync_args {
esp_ble_gap_periodic_adv_sync_params_t params;

View File

@ -102,6 +102,13 @@
#define UC_BT_HID_DEVICE_ENABLED FALSE
#endif
//HID remove device bonding option
#ifdef CONFIG_BT_HID_REMOVE_DEVICE_BONDING_ENABLED
#define UC_BT_HID_REMOVE_DEVICE_BONDING_ENABLED CONFIG_BT_HID_REMOVE_DEVICE_BONDING_ENABLED
#else
#define UC_BT_HID_REMOVE_DEVICE_BONDING_ENABLED FALSE
#endif
//BQB(BT)
#ifdef CONFIG_BT_CLASSIC_BQB_ENABLED
#define UC_BT_CLASSIC_BQB_ENABLED CONFIG_BT_CLASSIC_BQB_ENABLED
@ -147,12 +154,60 @@
#define UC_BT_BLE_42_FEATURES_SUPPORTED FALSE
#endif
#ifdef CONFIG_BT_BLE_42_DTM_TEST_EN
#define UC_BT_BLE_42_DTM_TEST_EN CONFIG_BT_BLE_42_DTM_TEST_EN
#else
#define UC_BT_BLE_42_DTM_TEST_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_42_ADV_EN
#define UC_BT_BLE_42_ADV_EN CONFIG_BT_BLE_42_ADV_EN
#else
#define UC_BT_BLE_42_ADV_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_42_SCAN_EN
#define UC_BT_BLE_42_SCAN_EN CONFIG_BT_BLE_42_SCAN_EN
#else
#define UC_BT_BLE_42_SCAN_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER
#define UC_BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER CONFIG_BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER
#else
#define UC_BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER FALSE
#endif
#ifdef CONFIG_BT_BLE_50_EXTEND_ADV_EN
#define UC_BT_BLE_50_EXTEND_ADV_EN CONFIG_BT_BLE_50_EXTEND_ADV_EN
#else
#define UC_BT_BLE_50_EXTEND_ADV_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_50_PERIODIC_ADV_EN
#define UC_BT_BLE_50_PERIODIC_ADV_EN CONFIG_BT_BLE_50_PERIODIC_ADV_EN
#else
#define UC_BT_BLE_50_PERIODIC_ADV_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_50_EXTEND_SCAN_EN
#define UC_BT_BLE_50_EXTEND_SCAN_EN CONFIG_BT_BLE_50_EXTEND_SCAN_EN
#else
#define UC_BT_BLE_50_EXTEND_SCAN_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_50_EXTEND_SYNC_EN
#define UC_BT_BLE_50_EXTEND_SYNC_EN CONFIG_BT_BLE_50_EXTEND_SYNC_EN
#else
#define UC_BT_BLE_50_EXTEND_SYNC_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_50_DTM_TEST_EN
#define UC_BT_BLE_50_DTM_TEST_EN CONFIG_BT_BLE_50_DTM_TEST_EN
#else
#define UC_BT_BLE_50_DTM_TEST_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH
#define UC_BT_BLE_FEAT_PERIODIC_ADV_ENH CONFIG_BT_BLE_FEAT_PERIODIC_ADV_ENH
#else
@ -320,14 +375,6 @@
#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_PPCP_CHAR_GAP
#define UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP CONFIG_BT_GATTS_PPCP_CHAR_GAP
#else

View File

@ -168,6 +168,10 @@
#define BTC_HD_INCLUDED TRUE
#endif /* UC_BT_HID_DEVICE_ENABLED */
#if UC_BT_HID_REMOVE_DEVICE_BONDING_ENABLED
#define BTC_HID_REMOVE_DEVICE_BONDING TRUE
#endif
#endif /* UC_BT_CLASSIC_ENABLED */
/* This is set to enable use of GAP L2CAP connections. */
@ -211,6 +215,54 @@
#define BLE_50_FEATURE_SUPPORT FALSE
#endif /* UC_BT_BLE_ENABLED */
#if (UC_BT_BLE_42_DTM_TEST_EN == TRUE)
#define BLE_42_DTM_TEST_EN TRUE
#else
#define BLE_42_DTM_TEST_EN FALSE
#endif
#if (UC_BT_BLE_42_ADV_EN == TRUE)
#define BLE_42_ADV_EN TRUE
#else
#define BLE_42_ADV_EN FALSE
#endif
#if (UC_BT_BLE_42_SCAN_EN == TRUE)
#define BLE_42_SCAN_EN TRUE
#else
#define BLE_42_SCAN_EN FALSE
#endif
#if (UC_BT_BLE_50_EXTEND_ADV_EN == TRUE)
#define BLE_50_EXTEND_ADV_EN TRUE
#else
#define BLE_50_EXTEND_ADV_EN FALSE
#endif
#if (UC_BT_BLE_50_PERIODIC_ADV_EN == TRUE)
#define BLE_50_PERIODIC_ADV_EN TRUE
#else
#define BLE_50_PERIODIC_ADV_EN FALSE
#endif
#if (UC_BT_BLE_50_EXTEND_SCAN_EN == TRUE)
#define BLE_50_EXTEND_SCAN_EN TRUE
#else
#define BLE_50_EXTEND_SCAN_EN FALSE
#endif
#if (UC_BT_BLE_50_EXTEND_SYNC_EN == TRUE)
#define BLE_50_EXTEND_SYNC_EN TRUE
#else
#define BLE_50_EXTEND_SYNC_EN FALSE
#endif
#if (UC_BT_BLE_50_DTM_TEST_EN == TRUE)
#define BLE_50_DTM_TEST_EN TRUE
#else
#define BLE_50_DTM_TEST_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#define BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER TRUE
#else
@ -404,6 +456,10 @@
#define BTC_HD_INCLUDED FALSE
#endif
#ifndef BTC_HID_REMOVE_DEVICE_BONDING
#define BTC_HID_REMOVE_DEVICE_BONDING FALSE
#endif
#ifndef SBC_DEC_INCLUDED
#define SBC_DEC_INCLUDED FALSE
#endif
@ -540,12 +596,6 @@
#define BTA_AV_CO_CP_SCMS_T FALSE
#endif
#if UC_BT_BLE_HOST_QUEUE_CONGESTION_CHECK
#define SCAN_QUEUE_CONGEST_CHECK TRUE
#else
#define SCAN_QUEUE_CONGEST_CHECK FALSE
#endif
#ifdef UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP
#define BTM_PERIPHERAL_ENABLED UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP
#endif
@ -1264,7 +1314,72 @@
#endif
#ifndef BLE_ANDROID_CONTROLLER_SCAN_FILTER
#define BLE_ANDROID_CONTROLLER_SCAN_FILTER TRUE
#define BLE_ANDROID_CONTROLLER_SCAN_FILTER FALSE
#endif
#ifndef BLE_HOST_BLE_MULTI_ADV_EN
#define BLE_HOST_BLE_MULTI_ADV_EN FALSE
#endif
#ifndef BLE_HOST_TRACK_ADVERTISER_EN
#define BLE_HOST_TRACK_ADVERTISER_EN FALSE
#endif
#ifndef BLE_HOST_ENERGY_INFO_EN
#define BLE_HOST_ENERGY_INFO_EN FALSE
#endif
#ifndef BLE_HOST_ENABLE_TEST_MODE_EN
#define BLE_HOST_ENABLE_TEST_MODE_EN FALSE
#endif
#ifndef BLE_HOST_EXECUTE_CBACK_EN
#define BLE_HOST_EXECUTE_CBACK_EN FALSE
#endif
#ifndef BLE_HOST_REMOVE_ALL_ACL_EN
#define BLE_HOST_REMOVE_ALL_ACL_EN FALSE
#endif
#ifndef BLE_HOST_REMOVE_AN_ACL_EN
#define BLE_HOST_REMOVE_AN_ACL_EN FALSE
#endif
#ifndef BLE_HOST_READ_TX_POWER_EN
#define BLE_HOST_READ_TX_POWER_EN FALSE
#endif
#ifndef BLE_HOST_STOP_ADV_UNUSED
#define BLE_HOST_STOP_ADV_UNUSED FALSE
#endif
#ifndef BLE_HOST_BLE_OBSERVE_EN
#define BLE_HOST_BLE_OBSERVE_EN FALSE
#endif
#ifndef BLE_HOST_BLE_SCAN_PARAM_UNUSED
#define BLE_HOST_BLE_SCAN_PARAM_UNUSED FALSE
#endif
#ifndef BLE_HOST_CONN_SCAN_PARAM_EN
#define BLE_HOST_CONN_SCAN_PARAM_EN FALSE
#endif
#ifndef BLE_HOST_SETUP_STORAGE_EN
#define BLE_HOST_SETUP_STORAGE_EN FALSE
#endif
#ifndef BLE_HOST_READ_SCAN_REPORTS_EN
#define BLE_HOST_READ_SCAN_REPORTS_EN FALSE
#endif
#ifndef BLE_HOST_BATCH_SCAN_EN
#define BLE_HOST_BATCH_SCAN_EN FALSE
#endif
#ifndef BLE_HOST_BG_CONNECT_EN
#define BLE_HOST_BG_CONNECT_EN FALSE
#endif
#ifndef LOCAL_BLE_CONTROLLER_ID

View File

@ -83,7 +83,9 @@ typedef struct {
bool simple_pairing_supported;
bool secure_connections_supported;
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
uint16_t ble_ext_adv_data_max_len;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
} controller_local_param_t;
@ -119,11 +121,13 @@ static void start_up(void)
response = AWAIT_COMMAND(controller_param.packet_factory->make_set_c2h_flow_control(HCI_HOST_FLOW_CTRL_ACL_ON));
controller_param.packet_parser->parse_generic_command_complete(response);
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
// Enable adv flow control
response = AWAIT_COMMAND(controller_param.packet_factory->make_set_adv_report_flow_control(HCI_HOST_FLOW_CTRL_ADV_REPORT_ON, (uint16_t)BLE_ADV_REPORT_FLOW_CONTROL_NUM, (uint16_t)BLE_ADV_REPORT_DISCARD_THRSHOLD));
controller_param.packet_parser->parse_generic_command_complete(response);
#endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
// Tell the controller about our buffer sizes and buffer counts next
// TODO(zachoverflow): factor this out. eww l2cap contamination. And why just a hardcoded 10?
response = AWAIT_COMMAND(
@ -265,16 +269,20 @@ static void start_up(void)
&controller_param.ble_resolving_list_max_size);
}
#if BLE_50_FEATURE_SUPPORT == TRUE
#if (BLE_50_EXTEND_ADV_EN == TRUE)
controller_param.ble_ext_adv_data_max_len = BLE_EXT_ADV_DATA_LEN_MAX;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
if (HCI_LE_EXT_ADV_SUPPORTED(controller_param.features_ble.as_array)) {
response = AWAIT_COMMAND(controller_param.packet_factory->make_read_max_adv_data_len());
controller_param.packet_parser->parse_ble_read_adv_max_len_response(
response,
&controller_param.ble_ext_adv_data_max_len);
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(controller_param.features_ble.as_array)) {
@ -508,6 +516,7 @@ static void set_ble_resolving_list_max_size(int resolving_list_max_size)
controller_param.ble_resolving_list_max_size = resolving_list_max_size;
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static uint16_t ble_get_ext_adv_data_max_len(void)
{
assert(controller_param.readable);
@ -515,6 +524,7 @@ static uint16_t ble_get_ext_adv_data_max_len(void)
return controller_param.ble_ext_adv_data_max_len;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BTM_SCO_HCI_INCLUDED == TRUE)
static uint8_t get_sco_data_size(void)
@ -574,7 +584,9 @@ static const controller_t interface = {
get_ble_resolving_list_max_size,
set_ble_resolving_list_max_size,
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
ble_get_ext_adv_data_max_len,
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BTM_SCO_HCI_INCLUDED == TRUE)
get_sco_data_size,

View File

@ -81,7 +81,9 @@ typedef struct controller_t {
void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
uint16_t (*ble_get_ext_adv_data_max_len)(void);
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // BLE_50_FEATURE_SUPPORT
#if (BTM_SCO_HCI_INCLUDED == TRUE)

View File

@ -52,9 +52,6 @@
#define HCI_HAL_BLE_ADV_RPT_QUEUE_LEN_MAX (200)
#endif
extern bool BTU_check_queue_is_congest(void);
static const uint8_t preamble_sizes[] = {
HCI_COMMAND_PREAMBLE_SIZE,
HCI_ACL_PREAMBLE_SIZE,
@ -71,6 +68,7 @@ static const uint16_t outbound_event_types[] = {
typedef struct {
fixed_queue_t *rx_q;
#if (BLE_42_SCAN_EN == TRUE)
struct pkt_queue *adv_rpt_q;
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
osi_mutex_t adv_flow_lock;
@ -80,6 +78,7 @@ typedef struct {
pkt_linked_item_t *adv_fc_cmd_buf;
bool cmd_buf_in_use;
#endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
hci_hal_callbacks_t *callbacks;
osi_thread_t *hci_h4_thread;
struct osi_event *upstream_data_ready;
@ -93,15 +92,18 @@ static const esp_bluedroid_hci_driver_callbacks_t hci_host_cb;
static void host_send_pkt_available_cb(void);
static int host_recv_pkt_cb(uint8_t *data, uint16_t len);
static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet);
#if (BLE_42_SCAN_EN == TRUE)
static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt);
#endif // #if (BLE_42_SCAN_EN == TRUE)
static void hci_upstream_data_handler(void *arg);
static bool hci_upstream_data_post(uint32_t timeout);
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
static void hci_adv_flow_monitor(void *context);
static void hci_adv_flow_cmd_free_cb(pkt_linked_item_t *linked_pkt);
#endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thread_t *task_thread)
{
assert(upper_callbacks != NULL);
@ -109,7 +111,7 @@ static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thr
hci_hal_env.hci_h4_thread = task_thread;
hci_hal_env.callbacks = (hci_hal_callbacks_t *)upper_callbacks;
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_hal_env.adv_fc_cmd_buf = osi_calloc(HCI_CMD_LINKED_BUF_SIZE(HCIC_PARAM_SIZE_BLE_UPDATE_ADV_FLOW_CONTROL));
assert(hci_hal_env.adv_fc_cmd_buf != NULL);
@ -122,13 +124,13 @@ static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thr
hci_hal_env.adv_flow_monitor = osi_alarm_new("adv_fc_mon", hci_adv_flow_monitor, NULL, HCI_ADV_FLOW_MONITOR_PERIOD_MS);
assert (hci_hal_env.adv_flow_monitor != NULL);
#endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.rx_q = fixed_queue_new(QUEUE_SIZE_MAX);
assert(hci_hal_env.rx_q != NULL);
#if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.adv_rpt_q = pkt_queue_create();
assert(hci_hal_env.adv_rpt_q != NULL);
#endif // #if (BLE_42_SCAN_EN == TRUE)
struct osi_event *event = osi_event_create(hci_upstream_data_handler, NULL);
assert(event != NULL);
hci_hal_env.upstream_data_ready = event;
@ -140,19 +142,23 @@ static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thr
static void hci_hal_env_deinit(void)
{
fixed_queue_t *rx_q = hci_hal_env.rx_q;
#if (BLE_42_SCAN_EN == TRUE)
struct pkt_queue *adv_rpt_q = hci_hal_env.adv_rpt_q;
#endif // #if (BLE_42_SCAN_EN == TRUE)
struct osi_event *upstream_data_ready = hci_hal_env.upstream_data_ready;
hci_hal_env.rx_q = NULL;
#if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.adv_rpt_q = NULL;
#endif // #if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.upstream_data_ready = NULL;
fixed_queue_free(rx_q, osi_free_func);
#if (BLE_42_SCAN_EN == TRUE)
pkt_queue_destroy(adv_rpt_q, NULL);
#endif // #if (BLE_42_SCAN_EN == TRUE)
osi_event_delete(upstream_data_ready);
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_hal_env.cmd_buf_in_use = true;
osi_alarm_cancel(hci_hal_env.adv_flow_monitor);
@ -162,7 +168,7 @@ static void hci_hal_env_deinit(void)
osi_free(hci_hal_env.adv_fc_cmd_buf);
hci_hal_env.adv_fc_cmd_buf = NULL;
#endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.hci_h4_thread = NULL;
memset(&hci_hal_env, 0, sizeof(hci_hal_env_t));
@ -225,7 +231,9 @@ static uint16_t transmit_data(serial_data_type_t type,
static void hci_upstream_data_handler(void *arg)
{
fixed_queue_t *rx_q = hci_hal_env.rx_q;
#if (BLE_42_SCAN_EN == TRUE)
struct pkt_queue *adv_rpt_q = hci_hal_env.adv_rpt_q;
#endif // #if (BLE_42_SCAN_EN == TRUE)
size_t pkts_to_process;
do {
@ -237,7 +245,7 @@ static void hci_upstream_data_handler(void *arg)
}
}
} while (0);
#if (BLE_42_SCAN_EN == TRUE)
do {
pkts_to_process = pkt_queue_length(adv_rpt_q);
for (size_t i = 0; i < pkts_to_process; i++) {
@ -247,8 +255,12 @@ static void hci_upstream_data_handler(void *arg)
}
}
} while (0);
if (!fixed_queue_is_empty(rx_q) || pkt_queue_length(adv_rpt_q) > 0) {
#endif // #if (BLE_42_SCAN_EN == TRUE)
if (!fixed_queue_is_empty(rx_q)
#if (BLE_42_SCAN_EN == TRUE)
|| pkt_queue_length(adv_rpt_q) > 0
#endif // #if (BLE_42_SCAN_EN == TRUE)
) {
hci_upstream_data_post(OSI_THREAD_MAX_TIMEOUT);
}
}
@ -289,6 +301,7 @@ bool host_recv_adv_packet(uint8_t *packet)
return false;
}
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
static void hci_adv_flow_monitor(void *context)
{
@ -414,6 +427,7 @@ int hci_adv_credits_force_release(uint16_t num)
return credits_released;
}
#endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
{
@ -475,7 +489,7 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
packet->event = outbound_event_types[PACKET_TYPE_TO_INDEX(type)];
hci_hal_env.callbacks->packet_ready(packet);
}
#if (BLE_42_SCAN_EN == TRUE)
static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt)
{
uint8_t type;
@ -511,13 +525,6 @@ static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt)
goto _discard_packet;
}
#if SCAN_QUEUE_CONGEST_CHECK
if(BTU_check_queue_is_congest()) {
HCI_TRACE_DEBUG("BtuQueue is congested");
goto _discard_packet;
}
#endif
packet->event = outbound_event_types[PACKET_TYPE_TO_INDEX(type)];
hci_hal_env.callbacks->adv_rpt_ready(linked_pkt);
@ -529,6 +536,7 @@ _discard_packet:
hci_adv_credits_prep_to_release(1);
#endif
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
static void host_send_pkt_available_cb(void)
{
@ -561,7 +569,9 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
{
//Target has packet to host, malloc new buffer for packet
BT_HDR *pkt = NULL;
#if (BLE_42_SCAN_EN == TRUE)
pkt_linked_item_t *linked_pkt = NULL;
#endif // #if (BLE_42_SCAN_EN == TRUE)
size_t pkt_size;
if (hci_hal_env.rx_q == NULL) {
@ -586,6 +596,7 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
memcpy(pkt->data, data, len);
fixed_queue_enqueue(hci_hal_env.rx_q, pkt, FIXED_QUEUE_MAX_TIMEOUT);
} else {
#if (BLE_42_SCAN_EN == TRUE)
#if !BLE_ADV_REPORT_FLOW_CONTROL
// drop the packets if pkt_queue length goes beyond upper limit
if (pkt_queue_length(hci_hal_env.adv_rpt_q) > HCI_HAL_BLE_ADV_RPT_QUEUE_LEN_MAX) {
@ -614,6 +625,9 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_adv_credits_consumed(1);
#endif
#else
assert(0);
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
hci_upstream_data_post(OSI_THREAD_MAX_TIMEOUT);

View File

@ -537,9 +537,11 @@ static void dispatch_adv_report(pkt_linked_item_t *linked_pkt)
//Tell Up-layer received packet.
if (btu_task_post(SIG_BTU_HCI_ADV_RPT_MSG, linked_pkt, OSI_THREAD_MAX_TIMEOUT) == false) {
osi_free(linked_pkt);
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_adv_credits_try_release(1);
#endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
}
// Misc internal functions

View File

@ -52,6 +52,7 @@ static BT_HDR *make_set_c2h_flow_control(uint8_t enable)
return packet;
}
#if (BLE_42_SCAN_EN == TRUE)
static BT_HDR *make_set_adv_report_flow_control(uint8_t enable, uint16_t num, uint16_t lost_threshold)
{
uint8_t *stream;
@ -63,7 +64,7 @@ static BT_HDR *make_set_adv_report_flow_control(uint8_t enable, uint16_t num, ui
UINT16_TO_STREAM(stream, lost_threshold);
return packet;
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
static BT_HDR *make_host_buffer_size(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count)
{
uint8_t *stream;
@ -219,10 +220,12 @@ static BT_HDR *make_write_default_erroneous_data_report(uint8_t enable)
return packet;
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static BT_HDR *make_read_max_adv_data_len(void)
{
return make_command_no_params(HCI_BLE_RD_MAX_ADV_DATA_LEN);
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
// Internal functions
@ -252,7 +255,9 @@ static const hci_packet_factory_t interface = {
make_reset,
make_read_buffer_size,
make_set_c2h_flow_control,
#if (BLE_42_SCAN_EN == TRUE)
make_set_adv_report_flow_control,
#endif // #if (BLE_42_SCAN_EN == TRUE)
make_host_buffer_size,
make_read_local_version_info,
make_read_bd_addr,
@ -269,7 +274,9 @@ static const hci_packet_factory_t interface = {
make_ble_read_local_supported_features,
make_ble_read_resolving_list_size,
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
make_read_max_adv_data_len,
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
make_ble_read_suggested_default_data_length,
make_ble_write_suggested_default_data_length,

View File

@ -209,6 +209,7 @@ static void parse_ble_read_suggested_default_data_length_response(
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static void parse_ble_read_adv_max_len_response(
BT_HDR *response,
uint16_t *adv_max_len_ptr)
@ -221,6 +222,7 @@ static void parse_ble_read_adv_max_len_response(
}
osi_free(response);
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
@ -282,7 +284,9 @@ static const hci_packet_parser_t interface = {
parse_ble_read_local_supported_features_response,
parse_ble_read_resolving_list_size_response,
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
parse_ble_read_adv_max_len_response,
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
parse_ble_read_suggested_default_data_length_response
};

View File

@ -104,10 +104,11 @@ void hci_shut_down(void);
bool hci_downstream_data_post(uint32_t timeout);
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
int hci_adv_credits_prep_to_release(uint16_t num);
int hci_adv_credits_try_release(uint16_t num);
int hci_adv_credits_force_release(uint16_t num);
#endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif /* _HCI_LAYER_H_ */

View File

@ -26,7 +26,9 @@ typedef struct {
BT_HDR *(*make_reset)(void);
BT_HDR *(*make_read_buffer_size)(void);
BT_HDR *(*make_set_c2h_flow_control)(uint8_t enable);
#if (BLE_42_SCAN_EN == TRUE)
BT_HDR *(*make_set_adv_report_flow_control)(uint8_t enable, uint16_t num, uint16_t lost_threshold);
#endif // #if (BLE_42_SCAN_EN == TRUE)
BT_HDR *(*make_host_buffer_size)(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count);
BT_HDR *(*make_read_local_version_info)(void);
BT_HDR *(*make_read_bd_addr)(void);
@ -43,7 +45,9 @@ typedef struct {
BT_HDR *(*make_ble_read_local_supported_features)(void);
BT_HDR *(*make_ble_read_resolving_list_size)(void);
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
BT_HDR *(*make_read_max_adv_data_len)(void);
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
BT_HDR *(*make_ble_read_suggested_default_data_length)(void);
BT_HDR *(*make_ble_write_suggested_default_data_length)(uint16_t SuggestedMaxTxOctets, uint16_t SuggestedMaxTxTime);

View File

@ -95,10 +95,12 @@ typedef struct {
uint8_t *resolving_list_size_ptr
);
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
void (*parse_ble_read_adv_max_len_response) (
BT_HDR *respone,
BT_HDR *response,
uint16_t *ble_ext_adv_data_max_len_ptr
);
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
void (*parse_ble_read_suggested_default_data_length_response)(
BT_HDR *response,

View File

@ -2060,6 +2060,7 @@ tBTM_STATUS BTM_ReadLinkQuality (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb)
return (BTM_UNKNOWN_ADDR);
}
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
/*******************************************************************************
**
** Function BTM_ReadTxPower
@ -2116,6 +2117,7 @@ tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_C
/* If here, no BD Addr found */
return (BTM_UNKNOWN_ADDR);
}
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
tBTM_STATUS BTM_SetAclPktTypes(BD_ADDR remote_bda, UINT16 pkt_types, tBTM_CMPL_CB *p_cb)
{
@ -2182,6 +2184,7 @@ void btm_acl_pkt_types_changed(UINT8 status, UINT16 handle, UINT16 pkt_types)
}
#if (BLE_INCLUDED == TRUE)
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb)
{
BOOLEAN ret;
@ -2208,6 +2211,7 @@ tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb)
return BTM_CMD_STARTED;
}
}
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
void BTM_BleGetWhiteListSize(uint16_t *length)
{
@ -2220,6 +2224,7 @@ void BTM_BleGetWhiteListSize(uint16_t *length)
}
#endif ///BLE_INCLUDED == TRUE
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
/*******************************************************************************
**
** Function btm_read_tx_power_complete
@ -2273,6 +2278,7 @@ void btm_read_tx_power_complete (UINT8 *p, BOOLEAN is_ble)
(*p_cb)(&results);
}
}
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
/*******************************************************************************
**

View File

@ -553,6 +553,7 @@ void BTM_BleSecureConnectionCreateOobData(void)
#endif
}
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
/******************************************************************************
**
** Function BTM_BleSetConnScanParams
@ -582,15 +583,17 @@ void BTM_BleSetConnScanParams (UINT32 scan_interval, UINT32 scan_window)
p_ble_cb->scan_win = scan_window;
new_param = TRUE;
}
#if (tGATT_BG_CONN_DEV == TRUE)
if (new_param && p_ble_cb->conn_state == BLE_BG_CONN) {
btm_ble_suspend_bg_conn();
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
} else {
BTM_TRACE_ERROR("Illegal Connection Scan Parameters");
}
#endif
}
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
/********************************************************
**
@ -766,6 +769,7 @@ BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, tBT_TRANSPORT tran
}
#if (BLE_INCLUDED == TRUE)
#if (BLE_42_DTM_TEST_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleReceiverTest
@ -805,7 +809,8 @@ void BTM_BleTransmitterTest(UINT8 tx_freq, UINT8 test_data_len,
BTM_TRACE_ERROR("%s: Unable to Trigger LE transmitter test", __FUNCTION__);
}
}
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
/*******************************************************************************
**
** Function BTM_BleTestEnd
@ -837,9 +842,9 @@ void btm_ble_test_command_complete(UINT8 *p)
(*p_cb)(p);
}
}
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleEnhancedReceiverTest
@ -882,7 +887,7 @@ void BTM_BleEnhancedTransmitterTest(UINT8 tx_freq, UINT8 test_data_len,
BTM_TRACE_ERROR("%s: Unable to Trigger LE enhanced transmitter test", __FUNCTION__);
}
}
#endif // BLE_50_FEATURE_SUPPORT
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
/*******************************************************************************
**

View File

@ -21,6 +21,7 @@ extern BOOLEAN BTM_GetLocalResolvablePrivateAddr(BD_ADDR bda);
extern void BTM_UpdateAddrInfor(uint8_t addr_type, BD_ADDR bda);
extern void BTM_BleSetStaticAddr(BD_ADDR rand_addr);
extern uint32_t BTM_BleUpdateOwnType(uint8_t *own_bda_type, tBTM_START_ADV_CMPL_CBACK *cb);
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static tBTM_STATUS btm_ble_ext_adv_params_validate(tBTM_BLE_GAP_EXT_ADV_PARAMS *params);
static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len, UINT8 *data);
@ -35,6 +36,8 @@ typedef struct {
} tBTM_EXT_ADV_RECORD;
tBTM_EXT_ADV_RECORD adv_record[MAX_BLE_ADV_INSTANCE] = {0};
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
extern void btm_ble_inter_set(bool extble_inter);
#if !UC_BT_STACK_NO_LOG
@ -193,11 +196,12 @@ void btm_ble_extendadvcb_init(void)
{
memset(&extend_adv_cb, 0, sizeof(tBTM_BLE_EXTENDED_CB));
}
#if (BLE_50_EXTEND_ADV_EN == TRUE)
void btm_ble_advrecod_init(void)
{
memset(&adv_record[0], 0, sizeof(tBTM_EXT_ADV_RECORD)*MAX_BLE_ADV_INSTANCE);
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
void BTM_BleGapRegisterCallback(tBTM_BLE_5_HCI_CBACK cb)
{
@ -286,6 +290,7 @@ tBTM_STATUS BTM_BleSetPreferPhy(BD_ADDR bd_addr, UINT8 all_phys, UINT8 tx_phy_ma
return BTM_SUCCESS;
}
#if (BLE_50_EXTEND_ADV_EN == TRUE)
tBTM_STATUS BTM_BleSetExtendedAdvRandaddr(UINT8 instance, BD_ADDR rand_addr)
{
tBTM_STATUS status = BTM_SUCCESS;
@ -678,7 +683,9 @@ tBTM_STATUS BTM_BleExtAdvSetClear(void)
return status;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Params *params)
{
tBTM_STATUS status = BTM_SUCCESS;
@ -806,7 +813,9 @@ end:
return status;
}
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params)
{
//tHCI_STATUS err = HCI_SUCCESS;
@ -864,6 +873,7 @@ end:
return status;
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
void btm_set_phy_callback(UINT8 status)
{
@ -874,6 +884,7 @@ void btm_set_phy_callback(UINT8 status)
}
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
void btm_create_sync_callback(UINT8 status)
{
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
@ -881,6 +892,7 @@ void btm_create_sync_callback(UINT8 status)
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT, &cb_params);
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
void btm_read_phy_callback(uint8_t hci_status, uint16_t conn_handle, uint8_t tx_phy, uint8_t rx_phy)
{
@ -901,6 +913,7 @@ void btm_read_phy_callback(uint8_t hci_status, uint16_t conn_handle, uint8_t tx_
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_READ_PHY_COMPLETE_EVT, &cb_params);
}
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
tBTM_STATUS BTM_BlePeriodicAdvSyncCancel(void)
{
tHCI_STATUS err = HCI_SUCCESS;
@ -1001,7 +1014,9 @@ tBTM_STATUS BTM_BlePeriodicAdvClearDev(void)
return status;
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
tBTM_STATUS BTM_BleSetExtendedScanParams(tBTM_BLE_EXT_SCAN_PARAMS *params)
{
UINT8 phy_mask = 0;
@ -1082,6 +1097,7 @@ end:
return status;
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
void BTM_BleSetPreferExtenedConnParams (BD_ADDR bd_addr, tBTM_EXT_CONN_PARAMS *params)
{
@ -1115,6 +1131,7 @@ void btm_ble_extended_cleanup(void)
}
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static tBTM_STATUS btm_ble_ext_adv_params_validate(tBTM_BLE_GAP_EXT_ADV_PARAMS *params)
{
if (!params) {
@ -1191,6 +1208,7 @@ static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len,
return BTM_SUCCESS;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
void btm_ble_update_phy_evt(tBTM_BLE_UPDATE_PHY *params)
{
@ -1218,11 +1236,14 @@ void btm_ble_update_phy_evt(tBTM_BLE_UPDATE_PHY *params)
return;
}
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
void btm_ble_scan_timeout_evt(void)
{
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_SCAN_TIMEOUT_EVT, NULL);
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
void btm_ble_adv_set_terminated_evt(tBTM_BLE_ADV_TERMINAT *params)
{
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
@ -1248,7 +1269,9 @@ void btm_ble_adv_set_terminated_evt(tBTM_BLE_ADV_TERMINAT *params)
return;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
void btm_ble_ext_adv_report_evt(tBTM_BLE_EXT_ADV_REPORT *params)
{
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
@ -1266,7 +1289,9 @@ void btm_ble_ext_adv_report_evt(tBTM_BLE_EXT_ADV_REPORT *params)
return;
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
void btm_ble_scan_req_received_evt(tBTM_BLE_SCAN_REQ_RECEIVED *params)
{
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
@ -1283,7 +1308,7 @@ void btm_ble_scan_req_received_evt(tBTM_BLE_SCAN_REQ_RECEIVED *params)
return;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
void btm_ble_channel_select_algorithm_evt(tBTM_BLE_CHANNEL_SEL_ALG *params)
{
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
@ -1301,6 +1326,7 @@ void btm_ble_channel_select_algorithm_evt(tBTM_BLE_CHANNEL_SEL_ALG *params)
return;
}
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
void btm_ble_periodic_adv_report_evt(tBTM_PERIOD_ADV_REPORT *params)
{
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
@ -1354,7 +1380,9 @@ void btm_ble_periodic_adv_sync_establish_evt(tBTM_BLE_PERIOD_ADV_SYNC_ESTAB *par
return;
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
uint8_t btm_ble_ext_adv_active_count(void)
{
uint8_t count = 0;
@ -1367,6 +1395,7 @@ uint8_t btm_ble_ext_adv_active_count(void)
return count;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)

View File

@ -22,6 +22,7 @@
#include "common/bt_target.h"
#if (BLE_INCLUDED == TRUE)
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
#include "stack/bt_types.h"
#include "stack/hcimsgs.h"
#include "stack/btu.h"
@ -445,11 +446,11 @@ BOOLEAN btm_ble_dealloc_addr_filter_counter(tBLE_BD_ADDR *p_bd_addr, UINT8 filte
**
** Function btm_ble_update_pf_local_name
**
** Description this function update(add,delete or clear) the adv lcoal name filtering condition.
** Description this function update(add,delete or clear) the adv local name filtering condition.
**
**
** Returns BTM_SUCCESS if sucessful,
** BTM_ILLEGAL_VALUE if paramter is not valid.
** Returns BTM_SUCCESS if successful,
** BTM_ILLEGAL_VALUE if parameter is not valid.
**
*******************************************************************************/
tBTM_STATUS btm_ble_update_pf_local_name(tBTM_BLE_SCAN_COND_OP action,
@ -506,8 +507,8 @@ tBTM_STATUS btm_ble_update_pf_local_name(tBTM_BLE_SCAN_COND_OP action,
** Description this function update(add/remove) service data change filter.
**
**
** Returns BTM_SUCCESS if sucessful,
** BTM_ILLEGAL_VALUE if paramter is not valid.
** Returns BTM_SUCCESS if successful,
** BTM_ILLEGAL_VALUE if parameter is not valid.
**
*******************************************************************************/
tBTM_STATUS btm_ble_update_srvc_data_change(tBTM_BLE_SCAN_COND_OP action,
@ -534,8 +535,8 @@ tBTM_STATUS btm_ble_update_srvc_data_change(tBTM_BLE_SCAN_COND_OP action,
** data filtering condition.
**
**
** Returns BTM_SUCCESS if sucessful,
** BTM_ILLEGAL_VALUE if paramter is not valid.
** Returns BTM_SUCCESS if successful,
** BTM_ILLEGAL_VALUE if parameter is not valid.
**
*******************************************************************************/
tBTM_STATUS btm_ble_update_pf_manu_data(tBTM_BLE_SCAN_COND_OP action,
@ -708,8 +709,8 @@ UINT8 btm_ble_cs_update_pf_counter(tBTM_BLE_SCAN_COND_OP action,
** Description this function update(add,delete or clear) the address filter of adv.
**
**
** Returns BTM_SUCCESS if sucessful,
** BTM_ILLEGAL_VALUE if paramter is not valid.
** Returns BTM_SUCCESS if successful,
** BTM_ILLEGAL_VALUE if parameter is not valid.
**
*******************************************************************************/
tBTM_STATUS btm_ble_update_addr_filter(tBTM_BLE_SCAN_COND_OP action,
@ -757,8 +758,8 @@ tBTM_STATUS btm_ble_update_addr_filter(tBTM_BLE_SCAN_COND_OP action,
** Description this function update(add,delete or clear) service UUID filter.
**
**
** Returns BTM_SUCCESS if sucessful,
** BTM_ILLEGAL_VALUE if paramter is not valid.
** Returns BTM_SUCCESS if successful,
** BTM_ILLEGAL_VALUE if parameter is not valid.
**
*******************************************************************************/
tBTM_STATUS btm_ble_update_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
@ -872,7 +873,7 @@ tBTM_STATUS btm_ble_update_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
}
} else {
BTM_TRACE_ERROR("UUID filter udpating failed");
BTM_TRACE_ERROR("UUID filter updating failed");
}
return st;
@ -886,8 +887,8 @@ tBTM_STATUS btm_ble_update_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
** Description clear all adv payload filter by de-select all the adv pf feature bits
**
**
** Returns BTM_SUCCESS if sucessful,
** BTM_ILLEGAL_VALUE if paramter is not valid.
** Returns BTM_SUCCESS if successful,
** BTM_ILLEGAL_VALUE if parameter is not valid.
**
*******************************************************************************/
tBTM_STATUS btm_ble_clear_scan_pf_filter(tBTM_BLE_SCAN_COND_OP action,
@ -1303,4 +1304,5 @@ void btm_ble_adv_filter_cleanup(void)
#endif
}
#endif // #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
#endif

View File

@ -29,15 +29,22 @@
#include "stack/hcimsgs.h"
#if (BLE_INCLUDED == TRUE)
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#if BTM_DYNAMIC_MEMORY == FALSE
tBTM_BLE_BATCH_SCAN_CB ble_batchscan_cb;
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
tBTM_BLE_ADV_TRACK_CB ble_advtrack_cb;
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#else
tBTM_BLE_BATCH_SCAN_CB *ble_batchscan_cb_ptr;
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
tBTM_BLE_ADV_TRACK_CB *ble_advtrack_cb_ptr;
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#define ble_batchscan_cb (*ble_batchscan_cb_ptr)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#define ble_advtrack_cb (*ble_advtrack_cb_ptr)
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#endif
/* length of each batch scan command */
@ -66,10 +73,11 @@ void btm_ble_batchscan_cleanup(void);
*******************************************************************************/
void btm_ble_batchscan_filter_track_adv_vse_cback(UINT8 len, UINT8 *p)
{
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
tBTM_BLE_TRACK_ADV_DATA adv_data;
UINT8 sub_event = 0;
tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
UINT8 sub_event = 0;
STREAM_TO_UINT8(sub_event, p);
BTM_TRACE_EVENT("btm_ble_batchscan_filter_track_adv_vse_cback called with event:%x", sub_event);
@ -78,7 +86,7 @@ void btm_ble_batchscan_filter_track_adv_vse_cback(UINT8 len, UINT8 *p)
ble_batchscan_cb.p_thres_cback(ble_batchscan_cb.ref_value);
return;
}
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
if (HCI_VSE_SUBCODE_BLE_TRACKING_SUB_EVT == sub_event && NULL != ble_advtrack_cb.p_track_cback) {
if (len < 10) {
return;
@ -125,6 +133,7 @@ void btm_ble_batchscan_filter_track_adv_vse_cback(UINT8 len, UINT8 *p)
ble_advtrack_cb.p_track_cback(&adv_data);
return;
}
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
}
/*******************************************************************************
@ -598,6 +607,7 @@ tBTM_STATUS btm_ble_enable_disable_batchscan(BOOLEAN should_enable)
return status;
}
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleSetStorageConfig
@ -676,7 +686,7 @@ tBTM_STATUS BTM_BleSetStorageConfig(UINT8 batch_scan_full_max, UINT8 batch_scan_
return status;
}
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
/*******************************************************************************
**
@ -796,6 +806,7 @@ tBTM_STATUS BTM_BleDisableBatchScan(tBTM_BLE_REF_VALUE ref_value)
return status;
}
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleReadScanReports
@ -854,8 +865,9 @@ tBTM_STATUS BTM_BleReadScanReports(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
}
return status;
}
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleTrackAdvertiser
@ -888,6 +900,7 @@ tBTM_STATUS BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK *p_track_cback,
ble_advtrack_cb.ref_value = ref_value;
return BTM_CMD_STARTED;
}
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
/*******************************************************************************
**
@ -904,7 +917,9 @@ void btm_ble_batchscan_init(void)
{
#if BTM_DYNAMIC_MEMORY == TRUE
ble_batchscan_cb_ptr = (tBTM_BLE_BATCH_SCAN_CB *)osi_malloc(sizeof(tBTM_BLE_BATCH_SCAN_CB));
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
ble_advtrack_cb_ptr = (tBTM_BLE_ADV_TRACK_CB *)osi_malloc(sizeof(tBTM_BLE_ADV_TRACK_CB));
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
if (ble_batchscan_cb_ptr == NULL || ble_advtrack_cb_ptr == NULL) {
BTM_TRACE_ERROR("%s malloc failed", __func__);
return;
@ -912,7 +927,9 @@ void btm_ble_batchscan_init(void)
#endif
BTM_TRACE_EVENT (" btm_ble_batchscan_init");
memset(&ble_batchscan_cb, 0, sizeof(tBTM_BLE_BATCH_SCAN_CB));
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
memset(&ble_advtrack_cb, 0, sizeof(tBTM_BLE_ADV_TRACK_CB));
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
BTM_RegisterForVSEvents(btm_ble_batchscan_filter_track_adv_vse_cback, TRUE);
}
@ -940,14 +957,21 @@ void btm_ble_batchscan_cleanup(void)
}
memset(&ble_batchscan_cb, 0, sizeof(tBTM_BLE_BATCH_SCAN_CB));
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
memset(&ble_advtrack_cb, 0, sizeof(tBTM_BLE_ADV_TRACK_CB));
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#if BTM_DYNAMIC_MEMORY == TRUE
osi_free(ble_batchscan_cb_ptr);
osi_free(ble_advtrack_cb_ptr);
ble_batchscan_cb_ptr = NULL;
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
osi_free(ble_advtrack_cb_ptr);
ble_advtrack_cb_ptr = NULL;
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#endif
}
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#endif

View File

@ -648,6 +648,7 @@ void btm_ble_initiate_select_conn(BD_ADDR bda)
BTM_TRACE_ERROR("btm_ble_initiate_select_conn failed");
}
}
#if (tGATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
** Function btm_ble_suspend_bg_conn
@ -672,6 +673,8 @@ BOOLEAN btm_ble_suspend_bg_conn(void)
return FALSE;
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
** Function btm_suspend_wl_activity
@ -689,10 +692,11 @@ static void btm_suspend_wl_activity(tBTM_BLE_WL_STATE wl_state)
if (wl_state & BTM_BLE_WL_SCAN) {
btm_ble_start_select_conn(FALSE, NULL);
}
#if (BLE_42_ADV_EN == TRUE)
if (wl_state & BTM_BLE_WL_ADV) {
btm_ble_stop_adv();
}
#endif // #if (BLE_42_ADV_EN == TRUE)
}
/*******************************************************************************
**
@ -705,9 +709,13 @@ static void btm_suspend_wl_activity(tBTM_BLE_WL_STATE wl_state)
*******************************************************************************/
void btm_resume_wl_activity(tBTM_BLE_WL_STATE wl_state)
{
#if (tGATT_BG_CONN_DEV == TRUE)
btm_ble_resume_bg_conn();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
if (wl_state & BTM_BLE_WL_ADV) {
#if (BLE_42_ADV_EN == TRUE)
btm_ble_start_adv();
#endif // #if (BLE_42_ADV_EN == TRUE)
}
}
@ -724,12 +732,13 @@ void btm_resume_wl_activity(tBTM_BLE_WL_STATE wl_state)
static void btm_wl_update_to_controller(void)
{
/* whitelist will be added in the btm_ble_resume_bg_conn(), we do not
support background connection now, so we nedd to use btm_execute_wl_dev_operation
support background connection now, so we need to use btm_execute_wl_dev_operation
to add whitelist directly ,if we support background connection in the future,
please delete btm_execute_wl_dev_operation(). */
btm_execute_wl_dev_operation();
}
#if (tGATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
** Function btm_ble_resume_bg_conn
@ -759,6 +768,8 @@ BOOLEAN btm_ble_resume_bg_conn(void)
return ret;
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
** Function btm_ble_get_conn_st

View File

@ -20,6 +20,7 @@
#include "common/bt_target.h"
#if (BLE_INCLUDED == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
#include "stack/bt_types.h"
#include "stack/hcimsgs.h"
#include "stack/btu.h"
@ -104,5 +105,6 @@ tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback)
return status;
}
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
#endif

View File

@ -76,15 +76,19 @@ tBTM_CallbackFunc conn_callback_func;
*******************************************************************************/
static void btm_ble_update_adv_flag(UINT8 flag);
static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt_type, UINT8 *p);
UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
tBTM_BLE_ADV_DATA *p_data);
static UINT8 btm_set_conn_mode_adv_init_addr(tBTM_BLE_INQ_CB *p_cb,
BD_ADDR_PTR p_peer_addr_ptr,
tBLE_ADDR_TYPE *p_peer_addr_type,
tBLE_ADDR_TYPE *p_own_addr_type);
static void btm_ble_stop_observe(void);
static void btm_ble_stop_discover(void);
#if (BLE_42_SCAN_EN == TRUE)
static void btm_adv_pkt_handler(void *arg);
#endif // #if (BLE_42_SCAN_EN == TRUE)
uint32_t BTM_BleUpdateOwnType(uint8_t *own_bda_type, tBTM_START_ADV_CMPL_CBACK *cb);
#define BTM_BLE_INQ_RESULT 0x01
@ -246,56 +250,77 @@ const UINT8 btm_le_state_combo_tbl[BTM_BLE_STATE_MAX][BTM_BLE_STATE_MAX][2] = {
/* check LE combo state supported */
#define BTM_LE_STATES_SUPPORTED(x, y, z) ((x)[(z)] & (y))
#if (BLE_42_ADV_EN == TRUE)
static osi_mutex_t adv_enable_lock;
static osi_mutex_t adv_data_lock;
static osi_mutex_t adv_param_lock;
static osi_mutex_t scan_enable_lock;
static osi_mutex_t scan_param_lock;
osi_sem_t adv_enable_sem;
osi_sem_t adv_data_sem;
osi_sem_t adv_param_sem;
osi_sem_t scan_enable_sem;
osi_sem_t scan_param_sem;
uint8_t adv_enable_status = 0;
uint8_t adv_data_status = 0;
uint8_t adv_param_status = 0;
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
static osi_mutex_t scan_enable_lock;
static osi_mutex_t scan_param_lock;
osi_sem_t scan_enable_sem;
osi_sem_t scan_param_sem;
uint8_t scan_enable_status = 0;
uint8_t scan_param_status = 0;
#endif // #if (BLE_42_SCAN_EN == TRUE)
void btm_ble_lock_init(void)
{
#if (BLE_42_ADV_EN == TRUE)
osi_mutex_new(&adv_enable_lock);
osi_mutex_new(&adv_data_lock);
osi_mutex_new(&adv_param_lock);
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
osi_mutex_new(&scan_enable_lock);
osi_mutex_new(&scan_param_lock);
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
void btm_ble_lock_free(void)
{
#if (BLE_42_ADV_EN == TRUE)
osi_mutex_free(&adv_enable_lock);
osi_mutex_free(&adv_data_lock);
osi_mutex_free(&adv_param_lock);
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
osi_mutex_free(&scan_enable_lock);
osi_mutex_free(&scan_param_lock);
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
void btm_ble_sem_init(void)
{
#if (BLE_42_ADV_EN == TRUE)
osi_sem_new(&adv_enable_sem, 1, 0);
osi_sem_new(&adv_data_sem, 1, 0);
osi_sem_new(&adv_param_sem, 1, 0);
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
osi_sem_new(&scan_enable_sem, 1, 0);
osi_sem_new(&scan_param_sem, 1, 0);
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
void btm_ble_sem_free(void)
{
#if (BLE_42_ADV_EN == TRUE)
osi_sem_free(&adv_enable_sem);
osi_sem_free(&adv_data_sem);
osi_sem_free(&adv_param_sem);
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
osi_sem_free(&scan_enable_sem);
osi_sem_free(&scan_param_sem);
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
/*******************************************************************************
@ -380,8 +405,10 @@ void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy)
if (p_cb->afp != adv_policy) {
p_cb->afp = adv_policy;
#if (BLE_42_ADV_EN == TRUE)
/* if adv active, stop and restart */
btm_ble_stop_adv ();
#endif // #if (BLE_42_ADV_EN == TRUE)
if (p_cb->connectable_mode & BTM_BLE_CONNECTABLE) {
p_cb->evt_type = btm_set_conn_mode_adv_init_addr(p_cb, p_addr_ptr, &init_addr_type,
@ -406,7 +433,9 @@ void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy)
p_cb->afp);
if (adv_mode == BTM_BLE_ADV_ENABLE) {
#if (BLE_42_ADV_EN == TRUE)
btm_ble_start_adv ();
#endif // #if (BLE_42_ADV_EN == TRUE)
}
}
@ -512,8 +541,9 @@ tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT32 duration,
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type,
BTM_BLE_DEFAULT_SFP);
}
#if (BLE_42_SCAN_EN == TRUE)
status = btm_ble_start_scan();
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
if (status == BTM_CMD_STARTED) {
@ -535,6 +565,7 @@ tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT32 duration,
}
#if (BLE_42_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleScan
@ -612,7 +643,9 @@ tBTM_STATUS BTM_BleScan(BOOLEAN start, UINT32 duration,
return status;
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleBroadcast
@ -671,7 +704,7 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_s
}
return status;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if BLE_VND_INCLUDED == TRUE
/*******************************************************************************
**
@ -723,11 +756,11 @@ static void btm_ble_vendor_capability_vsc_cmpl_cback (tBTM_VSC_CMPL *p_vcs_cplt_
__func__, status, btm_cb.cmn_ble_vsc_cb.max_irk_list_sz,
btm_cb.cmn_ble_vsc_cb.adv_inst_max, btm_cb.cmn_ble_vsc_cb.rpa_offloading,
btm_cb.cmn_ble_vsc_cb.energy_support, btm_cb.cmn_ble_vsc_cb.extended_scan_support);
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
if (BTM_BleMaxMultiAdvInstanceCount() > 0) {
btm_ble_multi_adv_init();
}
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
if (btm_cb.cmn_ble_vsc_cb.max_filter > 0) {
btm_ble_adv_filter_init();
}
@ -905,9 +938,11 @@ BOOLEAN BTM_BleConfigPrivacy(BOOLEAN privacy_mode, tBTM_SET_LOCAL_PRIVACY_CBACK
btm_gen_resolvable_private_addr((void *)btm_gen_resolve_paddr_low);
#endif
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
if (BTM_BleMaxMultiAdvInstanceCount() > 0) {
btm_ble_multi_adv_enb_privacy(privacy_mode);
}
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/* 4.2 controller only allow privacy 1.2 or mixed mode, resolvable private address in controller */
if (controller_get_interface()->supports_ble_privacy()) {
@ -1145,6 +1180,7 @@ void BTM_BleConfigConnParams(uint16_t int_min, uint16_t int_max, uint16_t latenc
#endif
}
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleMaxMultiAdvInstanceCount
@ -1159,6 +1195,7 @@ extern UINT8 BTM_BleMaxMultiAdvInstanceCount(void)
return btm_cb.cmn_ble_vsc_cb.adv_inst_max < BTM_BLE_MULTI_ADV_MAX ?
btm_cb.cmn_ble_vsc_cb.adv_inst_max : BTM_BLE_MULTI_ADV_MAX;
}
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#if BLE_PRIVACY_SPT == TRUE
/*******************************************************************************
@ -1297,7 +1334,9 @@ void BTM_BleClearBgConnDev(void)
{
btm_ble_start_auto_conn(FALSE);
btm_ble_clear_white_list(NULL);
#if (tGATT_BG_CONN_DEV == TRUE)
gatt_reset_bgdev_list();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
}
/*******************************************************************************
@ -1320,7 +1359,7 @@ BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR remote_bda)
BTM_TRACE_EVENT("%s() add=%d", __func__, add_remove);
return btm_update_dev_to_white_list(add_remove, remote_bda, 0, NULL);
}
#if 0
/*******************************************************************************
**
** Function BTM_BleSetConnectableMode
@ -1348,7 +1387,7 @@ tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode)
p_cb->directed_conn = connectable_mode;
return btm_ble_set_connectability( p_cb->connectable_mode);
}
#endif
/*******************************************************************************
**
** Function btm_set_conn_mode_adv_init_addr
@ -1441,76 +1480,7 @@ static UINT8 btm_set_conn_mode_adv_init_addr(tBTM_BLE_INQ_CB *p_cb,
return evt_type;
}
/*******************************************************************************
**
** Function BTM_BleSetAdvParams
**
** Description This function is called to set advertising parameters.
**
** Parameters adv_int_min: minimum advertising interval
** adv_int_max: maximum advertising interval
** p_dir_bda: connectable direct initiator's LE device address
** chnl_map: advertising channel map.
**
** Returns void
**
*******************************************************************************/
tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
tBLE_BD_ADDR *p_dir_bda,
tBTM_BLE_ADV_CHNL_MAP chnl_map)
{
tBTM_LE_RANDOM_CB *p_addr_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
tBTM_STATUS status = BTM_SUCCESS;
BD_ADDR p_addr_ptr = {0};
tBLE_ADDR_TYPE init_addr_type = BLE_ADDR_PUBLIC;
tBLE_ADDR_TYPE own_addr_type = p_addr_cb->own_addr_type;
UINT8 adv_mode = p_cb->adv_mode;
BTM_TRACE_EVENT ("BTM_BleSetAdvParams");
if (!controller_get_interface()->supports_ble()) {
return BTM_ILLEGAL_VALUE;
}
if (!BTM_BLE_ISVALID_PARAM(adv_int_min, BTM_BLE_ADV_INT_MIN, BTM_BLE_ADV_INT_MAX) ||
!BTM_BLE_ISVALID_PARAM(adv_int_max, BTM_BLE_ADV_INT_MIN, BTM_BLE_ADV_INT_MAX)) {
return BTM_ILLEGAL_VALUE;
}
p_cb->adv_interval_min = adv_int_min;
p_cb->adv_interval_max = adv_int_max;
p_cb->adv_chnl_map = chnl_map;
if (p_dir_bda) {
memcpy(&p_cb->direct_bda, p_dir_bda, sizeof(tBLE_BD_ADDR));
}
BTM_TRACE_EVENT ("update params for an active adv\n");
btm_ble_stop_adv();
p_cb->evt_type = btm_set_conn_mode_adv_init_addr(p_cb, p_addr_ptr, &init_addr_type,
&own_addr_type);
/* update adv params */
btsnd_hcic_ble_write_adv_params (p_cb->adv_interval_min,
p_cb->adv_interval_max,
p_cb->evt_type,
own_addr_type,
init_addr_type,
p_addr_ptr,
p_cb->adv_chnl_map,
p_cb->afp);
if (adv_mode == BTM_BLE_ADV_ENABLE) {
btm_ble_start_adv();
}
return status;
}
#if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleSetAdvParamsAll
@ -1605,6 +1575,7 @@ tBTM_STATUS BTM_BleStartAdv(void)
return status;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleReadAdvParams
@ -1638,6 +1609,7 @@ void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max,
}
}
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
/*******************************************************************************
**
** Function BTM_BleSetScanParams
@ -1696,7 +1668,9 @@ void BTM_BleSetScanParams(tGATT_IF client_if, UINT32 scan_interval, UINT32 scan_
}
}
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
tBTM_STATUS BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32 scan_window,
tBLE_SCAN_MODE scan_mode, UINT8 addr_type_own, UINT8 scan_duplicate_filter, tBTM_BLE_SFP scan_filter_policy,
tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback)
@ -1752,8 +1726,9 @@ tBTM_STATUS BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval,
osi_mutex_unlock(&scan_param_lock);
return ret;
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleWriteScanRsp
@ -1828,6 +1803,7 @@ tBTM_STATUS BTM_BleWriteScanRspRaw(UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_le
return ret;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
@ -1894,6 +1870,7 @@ tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type
return status;
}
#if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleWriteAdvData
@ -1944,38 +1921,6 @@ tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask, tBTM_BLE_ADV_DATA *p
return ret;
}
/*******************************************************************************
**
** Function BTM_BleWriteLongAdvData
**
** Description This function is called to write long advertising data.
**
** Parameters: adv_data: long advertising data
** adv_data_len: the length of long advertising data
**
** Returns void
**
*******************************************************************************/
tBTM_STATUS BTM_BleWriteLongAdvData(uint8_t *adv_data, uint8_t adv_data_len)
{
tBTM_STATUS status = BTM_NO_RESOURCES;
if (!controller_get_interface()->supports_ble()) {
return BTM_ILLEGAL_VALUE;
}
if(!adv_data || adv_data_len <= 0 || adv_data_len > BTM_BLE_LONG_ADV_MAX_LEN) {
return BTM_ILLEGAL_VALUE;
}
uint8_t long_adv[BTM_BLE_LONG_ADV_MAX_LEN + 1] = {0};
long_adv[0] = adv_data_len;
memcpy(&long_adv[1], adv_data, adv_data_len);
status = BTM_VendorSpecificCommand(HCI_VENDOR_BLE_LONG_ADV_DATA, BTM_BLE_LONG_ADV_MAX_LEN + 1, long_adv, NULL);
if(status == BTM_CMD_STARTED) {
status = BTM_SUCCESS;
}
return status;
}
/*******************************************************************************
**
** Function BTM_BleWriteAdvDataRaw
@ -2001,7 +1946,7 @@ tBTM_STATUS BTM_BleWriteAdvDataRaw(UINT8 *p_raw_adv, UINT32 raw_adv_len)
return ret;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
/*******************************************************************************
**
@ -2088,6 +2033,7 @@ BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type)
return TRUE;
}
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
/*******************************************************************************
**
** Function BTM_CheckAdvData
@ -2133,7 +2079,7 @@ UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT16 adv_data_len, UINT8 type, UINT8 *p
*p_length = 0;
return NULL;
}
#endif // #if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
/*******************************************************************************
**
** Function BTM__BLEReadDiscoverability
@ -2171,16 +2117,20 @@ UINT16 BTM_BleReadConnectability(void)
void BTM_Recovery_Pre_State(void)
{
#if ((BLE_42_ADV_EN == TRUE) || (BLE_42_SCAN_EN == TRUE))
tBTM_BLE_INQ_CB *ble_inq_cb = &btm_cb.ble_ctr_cb.inq_var;
#endif // #if ((BLE_42_ADV_EN == TRUE) || (BLE_42_SCAN_EN == TRUE))
#if (BLE_42_ADV_EN == TRUE)
if (ble_inq_cb->state & BTM_BLE_ADVERTISING) {
btm_ble_stop_adv();
btm_ble_start_adv();
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
if (ble_inq_cb->state & BTM_BLE_SCANNING) {
btm_ble_start_scan();
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
return;
}
@ -2209,6 +2159,26 @@ BOOLEAN BTM_GetCurrentConnParams(BD_ADDR bda, uint16_t *interval, uint16_t *late
return FALSE;
}
/*******************************************************************************
**
** Function btm_ble_map_adv_tx_power
**
** Description return the actual power in dBm based on the mapping in config file
**
** Parameters advertise parameters used for this instance.
**
** Returns tx power in dBm
**
*******************************************************************************/
static const int btm_ble_tx_power[BTM_BLE_ADV_TX_POWER_MAX + 1] = BTM_BLE_ADV_TX_POWER;
char btm_ble_map_adv_tx_power(int tx_power_index)
{
if (0 <= tx_power_index && tx_power_index <= BTM_BLE_ADV_TX_POWER_MAX) {
return (char)btm_ble_tx_power[tx_power_index];
}
return 0;
}
/*******************************************************************************
**
** Function btm_ble_build_adv_data
@ -2570,6 +2540,7 @@ void btm_ble_set_adv_flag(UINT16 connect_mode, UINT16 disc_mode)
btm_ble_update_adv_flag(flag);
}
}
#if 0
/*******************************************************************************
**
** Function btm_ble_set_discoverability
@ -2621,7 +2592,9 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
if (evt_type != p_cb->evt_type || p_cb->adv_addr_type != own_addr_type
|| !p_cb->fast_adv_on) {
#if (BLE_42_ADV_EN == TRUE)
btm_ble_stop_adv();
#endif // #if (BLE_42_ADV_EN == TRUE)
/* update adv params */
if (!btsnd_hcic_ble_write_adv_params (adv_int_min,
@ -2641,11 +2614,13 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
}
if (status == BTM_SUCCESS && p_cb->adv_mode != new_mode) {
#if (BLE_42_ADV_EN == TRUE)
if (new_mode == BTM_BLE_ADV_ENABLE) {
status = btm_ble_start_adv();
} else {
status = btm_ble_stop_adv();
}
#endif // #if (BLE_42_ADV_EN == TRUE)
}
if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE) {
@ -2668,7 +2643,7 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
}
return status;
}
#endif
/*******************************************************************************
**
** Function btm_ble_set_connectability
@ -2716,7 +2691,9 @@ tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode)
btm_ble_set_adv_flag (combined_mode, btm_cb.btm_inq_vars.discoverable_mode);
if (p_cb->evt_type != evt_type || p_cb->adv_addr_type != p_addr_cb->own_addr_type
|| !p_cb->fast_adv_on) {
#if (BLE_42_ADV_EN == TRUE)
btm_ble_stop_adv();
#endif // #if (BLE_42_ADV_EN == TRUE)
if (!btsnd_hcic_ble_write_adv_params (adv_int_min,
adv_int_max,
@ -2736,11 +2713,13 @@ tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode)
/* update advertising mode */
if (status == BTM_SUCCESS && new_mode != p_cb->adv_mode) {
#if (BLE_42_ADV_EN == TRUE)
if (new_mode == BTM_BLE_ADV_ENABLE) {
status = btm_ble_start_adv();
} else {
status = btm_ble_stop_adv();
}
#endif // #if (BLE_42_ADV_EN == TRUE)
}
if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE) {
@ -2801,7 +2780,9 @@ tBTM_STATUS btm_ble_start_inquiry (UINT8 mode, UINT8 duration)
/* enable IRK list */
//btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_SCAN);
#endif
#if (BLE_42_SCAN_EN == TRUE)
status = btm_ble_start_scan();
#endif // #if (BLE_42_SCAN_EN == TRUE)
} else if ((p_ble_cb->inq_var.scan_interval != BTM_BLE_LOW_LATENCY_SCAN_INT) ||
(p_ble_cb->inq_var.scan_window != BTM_BLE_LOW_LATENCY_SCAN_WIN)) {
BTM_TRACE_DEBUG("%s, restart LE scan with low latency scan params", __FUNCTION__);
@ -3510,6 +3491,7 @@ void btm_send_sel_conn_callback(BD_ADDR remote_bda, UINT8 evt_type, UINT8 *p_dat
}
}
#if (BLE_42_SCAN_EN == TRUE)
static void btm_adv_pkt_handler(void *arg)
{
UINT8 hci_evt_code, hci_evt_len;
@ -3552,6 +3534,7 @@ static void btm_adv_pkt_handler(void *arg)
UNUSED(hci_evt_code);
UNUSED(hci_evt_len);
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
/*******************************************************************************
**
@ -3838,6 +3821,7 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
void btm_ble_process_adv_discard_evt(UINT8 *p)
{
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
uint32_t num_dis = 0;
STREAM_TO_UINT32 (num_dis, p);
@ -3846,6 +3830,7 @@ void btm_ble_process_adv_discard_evt(UINT8 *p)
(p_obs_discard_cb)(num_dis);
}
#endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
void btm_ble_process_direct_adv_pkt(UINT8 *p)
@ -3853,6 +3838,7 @@ void btm_ble_process_direct_adv_pkt(UINT8 *p)
// TODO
}
#if (BLE_42_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function btm_ble_start_scan
@ -3890,6 +3876,7 @@ tBTM_STATUS btm_ble_start_scan(void)
osi_mutex_unlock(&scan_enable_lock);
return status;
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
/*******************************************************************************
**
@ -3939,8 +3926,10 @@ void btm_ble_stop_inquiry(void)
} else if ((p_ble_cb->inq_var.scan_interval != BTM_BLE_LOW_LATENCY_SCAN_INT) ||
(p_ble_cb->inq_var.scan_window != BTM_BLE_LOW_LATENCY_SCAN_WIN)) {
BTM_TRACE_DEBUG("%s: setting default params for ongoing observe", __FUNCTION__);
#if (BLE_42_SCAN_EN == TRUE)
btm_ble_stop_scan();
btm_ble_start_scan();
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
/* If we have a callback registered for inquiry complete, call it */
@ -3991,6 +3980,7 @@ static void btm_ble_stop_observe(void)
*******************************************************************************/
static void btm_ble_stop_discover(void)
{
#if (BLE_42_SCAN_EN == TRUE)
tBTM_BLE_CB *p_ble_cb = & btm_cb.ble_ctr_cb;
tBTM_CMPL_CB *p_scan_cb = p_ble_cb->p_scan_cmpl_cb;
btu_stop_timer (&p_ble_cb->scan_timer_ent);
@ -4003,7 +3993,6 @@ static void btm_ble_stop_discover(void)
if (!BTM_BLE_IS_SCAN_ACTIVE(p_ble_cb->scan_activity)) {
/* Clear the inquiry callback if set */
btm_cb.ble_ctr_cb.inq_var.scan_type = BTM_BLE_SCAN_MODE_NONE;
btm_cb.ble_ctr_cb.inq_var.state &= ~BTM_BLE_SCANNING;
/* stop discovery now */
if(btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_DISABLE, BTM_BLE_DUPLICATE_ENABLE)) {
@ -4018,6 +4007,7 @@ static void btm_ble_stop_discover(void)
(p_scan_cb)((tBTM_INQUIRY_CMPL *) &btm_cb.btm_inq_vars.inq_cmpl_info);
}
osi_mutex_unlock(&scan_enable_lock);
#endif // #if (BLE_42_SCAN_EN == TRUE)
}
/*******************************************************************************
@ -4030,6 +4020,7 @@ static void btm_ble_stop_discover(void)
**
*******************************************************************************/
typedef BOOLEAN (BTM_TOPOLOGY_FUNC_PTR)(tBTM_BLE_STATE_MASK);
#if (BLE_42_ADV_EN == TRUE)
static BOOLEAN btm_ble_adv_states_operation(BTM_TOPOLOGY_FUNC_PTR *p_handler, UINT8 adv_evt)
{
BOOLEAN rt = FALSE;
@ -4062,7 +4053,6 @@ static BOOLEAN btm_ble_adv_states_operation(BTM_TOPOLOGY_FUNC_PTR *p_handler, UI
return rt;
}
/*******************************************************************************
**
** Function btm_ble_start_adv
@ -4174,14 +4164,19 @@ tBTM_STATUS btm_ble_stop_adv(void)
}
return rt;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
tBTM_STATUS btm_ble_set_random_addr(BD_ADDR random_bda)
{
tBTM_STATUS rt = BTM_SUCCESS;
#if (BLE_42_ADV_EN == TRUE)
osi_mutex_lock(&adv_enable_lock, OSI_MUTEX_MAX_TIMEOUT);
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
osi_mutex_lock(&scan_enable_lock, OSI_MUTEX_MAX_TIMEOUT);
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_42_ADV_EN == TRUE)
if (btm_cb.ble_ctr_cb.inq_var.adv_mode == BTM_BLE_ADV_ENABLE) {
if (btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_DISABLE)) {
osi_sem_take(&adv_enable_sem, OSI_SEM_MAX_TIMEOUT);
@ -4190,7 +4185,9 @@ tBTM_STATUS btm_ble_set_random_addr(BD_ADDR random_bda)
rt = BTM_BAD_VALUE_RET;
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
if (BTM_BLE_IS_DISCO_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
if (btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_DISABLE, BTM_BLE_SCAN_DUPLICATE_DISABLE)) {
osi_sem_take(&scan_enable_sem, OSI_SEM_MAX_TIMEOUT);
@ -4199,11 +4196,13 @@ tBTM_STATUS btm_ble_set_random_addr(BD_ADDR random_bda)
rt = BTM_BAD_VALUE_RET;
}
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
if (rt == BTM_SUCCESS) {
btsnd_hcic_ble_set_random_addr(random_bda);
}
#if (BLE_42_ADV_EN == TRUE)
if (btm_cb.ble_ctr_cb.inq_var.adv_mode == BTM_BLE_ADV_ENABLE) {
if (btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_ENABLE)) {
osi_sem_take(&adv_enable_sem, OSI_SEM_MAX_TIMEOUT);
@ -4212,7 +4211,9 @@ tBTM_STATUS btm_ble_set_random_addr(BD_ADDR random_bda)
rt = BTM_BAD_VALUE_RET;
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
if (BTM_BLE_IS_DISCO_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
if (btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_ENABLE, btm_cb.ble_ctr_cb.inq_var.scan_duplicate_filter)) {
osi_sem_take(&scan_enable_sem, OSI_SEM_MAX_TIMEOUT);
@ -4221,9 +4222,14 @@ tBTM_STATUS btm_ble_set_random_addr(BD_ADDR random_bda)
rt = BTM_BAD_VALUE_RET;
}
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_42_ADV_EN == TRUE)
osi_mutex_unlock(&adv_enable_lock);
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
osi_mutex_unlock(&scan_enable_lock);
#endif // #if (BLE_42_SCAN_EN == TRUE)
return rt;
}
@ -4240,6 +4246,7 @@ tBTM_STATUS btm_ble_set_random_addr(BD_ADDR random_bda)
*******************************************************************************/
static void btm_ble_start_slow_adv (void)
{
#if (BLE_42_ADV_EN == TRUE)
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE) {
@ -4258,9 +4265,9 @@ static void btm_ble_start_slow_adv (void)
p_cb->evt_type, own_addr_type,
init_addr_type, p_addr_ptr,
p_cb->adv_chnl_map, p_cb->afp);
btm_ble_start_adv();
}
#endif // #if (BLE_42_ADV_EN == TRUE)
}
/*******************************************************************************
**
@ -4300,9 +4307,11 @@ void btm_ble_timeout(TIMER_LIST_ENT *p_tle)
btm_gen_resolvable_private_addr((void *)btm_gen_resolve_paddr_low);
#endif
} else {
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
if (BTM_BleMaxMultiAdvInstanceCount() > 0) {
btm_ble_multi_adv_configure_rpa((tBTM_BLE_MULTI_ADV_INST *)p_tle->param);
}
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
}
}
break;
@ -4524,7 +4533,9 @@ BOOLEAN btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 st
now in order */
if (btm_ble_get_conn_st() == BLE_CONN_IDLE && status != HCI_ERR_HOST_REJECT_RESOURCES &&
!btm_send_pending_direct_conn()) {
#if (tGATT_BG_CONN_DEV == TRUE)
bg_con = btm_ble_resume_bg_conn();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
}
return bg_con;
@ -4575,16 +4586,18 @@ void btm_ble_init (void)
p_cb->scan_int = p_cb->scan_win = BTM_BLE_SCAN_PARAM_UNDEF;
p_cb->inq_var.evt_type = BTM_BLE_NON_CONNECT_EVT;
#if (BLE_42_SCAN_EN == TRUE)
p_cb->adv_rpt_queue = pkt_queue_create();
assert(p_cb->adv_rpt_queue != NULL);
p_cb->adv_rpt_ready = osi_event_create(btm_adv_pkt_handler, NULL);
assert(p_cb->adv_rpt_ready != NULL);
osi_event_bind(p_cb->adv_rpt_ready, btu_get_current_thread(), 0);
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if BLE_VND_INCLUDED == FALSE
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
btm_ble_adv_filter_init();
#endif // #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
#endif
}
@ -4604,13 +4617,13 @@ void btm_ble_free (void)
BTM_TRACE_DEBUG("%s", __func__);
fixed_queue_free(p_cb->conn_pending_q, osi_free_func);
#if (BLE_42_SCAN_EN == TRUE)
pkt_queue_destroy(p_cb->adv_rpt_queue, NULL);
p_cb->adv_rpt_queue = NULL;
osi_event_delete(p_cb->adv_rpt_ready);
p_cb->adv_rpt_ready = NULL;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if BTM_DYNAMIC_MEMORY == TRUE
osi_free(cmn_ble_gap_vsc_cb_ptr);
cmn_ble_gap_vsc_cb_ptr = NULL;
@ -4779,6 +4792,7 @@ BOOLEAN BTM_BleSetCsaSupport(UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *
return TRUE;
}
#if (BLE_42_SCAN_EN == TRUE)
bool btm_ble_adv_pkt_ready(void)
{
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
@ -4797,4 +4811,6 @@ bool btm_ble_adv_pkt_post(pkt_linked_item_t *pkt)
pkt_queue_enqueue(p_cb->adv_rpt_queue, pkt);
return true;
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif /* BLE_INCLUDED */

View File

@ -22,6 +22,8 @@
#include "device/controller.h"
#if (BLE_INCLUDED == TRUE)
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#include "stack/bt_types.h"
#include "stack/hcimsgs.h"
#include "stack/btu.h"
@ -218,25 +220,7 @@ tBTM_STATUS btm_ble_enable_multi_adv (BOOLEAN enable, UINT8 inst_id, UINT8 cb_ev
}
return rt;
}
/*******************************************************************************
**
** Function btm_ble_map_adv_tx_power
**
** Description return the actual power in dBm based on the mapping in config file
**
** Parameters advertise parameters used for this instance.
**
** Returns tx power in dBm
**
*******************************************************************************/
static const int btm_ble_tx_power[BTM_BLE_ADV_TX_POWER_MAX + 1] = BTM_BLE_ADV_TX_POWER;
char btm_ble_map_adv_tx_power(int tx_power_index)
{
if (0 <= tx_power_index && tx_power_index <= BTM_BLE_ADV_TX_POWER_MAX) {
return (char)btm_ble_tx_power[tx_power_index];
}
return 0;
}
/*******************************************************************************
**
** Function btm_ble_multi_adv_set_params
@ -882,4 +866,5 @@ void *btm_ble_multi_adv_get_ref(UINT8 inst_id)
return NULL;
}
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#endif

View File

@ -683,20 +683,22 @@ BOOLEAN btm_ble_suspend_resolving_list_activity(void)
p_ble_cb->suspended_rl_state = BTM_BLE_RL_IDLE;
#if (BLE_42_ADV_EN == TRUE)
if (p_ble_cb->inq_var.adv_mode == BTM_BLE_ADV_ENABLE) {
btm_ble_stop_adv();
p_ble_cb->suspended_rl_state |= BTM_BLE_RL_ADV;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
if (BTM_BLE_IS_SCAN_ACTIVE(p_ble_cb->scan_activity)) {
btm_ble_stop_scan();
p_ble_cb->suspended_rl_state |= BTM_BLE_RL_SCAN;
}
#if (tGATT_BG_CONN_DEV == TRUE)
if (btm_ble_suspend_bg_conn()) {
p_ble_cb->suspended_rl_state |= BTM_BLE_RL_INIT;
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
return TRUE;
}
@ -714,19 +716,21 @@ BOOLEAN btm_ble_suspend_resolving_list_activity(void)
void btm_ble_resume_resolving_list_activity(void)
{
tBTM_BLE_CB *p_ble_cb = &btm_cb.ble_ctr_cb;
#if (BLE_42_ADV_EN == TRUE)
if (p_ble_cb->suspended_rl_state & BTM_BLE_RL_ADV) {
btm_ble_start_adv();
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
if (p_ble_cb->suspended_rl_state & BTM_BLE_RL_SCAN) {
btm_ble_start_scan();
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (tGATT_BG_CONN_DEV == TRUE)
if (p_ble_cb->suspended_rl_state & BTM_BLE_RL_INIT) {
btm_ble_resume_bg_conn();
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
p_ble_cb->suspended_rl_state = BTM_BLE_RL_IDLE;
}

View File

@ -82,7 +82,9 @@ void btm_dev_init (void)
/* Initialize nonzero defaults */
#if (BTM_MAX_LOC_BD_NAME_LEN > 0)
memset(btm_cb.cfg.ble_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
#if (CLASSIC_BT_INCLUDED == TRUE)
memset(btm_cb.cfg.bredr_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif
btm_cb.devcb.reset_timer.param = (TIMER_PARAM_TYPE)TT_DEV_RESET;
@ -169,8 +171,12 @@ static void reset_complete(void)
btm_cb.ble_ctr_cb.conn_state = BLE_CONN_IDLE;
btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_NONE;
btm_cb.ble_ctr_cb.p_select_cback = NULL;
#if (tGATT_BG_CONN_DEV == TRUE)
gatt_reset_bgdev_list();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
btm_ble_multi_adv_init();
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#endif
btm_pm_reset();
@ -471,7 +477,7 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type)
btm_cb.cfg.ble_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
}
}
#if (CLASSIC_BT_INCLUDED == TRUE)
if (name_type & BT_DEVICE_TYPE_BREDR) {
p = (UINT8 *)btm_cb.cfg.bredr_bd_name;
if (p != (UINT8 *)p_name) {
@ -479,6 +485,7 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type)
btm_cb.cfg.bredr_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
}
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#else
p = (UINT8 *)p_name;
#endif
@ -519,21 +526,22 @@ tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name, tBT_DEVICE_TYPE name_type)
*/
#if BTM_MAX_LOC_BD_NAME_LEN > 0
#if (CLASSIC_BT_INCLUDED == TRUE)
if ((name_type == BT_DEVICE_TYPE_DUMO) &&
(BCM_STRNCMP_S(btm_cb.cfg.bredr_bd_name, btm_cb.cfg.ble_bd_name, BTM_MAX_LOC_BD_NAME_LEN) != 0)) {
*p_name = NULL;
BTM_TRACE_ERROR("Error, BLE and BREDR have different names, return NULL\n");
return (BTM_NO_RESOURCES);
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
if (name_type & BT_DEVICE_TYPE_BLE) {
*p_name = btm_cb.cfg.ble_bd_name;
}
#if (CLASSIC_BT_INCLUDED == TRUE)
if (name_type & BT_DEVICE_TYPE_BREDR) {
*p_name = btm_cb.cfg.bredr_bd_name;
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
return (BTM_SUCCESS);
#else
*p_name = NULL;
@ -752,9 +760,6 @@ void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
#if (BLE_INCLUDED == TRUE)
tBTM_BLE_CB *ble_cb = &btm_cb.ble_ctr_cb;
switch(opcode) {
case HCI_VENDOR_BLE_LONG_ADV_DATA:
BTM_TRACE_EVENT("Set long adv data complete\n");
break;
case HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST: {
uint8_t subcode, status; uint32_t length;
STREAM_TO_UINT8(status, p);
@ -1074,6 +1079,7 @@ tBTM_STATUS BTM_WriteVoiceSettings(UINT16 settings)
return (BTM_NO_RESOURCES);
}
#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
/*******************************************************************************
**
** Function BTM_EnableTestMode
@ -1130,6 +1136,7 @@ tBTM_STATUS BTM_EnableTestMode(void)
return (BTM_NO_RESOURCES);
}
}
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
/*******************************************************************************
**

View File

@ -39,7 +39,9 @@ tBTM_CB *btm_cb_ptr;
#if (BLE_50_FEATURE_SUPPORT == TRUE)
extern void btm_ble_extendadvcb_init(void);
#if (BLE_50_EXTEND_ADV_EN == TRUE)
extern void btm_ble_advrecod_init(void);
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif
@ -89,7 +91,9 @@ void btm_init (void)
btm_sec_dev_init();
#if (BLE_50_FEATURE_SUPPORT == TRUE)
btm_ble_extendadvcb_init();
#if (BLE_50_EXTEND_ADV_EN == TRUE)
btm_ble_advrecod_init();
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif
}

View File

@ -1720,7 +1720,7 @@ void BTM_RemoteOobDataReply(tBTM_STATUS res, BD_ADDR bd_addr, BT_OCTET16 c, BT_O
btsnd_hcic_rem_oob_reply (bd_addr, c, r);
}
}
#if 0
/*******************************************************************************
**
** Function BTM_BuildOobData
@ -1745,8 +1745,10 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
UINT8 *p = p_data;
UINT16 len = 0;
#if BTM_MAX_LOC_BD_NAME_LEN > 0
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT16 name_size;
UINT8 name_type = BTM_EIR_SHORTENED_LOCAL_NAME_TYPE;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif
if (p_data && max_len >= BTM_OOB_MANDATORY_SIZE) {
@ -1789,6 +1791,7 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
max_len -= delta;
}
#if BTM_MAX_LOC_BD_NAME_LEN > 0
#if (CLASSIC_BT_INCLUDED == TRUE)
name_size = name_len;
if (name_size > strlen(btm_cb.cfg.bredr_bd_name)) {
name_type = BTM_EIR_COMPLETE_LOCAL_NAME_TYPE;
@ -1802,6 +1805,7 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
len += delta;
max_len -= delta;
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif
/* update len */
p = p_data;
@ -1871,6 +1875,7 @@ UINT8 *BTM_ReadOobData(UINT8 *p_data, UINT8 eir_tag, UINT8 *p_len)
return p_ret;
}
#endif
#endif ///BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)

View File

@ -342,10 +342,10 @@ typedef struct {
tBTM_INQ_RESULTS_CB *p_scan_results_cb;
tBTM_CMPL_CB *p_scan_cmpl_cb;
TIMER_LIST_ENT scan_timer_ent;
#if (BLE_42_SCAN_EN == TRUE)
struct pkt_queue *adv_rpt_queue;
struct osi_event *adv_rpt_ready;
#endif // #if (BLE_42_SCAN_EN == TRUE)
/* background connection procedure cb value */
tBTM_BLE_CONN_TYPE bg_conn_type;
UINT32 scan_int;
@ -388,12 +388,14 @@ extern "C" {
#endif
void btm_ble_timeout(TIMER_LIST_ENT *p_tle);
#if (BLE_42_SCAN_EN == TRUE)
void btm_ble_process_adv_pkt (UINT8 *p);
void btm_ble_process_adv_discard_evt(UINT8 *p);
void btm_ble_process_direct_adv_pkt (UINT8 *p);
bool btm_ble_adv_pkt_ready(void);
bool btm_ble_adv_pkt_post(pkt_linked_item_t *pkt);
void btm_ble_proc_scan_rsp_rpt (UINT8 *p);
#endif // #if (BLE_42_SCAN_EN == TRUE)
tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, tBTM_CMPL_CB *p_cb);
BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda);
@ -409,7 +411,11 @@ void btm_ble_init (void);
void btm_ble_free (void);
void btm_ble_connected (UINT8 *bda, UINT16 handle, UINT8 enc_mode, UINT8 role, tBLE_ADDR_TYPE addr_type, BOOLEAN addr_matched);
void btm_ble_read_remote_features_complete(UINT8 *p);
#if (BLE_42_ADV_EN == TRUE)
void btm_ble_write_adv_enable_complete(UINT8 *p);
#endif // #if (BLE_42_ADV_EN == TRUE)
void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced);
void btm_read_ble_local_supported_states_complete(UINT8 *p, UINT16 evt_len);
tBTM_BLE_CONN_ST btm_ble_get_conn_st(void);
@ -459,9 +465,12 @@ void btm_ble_remove_from_white_list_complete(UINT8 *p, UINT16 evt_len);
void btm_ble_clear_white_list_complete(UINT8 *p, UINT16 evt_len);
void btm_ble_white_list_init(UINT8 white_list_size);
#if (tGATT_BG_CONN_DEV == TRUE)
/* background connection function */
BOOLEAN btm_ble_suspend_bg_conn(void);
BOOLEAN btm_ble_resume_bg_conn(void);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
void btm_ble_initiate_select_conn(BD_ADDR bda);
BOOLEAN btm_ble_start_auto_conn(BOOLEAN start);
BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cback);
@ -504,12 +513,14 @@ void btm_ble_add_default_entry_to_resolving_list(void);
void btm_ble_set_privacy_mode_complete(UINT8 *p, UINT16 evt_len);
#endif
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
void btm_ble_multi_adv_configure_rpa (tBTM_BLE_MULTI_ADV_INST *p_inst);
void btm_ble_multi_adv_init(void);
void *btm_ble_multi_adv_get_ref(UINT8 inst_id);
void btm_ble_multi_adv_cleanup(void);
void btm_ble_multi_adv_reenable(UINT8 inst_id);
void btm_ble_multi_adv_enb_privacy(BOOLEAN enable);
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
char btm_ble_map_adv_tx_power(int tx_power_index);
void btm_ble_batchscan_init(void);
void btm_ble_batchscan_cleanup(void);

View File

@ -208,8 +208,10 @@ tBTM_ROLE_SWITCH_CMPL switch_role_ref_data;
tBTM_CMPL_CB *p_switch_role_cb; /* Callback function to be called when */
/* requested switch role is completed */
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
TIMER_LIST_ENT tx_power_timer;
tBTM_CMPL_CB *p_tx_power_cmpl_cb;/* Callback function to be called */
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
#if CLASSIC_BT_INCLUDED == TRUE
TIMER_LIST_ENT afh_channels_timer;
@ -724,14 +726,18 @@ struct tBTM_SEC_DEV_REC{
*/
typedef struct {
#if BTM_MAX_LOC_BD_NAME_LEN > 0
#if (CLASSIC_BT_INCLUDED == TRUE)
tBTM_LOC_BD_NAME bredr_bd_name; /* local BREDR device name */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
tBTM_LOC_BD_NAME ble_bd_name; /* local BLE device name */
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
BOOLEAN pin_type; /* TRUE if PIN type is fixed */
UINT8 pin_code_len; /* Bonding information */
PIN_CODE pin_code; /* PIN CODE if pin type is fixed */
BOOLEAN connectable; /* If TRUE page scan should be enabled */
UINT8 def_inq_scan_mode; /* ??? limited/general/none */
// BOOLEAN connectable; /* If TRUE page scan should be enabled */
// UINT8 def_inq_scan_mode; /* ??? limited/general/none */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
} tBTM_CFG;
enum {
@ -952,7 +958,7 @@ typedef struct {
#endif // SMP_INCLUDED == TRUE || BT_CLASSIC_ENABLED == TRUE
list_t *p_sec_dev_rec_list;
tBTM_SEC_SERV_REC *p_out_serv;
tBTM_MKEY_CALLBACK *mkey_cback;
// tBTM_MKEY_CALLBACK *mkey_cback;
BD_ADDR connecting_bda;
DEV_CLASS connecting_dc;

View File

@ -55,6 +55,7 @@ extern void btm_ble_test_command_complete(UINT8 *p);
/********************************************************************************/
/* L O C A L F U N C T I O N P R O T O T Y P E S */
/********************************************************************************/
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_inquiry_comp_evt (UINT8 *p);
static void btu_hcif_inquiry_result_evt (UINT8 *p);
static void btu_hcif_inquiry_rssi_result_evt (UINT8 *p);
@ -62,30 +63,46 @@ static void btu_hcif_extended_inquiry_result_evt (UINT8 *p);
static void btu_hcif_connection_comp_evt (UINT8 *p);
static void btu_hcif_connection_request_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_disconnection_comp_evt (UINT8 *p);
#if (SMP_INCLUDED == TRUE)
static void btu_hcif_authentication_comp_evt (UINT8 *p);
#endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (SMP_INCLUDED == TRUE)
static void btu_hcif_encryption_change_evt (UINT8 *p);
#endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_read_rmt_features_comp_evt (UINT8 *p);
static void btu_hcif_read_rmt_ext_features_comp_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_read_rmt_version_comp_evt (UINT8 *p);
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_qos_setup_comp_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_command_complete_evt (BT_HDR *response, void *context);
static void btu_hcif_command_status_evt (uint8_t status, BT_HDR *command, void *context);
static void btu_hcif_hardware_error_evt (UINT8 *p);
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_flush_occured_evt (void);
static void btu_hcif_role_change_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_num_compl_data_pkts_evt (UINT8 *p);
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_mode_change_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_pin_code_request_evt (UINT8 *p);
static void btu_hcif_link_key_request_evt (UINT8 *p);
static void btu_hcif_link_key_notification_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_loopback_command_evt (void);
static void btu_hcif_data_buf_overflow_evt (void);
static void btu_hcif_max_slots_changed_evt (void);
@ -98,6 +115,8 @@ static void btu_hcif_esco_connection_comp_evt(UINT8 *p);
static void btu_hcif_esco_connection_chg_evt(UINT8 *p);
static void btu_hcif_host_support_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/* Simple Pairing Events */
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_io_cap_request_evt (UINT8 *p);
@ -111,12 +130,14 @@ static void btu_hcif_keypress_notif_evt (UINT8 *p);
#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
static void btu_hcif_rem_oob_request_evt (UINT8 *p);
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_link_supv_to_changed_evt (UINT8 *p);
#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
static void btu_hcif_enhanced_flush_complete_evt (void);
#endif
static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if BLE_INCLUDED == TRUE
static void btu_ble_ll_conn_complete_evt (UINT8 *p, UINT16 evt_len);
@ -136,30 +157,41 @@ static void btu_ble_proc_enhanced_conn_cmpl (UINT8 *p, UINT16 evt_len);
//#endif
#if (BLE_50_FEATURE_SUPPORT == TRUE)
static void btu_ble_phy_update_complete_evt(UINT8 *p);
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
static void btu_ble_ext_adv_report_evt(UINT8 *p, UINT16 evt_len);
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
static void btu_ble_periodic_adv_sync_establish_evt(UINT8 *p);
static void btu_ble_periodic_adv_report_evt(UINT8 *p, UINT8 evt_len);
static void btu_ble_periodic_adv_sync_lost_evt(UINT8 *p);
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
static void btu_ble_scan_timeout_evt(UINT8 *p);
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static void btu_ble_adv_set_terminate_evt(UINT8 *p);
static void btu_ble_scan_req_received_evt(UINT8 *p);
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
static void btu_ble_channel_select_alg_evt(UINT8 *p);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
static void btu_ble_periodic_adv_sync_trans_recv(UINT8 *p);
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_42_ADV_EN == TRUE)
extern osi_sem_t adv_enable_sem;
extern osi_sem_t adv_data_sem;
extern osi_sem_t adv_param_sem;
extern osi_sem_t scan_enable_sem;
extern osi_sem_t scan_param_sem;
extern uint8_t adv_enable_status;
extern uint8_t adv_data_status;
extern uint8_t adv_param_status;
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
extern osi_sem_t scan_enable_sem;
extern osi_sem_t scan_param_sem;
extern uint8_t scan_enable_status;
extern uint8_t scan_param_status;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif
/*******************************************************************************
@ -183,6 +215,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
STREAM_TO_UINT8 (hci_evt_len, p);
switch (hci_evt_code) {
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_INQUIRY_COMP_EVT:
btu_hcif_inquiry_comp_evt (p);
break;
@ -201,6 +234,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_CONNECTION_REQUEST_EVT:
btu_hcif_connection_request_evt (p);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_DISCONNECTION_COMP_EVT:
btu_hcif_disconnection_comp_evt (p);
break;
@ -209,9 +243,11 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
btu_hcif_authentication_comp_evt (p);
#endif ///SMP_INCLUDED == TRUE
break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_RMT_NAME_REQUEST_COMP_EVT:
btu_hcif_rmt_name_request_comp_evt (p, hci_evt_len);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_ENCRYPTION_CHANGE_EVT:
#if (SMP_INCLUDED == TRUE)
btu_hcif_encryption_change_evt (p);
@ -224,18 +260,22 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
#endif ///SMP_INCLUDED == TRUE
break;
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_RMT_FEATURES_COMP_EVT:
btu_hcif_read_rmt_features_comp_evt (p);
break;
case HCI_READ_RMT_EXT_FEATURES_COMP_EVT:
btu_hcif_read_rmt_ext_features_comp_evt (p);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_RMT_VERSION_COMP_EVT:
btu_hcif_read_rmt_version_comp_evt (p);
break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_QOS_SETUP_COMP_EVT:
btu_hcif_qos_setup_comp_evt (p);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_COMMAND_COMPLETE_EVT:
//HCI_TRACE_ERROR("%s should not have received a command complete event. "
// "Someone didn't go through the hci transmit_command function.", __func__);
@ -247,19 +287,24 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_HARDWARE_ERROR_EVT:
btu_hcif_hardware_error_evt (p);
break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_FLUSH_OCCURED_EVT:
btu_hcif_flush_occured_evt ();
break;
case HCI_ROLE_CHANGE_EVT:
btu_hcif_role_change_evt (p);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_NUM_COMPL_DATA_PKTS_EVT:
btu_hcif_num_compl_data_pkts_evt (p);
break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_MODE_CHANGE_EVT:
btu_hcif_mode_change_evt (p);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_PIN_CODE_REQUEST_EVT:
btu_hcif_pin_code_request_evt (p);
break;
@ -269,7 +314,9 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_LINK_KEY_NOTIFICATION_EVT:
btu_hcif_link_key_notification_evt (p);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_LOOPBACK_COMMAND_EVT:
btu_hcif_loopback_command_evt ();
break;
@ -306,7 +353,6 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_RMT_HOST_SUP_FEAT_NOTIFY_EVT:
btu_hcif_host_support_evt (p);
break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_IO_CAPABILITY_REQUEST_EVT:
btu_hcif_io_cap_request_evt (p);
break;
@ -335,7 +381,6 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_KEYPRESS_NOTIFY_EVT:
btu_hcif_keypress_notif_evt (p);
break;
#endif /* (CLASSIC_BT_INCLUDED == TRUE) */
case HCI_LINK_SUPER_TOUT_CHANGED_EVT:
btu_hcif_link_supv_to_changed_evt (p);
break;
@ -344,6 +389,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
btu_hcif_enhanced_flush_complete_evt ();
break;
#endif
#endif /* (CLASSIC_BT_INCLUDED == TRUE) */
#if (BLE_INCLUDED == TRUE)
case HCI_BLE_EVENT:
@ -389,10 +435,13 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_BLE_PHY_UPDATE_COMPLETE_EVT:
btu_ble_phy_update_complete_evt(p);
break;
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
case HCI_BLE_EXT_ADV_REPORT_EVT:
//HCI_TRACE_ERROR("%s, HCI_BLE_EXT_ADV_REPORT_EVT.", __func__);
btu_ble_ext_adv_report_evt(p, hci_evt_len);
break;
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
case HCI_BLE_PERIOD_ADV_SYNC_ESTAB_EVT:
btu_ble_periodic_adv_sync_establish_evt(p);
break;
@ -402,15 +451,20 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_BLE_PERIOD_ADV_SYNC_LOST_EVT:
btu_ble_periodic_adv_sync_lost_evt(p);
break;
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
case HCI_BLE_SCAN_TIMEOUT_EVT:
btu_ble_scan_timeout_evt(p);
break;
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case HCI_BLE_ADV_SET_TERMINATED_EVT:
btu_ble_adv_set_terminate_evt(p);
break;
case HCI_BLE_SCAN_REQ_RECEIVED_EVT:
btu_ble_scan_req_received_evt(p);
break;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
case HCI_BLE_CHANNEL_SELECT_ALG:
btu_ble_channel_select_alg_evt(p);
break;
@ -561,7 +615,7 @@ void btu_hcif_send_host_rdy_for_data(void)
btsnd_hcic_host_num_xmitted_pkts (num_ents, handles, num_pkts);
}
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btu_hcif_inquiry_comp_evt
@ -689,7 +743,7 @@ static void btu_hcif_connection_request_evt (UINT8 *p)
}
#endif /* BTM_SCO_INCLUDED */
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
@ -738,6 +792,7 @@ static void btu_hcif_authentication_comp_evt (UINT8 *p)
}
#endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btu_hcif_rmt_name_request_comp_evt
@ -762,7 +817,7 @@ static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len)
btm_sec_rmt_name_request_complete (bd_addr, p, status);
#endif ///SMP_INCLUDED == TRUE
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
@ -788,7 +843,7 @@ static void btu_hcif_encryption_change_evt (UINT8 *p)
btm_sec_encrypt_change (handle, status, encr_enable);
}
#endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btu_hcif_read_rmt_features_comp_evt
@ -827,6 +882,7 @@ static void btu_hcif_read_rmt_ext_features_comp_evt (UINT8 *p)
btm_read_remote_ext_features_failed(status, handle);
}
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
@ -842,7 +898,7 @@ static void btu_hcif_read_rmt_version_comp_evt (UINT8 *p)
btm_read_remote_version_complete (p);
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btu_hcif_qos_setup_comp_evt
@ -936,6 +992,7 @@ static void btu_hcif_esco_connection_chg_evt (UINT8 *p)
rx_pkt_len, tx_pkt_len);
#endif
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
@ -951,6 +1008,7 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
{
uint8_t status;
switch (opcode) {
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_INQUIRY_CANCEL:
/* Tell inquiry processing that we are done */
btm_process_cancel_complete(HCI_SUCCESS, BTM_BR_INQUIRY_MASK);
@ -963,37 +1021,37 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
btm_delete_stored_link_key_complete (p);
break;
case HCI_READ_LOCAL_NAME:
btm_read_local_name_complete (p, evt_len);
break;
case HCI_GET_LINK_QUALITY:
btm_read_link_quality_complete (p);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_LOCAL_NAME:
btm_read_local_name_complete (p, evt_len);
break;
case HCI_READ_RSSI:
btm_read_rssi_complete (p);
break;
case HCI_READ_TRANSMIT_POWER_LEVEL:
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
btm_read_tx_power_complete(p, FALSE);
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_CREATE_CONNECTION_CANCEL:
btm_create_conn_cancel_complete(p);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_LOCAL_OOB_DATA:
#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
btm_read_local_oob_complete(p);
#endif
break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_INQ_TX_POWER_LEVEL:
btm_read_linq_tx_power_complete (p);
break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_SET_AFH_CHANNELS:
btm_set_afh_channels_complete(p);
break;
@ -1057,22 +1115,26 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
break;
case HCI_BLE_READ_ADV_CHNL_TX_POWER:
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
btm_read_tx_power_complete(p, TRUE);
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
break;
#if (BLE_42_ADV_EN == TRUE)
case HCI_BLE_WRITE_ADV_ENABLE:
btm_ble_write_adv_enable_complete(p);
break;
#endif // #if (BLE_42_ADV_EN == TRUE)
case HCI_BLE_CREATE_LL_CONN:
btm_ble_create_ll_conn_complete(*p);
break;
case HCI_BLE_TRANSMITTER_TEST:
case HCI_BLE_RECEIVER_TEST:
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
case HCI_BLE_TEST_END:
btm_ble_test_command_complete(p);
break;
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
case HCI_BLE_CREATE_CONN_CANCEL:
btm_ble_create_conn_cancel_complete(p);
break;
@ -1107,6 +1169,7 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
break;
#endif // #if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case HCI_BLE_SET_EXT_ADV_PARAM:
case HCI_BLE_SET_EXT_ADV_DATA:
case HCI_BLE_SET_EXT_SCAN_RSP_DATA:
@ -1115,6 +1178,7 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
HCI_TRACE_EVENT("%s opcode 0x%x status 0x%x", __func__, opcode, status);
break;
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
case HCI_BLE_READ_PHY: {
uint16_t conn_handle;
uint8_t tx_phy;
@ -1126,11 +1190,14 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
btm_read_phy_callback(status, conn_handle, tx_phy, rx_phy);
break;
}
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
case HCI_BLE_ENH_RX_TEST:
case HCI_BLE_ENH_TX_TEST:
btm_ble_test_command_complete(p);
break;
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
case HCI_BLE_SET_PERIOD_ADV_RECV_ENABLE:
case HCI_BLE_SET_DEFAULT_PAST_PARAMS:
@ -1194,6 +1261,7 @@ static void btu_hcif_command_complete_evt(BT_HDR *response, void *context)
uint8_t *stream = response->data + response->offset + 3;
STREAM_TO_UINT16(opcode, stream);
switch (opcode) {
#if (BLE_42_ADV_EN == TRUE)
case HCI_BLE_WRITE_ADV_DATA:
adv_data_status = *stream;
osi_sem_give(&adv_data_sem);
@ -1211,6 +1279,8 @@ static void btu_hcif_command_complete_evt(BT_HDR *response, void *context)
adv_param_status = *stream;
osi_sem_give(&adv_param_sem);
break;
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
case HCI_BLE_WRITE_SCAN_PARAMS:
scan_param_status = *stream;
osi_sem_give(&scan_param_sem);
@ -1219,6 +1289,7 @@ static void btu_hcif_command_complete_evt(BT_HDR *response, void *context)
scan_enable_status = *stream;
osi_sem_give(&scan_enable_sem);
break;
#endif // #if (BLE_42_SCAN_EN == TRUE)
default:
break;
}
@ -1267,6 +1338,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
#endif
switch (opcode) {
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_EXIT_SNIFF_MODE:
case HCI_EXIT_PARK_MODE:
#if BTM_SCO_WAKE_PARKED_LINK == TRUE
@ -1286,7 +1358,9 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
case HCI_PARK_MODE:
btm_pm_proc_cmd_status(status);
break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
case HCI_BLE_PERIOD_ADV_CREATE_SYNC:
{
uint8_t btm_status = BTM_SUCCESS;
@ -1297,6 +1371,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
btm_create_sync_callback(btm_status);
break;
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
case HCI_BLE_SET_PHY:
{
uint8_t btm_status = BTM_SUCCESS;
@ -1503,7 +1578,7 @@ static void btu_hcif_hardware_error_evt (UINT8 *p)
}
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btu_hcif_flush_occured_evt
@ -1540,7 +1615,7 @@ static void btu_hcif_role_change_evt (UINT8 *p)
l2c_link_role_changed (bda, role, status);
btm_acl_role_changed(status, bda, role);
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
@ -1561,7 +1636,7 @@ static void btu_hcif_num_compl_data_pkts_evt (UINT8 *p)
btm_sco_process_num_completed_pkts (p);
#endif
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btu_hcif_mode_change_evt
@ -1629,7 +1704,7 @@ static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len)
HCI_TRACE_WARNING("hcif ssr evt: st 0x%x, hdl 0x%x, tx_lat %d rx_lat %d", status, handle, max_tx_lat, max_rx_lat);
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btu_hcif_pin_code_request_evt
@ -1640,6 +1715,7 @@ static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len)
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_pin_code_request_evt (UINT8 *p)
{
#if (CLASSIC_BT_INCLUDED == TRUE)
@ -1694,9 +1770,10 @@ static void btu_hcif_link_key_notification_evt (UINT8 *p)
btm_sec_link_key_notification (bda, key, key_type);
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btu_hcif_loopback_command_evt
@ -1872,7 +1949,7 @@ static void btu_hcif_host_support_evt (UINT8 *p)
** Returns void
**
*******************************************************************************/
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_io_cap_request_evt (UINT8 *p)
{
btm_io_capabilities_req(p);
@ -1981,6 +2058,7 @@ static void btu_hcif_rem_oob_request_evt (UINT8 *p)
}
#endif
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btu_hcif_link_supv_to_changed_evt
@ -2019,6 +2097,7 @@ static void btu_hcif_enhanced_flush_complete_evt (void)
/* This is empty until an upper layer cares about returning event */
}
#endif
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/**********************************************
** End of Simple Pairing Events
***********************************************/
@ -2138,6 +2217,7 @@ static void btu_ble_phy_update_complete_evt(UINT8 *p)
}
#if BLE_PRIVACY_SPT == TRUE
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
/*******************************************************************************
**
** Function btm_ble_resolve_random_addr_adv_ext
@ -2158,8 +2238,10 @@ static void btm_ble_resolve_random_addr_adv_ext(void *p_rec, void *p)
BDADDR_TO_STREAM(pp,bda);
}
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#endif
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
static void btu_ble_ext_adv_report_evt(UINT8 *p, UINT16 evt_len)
{
tBTM_BLE_EXT_ADV_REPORT ext_adv_report = {0};
@ -2240,7 +2322,9 @@ static void btu_ble_ext_adv_report_evt(UINT8 *p, UINT16 evt_len)
}
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
static void btu_ble_periodic_adv_sync_establish_evt(UINT8 *p)
{
tBTM_BLE_PERIOD_ADV_SYNC_ESTAB sync_estab = {0};
@ -2313,14 +2397,18 @@ static void btu_ble_periodic_adv_sync_lost_evt(UINT8 *p)
btm_ble_periodic_adv_sync_lost_evt(&sync_lost);
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
static void btu_ble_scan_timeout_evt(UINT8 *p)
{
UNUSED(p);
btm_ble_scan_timeout_evt();
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static void btu_ble_adv_set_terminate_evt(UINT8 *p)
{
tBTM_BLE_ADV_TERMINAT adv_term = {0};
@ -2353,6 +2441,7 @@ static void btu_ble_scan_req_received_evt(UINT8 *p)
btm_ble_scan_req_received_evt(&req_received);
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
static void btu_ble_channel_select_alg_evt(UINT8 *p)
{

View File

@ -254,17 +254,6 @@ UINT16 BTU_BleAclPktSize(void)
#endif
}
#if SCAN_QUEUE_CONGEST_CHECK
bool BTU_check_queue_is_congest(void)
{
if (osi_thread_queue_wait_size(btu_thread, 0) >= BT_QUEUE_CONGEST_SIZE) {
return true;
}
return false;
}
#endif
int get_btu_work_queue_size(void)
{
return osi_thread_queue_wait_size(btu_thread, 0);

View File

@ -229,11 +229,13 @@ bool btu_task_post(uint32_t sig, void *param, uint32_t timeout)
break;
case SIG_BTU_HCI_ADV_RPT_MSG:
#if BLE_INCLUDED == TRUE
#if (BLE_42_SCAN_EN == TRUE)
if (param != NULL) {
btm_ble_adv_pkt_post(param);
}
btm_ble_adv_pkt_ready();
status = true;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#else
osi_free(param);
status = false;

View File

@ -75,7 +75,7 @@ UINT8 GATT_SetTraceLevel (UINT8 new_level)
**
** Function GATTS_AddHandleRange
**
** Description This function add the allocated handles range for the specifed
** Description This function add the allocated handles range for the specified
** application UUID, service UUID and service instance
**
** Parameter p_hndl_range: pointer to allocated handles information
@ -105,7 +105,7 @@ BOOLEAN GATTS_AddHandleRange(tGATTS_HNDL_RANGE *p_hndl_range)
** NV save callback function. There can be one and only one
** NV save callback function.
**
** Parameter p_cb_info : callback informaiton
** Parameter p_cb_info : callback information
**
** Returns TRUE if registered OK, else FALSE
**
@ -151,7 +151,7 @@ static void gatt_update_for_database_change(void)
** num_handles : number of handles needed by the service.
** is_pri : is a primary service or not.
**
** Returns service handle if sucessful, otherwise 0.
** Returns service handle if successful, otherwise 0.
**
*******************************************************************************/
UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
@ -170,7 +170,7 @@ UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
GATT_TRACE_API ("GATTS_CreateService\n" );
if (p_reg == NULL) {
GATT_TRACE_ERROR ("Inavlid gatt_if=%d\n", gatt_if);
GATT_TRACE_ERROR ("Invalid gatt_if=%d\n", gatt_if);
return (0);
}
@ -491,7 +491,7 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
return GATT_SERVICE_STARTED;
}
/*this is a new application servoce start */
/*this is a new application service start */
if ((i_sreg = gatt_sr_alloc_rcb(p_list)) == GATT_MAX_SR_PROFILES) {
GATT_TRACE_ERROR ("GATTS_StartService: no free server registration block");
return GATT_NO_RESOURCES;
@ -1388,8 +1388,9 @@ void GATT_Deregister (tGATT_IF gatt_if)
}
}
}
#if (tGATT_BG_CONN_DEV == TRUE)
gatt_deregister_bgdev_list(gatt_if);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/* update the listen mode */
#if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && (BLE_PERIPHERAL_MODE_SUPPORT == TRUE))
GATT_Listen(gatt_if, FALSE, NULL);
@ -1468,9 +1469,12 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_
if (is_direct) {
status = gatt_act_connect (p_reg, bd_addr, bd_addr_type, transport, is_aux);
} else {
#if (tGATT_BG_CONN_DEV == TRUE)
if (transport == BT_TRANSPORT_LE) {
status = gatt_update_auto_connect_dev(gatt_if, TRUE, bd_addr, TRUE);
} else {
} else
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
{
GATT_TRACE_ERROR("Unsupported transport for background connection");
}
}
@ -1483,7 +1487,7 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_
**
** Function GATT_CancelConnect
**
** Description This function terminate the connection initaition to a remote
** Description This function terminate the connection initiation to a remote
** device on GATT channel.
**
** Parameters gatt_if: client interface. If 0 used as unconditionally disconnect,
@ -1527,6 +1531,7 @@ BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct
status = gatt_cancel_open(gatt_if, bd_addr);
}
} else {
#if (tGATT_BG_CONN_DEV == TRUE)
if (!gatt_if) {
if (gatt_get_num_apps_for_bg_dev(bd_addr)) {
while (gatt_find_app_for_bg_dev(bd_addr, &temp_gatt_if)) {
@ -1539,6 +1544,7 @@ BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct
} else {
status = gatt_remove_bg_dev_for_app(gatt_if, bd_addr);
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
}
return status;
@ -1628,7 +1634,7 @@ tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr)
**
** Function GATT_GetConnectionInfor
**
** Description This function use conn_id to find its associated BD address and applciation
** Description This function use conn_id to find its associated BD address and application
** interface
**
** Parameters conn_id: connection id (input)
@ -1665,7 +1671,7 @@ BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if, BD_ADDR bd_
** Function GATT_GetConnIdIfConnected
**
** Description This function find the conn_id if the logical link for BD address
** and applciation interface is connected
** and application interface is connected
**
** Parameters gatt_if: application interface (input)
** bd_addr: peer device address. (input)
@ -1720,7 +1726,9 @@ BOOLEAN GATT_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr)
}
if (bd_addr != NULL) {
#if (tGATT_BG_CONN_DEV == TRUE)
gatt_update_auto_connect_dev(gatt_if, start, bd_addr, FALSE);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
} else {
p_reg->listening = start ? GATT_LISTEN_TO_ALL : GATT_LISTEN_TO_NONE;
}

View File

@ -502,7 +502,7 @@ static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connect
#endif ///GATTS_INCLUDED == TRUE
}
} else {
GATT_TRACE_ERROR("CCB max out, no rsources");
GATT_TRACE_ERROR("CCB max out, no resources");
}
}
} else {
@ -929,18 +929,23 @@ static void gatt_send_conn_cback(tGATT_TCB *p_tcb)
{
UINT8 i;
tGATT_REG *p_reg;
#if (tGATT_BG_CONN_DEV == TRUE)
tGATT_BG_CONN_DEV *p_bg_dev = NULL;
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
UINT16 conn_id;
#if (tGATT_BG_CONN_DEV == TRUE)
p_bg_dev = gatt_find_bg_dev(p_tcb->peer_bda);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/* notifying all applications for the connection up event */
for (i = 0, p_reg = gatt_cb.cl_rcb ; i < GATT_MAX_APPS; i++, p_reg++) {
if (p_reg->in_use) {
#if (tGATT_BG_CONN_DEV == TRUE)
if (p_bg_dev && gatt_is_bg_dev_for_app(p_bg_dev, p_reg->gatt_if)) {
gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, TRUE);
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
if (p_reg->app_cb.p_conn_cb) {
conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_reg->gatt_if);
(*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, p_tcb->peer_bda, conn_id,

View File

@ -108,7 +108,7 @@ void gatt_free_pending_ind(tGATT_TCB *p_tcb)
**
** Function gatt_free_pending_enc_queue
**
** Description Free all buffers in pending encyption queue
** Description Free all buffers in pending encryption queue
**
** Returns None
**
@ -222,7 +222,7 @@ void gatt_set_srv_chg(void)
**
** Description Find the app id in on the new service changed list
**
** Returns Pointer to the found new service changed item othwerwise NULL
** Returns Pointer to the found new service changed item otherwise NULL
**
*******************************************************************************/
tGATTS_PENDING_NEW_SRV_START *gatt_sr_is_new_srv_chg(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, UINT16 svc_inst)
@ -299,7 +299,7 @@ tGATTS_PENDING_NEW_SRV_START *gatt_add_pending_new_srv_start(tGATTS_HNDL_RANGE *
**
** Function gatt_add_srv_chg_clt
**
** Description Add a service chnage client to the service change client queue
** Description Add a service change client to the service change client queue
**
** Returns Pointer to the service change client buffer; Null no buffer available
**
@ -682,7 +682,7 @@ BOOLEAN gatt_remove_a_srv_from_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_
**
** Function gatt_add_an_item_to_list
**
** Description add an service handle range to the list in decending
** Description add an service handle range to the list in descending
** order of the start handle
**
** Returns BOOLEAN TRUE-if add is successful
@ -808,7 +808,7 @@ BOOLEAN gatt_find_the_connected_bda(UINT8 start_idx, BD_ADDR bda, UINT8 *p_found
**
** Function gatt_is_srv_chg_ind_pending
**
** Description Check whether a service chnaged is in the indication pending queue
** Description Check whether a service changed is in the indication pending queue
** or waiting for an Ack already
**
** Returns BOOLEAN
@ -846,9 +846,9 @@ BOOLEAN gatt_is_srv_chg_ind_pending (tGATT_TCB *p_tcb)
**
** Function gatt_is_bda_in_the_srv_chg_clt_list
**
** Description This function check the specified bda is in the srv chg clinet list or not
** Description This function check the specified bda is in the srv chg client list or not
**
** Returns pointer to the found elemenet otherwise NULL
** Returns pointer to the found element otherwise NULL
**
*******************************************************************************/
tGATTS_SRV_CHG *gatt_is_bda_in_the_srv_chg_clt_list (BD_ADDR bda)
@ -1205,7 +1205,7 @@ UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid)
if (uuid.len == LEN_UUID_16) {
UINT16_TO_STREAM (p, uuid.uu.uuid16);
len = LEN_UUID_16;
} else if (uuid.len == LEN_UUID_32) { /* always convert 32 bits into 128 bits as alwats */
} else if (uuid.len == LEN_UUID_32) { /* always convert 32 bits into 128 bits as always */
gatt_convert_uuid32_to_uuid128(p, uuid.uu.uuid32);
p += LEN_UUID_128;
len = LEN_UUID_128;
@ -1465,7 +1465,7 @@ UINT8 gatt_sr_alloc_rcb(tGATT_HDL_LIST_ELEM *p_list )
UINT8 ii = 0;
tGATT_SR_REG *p_sreg = NULL;
/*this is a new application servoce start */
/*this is a new application service start */
for (ii = 0, p_sreg = gatt_cb.sr_reg; ii < GATT_MAX_SR_PROFILES; ii++, p_sreg++) {
if (!p_sreg->in_use) {
memset (p_sreg, 0, sizeof(tGATT_SR_REG));
@ -1616,7 +1616,7 @@ UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl)
break;
default:
GATT_TRACE_ERROR("inavlid UUID len=%d", p_uuid->len);
GATT_TRACE_ERROR("invalid UUID len=%d", p_uuid->len);
SDP_DeleteRecord(sdp_handle);
return 0;
break;
@ -1633,7 +1633,7 @@ UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl)
SDP_AddProtocolList(sdp_handle, 2, proto_elem_list);
/* Make the service browseable */
/* Make the service browsable */
SDP_AddUuidSequence (sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &list);
return (sdp_handle);
@ -1868,7 +1868,7 @@ UINT8 gatt_num_apps_hold_link(tGATT_TCB *p_tcb)
**
** Function gatt_num_clcb_by_bd_addr
**
** Description The function searches all LCB with macthing bd address
** Description The function searches all LCB with matching bd address
**
** Returns total number of clcb found.
**
@ -1892,7 +1892,7 @@ UINT8 gatt_num_clcb_by_bd_addr(BD_ADDR bda)
**
** Function gatt_sr_update_cback_cnt
**
** Description The function searches all LCB with macthing bd address
** Description The function searches all LCB with matching bd address
**
** Returns total number of clcb found.
**
@ -1916,7 +1916,7 @@ void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb )
**
** Function gatt_sr_is_cback_cnt_zero
**
** Description The function searches all LCB with macthing bd address
** Description The function searches all LCB with matching bd address
**
** Returns True if thetotal application callback count is zero
**
@ -2015,7 +2015,7 @@ void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb )
**
** Function gatt_sr_update_cback_cnt
**
** Description Update the teh application callback count
** Description Update the the application callback count
**
** Returns None
**
@ -2045,7 +2045,7 @@ void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc
**
** Function gatt_sr_update_prep_cnt
**
** Description Update the teh prepare write request count
** Description Update the the prepare write request count
**
** Returns None
**
@ -2461,7 +2461,7 @@ void gatt_dbg_display_uuid(tBT_UUID bt_uuid)
}
#if (tGATT_BG_CONN_DEV == TRUE)
/*******************************************************************************
**
** Function gatt_is_bg_dev_for_app
@ -2552,7 +2552,7 @@ BOOLEAN gatt_add_bg_dev_list(tGATT_REG *p_reg, BD_ADDR bd_addr, BOOLEAN is_init
for (i = 0; i < GATT_MAX_APPS; i ++) {
if (is_initator) {
if (p_dev->gatt_if[i] == gatt_if) {
GATT_TRACE_ERROR("device already in iniator white list");
GATT_TRACE_ERROR("device already in initiator white list");
return TRUE;
} else if (p_dev->gatt_if[i] == 0) {
p_dev->gatt_if[i] = gatt_if;
@ -2618,9 +2618,9 @@ BOOLEAN gatt_remove_bg_dev_for_app(tGATT_IF gatt_if, BD_ADDR bd_addr)
**
** Function gatt_get_num_apps_for_bg_dev
**
** Description Gte the number of applciations for the specified background device
** Description Gte the number of applications for the specified background device
**
** Returns UINT8 total number fo applications
** Returns UINT8 total number for applications
**
*******************************************************************************/
UINT8 gatt_get_num_apps_for_bg_dev(BD_ADDR bd_addr)
@ -2842,7 +2842,7 @@ BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_
}
return ret;
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/*******************************************************************************

View File

@ -130,7 +130,7 @@ typedef union {
tGATT_EXEC_FLAG exec_write; /* execute write */
} tGATT_CL_MSG;
/* error response strucutre */
/* error response structure */
typedef struct {
UINT16 handle;
UINT8 cmd_code;
@ -480,12 +480,14 @@ typedef struct {
UINT32 service_change;
} tGATT_SVC_CHG;
#if (tGATT_BG_CONN_DEV == TRUE)
typedef struct {
tGATT_IF gatt_if[GATT_MAX_APPS];
tGATT_IF listen_gif[GATT_MAX_APPS];
BD_ADDR remote_bda;
BOOLEAN in_use;
} tGATT_BG_CONN_DEV;
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#define GATT_SVC_CHANGED_CONNECTING 1 /* wait for connection */
#define GATT_SVC_CHANGED_SERVICE 2 /* GATT service discovery */
@ -553,8 +555,9 @@ typedef struct {
tGATT_HDL_CFG hdl_cfg;
#if (tGATT_BG_CONN_DEV == TRUE)
tGATT_BG_CONN_DEV bgconn_dev[GATT_MAX_BG_CONN_DEV];
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
BOOLEAN auto_disc; /* internal use: true for auto discovering after connected */
UINT8 srv_chg_mode; /* internal use: service change mode */
tGATTS_RSP rsp; /* use to read internal service attribute */
@ -667,6 +670,7 @@ extern BOOLEAN gatt_add_an_item_to_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_L
extern BOOLEAN gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_remove);
extern tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg);
#if (tGATT_BG_CONN_DEV == TRUE)
/* for background connection */
extern BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_addr, BOOLEAN is_initiator);
extern BOOLEAN gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if);
@ -676,6 +680,7 @@ extern BOOLEAN gatt_find_app_for_bg_dev(BD_ADDR bd_addr, tGATT_IF *p_gatt_if);
extern tGATT_BG_CONN_DEV *gatt_find_bg_dev(BD_ADDR remote_bda);
extern void gatt_deregister_bgdev_list(tGATT_IF gatt_if);
extern void gatt_reset_bgdev_list(void);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/* server function */
extern UINT8 gatt_sr_find_i_rcb_by_handle(UINT16 handle);

View File

@ -686,6 +686,7 @@ BOOLEAN btsnd_hcic_ble_ltk_req_neg_reply (UINT16 handle)
return (TRUE);
}
#if (BLE_42_DTM_TEST_EN == TRUE)
BOOLEAN btsnd_hcic_ble_receiver_test(UINT8 rx_freq)
{
BT_HDR *p;
@ -733,7 +734,9 @@ BOOLEAN btsnd_hcic_ble_transmitter_test(UINT8 tx_freq, UINT8 test_data_len, UINT
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
return (TRUE);
}
#endif // // #if (BLE_42_DTM_TEST_EN == TRUE)
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
BOOLEAN btsnd_hcic_ble_test_end(void)
{
BT_HDR *p;
@ -754,6 +757,7 @@ BOOLEAN btsnd_hcic_ble_test_end(void)
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
return (TRUE);
}
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
BOOLEAN btsnd_hcic_ble_read_host_supported (void)
{
@ -1174,6 +1178,7 @@ BOOLEAN btsnd_hcic_ble_set_phy(UINT16 conn_handle,
return TRUE;
}
#if (BLE_50_DTM_TEST_EN == TRUE)
UINT8 btsnd_hcic_ble_enhand_rx_test(UINT8 rx_channel, UINT8 phy,
UINT8 modulation_idx)
{
@ -1218,7 +1223,9 @@ UINT8 btsnd_hcic_ble_enhand_tx_test(UINT8 tx_channel, UINT8 len,
return TRUE;
}
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
UINT8 btsnd_hcic_ble_set_extend_rand_address(UINT8 adv_handle, BD_ADDR rand_addr)
{
BT_HDR *p;
@ -1432,7 +1439,9 @@ UINT8 btsnd_hcic_ble_clear_adv_set(void)
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
UINT8 btsnd_hcic_ble_set_periodic_adv_params(UINT8 adv_handle,
UINT16 interval_min,
UINT16 interval_max,
@ -1507,7 +1516,9 @@ UINT8 btsnd_hcic_ble_periodic_adv_enable(UINT8 enable, UINT8 adv_handle)
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
UINT8 btsnd_hcic_ble_set_ext_scan_params(UINT8 own_addr_type, UINT8 filter_policy,
UINT8 phy_mask, UINT8 phy_count,
tHCI_EXT_SCAN_PARAMS *params)
@ -1555,6 +1566,7 @@ UINT8 btsnd_hcic_ble_ext_scan_enable(UINT8 enable, UINT8 filter_dups,
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
BOOLEAN btsnd_hcic_ble_create_ext_conn(tHCI_CreatExtConn *p_conn)
{
@ -1627,6 +1639,7 @@ BOOLEAN btsnd_hcic_ble_create_ext_conn(tHCI_CreatExtConn *p_conn)
}
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
BOOLEAN btsnd_hcic_ble_periodic_adv_create_sync(UINT8 option, UINT8 adv_sid,
UINT8 adv_addr_type, BD_ADDR adv_addr,
UINT16 sync_timeout, UINT8 unused)
@ -1750,6 +1763,7 @@ UINT8 btsnd_hcic_ble_read_periodic_adv_list_size(void)
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
UINT8 btsnd_hcic_ble_read_trans_power(void)
{

View File

@ -3022,7 +3022,7 @@ tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr,
//extern
tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb);
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
/*******************************************************************************
**
** Function BTM_ReadTxPower
@ -3043,6 +3043,7 @@ tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda,
tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb);
tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb);
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
void BTM_BleGetWhiteListSize(uint16_t *length);

View File

@ -367,7 +367,6 @@ typedef UINT32 tBTM_BLE_AD_MASK;
#define BTM_BLE_AD_TYPE_MANU HCI_EIR_MANUFACTURER_SPECIFIC_TYPE /* 0xff */
typedef UINT8 tBTM_BLE_AD_TYPE;
#define BTM_BLE_LONG_ADV_MAX_LEN 249
/* Security settings used with L2CAP LE COC */
#define BTM_SEC_LE_LINK_ENCRYPTED 0x01
@ -395,7 +394,9 @@ typedef UINT8 tBTM_BLE_ADV_TX_POWER;
/* adv tx power in dBm */
typedef struct {
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
UINT8 adv_inst_max; /* max adv instance supported in controller */
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
UINT8 rpa_offloading;
UINT16 tot_scan_results_strg;
UINT8 max_irk_list_sz;
@ -499,6 +500,7 @@ typedef struct {
tBTM_BLE_ADV_TX_POWER tx_power;
} tBTM_BLE_ADV_PARAMS;
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
typedef struct {
UINT8 *p_sub_code; /* dynamic array to store sub code */
UINT8 *p_inst_id; /* dynamic array to store instance id */
@ -530,6 +532,7 @@ typedef struct {
tBTM_BLE_MULTI_ADV_INST *p_adv_inst; /* dynamic array to store adv instance */
tBTM_BLE_MULTI_ADV_OPQ op_q;
} tBTM_BLE_MULTI_ADV_CB;
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
typedef UINT8 tGATT_IF;
@ -944,6 +947,7 @@ typedef UINT8 tBTM_BLE_CONN_TYPE;
#define ADV_INFO_PRESENT 0x00
#define NO_ADV_INFO_PRESENT 0x01
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
typedef btgatt_track_adv_info_t tBTM_BLE_TRACK_ADV_DATA;
typedef void (tBTM_BLE_TRACK_ADV_CBACK)(tBTM_BLE_TRACK_ADV_DATA *p_track_adv_data);
@ -961,6 +965,7 @@ enum {
};
typedef UINT8 tBTM_BLE_TRACK_ADV_ACTION;
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#define BTM_BLE_MULTI_ADV_INVALID 0
@ -1013,6 +1018,7 @@ typedef void (tBTM_SET_CSA_SUPPORT_CMPL_CBACK) (tBTM_STATUS status);
#define BTM_BLE_5_GAP_READ_PHY_COMPLETE_EVT 1
#define BTM_BLE_5_GAP_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT 2
#define BTM_BLE_5_GAP_SET_PREFERED_PHY_COMPLETE_EVT 3
#if (BLE_50_EXTEND_ADV_EN == TRUE)
#define BTM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT 4
#define BTM_BLE_5_GAP_EXT_ADV_SET_PARAMS_COMPLETE_EVT 5
#define BTM_BLE_5_GAP_EXT_ADV_DATA_SET_COMPLETE_EVT 6
@ -1021,29 +1027,42 @@ typedef void (tBTM_SET_CSA_SUPPORT_CMPL_CBACK) (tBTM_STATUS status);
#define BTM_BLE_5_GAP_EXT_ADV_STOP_COMPLETE_EVT 9
#define BTM_BLE_5_GAP_EXT_ADV_SET_REMOVE_COMPLETE_EVT 10
#define BTM_BLE_5_GAP_EXT_ADV_SET_CLEAR_COMPLETE_EVT 11
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
#define BTM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT 12
#define BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT 13
#define BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT 14
#define BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT 15
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
#define BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT 16
#define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT 17
#define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT 18
#define BTM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT 19
#define BTM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT 20
#define BTM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT 21
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
#define BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT 22
#define BTM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT 23
#define BTM_BLE_5_GAP_EXT_SCAN_STOP_COMPLETE_EVT 24
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#define BTM_BLE_5_GAP_PREFER_EXT_CONN_PARAMS_SET_COMPLETE_EVT 25
#define BTM_BLE_5_GAP_PHY_UPDATE_COMPLETE_EVT 26
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
#define BTM_BLE_5_GAP_EXT_ADV_REPORT_EVT 27
#define BTM_BLE_5_GAP_SCAN_TIMEOUT_EVT 28
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
#define BTM_BLE_5_GAP_ADV_TERMINATED_EVT 29
#define BTM_BLE_5_GAP_SCAN_REQ_RECEIVED_EVT 30
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#define BTM_BLE_5_GAP_CHANNEL_SELETE_ALGORITHM_EVT 31
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
#define BTM_BLE_5_GAP_PERIODIC_ADV_REPORT_EVT 32
#define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_LOST_EVT 33
#define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_ESTAB_EVT 34
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#define BTM_BLE_GAP_PERIODIC_ADV_RECV_ENABLE_COMPLETE_EVT 35
#define BTM_BLE_GAP_PERIODIC_ADV_SYNC_TRANS_COMPLETE_EVT 36
@ -1313,34 +1332,48 @@ typedef union {
tBTM_BLE_READ_PHY_CMPL read_phy;
tBTM_BLE_SET_PREF_DEF_PHY_CMPL set_perf_def_phy;
tBTM_BLE_SET_PERF_PHY_CMPL set_perf_phy;
#if (BLE_50_EXTEND_ADV_EN == TRUE)
tBTM_BLE_EXT_ADV_SET_RAND_ADDR_CMPL set_ext_rand_addr;
tBTM_BLE_EXT_ADV_SET_PARAMS_CMPL set_params;
tBTM_BLE_EXT_ADV_DATA_SET_CMPL adv_data_set;
tBTM_BLE_EXT_ADV_SCAN_RSP_DATA_SET_CMPL scan_rsp_data_set;
tBTM_BLE_EXT_ADV_START_CMPL adv_start;
tBTM_BLE_EXT_ADV_STOP_CMPL adv_stop;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
tBTM_BLE_PERIOD_ADV_SET_PARAMS_CMPL per_adv_set_params;
tBTM_BLE_PERIOD_ADV_DATA_SET_CMPL per_adv_data_set;
tBTM_BLE_PERIOD_ADV_START_CMPL per_adv_start;
tBTM_BLE_PERIOD_ADV_STOP_CMPL per_adv_stop;
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
tBTM_BLE_PERIOD_ADV_SYNC_CREATE_CMPL per_adv_sync_create;
tBTM_BLE_PERIOD_ADV_SYNC_CANCEL_CMPL per_adv_sync_cancel;
tBTM_BLE_PERIOD_ADV_SYNC_TEMINAT_CMPL per_adv_sync_term;
tBTM_BLE_PERIOD_ADV_ADD_DEV_CMPL per_adv_add_dev;
tBTM_BLE_PERIOD_ADV_REMOVE_DEV_CMPL per_adv_remove_dev;
tBTM_BLE_PEROID_ADV_CLEAR_DEV_CMPL per_adv_clear_dev;
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
tBTM_BLE_SET_EXT_SCAN_PARAMS_CMPL ext_scan;
tBTM_BLE_EXT_SCAN_START_CMPL scan_start;
tBTM_BLE_EXT_SCAN_STOP_CMPL scan_stop;
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
tBTM_BLE_PREF_EXT_CONN_SET_PARAMS_CMPL ext_conn_set_params;
tBTM_BLE_PHY_UPDATE_CMPL phy_update;
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
tBTM_BLE_EXT_ADV_REPORT ext_adv_report;
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
tBTM_BLE_ADV_TERMINAT adv_term;
tBTM_BLE_SCAN_REQ_RECEIVED scan_req;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
tBTM_BLE_CHANNEL_SEL_ALG channel_sel;
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
tBTM_PERIOD_ADV_REPORT period_adv_report;
tBTM_BLE_PERIOD_ADV_SYNC_LOST sync_lost;
tBTM_BLE_PERIOD_ADV_SYNC_ESTAB sync_estab;
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
tBTM_BLE_PERIOD_ADV_RECV_ENABLE_CMPL per_adv_recv_enable;
tBTM_BLE_PERIOD_ADV_SYNC_TRANS_CMPL per_adv_sync_trans;
@ -1424,23 +1457,6 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name,
BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key,
tBTM_LE_KEY_TYPE key_type);
/*******************************************************************************
**
** Function BTM_BleSetAdvParams
**
** Description This function is called to set advertising parameters.
**
** Parameters: None.
**
** Returns void
**
*******************************************************************************/
//extern
tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP chnl_map);
/*******************************************************************************
**
** Function BTM_BleSetAdvParamsAll
@ -1485,20 +1501,6 @@ tBTM_STATUS BTM_BleStartAdv(void);
tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask,
tBTM_BLE_ADV_DATA *p_data);
/*******************************************************************************
**
** Function BTM_BleWriteLongAdvData
**
** Description This function is called to write long advertising data.
**
** Parameters: adv_data: long advertising data
** adv_data_len: the length of long advertising data
**
** Returns void
**
*******************************************************************************/
tBTM_STATUS BTM_BleWriteLongAdvData(uint8_t *adv_data, uint8_t adv_data_len);
/*******************************************************************************
**
** Function BTM_BleWriteAdvDataRaw
@ -1552,6 +1554,7 @@ void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max,
//extern
void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb);
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
/*******************************************************************************
**
** Function BTM_BleSetScanParams
@ -1572,7 +1575,7 @@ void BTM_BleSetScanParams(tGATT_IF client_if, UINT32 scan_interval,
UINT32 scan_window, tBLE_SCAN_MODE scan_type,
tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback);
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
/*******************************************************************************
**
@ -1671,6 +1674,7 @@ tBTM_STATUS BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
//extern
tBTM_STATUS BTM_BleDisableBatchScan(tBTM_BLE_REF_VALUE ref_value);
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleReadScanReports
@ -1686,7 +1690,9 @@ tBTM_STATUS BTM_BleDisableBatchScan(tBTM_BLE_REF_VALUE ref_value);
//extern
tBTM_STATUS BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode,
tBTM_BLE_REF_VALUE ref_value);
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleTrackAdvertiser
@ -1702,6 +1708,7 @@ tBTM_STATUS BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode,
//extern
tBTM_STATUS BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK *p_track_cback,
tBTM_BLE_REF_VALUE ref_value);
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
/*******************************************************************************
**
@ -2272,6 +2279,7 @@ BOOLEAN BTM_BleLocalPrivacyEnabled(void);
//extern
void BTM_BleEnableMixedPrivacyMode(BOOLEAN mixed_on);
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleMaxMultiAdvInstanceCount
@ -2283,6 +2291,7 @@ void BTM_BleEnableMixedPrivacyMode(BOOLEAN mixed_on);
*******************************************************************************/
//extern
UINT8 BTM_BleMaxMultiAdvInstanceCount(void);
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************
**
@ -2463,6 +2472,7 @@ BOOLEAN BTM_BleSecurityProcedureIsRunning (BD_ADDR bd_addr);
//extern
UINT8 BTM_BleGetSupportedKeySize (BD_ADDR bd_addr);
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************/
/* Multi ADV API */
/*******************************************************************************
@ -2535,6 +2545,8 @@ tBTM_STATUS BTM_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
//extern
tBTM_STATUS BTM_BleDisableAdvInstance (UINT8 inst_id);
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
/*******************************************************************************
**
** Function BTM_BleAdvFilterParamSetup
@ -2789,12 +2801,13 @@ tBTM_STATUS BTM_BleSetExtendedScanParams(tBTM_BLE_EXT_SCAN_PARAMS *params);
tBTM_STATUS BTM_BleExtendedScan(BOOLEAN enable, UINT16 duration, UINT16 period);
void BTM_BleSetPreferExtenedConnParams(BD_ADDR bd_addr, tBTM_EXT_CONN_PARAMS *params);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
void BTM_BleEnhancedReceiverTest(UINT8 rx_freq, UINT8 phy, UINT8 modulation_index, tBTM_CMPL_CB *p_cmd_cmpl_cback);
void BTM_BleEnhancedTransmitterTest(UINT8 tx_freq, UINT8 test_data_len, UINT8 packet_payload, UINT8 phy, tBTM_CMPL_CB *p_cmd_cmpl_cback);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
void BTM_BlePeriodicAdvRecvEnable(UINT16 sync_handle, UINT8 enable);

View File

@ -357,8 +357,12 @@
#define HCI_BLE_READ_PHY (0x0030 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_DEFAULT_PHY (0x0031 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_PHY (0x0032 | HCI_GRP_BLE_CMDS)
#endif
#if (BLE_50_DTM_TEST_EN == TRUE)
#define HCI_BLE_ENH_RX_TEST (0x0033 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ENH_TX_TEST (0x0034 | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#define HCI_BLE_SET_ADV_RAND_ADDR (0x0035 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_EXT_ADV_PARAM (0x0036 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_EXT_ADV_DATA (0x0037 | HCI_GRP_BLE_CMDS)
@ -461,8 +465,6 @@
#define HCI_BLE_ENERGY_INFO_OCF HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_ENERGY_INFO)
/* Extended BLE Scan parameters OCF */
#define HCI_BLE_EXTENDED_SCAN_PARAMS_OCF HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_EXTENDED_SCAN_PARAMS)
/* Long BLE Adv data OCF */
#define HCI_VENDOR_BLE_LONG_ADV_DATA HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_LONG_ADV)
/* BLE update duplicate scan exceptional list */
#define HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_DUPLICATE_EXCEPTIONAL_LIST)
#define HCI_VENDOR_BLE_SET_ADV_FLOW_CONTROL HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_SET_ADV_FLOW_CONTROL)

View File

@ -764,8 +764,12 @@ void btsnd_hcic_vendor_spec_cmd (BT_HDR *buffer, UINT16 opcode,
#define HCIC_PARAM_SIZE_BLE_READ_PHY 2
#define HCIC_PARAM_SIZE_BLE_SET_DEF_PHY 3
#define HCIC_PARAM_SIZE_BLE_SET_PHY 7
#endif
#if (BLE_50_DTM_TEST_EN == TRUE)
#define HCIC_PARAM_SIZE_ENH_RX_TEST 3
#define HCIC_PARAM_SIZE_ENH_TX_TEST 4
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#define HCIC_PARAM_SIZE_EXT_RAND_ADDR 7
#define HCIC_PARAM_SIZE_EXT_ADV_SET_PARAMS 25
#define HCIC_PARAM_SIZE_EXT_ADV_WRITE_DATA 251
@ -963,14 +967,17 @@ UINT8 btsnd_hcic_ble_set_prefered_default_phy(UINT8 all_phys,
BOOLEAN btsnd_hcic_ble_set_phy(UINT16 conn_handle,
UINT8 all_phys, UINT8 tx_phys,
UINT8 rx_phys, UINT16 phy_options);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
UINT8 btsnd_hcic_ble_enhand_rx_test(UINT8 rx_channel, UINT8 phy,
UINT8 modulation_idx);
UINT8 btsnd_hcic_ble_enhand_tx_test(UINT8 tx_channel, UINT8 len,
UINT8 packect,
UINT8 phy);
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
UINT8 btsnd_hcic_ble_set_extend_rand_address(UINT8 adv_handle, BD_ADDR rand_addr);
UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UINT32 interval_min,

View File

@ -1073,11 +1073,11 @@ BOOLEAN l2cble_create_conn (tL2C_LCB *p_lcb)
L2CAP_TRACE_WARNING ("L2CAP - LE - cannot start new connection at conn st: %d", conn_st);
btm_ble_enqueue_direct_conn_req(p_lcb);
#if (tGATT_BG_CONN_DEV == TRUE)
if (conn_st == BLE_BG_CONN) {
btm_ble_suspend_bg_conn();
}
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
rt = TRUE;
}
return rt;

View File

@ -368,9 +368,11 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
BTM_Recovery_Pre_State();
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
if(btm_ble_inter_get() && reason == HCI_ERR_CONN_FAILED_ESTABLISHMENT) {
BTM_BleStartExtAdvRestart(handle);
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif ///BLE_INCLUDED == TRUE
status = FALSE;
@ -483,19 +485,23 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
#endif // (GATTC_CONNECT_RETRY_EN == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
if(btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE) {
p_lcb->retry_create_con ++;
L2CAP_TRACE_DEBUG("slave restart extend adv, retry count %d reason 0x%x\n", p_lcb->retry_create_con, reason);
BTM_BleStartExtAdvRestart(handle);
}
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
if(!btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE) {
p_lcb->retry_create_con ++;
L2CAP_TRACE_DEBUG("slave resatrt adv, retry count %d reason 0x%x\n", p_lcb->retry_create_con, reason);
btm_ble_start_adv();
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
}

View File

@ -220,7 +220,6 @@ CONFIG_BLUFI_TRACE_LEVEL_EVENT CONFIG_BT_LOG_BLUFI_
CONFIG_BLUFI_TRACE_LEVEL_DEBUG CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_DEBUG
CONFIG_BLUFI_TRACE_LEVEL_VERBOSE CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_VERBOSE
CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK
CONFIG_SMP_ENABLE CONFIG_BT_SMP_ENABLE
CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN
CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -111,7 +111,18 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in
esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal)
{
// Currently calibration is not supported on ESP32-C2, IDF-5236
*tsens_cal = 0.0;
const esp_efuse_desc_t** cal_temp_efuse;
cal_temp_efuse = ESP_EFUSE_TEMP_CALIB;
int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse);
assert(cal_temp_size == 9);
uint32_t cal_temp = 0;
esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size);
if (err != ESP_OK) {
*tsens_cal = 0.0;
return err;
}
// BIT(8) stands for sign: 1: negative, 0: positive
*tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp;
return ESP_OK;
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -132,7 +132,18 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in
esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal)
{
// Currently calibration is not supported on ESP32-C6, IDF-5236
*tsens_cal = 0;
const esp_efuse_desc_t** cal_temp_efuse;
cal_temp_efuse = ESP_EFUSE_TEMP_CALIB;
int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse);
assert(cal_temp_size == 9);
uint32_t cal_temp = 0;
esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size);
if (err != ESP_OK) {
*tsens_cal = 0.0;
return err;
}
// BIT(8) stands for sign: 1: negative, 0: positive
*tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp;
return ESP_OK;
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -124,7 +124,18 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in
esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal)
{
// Currently calibration is not supported on ESP32-H2, IDF-5236
*tsens_cal = 0;
const esp_efuse_desc_t** cal_temp_efuse;
cal_temp_efuse = ESP_EFUSE_TEMP_CALIB;
int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse);
assert(cal_temp_size == 9);
uint32_t cal_temp = 0;
esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size);
if (err != ESP_OK) {
*tsens_cal = 0.0;
return err;
}
// BIT(8) stands for sign: 1: negative, 0: positive
*tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp;
return ESP_OK;
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -7,6 +7,7 @@
#include <esp_bit_defs.h>
#include "esp_efuse.h"
#include "esp_efuse_table.h"
#include "esp_efuse_rtc_calib.h"
int esp_efuse_rtc_calib_get_ver(void)
{
@ -35,7 +36,18 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, int atten, uint32_t*
esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal)
{
//TODO: IDF-7482
*tsens_cal = 0;
return ESP_ERR_NOT_SUPPORTED;
const esp_efuse_desc_t** cal_temp_efuse;
cal_temp_efuse = ESP_EFUSE_TEMPERATURE_SENSOR;
int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse);
assert(cal_temp_size == 9);
uint32_t cal_temp = 0;
esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size);
if (err != ESP_OK) {
*tsens_cal = 0.0;
return err;
}
// BIT(8) stands for sign: 1: negative, 0: positive
*tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp;
return ESP_OK;
}

@ -1 +1 @@
Subproject commit 5dfd9c58155efcc02307273e6e530a65c7dca50f
Subproject commit 070b21458de97671380bd46e562b5dc67d41e8a9

View File

@ -1,31 +1,45 @@
menu "ESP-Driver:GPTimer Configurations"
depends on SOC_GPTIMER_SUPPORTED
config GPTIMER_ISR_HANDLER_IN_IRAM
bool "Place GPTimer ISR handler into IRAM"
bool "Place GPTimer ISR handler in IRAM to reduce latency"
default y
select GPTIMER_OBJ_CACHE_SAFE
help
Place GPTimer ISR handler into IRAM for better performance and fewer cache misses.
Place GPTimer ISR handler in IRAM to reduce latency caused by cache miss.
config GPTIMER_CTRL_FUNC_IN_IRAM
bool "Place GPTimer control functions into IRAM"
bool "Place GPTimer control functions in IRAM"
default n
select GPTIMER_OBJ_CACHE_SAFE
help
Place GPTimer control functions (like start/stop) into IRAM,
so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context.
Enabling this option can improve driver performance as well.
Place GPTimer control functions (like start/stop) in IRAM, to reduce latency caused by cache miss.
If enabled, these functions can also be called when cache is disabled.
config GPTIMER_ISR_IRAM_SAFE
bool "GPTimer ISR IRAM-Safe"
bool "Allow GPTimer ISR to execute when cache is disabled"
select GPTIMER_ISR_HANDLER_IN_IRAM
default n
help
Ensure the GPTimer interrupt is IRAM-Safe by allowing the interrupt handler to be
executable when the cache is disabled (e.g. SPI Flash write).
Enable this option to allow the GPTimer Interrupt Service Routine (ISR)
to execute even when the cache is disabled. This can be useful in scenarios where the cache
might be turned off, but the GPTimer functionality is still required to operate correctly.
config GPTIMER_ENABLE_DEBUG_LOG
bool "Enable debug log"
config GPTIMER_OBJ_CACHE_SAFE
bool
default n
help
whether to enable the debug log message for GPTimer driver.
Note that, this option only controls the GPTimer driver log, won't affect other drivers.
This will ensure the GPTimer object will not be allocated from a memory region
where its cache can be disabled.
config GPTIMER_ENABLE_DEBUG_LOG
bool "Force enable debug log"
default n
help
If enabled, GPTimer component will:
1. ignore the global logging settings
2. compile all log messages into the binary
3. set the runtime log level to VERBOSE
Please enable this option by caution, as it will increase the binary size.
endmenu

View File

@ -1,27 +1,14 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#include <sys/lock.h>
#include "sdkconfig.h"
#if CONFIG_GPTIMER_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for this source file
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
#endif
#include "freertos/FreeRTOS.h"
#include "esp_attr.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp_check.h"
#include "driver/gptimer.h"
#include "esp_memory_utils.h"
#include "gptimer_priv.h"
static const char *TAG = "gptimer";
#include "esp_memory_utils.h"
static void gptimer_default_isr(void *args);
@ -134,9 +121,6 @@ static esp_err_t gptimer_destroy(gptimer_t *timer)
esp_err_t gptimer_new_timer(const gptimer_config_t *config, gptimer_handle_t *ret_timer)
{
#if CONFIG_GPTIMER_ENABLE_DEBUG_LOG
esp_log_level_set(TAG, ESP_LOG_DEBUG);
#endif
esp_err_t ret = ESP_OK;
gptimer_t *timer = NULL;
ESP_RETURN_ON_FALSE(config && ret_timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
@ -185,7 +169,7 @@ esp_err_t gptimer_new_timer(const gptimer_config_t *config, gptimer_handle_t *re
timer->direction = config->direction;
timer->intr_priority = config->intr_priority;
timer->flags.intr_shared = config->flags.intr_shared;
ESP_LOGD(TAG, "new gptimer (%d,%d) at %p, resolution=%"PRIu32"Hz", group_id, timer_id, timer, timer->resolution_hz);
ESP_LOGD(TAG, "new gptimer (%d,%d) at %p, %zu bytes used", group_id, timer_id, timer, heap_caps_get_allocated_size(timer));
*ret_timer = timer;
return ESP_OK;
@ -228,7 +212,9 @@ esp_err_t gptimer_del_timer(gptimer_handle_t timer)
esp_err_t gptimer_set_raw_count(gptimer_handle_t timer, unsigned long long value)
{
ESP_RETURN_ON_FALSE_ISR(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
if (timer == NULL) {
return ESP_ERR_INVALID_ARG;
}
portENTER_CRITICAL_SAFE(&timer->spinlock);
timer_hal_set_counter_value(&timer->hal, value);
@ -238,7 +224,9 @@ esp_err_t gptimer_set_raw_count(gptimer_handle_t timer, unsigned long long value
esp_err_t gptimer_get_raw_count(gptimer_handle_t timer, unsigned long long *value)
{
ESP_RETURN_ON_FALSE_ISR(timer && value, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
if (timer == NULL || value == NULL) {
return ESP_ERR_INVALID_ARG;
}
portENTER_CRITICAL_SAFE(&timer->spinlock);
*value = timer_hal_capture_and_get_counter_value(&timer->hal);
@ -255,7 +243,9 @@ esp_err_t gptimer_get_resolution(gptimer_handle_t timer, uint32_t *out_resolutio
esp_err_t gptimer_get_captured_count(gptimer_handle_t timer, uint64_t *value)
{
ESP_RETURN_ON_FALSE_ISR(timer && value, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
if (timer == NULL || value == NULL) {
return ESP_ERR_INVALID_ARG;
}
portENTER_CRITICAL_SAFE(&timer->spinlock);
*value = timer_ll_get_counter_value(timer->hal.dev, timer->timer_id);
@ -305,14 +295,22 @@ esp_err_t gptimer_register_event_callbacks(gptimer_handle_t timer, const gptimer
esp_err_t gptimer_set_alarm_action(gptimer_handle_t timer, const gptimer_alarm_config_t *config)
{
ESP_RETURN_ON_FALSE_ISR(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
if (timer == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (config) {
#if CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM
ESP_RETURN_ON_FALSE_ISR(esp_ptr_internal(config), ESP_ERR_INVALID_ARG, TAG, "alarm config struct not in internal RAM");
// when the function is placed in IRAM, we expect the config struct is also placed in internal RAM
// if the cache is disabled, the function can still access the config struct
if (esp_ptr_internal(config) == false) {
return ESP_ERR_INVALID_ARG;
}
#endif
// When auto_reload is enabled, alarm_count should not be equal to reload_count
bool valid_auto_reload = !config->flags.auto_reload_on_alarm || config->alarm_count != config->reload_count;
ESP_RETURN_ON_FALSE_ISR(valid_auto_reload, ESP_ERR_INVALID_ARG, TAG, "reload count can't equal to alarm count");
if (valid_auto_reload == false) {
return ESP_ERR_INVALID_ARG;
}
portENTER_CRITICAL_SAFE(&timer->spinlock);
timer->reload_count = config->reload_count;
@ -340,6 +338,7 @@ esp_err_t gptimer_set_alarm_action(gptimer_handle_t timer, const gptimer_alarm_c
esp_err_t gptimer_enable(gptimer_handle_t timer)
{
ESP_RETURN_ON_FALSE(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
// the only acceptable FSM change: init->enable
gptimer_fsm_t expected_fsm = GPTIMER_FSM_INIT;
ESP_RETURN_ON_FALSE(atomic_compare_exchange_strong(&timer->fsm, &expected_fsm, GPTIMER_FSM_ENABLE),
ESP_ERR_INVALID_STATE, TAG, "timer not in init state");
@ -360,6 +359,7 @@ esp_err_t gptimer_enable(gptimer_handle_t timer)
esp_err_t gptimer_disable(gptimer_handle_t timer)
{
ESP_RETURN_ON_FALSE(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
// the only acceptable FSM change: enable->init
gptimer_fsm_t expected_fsm = GPTIMER_FSM_ENABLE;
ESP_RETURN_ON_FALSE(atomic_compare_exchange_strong(&timer->fsm, &expected_fsm, GPTIMER_FSM_INIT),
ESP_ERR_INVALID_STATE, TAG, "timer not in enable state");
@ -379,7 +379,14 @@ esp_err_t gptimer_disable(gptimer_handle_t timer)
esp_err_t gptimer_start(gptimer_handle_t timer)
{
ESP_RETURN_ON_FALSE_ISR(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
if (timer == NULL) {
return ESP_ERR_INVALID_ARG;
}
// if the timer is already started, do nothing
if (atomic_load(&timer->fsm) == GPTIMER_FSM_RUN) {
return ESP_OK;
}
gptimer_fsm_t expected_fsm = GPTIMER_FSM_ENABLE;
if (atomic_compare_exchange_strong(&timer->fsm, &expected_fsm, GPTIMER_FSM_RUN_WAIT)) {
@ -393,7 +400,8 @@ esp_err_t gptimer_start(gptimer_handle_t timer)
atomic_store(&timer->fsm, GPTIMER_FSM_RUN);
portEXIT_CRITICAL_SAFE(&timer->spinlock);
} else {
ESP_RETURN_ON_FALSE_ISR(false, ESP_ERR_INVALID_STATE, TAG, "timer is not ready for a new start");
// return error if the timer is not in the expected state
return ESP_ERR_INVALID_STATE;
}
return ESP_OK;
@ -401,7 +409,15 @@ esp_err_t gptimer_start(gptimer_handle_t timer)
esp_err_t gptimer_stop(gptimer_handle_t timer)
{
ESP_RETURN_ON_FALSE_ISR(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
if (timer == NULL) {
// not printing error message here because the return value already indicates the error well
return ESP_ERR_INVALID_ARG;
}
// if the timer is not started, do nothing
if (atomic_load(&timer->fsm) == GPTIMER_FSM_ENABLE) {
return ESP_OK;
}
gptimer_fsm_t expected_fsm = GPTIMER_FSM_RUN;
if (atomic_compare_exchange_strong(&timer->fsm, &expected_fsm, GPTIMER_FSM_ENABLE_WAIT)) {
@ -412,7 +428,8 @@ esp_err_t gptimer_stop(gptimer_handle_t timer)
atomic_store(&timer->fsm, GPTIMER_FSM_ENABLE);
portEXIT_CRITICAL_SAFE(&timer->spinlock);
} else {
ESP_RETURN_ON_FALSE_ISR(false, ESP_ERR_INVALID_STATE, TAG, "timer is not running");
// return error if the timer is not in the expected state
return ESP_ERR_INVALID_STATE;
}
return ESP_OK;

View File

@ -1,15 +1,14 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "esp_check.h"
#include <sys/lock.h>
#include "esp_clk_tree.h"
#include "esp_private/gptimer.h"
#include "gptimer_priv.h"
static const char *TAG = "gptimer";
#include "esp_private/esp_clk_tree_common.h"
typedef struct gptimer_platform_t {
_lock_t mutex; // platform level mutex lock
@ -171,3 +170,11 @@ esp_err_t gptimer_get_pm_lock(gptimer_handle_t timer, esp_pm_lock_handle_t *ret_
*ret_pm_lock = timer->pm_lock;
return ESP_OK;
}
#if CONFIG_GPTIMER_ENABLE_DEBUG_LOG
__attribute__((constructor))
static void gptimer_override_default_log_level(void)
{
esp_log_level_set(TAG, ESP_LOG_VERBOSE);
}
#endif

View File

@ -1,26 +1,17 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#include <sys/lock.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp_check.h"
#include "esp_heap_caps.h"
#include "driver/gptimer.h"
#include "gptimer_priv.h"
#include "hal/timer_ll.h"
#include "esp_private/etm_interface.h"
#define ETM_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT
static const char *TAG = "gptimer-etm";
static esp_err_t gptimer_del_etm_event(esp_etm_event_t *event)
{
free(event);
@ -36,17 +27,16 @@ static esp_err_t gptimer_del_etm_task(esp_etm_task_t *task)
esp_err_t gptimer_new_etm_event(gptimer_handle_t timer, const gptimer_etm_event_config_t *config, esp_etm_event_handle_t *out_event)
{
esp_etm_event_t *event = NULL;
esp_err_t ret = ESP_OK;
ESP_GOTO_ON_FALSE(timer && config && out_event, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");
ESP_GOTO_ON_FALSE(config->event_type < GPTIMER_ETM_EVENT_MAX, ESP_ERR_INVALID_ARG, err, TAG, "invalid event type");
ESP_RETURN_ON_FALSE(timer && config && out_event, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
ESP_RETURN_ON_FALSE(config->event_type < GPTIMER_ETM_EVENT_MAX, ESP_ERR_INVALID_ARG, TAG, "invalid event type");
event = heap_caps_calloc(1, sizeof(esp_etm_event_t), ETM_MEM_ALLOC_CAPS);
ESP_GOTO_ON_FALSE(event, ESP_ERR_NO_MEM, err, TAG, "no memory for ETM event");
ESP_RETURN_ON_FALSE(event, ESP_ERR_NO_MEM, TAG, "no memory for ETM event");
// get the event ID that can be recognized by ETM hardware
gptimer_group_t *group = timer->group;
int group_id = group->group_id;
int timer_id = timer->timer_id;
uint32_t event_id = TIMER_LL_ETM_EVENT_TABLE(group_id, timer_id, config->event_type);
ESP_GOTO_ON_FALSE(event_id != 0, ESP_ERR_NOT_SUPPORTED, err, TAG, "not supported event type");
// fill the ETM event object
event->event_id = event_id;
@ -54,28 +44,21 @@ esp_err_t gptimer_new_etm_event(gptimer_handle_t timer, const gptimer_etm_event_
event->del = gptimer_del_etm_event;
*out_event = event;
return ESP_OK;
err:
if (event) {
gptimer_del_etm_event(event);
}
return ret;
}
esp_err_t gptimer_new_etm_task(gptimer_handle_t timer, const gptimer_etm_task_config_t *config, esp_etm_task_handle_t *out_task)
{
esp_etm_task_t *task = NULL;
esp_err_t ret = ESP_OK;
ESP_GOTO_ON_FALSE(timer && config && out_task, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");
ESP_GOTO_ON_FALSE(config->task_type < GPTIMER_ETM_TASK_MAX, ESP_ERR_INVALID_ARG, err, TAG, "invalid task type");
ESP_RETURN_ON_FALSE(timer && config && out_task, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
ESP_RETURN_ON_FALSE(config->task_type < GPTIMER_ETM_TASK_MAX, ESP_ERR_INVALID_ARG, TAG, "invalid task type");
task = heap_caps_calloc(1, sizeof(esp_etm_task_t), ETM_MEM_ALLOC_CAPS);
ESP_GOTO_ON_FALSE(task, ESP_ERR_NO_MEM, err, TAG, "no memory for ETM task");
ESP_RETURN_ON_FALSE(task, ESP_ERR_NO_MEM, TAG, "no memory for ETM task");
// get the task ID that can be recognized by ETM hardware
gptimer_group_t *group = timer->group;
int group_id = group->group_id;
int timer_id = timer->timer_id;
uint32_t task_id = TIMER_LL_ETM_TASK_TABLE(group_id, timer_id, config->task_type);
ESP_GOTO_ON_FALSE(task_id != 0, ESP_ERR_NOT_SUPPORTED, err, TAG, "not supported task type");
// fill the ETM task object
task->task_id = task_id;
@ -83,10 +66,4 @@ esp_err_t gptimer_new_etm_task(gptimer_handle_t timer, const gptimer_etm_task_co
task->del = gptimer_del_etm_task;
*out_task = task;
return ESP_OK;
err:
if (task) {
gptimer_del_etm_task(task);
}
return ret;
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -9,17 +9,25 @@
#include <stdint.h>
#include <stdatomic.h>
#include "sdkconfig.h"
#if CONFIG_GPTIMER_ENABLE_DEBUG_LOG
// The local log level must be defined before including esp_log.h
// Set the maximum log level for gptimer driver
#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
#endif
#include "soc/soc_caps.h"
#include "freertos/FreeRTOS.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp_check.h"
#include "esp_attr.h"
#include "esp_intr_alloc.h"
#include "esp_heap_caps.h"
#include "clk_ctrl_os.h"
#include "esp_pm.h"
#include "soc/timer_periph.h"
#include "hal/timer_types.h"
#include "hal/timer_hal.h"
#include "hal/timer_ll.h"
#include "clk_ctrl_os.h"
#include "esp_private/sleep_retention.h"
#include "esp_private/periph_ctrl.h"
@ -29,7 +37,7 @@ extern "C" {
// If ISR handler is allowed to run whilst cache is disabled,
// Make sure all the code and related variables used by the handler are in the SRAM
#if CONFIG_GPTIMER_ISR_IRAM_SAFE || CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM
#if CONFIG_GPTIMER_OBJ_CACHE_SAFE
#define GPTIMER_MEM_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
#else
#define GPTIMER_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT
@ -53,6 +61,10 @@ extern "C" {
#define GPTIMER_CLOCK_SRC_ATOMIC()
#endif
///!< Logging settings
#define TAG "gptimer"
///!< Forward declaration
typedef struct gptimer_t gptimer_t;
typedef struct gptimer_group_t {

View File

@ -299,7 +299,7 @@ TEST_ALARM_CALLBACK_ATTR static bool test_gptimer_alarm_normal_callback(gptimer_
* Also should account for the inaccuracy of the systick during DFS.
*/
#if CONFIG_PM_ENABLE
#define GPTIMER_ONE_SHOT_ALARM_COUNT_DELTA 15000
#define GPTIMER_ONE_SHOT_ALARM_COUNT_DELTA 50000
#else
#define GPTIMER_ONE_SHOT_ALARM_COUNT_DELTA 1000
#endif // CONFIG_PM_ENABLE

View File

@ -23,7 +23,7 @@ static void IRAM_ATTR test_delay_post_cache_disable(void *args)
esp_rom_delay_us(1000);
}
TEST_CASE("gptimer_interrupt_iram_safe", "[gptimer]")
TEST_CASE("gptimer works with cache disabled", "[gptimer]")
{
gptimer_handle_t gptimer = NULL;
gptimer_config_t timer_config = {

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -127,12 +127,64 @@ void rmt_release_group_handle(rmt_group_t *group)
}
}
esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t clk_src)
#if !SOC_RMT_CHANNEL_CLK_INDEPENDENT
static esp_err_t s_rmt_set_group_prescale(rmt_channel_t *chan, uint32_t expect_resolution_hz, uint32_t *ret_channel_prescale)
{
uint32_t periph_src_clk_hz = 0;
rmt_group_t *group = chan->group;
int group_id = group->group_id;
ESP_RETURN_ON_ERROR(esp_clk_tree_src_get_freq_hz(group->clk_src, ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &periph_src_clk_hz), TAG, "get clock source freq failed");
uint32_t group_resolution_hz = 0;
uint32_t group_prescale = 0;
uint32_t channel_prescale = 0;
if (group->resolution_hz == 0) {
while (++group_prescale <= RMT_LL_GROUP_CLOCK_MAX_INTEGER_PRESCALE) {
group_resolution_hz = periph_src_clk_hz / group_prescale;
channel_prescale = (group_resolution_hz + expect_resolution_hz / 2) / expect_resolution_hz;
// use the first value found during the search that satisfies the division requirement (highest frequency)
if (channel_prescale > 0 && channel_prescale <= RMT_LL_CHANNEL_CLOCK_MAX_PRESCALE) {
break;
}
}
} else {
group_prescale = periph_src_clk_hz / group->resolution_hz;
channel_prescale = (group->resolution_hz + expect_resolution_hz / 2) / expect_resolution_hz;
}
ESP_RETURN_ON_FALSE(group_prescale > 0 && group_prescale <= RMT_LL_GROUP_CLOCK_MAX_INTEGER_PRESCALE, ESP_ERR_INVALID_ARG, TAG,
"group prescale out of the range");
ESP_RETURN_ON_FALSE(channel_prescale > 0 && channel_prescale <= RMT_LL_CHANNEL_CLOCK_MAX_PRESCALE, ESP_ERR_INVALID_ARG, TAG,
"channel prescale out of the range");
// group prescale is shared by all rmt_channel, only set once. use critical section to avoid race condition.
bool prescale_conflict = false;
group_resolution_hz = periph_src_clk_hz / group_prescale;
portENTER_CRITICAL(&group->spinlock);
if (group->resolution_hz == 0) {
group->resolution_hz = group_resolution_hz;
RMT_CLOCK_SRC_ATOMIC() {
rmt_ll_set_group_clock_src(group->hal.regs, chan->channel_id, group->clk_src, group_prescale, 1, 0);
rmt_ll_enable_group_clock(group->hal.regs, true);
}
} else {
prescale_conflict = (group->resolution_hz != group_resolution_hz);
}
portEXIT_CRITICAL(&group->spinlock);
ESP_RETURN_ON_FALSE(!prescale_conflict, ESP_ERR_INVALID_ARG, TAG,
"group resolution conflict, already is %"PRIu32" but attempt to %"PRIu32"", group->resolution_hz, group_resolution_hz);
ESP_LOGD(TAG, "group (%d) clock resolution:%"PRIu32"Hz", group_id, group->resolution_hz);
*ret_channel_prescale = channel_prescale;
return ESP_OK;
}
#endif // SOC_RMT_CHANNEL_CLK_INDEPENDENT
esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t clk_src, uint32_t expect_channel_resolution)
{
esp_err_t ret = ESP_OK;
rmt_group_t *group = chan->group;
int channel_id = chan->channel_id;
uint32_t periph_src_clk_hz = 0;
bool clock_selection_conflict = false;
// check if we need to update the group clock source, group clock source is shared by all channels
portENTER_CRITICAL(&group->spinlock);
@ -142,7 +194,7 @@ esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t
clock_selection_conflict = (group->clk_src != clk_src);
}
portEXIT_CRITICAL(&group->spinlock);
ESP_RETURN_ON_FALSE(!clock_selection_conflict, ESP_ERR_INVALID_STATE, TAG,
ESP_RETURN_ON_FALSE(!clock_selection_conflict, ESP_ERR_INVALID_ARG, TAG,
"group clock conflict, already is %d but attempt to %d", group->clk_src, clk_src);
// TODO: [clk_tree] to use a generic clock enable/disable or acquire/release function for all clock source
@ -154,10 +206,6 @@ esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t
}
#endif // SOC_RMT_SUPPORT_RC_FAST
// get clock source frequency
ESP_RETURN_ON_ERROR(esp_clk_tree_src_get_freq_hz((soc_module_clk_t)clk_src, ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &periph_src_clk_hz),
TAG, "get clock source frequency failed");
#if CONFIG_PM_ENABLE
// if DMA is not used, we're using CPU to push the data to the RMT FIFO
// if the CPU frequency goes down, the transfer+encoding scheme could be unstable because CPU can't fill the data in time
@ -172,18 +220,39 @@ esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t
}
#endif // SOC_RMT_SUPPORT_APB
sprintf(chan->pm_lock_name, "rmt_%d_%d", group->group_id, channel_id); // e.g. rmt_0_0
sprintf(chan->pm_lock_name, "rmt_%d_%d", group->group_id, chan->channel_id); // e.g. rmt_0_0
ret = esp_pm_lock_create(pm_lock_type, 0, chan->pm_lock_name, &chan->pm_lock);
ESP_RETURN_ON_ERROR(ret, TAG, "create pm lock failed");
#endif // CONFIG_PM_ENABLE
// no division for group clock source, to achieve highest resolution
uint32_t real_div;
#if SOC_RMT_CHANNEL_CLK_INDEPENDENT
uint32_t periph_src_clk_hz = 0;
// get clock source frequency
ESP_RETURN_ON_ERROR(esp_clk_tree_src_get_freq_hz((soc_module_clk_t)clk_src, ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &periph_src_clk_hz),
TAG, "get clock source frequency failed");
RMT_CLOCK_SRC_ATOMIC() {
rmt_ll_set_group_clock_src(group->hal.regs, channel_id, clk_src, 1, 1, 0);
rmt_ll_set_group_clock_src(group->hal.regs, chan->channel_id, clk_src, 1, 1, 0);
rmt_ll_enable_group_clock(group->hal.regs, true);
}
group->resolution_hz = periph_src_clk_hz;
ESP_LOGD(TAG, "group clock resolution:%"PRIu32, group->resolution_hz);
real_div = (group->resolution_hz + expect_channel_resolution / 2) / expect_channel_resolution;
#else
// set division for group clock source, to achieve highest resolution while guaranteeing the channel resolution.
ESP_RETURN_ON_ERROR(s_rmt_set_group_prescale(chan, expect_channel_resolution, &real_div), TAG, "set rmt group prescale failed");
#endif // SOC_RMT_CHANNEL_CLK_INDEPENDENT
if (chan->direction == RMT_CHANNEL_DIRECTION_TX) {
rmt_ll_tx_set_channel_clock_div(group->hal.regs, chan->channel_id, real_div);
} else {
rmt_ll_rx_set_channel_clock_div(group->hal.regs, chan->channel_id, real_div);
}
// resolution lost due to division, calculate the real resolution
chan->resolution_hz = group->resolution_hz / real_div;
if (chan->resolution_hz != expect_channel_resolution) {
ESP_LOGW(TAG, "channel resolution loss, real=%"PRIu32, chan->resolution_hz);
}
return ret;
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -19,6 +19,7 @@
#include "hal/rmt_hal.h"
#include "hal/dma_types.h"
#include "hal/cache_ll.h"
#include "hal/hal_utils.h"
#include "esp_intr_alloc.h"
#include "esp_heap_caps.h"
#include "esp_clk_tree.h"
@ -113,7 +114,7 @@ struct rmt_group_t {
portMUX_TYPE spinlock; // to protect per-group register level concurrent access
rmt_hal_context_t hal; // hal layer for each group
rmt_clock_source_t clk_src; // record the group clock source, group clock is shared by all channels
uint32_t resolution_hz; // resolution of group clock
uint32_t resolution_hz; // resolution of group clock. clk_src_hz / prescale = resolution_hz
uint32_t occupy_mask; // a set bit in the mask indicates the channel is not available
rmt_tx_channel_t *tx_channels[SOC_RMT_TX_CANDIDATES_PER_GROUP]; // array of RMT TX channels
rmt_rx_channel_t *rx_channels[SOC_RMT_RX_CANDIDATES_PER_GROUP]; // array of RMT RX channels
@ -218,17 +219,18 @@ rmt_group_t *rmt_acquire_group_handle(int group_id);
void rmt_release_group_handle(rmt_group_t *group);
/**
* @brief Set clock source for RMT peripheral
* @brief Set clock source and resolution for RMT peripheral
*
* @param chan RMT channel handle
* @param clk_src Clock source
* @param expect_channel_resolution Expected channel resolution
* @return
* - ESP_OK: Set clock source successfully
* - ESP_ERR_NOT_SUPPORTED: Set clock source failed because the clk_src is not supported
* - ESP_ERR_INVALID_STATE: Set clock source failed because the clk_src is different from other RMT channel
* - ESP_FAIL: Set clock source failed because of other error
*/
esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t clk_src);
esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t clk_src, uint32_t expect_channel_resolution);
/**
* @brief Set interrupt priority to RMT group

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -254,16 +254,9 @@ esp_err_t rmt_new_rx_channel(const rmt_rx_channel_config_t *config, rmt_channel_
ESP_GOTO_ON_ERROR(ret, err, TAG, "install rx interrupt failed");
}
// select the clock source
ESP_GOTO_ON_ERROR(rmt_select_periph_clock(&rx_channel->base, config->clk_src), err, TAG, "set group clock failed");
// set channel clock resolution, find the divider to get the closest resolution
uint32_t real_div = (group->resolution_hz + config->resolution_hz / 2) / config->resolution_hz;
rmt_ll_rx_set_channel_clock_div(hal->regs, channel_id, real_div);
// resolution loss due to division, calculate the real resolution
rx_channel->base.resolution_hz = group->resolution_hz / real_div;
if (rx_channel->base.resolution_hz != config->resolution_hz) {
ESP_LOGW(TAG, "channel resolution loss, real=%"PRIu32, rx_channel->base.resolution_hz);
}
rx_channel->base.direction = RMT_CHANNEL_DIRECTION_RX;
// select the clock source and set clock resolution
ESP_GOTO_ON_ERROR(rmt_select_periph_clock(&rx_channel->base, config->clk_src, config->resolution_hz), err, TAG, "set clock resolution failed");
rx_channel->filter_clock_resolution_hz = group->resolution_hz;
// On esp32 and esp32s2, the counting clock used by the RX filter always comes from APB clock
@ -303,7 +296,6 @@ esp_err_t rmt_new_rx_channel(const rmt_rx_channel_config_t *config, rmt_channel_
// initialize other members of rx channel
portMUX_INITIALIZE(&rx_channel->base.spinlock);
atomic_init(&rx_channel->base.fsm, RMT_FSM_INIT);
rx_channel->base.direction = RMT_CHANNEL_DIRECTION_RX;
rx_channel->base.hw_mem_base = &RMTMEM.channels[channel_id + RMT_RX_CHANNEL_OFFSET_IN_GROUP].symbols[0];
// polymorphic methods
rx_channel->base.del = rmt_del_rx_channel;

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -315,16 +315,9 @@ esp_err_t rmt_new_tx_channel(const rmt_tx_channel_config_t *config, rmt_channel_
ESP_GOTO_ON_ERROR(rmt_tx_init_dma_link(tx_channel, config), err, TAG, "install tx DMA failed");
}
#endif
// select the clock source
ESP_GOTO_ON_ERROR(rmt_select_periph_clock(&tx_channel->base, config->clk_src), err, TAG, "set group clock failed");
// set channel clock resolution, find the divider to get the closest resolution
uint32_t real_div = (group->resolution_hz + config->resolution_hz / 2) / config->resolution_hz;
rmt_ll_tx_set_channel_clock_div(hal->regs, channel_id, real_div);
// resolution lost due to division, calculate the real resolution
tx_channel->base.resolution_hz = group->resolution_hz / real_div;
if (tx_channel->base.resolution_hz != config->resolution_hz) {
ESP_LOGW(TAG, "channel resolution loss, real=%"PRIu32, tx_channel->base.resolution_hz);
}
tx_channel->base.direction = RMT_CHANNEL_DIRECTION_TX;
// select the clock source and set clock resolution
ESP_GOTO_ON_ERROR(rmt_select_periph_clock(&tx_channel->base, config->clk_src, config->resolution_hz), err, TAG, "set clock resolution failed");
rmt_ll_tx_set_mem_blocks(hal->regs, channel_id, tx_channel->base.mem_block_num);
// set limit threshold, after transmit ping_pong_symbols size, an interrupt event would be generated
@ -359,7 +352,6 @@ esp_err_t rmt_new_tx_channel(const rmt_tx_channel_config_t *config, rmt_channel_
portMUX_INITIALIZE(&tx_channel->base.spinlock);
atomic_init(&tx_channel->base.fsm, RMT_FSM_INIT);
tx_channel->base.direction = RMT_CHANNEL_DIRECTION_TX;
tx_channel->base.hw_mem_base = &RMTMEM.channels[channel_id + RMT_TX_CHANNEL_OFFSET_IN_GROUP].symbols[0];
// polymorphic methods
tx_channel->base.del = rmt_del_tx_channel;

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -156,3 +156,34 @@ TEST_CASE("RMT interrupt priority", "[rmt]")
TEST_ESP_OK(rmt_del_channel(rx_channel));
TEST_ESP_OK(rmt_del_channel(another_rx_channel));
}
#if !SOC_RMT_CHANNEL_CLK_INDEPENDENT
TEST_CASE("rmt multiple channels with different resolution", "[rmt]")
{
rmt_tx_channel_config_t tx_channel_cfg = {
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
.gpio_num = TEST_RMT_GPIO_NUM_A,
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = 20 * 1000, // 20KHz
.trans_queue_depth = 1,
};
rmt_channel_handle_t tx_channel = NULL;
rmt_rx_channel_config_t rx_channel_cfg = {
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
.gpio_num = TEST_RMT_GPIO_NUM_B,
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = 40 * 1000 * 1000, // 40MHz
};
rmt_channel_handle_t rx_channel = NULL;
TEST_ESP_OK(rmt_new_tx_channel(&tx_channel_cfg, &tx_channel));
TEST_ESP_ERR(ESP_ERR_INVALID_ARG, rmt_new_rx_channel(&rx_channel_cfg, &rx_channel));
rx_channel_cfg.resolution_hz = 1 * 1000 * 1000; // 1MHz
TEST_ESP_OK(rmt_new_rx_channel(&rx_channel_cfg, &rx_channel));
TEST_ESP_OK(rmt_del_channel(tx_channel));
TEST_ESP_OK(rmt_del_channel(rx_channel));
}
#endif //SOC_RMT_CHANNEL_CLK_INDEPENDENT

View File

@ -572,6 +572,15 @@ esp_err_t spi_bus_remove_device(spi_device_handle_t handle)
#if SOC_SPI_SUPPORT_CLK_RC_FAST
if (handle->cfg.clock_source == SPI_CLK_SRC_RC_FAST) {
// If no transactions from other device, acquire the bus to switch module clock to `SPI_CLK_SRC_DEFAULT`
// because `SPI_CLK_SRC_RC_FAST` will be disabled then, which block following transactions
if (handle->host->cur_cs == DEV_NUM_MAX) {
spi_device_acquire_bus(handle, portMAX_DELAY);
SPI_MASTER_PERI_CLOCK_ATOMIC() {
spi_ll_set_clk_source(handle->host->hal.hw, SPI_CLK_SRC_DEFAULT);
}
spi_device_release_bus(handle);
}
periph_rtc_dig_clk8m_disable();
}
#endif

@ -1 +1 @@
Subproject commit 38908075833e4ae3a48e6ffe431a672698e07e21
Subproject commit e5944fc80c813150131566dd0761709ae9fdea89

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -23,6 +23,10 @@ IRAM_ATTR void esp_rom_gpio_connect_out_signal(uint32_t gpio_num, uint32_t signa
}
REG_WRITE(GPIO_FUNC0_OUT_SEL_CFG_REG + (gpio_num * 4), value);
REG_WRITE(GPIO_ENABLE_W1TS_REG, (1 << gpio_num));
if (gpio_num < 32) {
REG_WRITE(GPIO_ENABLE_W1TS_REG, (1 << gpio_num));
} else {
REG_WRITE(GPIO_ENABLE1_W1TS_REG, (1 << (gpio_num - 32)));
}
}
#endif

@ -1 +1 @@
Subproject commit d4d36dd2ff20a2058392cce7aee6e61b502d6c48
Subproject commit fd857ec9e1f20942c9d398cccd84cc4f498e8e1a

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

Some files were not shown because too many files have changed in this diff Show More