mirror of
https://github.com/espressif/esp-idf
synced 2025-03-08 15:49:08 -05:00
Compare commits
242 Commits
dfe23bcf67
...
2e85c66e0c
Author | SHA1 | Date | |
---|---|---|---|
|
2e85c66e0c | ||
|
a6c3a9cbbb | ||
|
83e8f70ee4 | ||
|
9f68b151db | ||
|
de853be81e | ||
|
6858b37f51 | ||
|
2d1c99e74f | ||
|
4f968c3fc5 | ||
|
ce3d603e05 | ||
|
f02812544e | ||
|
e81a9285fe | ||
|
a07e67893b | ||
|
dbd2aa8c54 | ||
|
80bc9d8828 | ||
|
1f08a8c67e | ||
|
371c7edb22 | ||
|
8606eb43f7 | ||
|
fec59ecb42 | ||
|
d53b0a9111 | ||
|
51fd02dd83 | ||
|
8f371a5004 | ||
|
b66e140fbc | ||
|
8014ffa225 | ||
|
656415b8aa | ||
|
dfd8098716 | ||
|
64f4956d4f | ||
|
aa424235e2 | ||
|
309747bf9a | ||
|
70b474a08a | ||
|
8778ed2812 | ||
|
038d99f3c5 | ||
|
6aa557c845 | ||
|
b144337020 | ||
|
132444cd08 | ||
|
76c207250d | ||
|
548caad60b | ||
|
da07b1fabe | ||
|
bc299e784c | ||
|
efdce75bb1 | ||
|
5b8ac71ace | ||
|
3dc8c0f3cb | ||
|
dd2bde0847 | ||
|
26078bbf9a | ||
|
c264d8c580 | ||
|
0461e2ff88 | ||
|
873409da6b | ||
|
909d81283d | ||
|
a74f9cbe63 | ||
|
5c4a527750 | ||
|
26fa7109f3 | ||
|
a99753d293 | ||
|
e2e8e7dce1 | ||
|
d7222cc89e | ||
|
a4a28b57a3 | ||
|
9f0c8e7bfc | ||
|
54cb6636ec | ||
|
d4c15e2cb6 | ||
|
61f992a061 | ||
|
e7088bbd07 | ||
|
d17b0ed4fe | ||
|
13188dc33b | ||
|
e405583bae | ||
|
e964cc3ad5 | ||
|
e815f68a50 | ||
|
858947e461 | ||
|
837311c0ff | ||
|
73eb376eb1 | ||
|
028a16c01c | ||
|
7e54886a4e | ||
|
51ad6cfab0 | ||
|
d3acbe15aa | ||
|
760f134d84 | ||
|
046279155d | ||
|
18c09cfe64 | ||
|
e2fc36349a | ||
|
c9dff55c9f | ||
|
97b7b880c7 | ||
|
33e81e572b | ||
|
5f70a525f0 | ||
|
9822433957 | ||
|
5f2a7f4d29 | ||
|
37a4de8a71 | ||
|
0d6b29c369 | ||
|
62700fa36f | ||
|
90728ade83 | ||
|
c7ee2d7157 | ||
|
d598c9db7c | ||
|
877057db3d | ||
|
b6903296ad | ||
|
e00ba3cbd1 | ||
|
ca24a117c7 | ||
|
cfe4bf339f | ||
|
93b4ef13ae | ||
|
26a1b69a2a | ||
|
1bfc6eddf0 | ||
|
a1e6387c16 | ||
|
3d5bf355c3 | ||
|
7bc8938469 | ||
|
1633c1a2bb | ||
|
a38893d2d1 | ||
|
a5fe1e2a46 | ||
|
af0f270e17 | ||
|
43a7248501 | ||
|
786dcacd8b | ||
|
d6aff6d2a4 | ||
|
1aae76f524 | ||
|
7361aca98b | ||
|
e57f02e920 | ||
|
53d8b70e8b | ||
|
bbd9acee93 | ||
|
57a52f571d | ||
|
50e3a2bcba | ||
|
1d6bcb86ba | ||
|
a88bd155cd | ||
|
76133bc373 | ||
|
9ed5ea1acf | ||
|
f77183ceaf | ||
|
f390fcbd90 | ||
|
f8efa4cd80 | ||
|
d305628c25 | ||
|
88a3a6c58d | ||
|
81e8b752fd | ||
|
3a64c44d86 | ||
|
af7b6b71ea | ||
|
90d59288b1 | ||
|
79ee0927d1 | ||
|
0f3fb0c0fb | ||
|
4e073fe166 | ||
|
45b1141f8f | ||
|
8355b832d3 | ||
|
c004b93669 | ||
|
64ae64fb16 | ||
|
0f69fda3d5 | ||
|
7f2cedc048 | ||
|
6b1d8dbbfb | ||
|
3b28818ba4 | ||
|
0b6922405d | ||
|
5301eaf0d8 | ||
|
f31a0f7f61 | ||
|
486f3cdb7b | ||
|
bfa25448b7 | ||
|
46952c601d | ||
|
8ad16fd58d | ||
|
222b1ddbab | ||
|
e01877ff2e | ||
|
36335e38b6 | ||
|
51205a8fd8 | ||
|
7e93f4b5ed | ||
|
738ce191cd | ||
|
96af7b4a11 | ||
|
463af2a065 | ||
|
93cdad7a3b | ||
|
d5f2447b88 | ||
|
c71d74e2f8 | ||
|
bc1965a109 | ||
|
3df8f30816 | ||
|
5c3829cebc | ||
|
93fd1d91cb | ||
|
01f9245da1 | ||
|
180e67b547 | ||
|
c2449607dc | ||
|
472320a7a3 | ||
|
f167fa8a6c | ||
|
34ae5db60d | ||
|
328665135c | ||
|
e111d92af6 | ||
|
deb703cc68 | ||
|
2c0381d23b | ||
|
0d7b0c885c | ||
|
7a5684d478 | ||
|
7559275fef | ||
|
2f59c59350 | ||
|
b562afa08e | ||
|
727d0a687f | ||
|
c11f49e2cb | ||
|
fcb1e8ad5c | ||
|
b5aef58afe | ||
|
83eaa261af | ||
|
3ad70e9998 | ||
|
dcfbac8c94 | ||
|
d31654da96 | ||
|
5b7cee8631 | ||
|
04133e0225 | ||
|
d68fcf1d7b | ||
|
6a584e9698 | ||
|
004ff87ea4 | ||
|
5d63f251f9 | ||
|
e41f619566 | ||
|
e2fbec5d2e | ||
|
608ecf63e2 | ||
|
e61089e7e0 | ||
|
58dc93bb99 | ||
|
e4b698fc32 | ||
|
2221133ba8 | ||
|
b3c4c58ee0 | ||
|
46d1d7a43f | ||
|
c95a12658e | ||
|
1003ced6e9 | ||
|
fd4094e502 | ||
|
f2c8b32075 | ||
|
f8ff9e47ed | ||
|
7d751dcc8f | ||
|
e21e3f417f | ||
|
c1149f24e0 | ||
|
9f489c2ab0 | ||
|
1bd8fabf5e | ||
|
581cbca5ab | ||
|
6f49122b74 | ||
|
923255d7a7 | ||
|
664b0a772e | ||
|
c03b007644 | ||
|
95ce1c08c1 | ||
|
fd2df5e2fc | ||
|
d2c5724873 | ||
|
3aaaa2203a | ||
|
78e6ce0d35 | ||
|
ad623893d4 | ||
|
43121c0d47 | ||
|
fd09700aab | ||
|
299d8115ed | ||
|
c465b75ed6 | ||
|
f38a2e193d | ||
|
aa791ead44 | ||
|
69acda1785 | ||
|
d2d4d1518d | ||
|
fb08e4eafe | ||
|
7e0cb453e8 | ||
|
0959beef72 | ||
|
540b0131c2 | ||
|
91bff05d9f | ||
|
b3523a6fbe | ||
|
0fd3984c72 | ||
|
147ffec4ac | ||
|
09aae72bfa | ||
|
92d575379f | ||
|
64b85676ae | ||
|
342202204c | ||
|
67638981ec | ||
|
8155e60edf | ||
|
a45b12a68b | ||
|
c0590f5b50 | ||
|
d78461eb54 |
@ -11,3 +11,14 @@ generate_failed_jobs_report:
|
||||
- job_report.html
|
||||
script:
|
||||
- python tools/ci/dynamic_pipelines/scripts/generate_report.py --report-type job
|
||||
|
||||
sync_support_status:
|
||||
stage: post_deploy
|
||||
extends:
|
||||
- .rules:sync_support_status
|
||||
needs:
|
||||
- push_to_github
|
||||
image: $ESP_ENV_IMAGE
|
||||
tags: [ brew, github_sync ]
|
||||
script:
|
||||
- curl --fail --request POST --form token="$IDF_STATUS_TRIG_TOKEN" --form ref="$IDF_STATUS_BRANCH" --form "variables[UPLOAD_TO_S3]=true" "$IDF_STATUS_TRIG_URL"
|
||||
|
@ -68,6 +68,7 @@
|
||||
- "tools/ci/check_public_headers.py"
|
||||
- "tools/ci/check_register_rw_half_word.cmake"
|
||||
- "tools/ci/check_register_rw_half_word.py"
|
||||
- "examples/build_system/**/*"
|
||||
|
||||
.patterns-host_test: &patterns-host_test
|
||||
- ".gitlab/ci/host-test.yml"
|
||||
@ -168,6 +169,9 @@
|
||||
.if-ref-master: &if-ref-master
|
||||
if: '$CI_COMMIT_REF_NAME == "master"'
|
||||
|
||||
.if-ref-master-no_label: &if-ref-master-no_label
|
||||
if: '$CI_COMMIT_REF_NAME == "master" && $BOT_TRIGGER_WITH_LABEL == null'
|
||||
|
||||
.if-tag-release: &if-tag-release
|
||||
if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/'
|
||||
|
||||
@ -219,6 +223,11 @@
|
||||
when: never
|
||||
- <<: *if-protected-no_label
|
||||
|
||||
# Not uploading on release branches
|
||||
.rules:sync_support_status:
|
||||
rules:
|
||||
- <<: *if-ref-master-no_label
|
||||
|
||||
.rules:protected-no_label-always:
|
||||
rules:
|
||||
- <<: *if-qa-test-tag
|
||||
|
@ -27,3 +27,6 @@ Test Case Filters:
|
||||
# This example will include all tests containing 'test_hello_world' in the name,
|
||||
# and include all tests containing 'test_sdm' but not 'sdmmc' in the name.
|
||||
``` --><!-- Optional -->
|
||||
|
||||
<!-- Don't remove the next line - assigns the MR author as the assignee -->
|
||||
/assign me
|
||||
|
@ -60,3 +60,6 @@ _If there are any breaking changes, please mention it here. Talking about (1) wh
|
||||
_Please strictly follow the breaking change restriction, which means, if there is a breaking change but you are merging to non-major versions, you have to separate the breaking part out to another MR for a major version. The breaking change subsection is only accepted in MRs merging to major versions._
|
||||
|
||||
* [VFS/UART] Now vfs_uart_set_rts_cts accept one more instance argument, to support configuration to different ports.
|
||||
|
||||
<!-- Don't remove the next line - assigns the MR author as the assignee -->
|
||||
/assign me
|
||||
|
@ -97,6 +97,18 @@ Supported since ESP-IDF v5.0.
|
||||
| release/v5.2 | v5.2.2+ | v5.2 |
|
||||
| release/v5.3 and above | v5.3+ | v5.3 |
|
||||
|
||||
#### v2.0
|
||||
|
||||
| Release branch | Recommended | Required |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.0 | v5.0.8+ | v5.0.8 |
|
||||
| release/v5.1 | v5.1.5+ | v5.1.5* |
|
||||
| release/v5.2 | v5.2.4+ | v5.2.4 |
|
||||
| release/v5.3 | v5.3.2+ | v5.3.2* |
|
||||
| release/v5.4 and above | v5.4+ | v5.4 |
|
||||
|
||||
Note: IDF v5.1.5 and v5.3.2 are compatible with C2 v2.0. However the chip revision check hasn't been updated on these releases. Enable `ESP32C2_REV2_DEVELOPMENT` config to bypass the outdated check.
|
||||
|
||||
### ESP32-C6
|
||||
|
||||
#### v0.0, v0.1
|
||||
@ -109,6 +121,16 @@ Supported since ESP-IDF v5.1.
|
||||
|
||||
Supported since ESP-IDF v5.1.
|
||||
|
||||
#### v1.2
|
||||
|
||||
| Release branch | Recommended | Required |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.1 | v5.1.6+ | v5.1.6 |
|
||||
| release/v5.2 | v5.2.5+ | v5.2.5 |
|
||||
| release/v5.3 | v5.3.3+ | v5.3.3 |
|
||||
| release/v5.4 | v5.4.1+ | v5.4.1 |
|
||||
| release/v5.5 and above | v5.5+ | v5.5 |
|
||||
|
||||
## What If the ESP-IDF Version Is Lower than the `Required` Version?
|
||||
|
||||
Latest ESP-IDF versions can prevent from downloading to, or even execute binaries on unsupported chips. ESP-IDF of versions v4.4.5+, v5.0.1+, v5.1 and above have both esptool download check and bootloader loading check against the chip revision. While ESP-IDF v4.3.5 has only esptool downloading check.
|
||||
|
@ -97,6 +97,18 @@
|
||||
| release/v5.2 | v5.2.2+ | v5.1 |
|
||||
| release/v5.3 及以上 | v5.3+ | v5.3 |
|
||||
|
||||
#### v2.0
|
||||
|
||||
| 发布分支 | 推荐版本 | 需求版本 |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.0 | v5.0.8+ | v5.0.8 |
|
||||
| release/v5.1 | v5.1.5+ | v5.1.5* |
|
||||
| release/v5.2 | v5.2.4+ | v5.2.4 |
|
||||
| release/v5.3 | v5.3.2+ | v5.3.2* |
|
||||
| release/v5.4 及以上 | v5.4+ | v5.4 |
|
||||
|
||||
提示: IDF v5.1.5 及 v5.3.2 与 C2 v2.0 兼容,但芯片版本检查尚未在这些发布版本更新。使能 `ESP32C2_REV2_DEVELOPMENT` 选项来跳过这些过时的检查。
|
||||
|
||||
### ESP32-C6
|
||||
|
||||
#### v0.0, v0.1
|
||||
@ -109,6 +121,16 @@
|
||||
|
||||
从 ESP-IDF v5.1 开始支持。
|
||||
|
||||
#### v1.2
|
||||
|
||||
| 发布分支 | 推荐版本 | 需求版本 |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.1 | v5.1.6+ | v5.1.6 |
|
||||
| release/v5.2 | v5.2.5+ | v5.2.5 |
|
||||
| release/v5.3 | v5.3.3+ | v5.3.3 |
|
||||
| release/v5.4 | v5.4.1+ | v5.4.1 |
|
||||
| release/v5.5 及以上 | v5.5+ | v5.5 |
|
||||
|
||||
|
||||
## 如果 ESP-IDF 版本低于 `需求版本` 会出现什么情况?
|
||||
|
||||
|
1
Kconfig
1
Kconfig
@ -702,6 +702,5 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
- CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
|
||||
- CONFIG_ESP_WIFI_EAP_TLS1_3
|
||||
- CONFIG_ESP_WIFI_ENABLE_ROAMING_APP
|
||||
- CONFIG_USB_HOST_EXT_PORT_SUPPORT_LS
|
||||
- CONFIG_USB_HOST_EXT_PORT_RESET_ATTEMPTS
|
||||
- CONFIG_LIBC_PICOLIBC
|
||||
|
@ -93,7 +93,7 @@ void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
|
||||
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) {
|
||||
// For ESP32D2WD or ESP32-PICO series,the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CLK_IO, MSPI_FUNC_NUM);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else {
|
||||
const uint32_t spiconfig = esp_rom_efuse_get_flash_gpio_info();
|
||||
@ -108,14 +108,14 @@ void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
|
||||
esp_rom_gpio_connect_out_signal(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0);
|
||||
esp_rom_gpio_connect_in_signal(FLASH_SPIHD_IO, SPIHD_IN_IDX, 0);
|
||||
//select pin function gpio
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIQ_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPID_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIHD_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIWP_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CS_IO, PIN_FUNC_GPIO);
|
||||
// flash clock signal should come from IO MUX.
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CLK_IO, MSPI_FUNC_NUM);
|
||||
// set drive ability for clock
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
|
||||
uint32_t flash_id = g_rom_flashchip.device_id;
|
||||
@ -190,7 +190,7 @@ int bootloader_flash_get_wp_pin(void)
|
||||
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302:
|
||||
return ESP32_PICO_V3_GPIO;
|
||||
default:
|
||||
return MSPI_IOMUX_PIN_NUM_WP;
|
||||
return FLASH_SPIWP_IO;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -207,7 +207,7 @@ void bootloader_configure_spi_pins(int drv)
|
||||
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) {
|
||||
// For ESP32D2WD or ESP32-PICO series,the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CLK_IO, MSPI_FUNC_NUM);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else {
|
||||
const uint32_t spiconfig = esp_rom_efuse_get_flash_gpio_info();
|
||||
@ -222,14 +222,14 @@ void bootloader_configure_spi_pins(int drv)
|
||||
esp_rom_gpio_connect_out_signal(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0);
|
||||
esp_rom_gpio_connect_in_signal(FLASH_SPIHD_IO, SPIHD_IN_IDX, 0);
|
||||
//select pin function gpio
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIQ_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPID_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIHD_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIWP_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CS_IO, PIN_FUNC_GPIO);
|
||||
// flash clock signal should come from IO MUX.
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CLK_IO, MSPI_FUNC_NUM);
|
||||
// set drive ability for clock
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
|
||||
#if CONFIG_SPIRAM_TYPE_ESPPSRAM32 || CONFIG_SPIRAM_TYPE_ESPPSRAM64
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -12,14 +12,12 @@
|
||||
#include "bootloader_mem.h"
|
||||
#include "esp_cpu.h"
|
||||
|
||||
#if SOC_APM_SUPPORTED
|
||||
#include "hal/apm_hal.h"
|
||||
#endif
|
||||
|
||||
void bootloader_init_mem(void)
|
||||
{
|
||||
|
||||
#if !defined(BOOTLOADER_BUILD) && defined(SOC_APM_SUPPORTED)
|
||||
#if !defined(BOOTLOADER_BUILD)
|
||||
/* By default, these access path filters are enable and allow the
|
||||
* access to masters only if they are in TEE mode. Since all masters
|
||||
* except HP CPU boots in REE mode, default setting of these filters
|
||||
|
@ -1,107 +1,58 @@
|
||||
/*
|
||||
* 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 "sdkconfig.h"
|
||||
#include "bootloader_random.h"
|
||||
#include "soc/soc.h"
|
||||
#include "soc/pcr_reg.h"
|
||||
#include "soc/apb_saradc_reg.h"
|
||||
#include "soc/pmu_reg.h"
|
||||
#include "hal/regi2c_ctrl.h"
|
||||
#include "soc/regi2c_saradc.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
static const uint32_t SAR2_CHANNEL = 9;
|
||||
static const uint32_t SAR1_CHANNEL = 7;
|
||||
static const uint32_t PATTERN_BIT_WIDTH = 6;
|
||||
static const uint32_t SAR1_ATTEN = 3;
|
||||
static const uint32_t SAR2_ATTEN = 3;
|
||||
#include "hal/regi2c_ctrl_ll.h"
|
||||
#include "hal/adc_ll.h"
|
||||
#include "hal/adc_types.h"
|
||||
|
||||
void bootloader_random_enable(void)
|
||||
{
|
||||
// pull SAR ADC out of reset
|
||||
REG_SET_BIT(PCR_SARADC_CONF_REG, PCR_SARADC_RST_EN);
|
||||
REG_CLR_BIT(PCR_SARADC_CONF_REG, PCR_SARADC_RST_EN);
|
||||
|
||||
// enable SAR ADC APB clock
|
||||
REG_SET_BIT(PCR_SARADC_CONF_REG, PCR_SARADC_REG_CLK_EN);
|
||||
|
||||
// pull APB register out of reset
|
||||
REG_SET_BIT(PCR_SARADC_CONF_REG, PCR_SARADC_REG_RST_EN);
|
||||
REG_CLR_BIT(PCR_SARADC_CONF_REG, PCR_SARADC_REG_RST_EN);
|
||||
|
||||
// enable ADC_CTRL_CLK (SAR ADC function clock)
|
||||
REG_SET_BIT(PCR_SARADC_CLKM_CONF_REG, PCR_SARADC_CLKM_EN);
|
||||
|
||||
// select XTAL clock (40 MHz) source for ADC_CTRL_CLK
|
||||
REG_SET_FIELD(PCR_SARADC_CLKM_CONF_REG, PCR_SARADC_CLKM_SEL, 0);
|
||||
|
||||
// set the clock divider for ADC_CTRL_CLK to default value (in case it has been changed)
|
||||
REG_SET_FIELD(PCR_SARADC_CLKM_CONF_REG, PCR_SARADC_CLKM_DIV_NUM, 0);
|
||||
adc_ll_reset_register();
|
||||
adc_ll_enable_bus_clock(true);
|
||||
adc_ll_enable_func_clock(true);
|
||||
adc_ll_digi_clk_sel(ADC_DIGI_CLK_SRC_XTAL);
|
||||
adc_ll_digi_controller_clk_div(0, 0, 0);
|
||||
|
||||
// some ADC sensor registers are in power group PERIF_I2C and need to be enabled via PMU
|
||||
SET_PERI_REG_MASK(PMU_RF_PWC_REG, PMU_PERIF_I2C_RSTB);
|
||||
SET_PERI_REG_MASK(PMU_RF_PWC_REG, PMU_XPD_PERIF_I2C);
|
||||
|
||||
regi2c_ctrl_ll_i2c_reset_set();
|
||||
regi2c_ctrl_ll_i2c_periph_enable();
|
||||
// enable analog i2c master clock for RNG runtime
|
||||
ANALOG_CLOCK_ENABLE();
|
||||
|
||||
// Config ADC circuit (Analog part) with I2C(HOST ID 0x69) and chose internal voltage as sampling source
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC_DTEST_RTC_ADDR , 0);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC_ENT_RTC_ADDR , 1);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC1_ENCAL_REF_ADDR, 1);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC2_ENCAL_REF_ADDR, 1);
|
||||
adc_ll_regi2c_adc_init();
|
||||
adc_ll_set_calibration_param(ADC_UNIT_1, 0x866);
|
||||
adc_ll_set_calibration_param(ADC_UNIT_2, 0x866);
|
||||
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR2_INITIAL_CODE_HIGH_ADDR, 0x08);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR2_INITIAL_CODE_LOW_ADDR, 0x66);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_HIGH_ADDR, 0x08);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_LOW_ADDR, 0x66);
|
||||
adc_digi_pattern_config_t pattern_config = {};
|
||||
pattern_config.unit = ADC_UNIT_1;
|
||||
pattern_config.atten = ADC_ATTEN_DB_12;
|
||||
pattern_config.channel = ADC_CHANNEL_7;
|
||||
adc_ll_digi_set_pattern_table(ADC_UNIT_1, 0, pattern_config);
|
||||
pattern_config.unit = ADC_UNIT_2;
|
||||
pattern_config.atten = ADC_ATTEN_DB_12;
|
||||
pattern_config.channel = ADC_CHANNEL_1;
|
||||
adc_ll_digi_set_pattern_table(ADC_UNIT_2, 1, pattern_config);
|
||||
adc_ll_digi_set_pattern_table_len(ADC_UNIT_1, 2);
|
||||
|
||||
// create patterns and set them in pattern table
|
||||
uint32_t pattern_one = (SAR2_CHANNEL << 2) | SAR2_ATTEN; // we want channel 9 with max attenuation
|
||||
uint32_t pattern_two = (SAR1_CHANNEL << 2) | SAR1_ATTEN; // we want channel 7 with max attenuation
|
||||
uint32_t pattern_table = 0 | (pattern_two << 3 * PATTERN_BIT_WIDTH) | pattern_one << 2 * PATTERN_BIT_WIDTH;
|
||||
REG_WRITE(SARADC_SAR_PATT_TAB1_REG, pattern_table);
|
||||
|
||||
// set pattern length to 2 (APB_SARADC_SAR_PATT_LEN counts from 0)
|
||||
REG_SET_FIELD(SARADC_CTRL_REG, SARADC_SAR_PATT_LEN, 1);
|
||||
|
||||
// Same as in C3
|
||||
REG_SET_FIELD(SARADC_CTRL_REG, SARADC_SAR_CLK_DIV, 15);
|
||||
|
||||
// set timer expiry (timer is ADC_CTRL_CLK)
|
||||
REG_SET_FIELD(SARADC_CTRL2_REG, SARADC_TIMER_TARGET, 200);
|
||||
|
||||
// enable timer
|
||||
REG_SET_BIT(SARADC_CTRL2_REG, SARADC_TIMER_EN);
|
||||
adc_ll_digi_set_clk_div(15);
|
||||
adc_ll_digi_set_trigger_interval(200);
|
||||
adc_ll_digi_trigger_enable();
|
||||
}
|
||||
|
||||
void bootloader_random_disable(void)
|
||||
{
|
||||
// disable timer
|
||||
REG_CLR_BIT(SARADC_CTRL2_REG, SARADC_TIMER_EN);
|
||||
|
||||
// Write reset value of this register
|
||||
REG_WRITE(SARADC_SAR_PATT_TAB1_REG, 0xFFFFFF);
|
||||
|
||||
// Revert ADC I2C configuration and initial voltage source setting
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR2_INITIAL_CODE_HIGH_ADDR, 0x60);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR2_INITIAL_CODE_LOW_ADDR, 0x0);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_HIGH_ADDR, 0x60);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_LOW_ADDR, 0x0);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC_DTEST_RTC_ADDR, 0);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC_ENT_RTC_ADDR, 0);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC1_ENCAL_REF_ADDR, 0);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC2_ENCAL_REF_ADDR, 0);
|
||||
adc_ll_digi_trigger_disable();
|
||||
adc_ll_digi_reset_pattern_table();
|
||||
adc_ll_set_calibration_param(ADC_UNIT_1, 0x0);
|
||||
adc_ll_set_calibration_param(ADC_UNIT_2, 0x0);
|
||||
adc_ll_regi2c_adc_deinit();
|
||||
|
||||
// disable analog i2c master clock
|
||||
ANALOG_CLOCK_DISABLE();
|
||||
|
||||
// disable ADC_CTRL_CLK (SAR ADC function clock)
|
||||
REG_WRITE(PCR_SARADC_CLKM_CONF_REG, 0x00404000);
|
||||
|
||||
// Set PCR_SARADC_CONF_REG to initial state
|
||||
REG_WRITE(PCR_SARADC_CONF_REG, 0x5);
|
||||
adc_ll_digi_controller_clk_div(4, 0, 0);
|
||||
adc_ll_digi_clk_sel(ADC_DIGI_CLK_SRC_XTAL);
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_log.h"
|
||||
#include "bootloader_random.h"
|
||||
#include "hal/regi2c_ctrl_ll.h"
|
||||
#include "hal/adc_ll.h"
|
||||
@ -23,9 +22,7 @@ void bootloader_random_enable(void)
|
||||
// enable analog i2c master clock for RNG runtime
|
||||
ANALOG_CLOCK_ENABLE();
|
||||
|
||||
adc_ll_set_dtest_param(0);
|
||||
adc_ll_set_ent_param(1);
|
||||
adc_ll_enable_tout_bus(ADC_UNIT_1, true);
|
||||
adc_ll_regi2c_adc_init();
|
||||
adc_ll_set_calibration_param(ADC_UNIT_1, 0x866);
|
||||
adc_ll_set_calibration_param(ADC_UNIT_2, 0x866);
|
||||
|
||||
@ -49,9 +46,7 @@ void bootloader_random_disable(void)
|
||||
adc_ll_digi_reset_pattern_table();
|
||||
adc_ll_set_calibration_param(ADC_UNIT_1, 0x0);
|
||||
adc_ll_set_calibration_param(ADC_UNIT_2, 0x0);
|
||||
adc_ll_set_dtest_param(0);
|
||||
adc_ll_set_ent_param(0);
|
||||
adc_ll_enable_tout_bus(ADC_UNIT_1, false);
|
||||
adc_ll_regi2c_adc_deinit();
|
||||
|
||||
// disable analog i2c master clock
|
||||
ANALOG_CLOCK_DISABLE();
|
||||
|
@ -91,6 +91,7 @@ if(CONFIG_BT_ENABLED)
|
||||
endif()
|
||||
set(ldscripts "linker_esp32c2.lf")
|
||||
else()
|
||||
list(APPEND srcs "controller/${target_name}/ble.c")
|
||||
list(APPEND ldscripts "linker_esp_ble_controller.lf")
|
||||
endif()
|
||||
|
||||
@ -131,12 +132,9 @@ if(CONFIG_BT_ENABLED)
|
||||
"common/osi/osi.c"
|
||||
"common/osi/semaphore.c"
|
||||
"porting/mem/bt_osi_mem.c"
|
||||
"common/ble_log/ble_log_spi_out.c"
|
||||
)
|
||||
|
||||
if(CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED)
|
||||
list(APPEND srcs "common/ble_log/ble_log_spi_out.c")
|
||||
endif()
|
||||
|
||||
# Host Bluedroid
|
||||
if(CONFIG_BT_BLUEDROID_ENABLED)
|
||||
|
||||
@ -872,12 +870,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
|
||||
PRIV_REQUIRES "${bt_priv_requires}"
|
||||
LDFRAGMENTS "${ldscripts}")
|
||||
|
||||
if(CONFIG_BT_ENABLED)
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,6 +1,77 @@
|
||||
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.
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble logs to SPI bus (Experimental)"
|
||||
default n
|
||||
help
|
||||
Output ble logs to SPI bus
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
||||
bool "Enable HCI log output to SPI"
|
||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Enable logging of HCI packets to the SPI bus when BLE SPI log output is enabled.
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_HOST_ENABLED
|
||||
bool "Enable Host log output to SPI"
|
||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
This configuration applies to the logs of both Bluedroid Host and NimBLE Host.
|
||||
When BLE SPI log output is enabled, this option allows host logs to be transmitted via SPI.
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_QUEUE_SIZE
|
||||
int "Number of ble log async SPI output queues"
|
||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default 4
|
||||
help
|
||||
The number of ble log async SPI output queues
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_TRANS_BUF_SIZE
|
||||
int "Size of ble log async SPI output transaction buffer size"
|
||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default 2048
|
||||
help
|
||||
The size of ble log async SPI output transaction buffer size
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_MOSI_IO_NUM
|
||||
int "GPIO number of SPI MOSI"
|
||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default 0
|
||||
help
|
||||
GPIO number of SPI MOSI
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_SCLK_IO_NUM
|
||||
int "GPIO number of SPI SCLK"
|
||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default 1
|
||||
help
|
||||
GPIO number of SPI SCLK
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_CS_IO_NUM
|
||||
int "GPIO number of SPI CS"
|
||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default 2
|
||||
help
|
||||
GPIO number of SPI CS
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
bool "Enable ble log & logic analyzer log time sync"
|
||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable ble log & logic analyzer log time sync
|
||||
|
||||
config BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM
|
||||
int "GPIO number of SYNC IO"
|
||||
depends on BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
default 3
|
||||
help
|
||||
GPIO number of SYNC IO
|
||||
|
@ -5,12 +5,16 @@
|
||||
*/
|
||||
#include "ble_log/ble_log_spi_out.h"
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
|
||||
// Private defines
|
||||
#define SPI_OUT_BUS SPI2_HOST
|
||||
#define SPI_OUT_TAIL 0xAA
|
||||
#define SPI_OUT_FLUSHOUT_TIMEOUT (1000 * 1000)
|
||||
#define SPI_OUT_TS_SYNC_TIMEOUT (1000 * 1000)
|
||||
|
||||
// Private typedefs
|
||||
typedef struct spi_out_trans
|
||||
{
|
||||
typedef struct spi_out_trans {
|
||||
spi_transaction_t trans;
|
||||
struct spi_out_trans *next;
|
||||
} spi_out_trans_t;
|
||||
@ -20,20 +24,38 @@ static spi_device_handle_t spi_handle = NULL;
|
||||
static spi_out_trans_t *trans_head = NULL;
|
||||
static SemaphoreHandle_t mutex_handle = NULL;
|
||||
static bool spi_out_inited = false;
|
||||
static esp_timer_handle_t flushout_timer_handle = NULL;
|
||||
static uint32_t loss_frame_cnt = 0;
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
static bool sync_io_level = false;
|
||||
static esp_timer_handle_t ts_sync_timer_handle = NULL;
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
|
||||
// Private function declarations
|
||||
static void spi_out_init_trans(void);
|
||||
static void spi_out_deinit_trans(void);
|
||||
static void spi_out_recycle_trans(uint32_t ms_to_wait);
|
||||
static void spi_out_append_trans(void);
|
||||
static int spi_out_write(const uint8_t *addr, uint16_t len);
|
||||
static void esp_timer_cb_flushout(void);
|
||||
static void esp_timer_cb_ts_sync(void);
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||
extern uint32_t r_ble_lll_timer_current_tick_get(void);
|
||||
#endif // CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C6
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32C2)
|
||||
extern uint32_t r_os_cputime_get32(void);
|
||||
#endif // CONFIG_IDF_TARGET_ESP32C2
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
|
||||
// Private functions
|
||||
static void spi_out_init_trans(void)
|
||||
{
|
||||
for (int i = 0; i < CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_QUEUE_SIZE; i++)
|
||||
{
|
||||
for (int i = 0; i < CONFIG_BT_BLE_LOG_SPI_OUT_QUEUE_SIZE; i++) {
|
||||
// Allocate memory for SPI transaction
|
||||
uint8_t *buf = (uint8_t *)spi_bus_dma_memory_alloc(SPI_OUT_BUS, CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_TRANS_BUF_SIZE, 0);
|
||||
uint8_t *buf = (uint8_t *)spi_bus_dma_memory_alloc(SPI_OUT_BUS, CONFIG_BT_BLE_LOG_SPI_OUT_TRANS_BUF_SIZE, 0);
|
||||
assert(buf);
|
||||
|
||||
// Initialize new trans
|
||||
@ -57,8 +79,7 @@ static void spi_out_deinit_trans(void)
|
||||
|
||||
// Release memory
|
||||
spi_out_trans_t *next;
|
||||
while (trans_head != NULL)
|
||||
{
|
||||
while (trans_head != NULL) {
|
||||
next = trans_head->next;
|
||||
free((uint8_t *)trans_head->trans.tx_buffer);
|
||||
free(trans_head);
|
||||
@ -68,52 +89,160 @@ static void spi_out_deinit_trans(void)
|
||||
return;
|
||||
}
|
||||
|
||||
// CRITICAL: Do not recycle trans when trans_head is not empty!
|
||||
IRAM_ATTR static void spi_out_recycle_trans(uint32_t ms_to_wait)
|
||||
{
|
||||
// Try to recycle transaction
|
||||
spi_transaction_t *ret_trans;
|
||||
spi_out_trans_t *recycled_trans;
|
||||
while (ESP_OK == spi_device_get_trans_result(spi_handle, &ret_trans, pdMS_TO_TICKS(ms_to_wait)))
|
||||
{
|
||||
while (ESP_OK == spi_device_get_trans_result(spi_handle, &ret_trans, pdMS_TO_TICKS(ms_to_wait))) {
|
||||
recycled_trans = __containerof(ret_trans, spi_out_trans_t, trans);
|
||||
recycled_trans->next = trans_head;
|
||||
trans_head = recycled_trans;
|
||||
trans_head->trans.length = 0;
|
||||
trans_head->trans.rxlength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
IRAM_ATTR static void spi_out_append_trans(void)
|
||||
{
|
||||
// Stop flushout timer
|
||||
esp_timer_stop(flushout_timer_handle);
|
||||
|
||||
// Transaction head shall not be NULL for appending
|
||||
assert(trans_head);
|
||||
if (trans_head) {
|
||||
// Detach transaction head
|
||||
spi_out_trans_t *trans_to_append = trans_head;
|
||||
trans_head = trans_head->next;
|
||||
trans_to_append->next = NULL;
|
||||
|
||||
// Detach transaction head
|
||||
spi_out_trans_t *trans_to_append = trans_head;
|
||||
trans_head = trans_head->next;
|
||||
trans_to_append->next = NULL;
|
||||
|
||||
// CRITICAL: Length unit conversion from bytes to bits
|
||||
trans_to_append->trans.length *= 8;
|
||||
assert(ESP_OK == spi_device_queue_trans(spi_handle, &trans_to_append->trans, 0));
|
||||
// CRITICAL: Length unit conversion from bytes to bits
|
||||
trans_to_append->trans.length *= 8;
|
||||
ESP_ERROR_CHECK(spi_device_queue_trans(spi_handle, &trans_to_append->trans, 0));
|
||||
}
|
||||
|
||||
// Try to recycle trans
|
||||
spi_out_recycle_trans(0);
|
||||
|
||||
// Restart flushout timer
|
||||
esp_timer_start_once(flushout_timer_handle, SPI_OUT_FLUSHOUT_TIMEOUT);
|
||||
}
|
||||
|
||||
IRAM_ATTR static int spi_out_write(const uint8_t *addr, uint16_t len)
|
||||
{
|
||||
// Recycle trans if free buffer list is empty
|
||||
if (!trans_head) {
|
||||
spi_out_recycle_trans(0);
|
||||
}
|
||||
|
||||
// Copy user data to buffer
|
||||
uint16_t copy_buf_len;
|
||||
uint16_t data_left_len = len;
|
||||
uint16_t empty_buf_len = CONFIG_BT_BLE_LOG_SPI_OUT_TRANS_BUF_SIZE - trans_head->trans.length;
|
||||
while (data_left_len) {
|
||||
// There shall always be available buffer in free buffer list during write operation
|
||||
if (!trans_head) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Copy data to buffer and update length
|
||||
copy_buf_len = (data_left_len > empty_buf_len) ? empty_buf_len : data_left_len;
|
||||
memcpy((uint8_t *)trans_head->trans.tx_buffer + trans_head->trans.length, addr + (len - data_left_len), copy_buf_len);
|
||||
trans_head->trans.length += copy_buf_len;
|
||||
data_left_len -= copy_buf_len;
|
||||
|
||||
// If buffer is full, append transaction and reset buffer length
|
||||
if (trans_head->trans.length == CONFIG_BT_BLE_LOG_SPI_OUT_TRANS_BUF_SIZE) {
|
||||
spi_out_append_trans();
|
||||
empty_buf_len = CONFIG_BT_BLE_LOG_SPI_OUT_TRANS_BUF_SIZE;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CRITICAL: This function is called in ESP Timer task
|
||||
IRAM_ATTR static void esp_timer_cb_flushout(void)
|
||||
{
|
||||
// Take semaphore
|
||||
assert(xSemaphoreTakeRecursive(mutex_handle, portMAX_DELAY) == pdTRUE);
|
||||
|
||||
// Flushout
|
||||
if (trans_head) {
|
||||
// Make sure there's enough space for loss frame counter
|
||||
if (trans_head->next && loss_frame_cnt) {
|
||||
ble_log_spi_out_write(BLE_LOG_SPI_OUT_SOURCE_LOSS, (uint8_t *)&loss_frame_cnt, sizeof(loss_frame_cnt));
|
||||
loss_frame_cnt = 0;
|
||||
}
|
||||
if (trans_head->trans.length) {
|
||||
spi_out_append_trans();
|
||||
}
|
||||
}
|
||||
|
||||
// Restart flushout timer if not active
|
||||
if (!esp_timer_is_active(flushout_timer_handle)) {
|
||||
esp_timer_start_once(flushout_timer_handle, SPI_OUT_FLUSHOUT_TIMEOUT);
|
||||
}
|
||||
|
||||
// Release semaphore
|
||||
xSemaphoreGiveRecursive(mutex_handle);
|
||||
}
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
// CRITICAL: This function is called in ESP Timer task
|
||||
IRAM_ATTR static void esp_timer_cb_ts_sync(void)
|
||||
{
|
||||
// Initialize variables
|
||||
uint32_t lc_ts = 0;
|
||||
uint32_t esp_ts = 0;
|
||||
|
||||
// Toggle sync IO
|
||||
sync_io_level = !sync_io_level;
|
||||
|
||||
// Enter critical
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
|
||||
// Get LC timestamp
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||
lc_ts = r_ble_lll_timer_current_tick_get();
|
||||
#endif // CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C6
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32C2)
|
||||
lc_ts = r_os_cputime_get32();
|
||||
#endif // CONFIG_IDF_TARGET_ESP32C2
|
||||
|
||||
// Set sync IO level
|
||||
gpio_set_level(CONFIG_BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM, (uint32_t)sync_io_level);
|
||||
|
||||
// Get ESP timestamp
|
||||
esp_ts = esp_timer_get_time();
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
// Exit critical
|
||||
|
||||
// Write timestamp sync log
|
||||
uint8_t sync_frame[9];
|
||||
sync_frame[0] = ((uint8_t)sync_io_level & 0xFF);
|
||||
memcpy(sync_frame + 1, &lc_ts, sizeof(lc_ts));
|
||||
memcpy(sync_frame + 5, &esp_ts, sizeof(esp_ts));
|
||||
ble_log_spi_out_write(BLE_LOG_SPI_OUT_SOURCE_SYNC, sync_frame, 9);
|
||||
}
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
|
||||
// Public functions
|
||||
void ble_log_spi_out_init(void)
|
||||
{
|
||||
// Avoid double init
|
||||
if (spi_out_inited)
|
||||
{
|
||||
if (spi_out_inited) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize mutex
|
||||
mutex_handle = xSemaphoreCreateRecursiveMutex();
|
||||
|
||||
// Initialize SPI
|
||||
spi_bus_config_t bus_config = {
|
||||
.miso_io_num = -1,
|
||||
.mosi_io_num = CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_MOSI_IO_NUM,
|
||||
.sclk_io_num = CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_SCLK_IO_NUM,
|
||||
.mosi_io_num = CONFIG_BT_BLE_LOG_SPI_OUT_MOSI_IO_NUM,
|
||||
.sclk_io_num = CONFIG_BT_BLE_LOG_SPI_OUT_SCLK_IO_NUM,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
.max_transfer_sz = 10240
|
||||
@ -121,8 +250,8 @@ void ble_log_spi_out_init(void)
|
||||
spi_device_interface_config_t dev_config = {
|
||||
.clock_speed_hz = SPI_MASTER_FREQ_20M,
|
||||
.mode = 0,
|
||||
.spics_io_num = CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_CS_IO_NUM,
|
||||
.queue_size = CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_QUEUE_SIZE
|
||||
.spics_io_num = CONFIG_BT_BLE_LOG_SPI_OUT_CS_IO_NUM,
|
||||
.queue_size = CONFIG_BT_BLE_LOG_SPI_OUT_QUEUE_SIZE
|
||||
};
|
||||
ESP_ERROR_CHECK(spi_bus_initialize(SPI_OUT_BUS, &bus_config, SPI_DMA_CH_AUTO));
|
||||
ESP_ERROR_CHECK(spi_bus_add_device(SPI_OUT_BUS, &dev_config, &spi_handle));
|
||||
@ -130,8 +259,33 @@ void ble_log_spi_out_init(void)
|
||||
// Initialize transaction link nodes
|
||||
spi_out_init_trans();
|
||||
|
||||
// Initialize mutex
|
||||
mutex_handle = xSemaphoreCreateMutex();
|
||||
// Initialize flushout timer
|
||||
esp_timer_create_args_t timer_args = {
|
||||
.callback = (esp_timer_cb_t)esp_timer_cb_flushout,
|
||||
.dispatch_method = ESP_TIMER_TASK
|
||||
};
|
||||
ESP_ERROR_CHECK(esp_timer_create(&timer_args, &flushout_timer_handle));
|
||||
esp_timer_start_once(flushout_timer_handle, SPI_OUT_FLUSHOUT_TIMEOUT);
|
||||
loss_frame_cnt = 0;
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
// Initialize timestamp synchronizer
|
||||
gpio_config_t io_conf = {
|
||||
.intr_type = GPIO_INTR_DISABLE,
|
||||
.mode = GPIO_MODE_OUTPUT,
|
||||
.pin_bit_mask = (1UL << CONFIG_BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM),
|
||||
.pull_down_en = 0,
|
||||
.pull_up_en = 0
|
||||
};
|
||||
ESP_ERROR_CHECK(gpio_config(&io_conf));
|
||||
sync_io_level = false;
|
||||
gpio_set_level(CONFIG_BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM, sync_io_level);
|
||||
esp_timer_create_args_t ts_sync_timer_args = {
|
||||
.callback = (esp_timer_cb_t)esp_timer_cb_ts_sync,
|
||||
.dispatch_method = ESP_TIMER_TASK
|
||||
};
|
||||
ESP_ERROR_CHECK(esp_timer_create(&ts_sync_timer_args, &ts_sync_timer_handle));
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
|
||||
// Set init flag
|
||||
spi_out_inited = true;
|
||||
@ -140,11 +294,21 @@ void ble_log_spi_out_init(void)
|
||||
void ble_log_spi_out_deinit(void)
|
||||
{
|
||||
// Avoid double deinit
|
||||
if (!spi_out_inited)
|
||||
{
|
||||
if (!spi_out_inited) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
// Deinitialize timestamp synchronizer
|
||||
esp_timer_stop(ts_sync_timer_handle);
|
||||
esp_timer_delete(ts_sync_timer_handle);
|
||||
gpio_reset_pin(CONFIG_BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM);
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
|
||||
// Deinitialize flushout timer
|
||||
esp_timer_stop(flushout_timer_handle);
|
||||
esp_timer_delete(flushout_timer_handle);
|
||||
|
||||
// Deinitialize transaction link nodes
|
||||
spi_out_deinit_trans();
|
||||
|
||||
@ -161,60 +325,178 @@ void ble_log_spi_out_deinit(void)
|
||||
spi_out_inited = false;
|
||||
}
|
||||
|
||||
IRAM_ATTR void ble_log_spi_out_write(uint32_t len, const uint8_t *addr, spi_out_source_t source)
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
void ble_log_spi_out_ts_sync_start(void)
|
||||
{
|
||||
// Take semaphore
|
||||
assert(xSemaphoreTake(mutex_handle, portMAX_DELAY) == pdTRUE);
|
||||
|
||||
// Recycle trans if free buffer list is empty
|
||||
if (!trans_head)
|
||||
{
|
||||
spi_out_recycle_trans(0);
|
||||
// Check if SPI out is initialized
|
||||
if (!spi_out_inited) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Length of 0 means flush out
|
||||
if (!len)
|
||||
{
|
||||
assert(trans_head);
|
||||
if (trans_head->trans.length)
|
||||
{
|
||||
spi_out_append_trans();
|
||||
}
|
||||
goto release;
|
||||
}
|
||||
|
||||
// Copy user data to buffer
|
||||
uint32_t copy_buf_len;
|
||||
uint32_t data_left_len = len;
|
||||
uint32_t empty_buf_len = CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_TRANS_BUF_SIZE - trans_head->trans.length;
|
||||
while (data_left_len)
|
||||
{
|
||||
// There shall always be available buffer in free buffer list during write operation
|
||||
assert(trans_head);
|
||||
|
||||
// Copy data to buffer and update length
|
||||
copy_buf_len = (data_left_len > empty_buf_len) ? empty_buf_len : data_left_len;
|
||||
memcpy((uint8_t *)trans_head->trans.tx_buffer + trans_head->trans.length, addr + (len - data_left_len), copy_buf_len);
|
||||
trans_head->trans.length += copy_buf_len;
|
||||
data_left_len -= copy_buf_len;
|
||||
|
||||
// Transaction buffer length shall never exceed buffer size
|
||||
assert(trans_head->trans.length <= CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_TRANS_BUF_SIZE);
|
||||
|
||||
// If buffer is full, append transaction and reset buffer length
|
||||
if (trans_head->trans.length == CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_TRANS_BUF_SIZE)
|
||||
{
|
||||
spi_out_append_trans();
|
||||
empty_buf_len = CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_TRANS_BUF_SIZE;
|
||||
// Start timestamp sync timer
|
||||
if (ts_sync_timer_handle) {
|
||||
if (!esp_timer_is_active(ts_sync_timer_handle)) {
|
||||
esp_timer_start_periodic(ts_sync_timer_handle, SPI_OUT_TS_SYNC_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
release:
|
||||
xSemaphoreGive(mutex_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
void ble_log_spi_out_ts_sync_stop(void)
|
||||
{
|
||||
// Check if SPI out is initialized
|
||||
if (!spi_out_inited) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop timestamp sync timer
|
||||
if (ts_sync_timer_handle) {
|
||||
if (esp_timer_is_active(ts_sync_timer_handle)) {
|
||||
esp_timer_stop(ts_sync_timer_handle);
|
||||
}
|
||||
|
||||
// Set sync IO to low level
|
||||
sync_io_level = 0;
|
||||
gpio_set_level(CONFIG_BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM, (uint32_t)sync_io_level);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||
|
||||
IRAM_ATTR void ble_log_spi_out_write_esp(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
ble_log_spi_out_write(len, addr, esp_controller);
|
||||
return ble_log_spi_out_write(BLE_LOG_SPI_OUT_SOURCE_ESP, addr, len);
|
||||
}
|
||||
|
||||
IRAM_ATTR void ble_log_spi_out_write(uint8_t source, const uint8_t *addr, uint16_t len)
|
||||
{
|
||||
// Initialize frame sequence number
|
||||
static uint8_t frame_sn = 0;
|
||||
|
||||
// Take semaphore
|
||||
assert(xSemaphoreTakeRecursive(mutex_handle, portMAX_DELAY) == pdTRUE);
|
||||
|
||||
// Prepare frame head and frame tail
|
||||
const uint8_t head[4] = {len & 0xFF, (len >> 8) & 0xFF, (uint8_t)source, frame_sn};
|
||||
const uint8_t tail = SPI_OUT_TAIL;
|
||||
|
||||
// Write frame head first, then payload, finally frame tail
|
||||
do {
|
||||
if (spi_out_write(head, 4) != 0) {
|
||||
loss_frame_cnt++;
|
||||
break;
|
||||
}
|
||||
if (spi_out_write(addr, len) != 0) {
|
||||
loss_frame_cnt++;
|
||||
break;
|
||||
}
|
||||
if (spi_out_write(&tail, 1) != 0) {
|
||||
loss_frame_cnt++;
|
||||
break;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
// Update frame sequence number
|
||||
frame_sn++;
|
||||
|
||||
// Release semaphore
|
||||
xSemaphoreGiveRecursive(mutex_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
IRAM_ATTR int ble_log_spi_out_printf(uint8_t source, const char *format, ...)
|
||||
{
|
||||
// Get esp timestamp
|
||||
uint32_t esp_ts = esp_timer_get_time();
|
||||
|
||||
// Get arguments
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
// Get len as ref to allocate heap memory
|
||||
va_list args_copy;
|
||||
va_copy(args_copy, args);
|
||||
int len = vsnprintf(NULL, 0, format, args_copy);
|
||||
va_end(args_copy);
|
||||
|
||||
// Length validation
|
||||
if ((len < 0) || (len > 0xFFFF)) {
|
||||
va_end(args);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Allocate memory
|
||||
uint8_t *buffer = malloc(len + 1);
|
||||
if (!buffer) {
|
||||
va_end(args);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Generate string
|
||||
vsnprintf((char *)buffer, len + 1, format, args);
|
||||
va_end(args);
|
||||
|
||||
// Write to SPI
|
||||
ble_log_spi_out_write(source, (const uint8_t *)&esp_ts, 4);
|
||||
ble_log_spi_out_write(source, (const uint8_t *)buffer, len);
|
||||
|
||||
// Release
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
IRAM_ATTR int ble_log_spi_out_printf_enh(uint8_t source, uint8_t level, const char *tag, const char *format, ...)
|
||||
{
|
||||
// Get ESP timestamp
|
||||
uint32_t esp_ts = esp_timer_get_time();
|
||||
|
||||
// Create log prefix in the format: "[level][tag] "
|
||||
char prefix[32];
|
||||
int prefix_len = snprintf(prefix, sizeof(prefix), "[%d][%s] ", level, tag ? tag : "NULL");
|
||||
|
||||
// Compute the length of the formatted log message
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
va_list args_copy;
|
||||
va_copy(args_copy, args);
|
||||
int log_len = vsnprintf(NULL, 0, format, args_copy);
|
||||
va_end(args_copy);
|
||||
|
||||
// Validate length
|
||||
if (log_len < 0 || log_len > 0xFFFF) {
|
||||
va_end(args);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Compute total log length (prefix + formatted message)
|
||||
int total_len = prefix_len + log_len;
|
||||
|
||||
// Allocate memory for the complete log message
|
||||
uint8_t *buffer = malloc(total_len + 1);
|
||||
if (!buffer) {
|
||||
va_end(args);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Construct the final log message
|
||||
memcpy(buffer, prefix, prefix_len); // Copy the prefix
|
||||
vsnprintf((char *)(buffer + prefix_len), log_len + 1, format, args);
|
||||
va_end(args);
|
||||
|
||||
// Transmit log data via SPI
|
||||
ble_log_spi_out_write(source, (const uint8_t *)&esp_ts, 4);
|
||||
ble_log_spi_out_write(source, buffer, total_len);
|
||||
|
||||
// Free allocated memory
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
IRAM_ATTR void ble_log_spi_out_write_with_ts(uint8_t source, const uint8_t *addr, uint16_t len)
|
||||
{
|
||||
// Get esp timestamp
|
||||
uint32_t esp_ts = esp_timer_get_time();
|
||||
|
||||
// Write to SPI
|
||||
ble_log_spi_out_write(source, (const uint8_t *)&esp_ts, 4);
|
||||
ble_log_spi_out_write(source, addr, len);
|
||||
}
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
|
@ -6,21 +6,42 @@
|
||||
#ifndef __BT_SPI_OUT_H__
|
||||
#define __BT_SPI_OUT_H__
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "driver/spi_master.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_timer.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
// Public typedefs
|
||||
typedef enum
|
||||
{
|
||||
esp_controller = 0,
|
||||
ceva_controller = 1
|
||||
} spi_out_source_t;
|
||||
#define BLE_LOG_SPI_OUT_SOURCE_ESP 0
|
||||
#define BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY 1
|
||||
#define BLE_LOG_SPI_OUT_SOURCE_BLUEDROID 2
|
||||
#define BLE_LOG_SPI_OUT_SOURCE_NIMBLE 3
|
||||
#define BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM 4
|
||||
#define BLE_LOG_SPI_OUT_SOURCE_HCI_DOWNSTREAM 5
|
||||
#define BLE_LOG_SPI_OUT_SOURCE_USER 0x10
|
||||
#define BLE_LOG_SPI_OUT_SOURCE_SYNC 0xFE
|
||||
#define BLE_LOG_SPI_OUT_SOURCE_LOSS 0xFF
|
||||
|
||||
// SPI Log Level Definitions
|
||||
#define BLE_LOG_SPI_OUT_LEVEL_NONE 0 /*!< No log output */
|
||||
#define BLE_LOG_SPI_OUT_LEVEL_ERROR 1 /*!< Critical errors that SPI driver cannot recover from */
|
||||
#define BLE_LOG_SPI_OUT_LEVEL_WARN 2 /*!< Recoverable error conditions in SPI communication */
|
||||
#define BLE_LOG_SPI_OUT_LEVEL_INFO 3 /*!< Informational messages about SPI transactions */
|
||||
#define BLE_LOG_SPI_OUT_LEVEL_DEBUG 4 /*!< Detailed debug information, such as SPI register values */
|
||||
#define BLE_LOG_SPI_OUT_LEVEL_VERBOSE 5 /*!< Very detailed debugging logs, potentially flooding output */
|
||||
#define BLE_LOG_SPI_OUT_LEVEL_MAX 6 /*!< Number of SPI log levels supported */
|
||||
|
||||
// Public functions
|
||||
void ble_log_spi_out_init(void);
|
||||
void ble_log_spi_out_deinit(void);
|
||||
void ble_log_spi_out_write(uint32_t len, const uint8_t *addr, spi_out_source_t source);
|
||||
void ble_log_spi_out_write(uint8_t source, const uint8_t *addr, uint16_t len);
|
||||
void ble_log_spi_out_write_esp(uint32_t len, const uint8_t *addr, bool end);
|
||||
void ble_log_spi_out_ts_sync_start(void);
|
||||
void ble_log_spi_out_ts_sync_stop(void);
|
||||
int ble_log_spi_out_printf(uint8_t source, const char *format, ...);
|
||||
int ble_log_spi_out_printf_enh(uint8_t source, uint8_t level, const char *tag, const char *format, ...);
|
||||
void ble_log_spi_out_write_with_ts(uint8_t source, const uint8_t *addr, uint16_t len);
|
||||
|
||||
#endif // __BT_SPI_OUT_H__
|
||||
|
@ -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
|
||||
*/
|
||||
@ -389,6 +389,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;
|
||||
@ -398,6 +399,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
|
||||
@ -452,6 +454,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;
|
||||
}
|
||||
@ -461,6 +464,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
|
||||
|
||||
@ -530,9 +534,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;
|
||||
}
|
||||
@ -548,18 +549,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)
|
||||
|
@ -146,7 +146,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);
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
*/
|
||||
@ -84,6 +84,20 @@
|
||||
#define BT_HCI_LOG_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
// HCI LOG TO SPI
|
||||
#if UC_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
||||
#define BT_BLE_LOG_SPI_OUT_HCI_ENABLED UC_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
||||
#else
|
||||
#define BT_BLE_LOG_SPI_OUT_HCI_ENABLED FALSE
|
||||
#endif
|
||||
|
||||
// BLURDROID LOG TO SPI
|
||||
#if UC_BT_BLE_LOG_SPI_OUT_HOST_ENABLED
|
||||
#define BT_BLE_LOG_SPI_OUT_HOST_ENABLED UC_BT_BLE_LOG_SPI_OUT_HOST_ENABLED
|
||||
#else
|
||||
#define BT_BLE_LOG_SPI_OUT_HOST_ENABLED FALSE
|
||||
#endif
|
||||
|
||||
#if UC_BT_HCI_LOG_DATA_BUFFER_SIZE
|
||||
#define HCI_LOG_DATA_BUFFER_SIZE UC_BT_HCI_LOG_DATA_BUFFER_SIZE
|
||||
#else
|
||||
|
@ -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
|
||||
*/
|
||||
@ -126,6 +126,20 @@
|
||||
#define UC_BT_HCI_LOG_DEBUG_EN FALSE
|
||||
#endif
|
||||
|
||||
//HCI LOG TO SPI
|
||||
#ifdef CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
||||
#define UC_BT_BLE_LOG_SPI_OUT_HCI_ENABLED TRUE
|
||||
#else
|
||||
#define UC_BT_BLE_LOG_SPI_OUT_HCI_ENABLED FALSE
|
||||
#endif
|
||||
|
||||
//BLUEDROID LOG TO SPI
|
||||
#ifdef CONFIG_BT_BLE_LOG_SPI_OUT_HOST_ENABLED
|
||||
#define UC_BT_BLE_LOG_SPI_OUT_HOST_ENABLED TRUE
|
||||
#else
|
||||
#define UC_BT_BLE_LOG_SPI_OUT_HOST_ENABLED FALSE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCI_LOG_DATA_BUFFER_SIZE
|
||||
#define UC_BT_HCI_LOG_DATA_BUFFER_SIZE CONFIG_BT_HCI_LOG_DATA_BUFFER_SIZE
|
||||
#else
|
||||
|
@ -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
|
||||
*/
|
||||
@ -48,6 +48,10 @@
|
||||
#include "esp_rom_sys.h"
|
||||
#include "hli_api.h"
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
#include "ble_log/ble_log_spi_out.h"
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
/* Macro definition
|
||||
@ -1686,6 +1690,10 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
coex_init();
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
ble_log_spi_out_init();
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
|
||||
btdm_cfg_mask = btdm_config_mask_load();
|
||||
|
||||
err = btdm_controller_init(btdm_cfg_mask, cfg);
|
||||
@ -1713,6 +1721,10 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
ble_log_spi_out_deinit();
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
|
||||
btdm_controller_deinit();
|
||||
|
||||
bt_controller_deinit_internal();
|
||||
|
@ -312,45 +312,11 @@ config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_QUEUE_SIZE
|
||||
int "Number of ble controller log async SPI output queues"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 4
|
||||
help
|
||||
The number of ble controller log async SPI output queues
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_TRANS_BUF_SIZE
|
||||
int "Size of ble controller log async SPI output transaction buffer size"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 512
|
||||
help
|
||||
The size of ble controller log async SPI output transaction buffer size
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_MOSI_IO_NUM
|
||||
int "GPIO number of SPI MOSI"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 1
|
||||
help
|
||||
GPIO number of SPI MOSI
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_SCLK_IO_NUM
|
||||
int "GPIO number of SPI SCLK"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 6
|
||||
help
|
||||
GPIO number of SPI SCLK
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_CS_IO_NUM
|
||||
int "GPIO number of SPI CS"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 7
|
||||
help
|
||||
GPIO number of SPI CS
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
|
@ -130,7 +130,7 @@ extern int ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
extern int ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int ble_log_deinit_async(void);
|
||||
extern void ble_log_async_output_dump_all(bool output);
|
||||
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
|
||||
extern void esp_panic_handler_feed_wdts(void);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_controller_deinit(void);
|
||||
extern int ble_controller_enable(uint8_t mode);
|
||||
@ -391,13 +391,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
ble_log_async_output_dump_all(true);
|
||||
stop_write = true;
|
||||
esp_bt_ontroller_log_deinit();
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
stop_write = true;
|
||||
|
||||
buffer = (const uint8_t *)mapped_ptr;
|
||||
esp_panic_handler_feed_wdts();
|
||||
if (is_filled) {
|
||||
read_index = next_erase_index;
|
||||
} else {
|
||||
@ -409,7 +409,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
while (read_index != write_index) {
|
||||
esp_rom_printf("%02x ", buffer[read_index]);
|
||||
if (print_len > max_print_len) {
|
||||
vTaskDelay(2);
|
||||
esp_panic_handler_feed_wdts();
|
||||
print_len = 0;
|
||||
}
|
||||
|
||||
@ -417,6 +417,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
read_index = (read_index + 1) % MAX_STORAGE_SIZE;
|
||||
}
|
||||
esp_rom_printf(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
esp_partition_munmap(mmap_handle);
|
||||
err = esp_bt_controller_log_init(log_output_mode);
|
||||
assert(err == ESP_OK);
|
||||
@ -430,6 +431,9 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
|
||||
esp_bt_controller_log_storage(len, addr, end);
|
||||
#endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_feed_wdts();
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
@ -437,6 +441,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
|
||||
if (end) {
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,7 +454,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
BT_ASSERT_PRINT("\r\n[DUMP_START:");
|
||||
ble_log_async_output_dump_all(output);
|
||||
BT_ASSERT_PRINT(":DUMP_END]\r\n");
|
||||
|
@ -550,6 +550,7 @@ config BT_CTRL_BLE_SECURITY_ENABLE
|
||||
depends on BT_CTRL_RUN_IN_FLASH_ONLY && BT_CONTROLLER_ONLY
|
||||
bool "Enable BLE security feature"
|
||||
default y
|
||||
|
||||
config BT_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
|
||||
bool "Enable enhanced Access Address check in CONNECT_IND"
|
||||
default n
|
||||
@ -557,3 +558,71 @@ config BT_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
|
||||
Enabling this option will add stricter verification of the Access Address in the CONNECT_IND PDU.
|
||||
This improves security by ensuring that only connection requests with valid Access Addresses are accepted.
|
||||
If disabled, only basic checks are applied, improving compatibility.
|
||||
|
||||
menu "Controller debug log Options (Experimental)"
|
||||
config BT_CTRL_LE_LOG_EN
|
||||
depends on BT_CTRL_RUN_IN_FLASH_ONLY
|
||||
bool "Enable BLE debug log"
|
||||
default n
|
||||
|
||||
config BT_CTRL_LE_HCI_LOG_EN
|
||||
depends on BT_CTRL_LE_LOG_EN
|
||||
bool "Enable BLE HCI log"
|
||||
default n
|
||||
|
||||
config BT_CTRL_LE_LOG_DUMP_ONLY
|
||||
depends on BT_CTRL_LE_LOG_EN
|
||||
bool "Enable BLE log dump only"
|
||||
default n
|
||||
|
||||
config BT_CTRL_LE_LOG_STORAGE_EN
|
||||
depends on BT_CTRL_LE_LOG_EN
|
||||
bool "Enable BLE log storage to flash"
|
||||
default n
|
||||
|
||||
config BT_CTRL_LE_LOG_PARTITION_SIZE
|
||||
int "The size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_CTRL_LE_LOG_STORAGE_EN
|
||||
default 65536
|
||||
help
|
||||
The size of ble controller log partition shall be a multiples of 4K.
|
||||
The name of log partition shall be "bt_ctrl_log".
|
||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||
|
||||
config BT_CTRL_LE_LOG_SPI_OUT_EN
|
||||
bool "Output ble controller logs to SPI bus"
|
||||
depends on BT_CTRL_LE_LOG_EN
|
||||
depends on !BT_CTRL_LE_LOG_DUMP_ONLY
|
||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
|
||||
config BT_CTRL_LE_LOG_MODE_EN
|
||||
depends on BT_CTRL_LE_LOG_EN
|
||||
int "Enable log for specified BLE mode"
|
||||
range 0 4095
|
||||
default 4093
|
||||
|
||||
config BT_CTRL_LE_LOG_LEVEL
|
||||
depends on BT_CTRL_LE_LOG_EN
|
||||
int "The level of BLE log"
|
||||
range 0 5
|
||||
default 2
|
||||
|
||||
config BT_CTRL_LE_LOG_BUF1_SIZE
|
||||
depends on BT_CTRL_LE_LOG_EN
|
||||
int "The size of BLE log buffer1"
|
||||
default 1024
|
||||
|
||||
config BT_CTRL_LE_LOG_HCI_BUF_SIZE
|
||||
depends on BT_CTRL_LE_LOG_EN
|
||||
int "The size of BLE log HCI buffer"
|
||||
default 1024
|
||||
|
||||
config BT_CTRL_LE_LOG_BUF2_SIZE
|
||||
depends on BT_CTRL_LE_LOG_EN
|
||||
int "The size of BLE log buffer2"
|
||||
default 1024
|
||||
endmenu
|
||||
|
@ -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
|
||||
*/
|
||||
@ -49,6 +49,13 @@
|
||||
#else //CONFIG_IDF_TARGET_ESP32S3
|
||||
#include "esp32s3/rom/rom_layout.h"
|
||||
#endif
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
#include "ble_log/ble_log_spi_out.h"
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
#include "esp_partition.h"
|
||||
#include "hal/wdt_hal.h"
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
/* Macro definition
|
||||
@ -115,12 +122,20 @@ do{\
|
||||
} while(0)
|
||||
|
||||
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
|
||||
#define OSI_VERSION 0x00010009
|
||||
#define OSI_VERSION 0x0001000A
|
||||
#define OSI_MAGIC_VALUE 0xFADEBEAD
|
||||
|
||||
#define BLE_PWR_HDL_INVL 0xFFFF
|
||||
|
||||
#define BLE_CONTROLLER_MALLOC_CAPS (MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA)
|
||||
|
||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
#define MAX_STORAGE_SIZE (CONFIG_BT_CTRL_LE_LOG_PARTITION_SIZE)
|
||||
#define BLOCK_SIZE (4096)
|
||||
#define THRESHOLD (3072)
|
||||
#define PARTITION_NAME "bt_ctrl_log"
|
||||
#endif
|
||||
|
||||
/* Types definition
|
||||
************************************************************************
|
||||
*/
|
||||
@ -216,8 +231,13 @@ struct osi_funcs_t {
|
||||
void (* _btdm_rom_table_ready)(void);
|
||||
bool (* _coex_bt_wakeup_request)(void);
|
||||
void (* _coex_bt_wakeup_request_end)(void);
|
||||
int64_t (*_get_time_us)(void);
|
||||
void (* _assert)(void);
|
||||
};
|
||||
|
||||
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||
typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||
|
||||
/* External functions or values
|
||||
************************************************************************
|
||||
@ -277,6 +297,15 @@ extern void ets_backup_dma_copy(uint32_t reg, uint32_t mem_addr, uint32_t num, b
|
||||
extern void btdm_cca_feature_enable(void);
|
||||
extern void btdm_aa_check_enhance_enable(void);
|
||||
|
||||
/* BLE Log module */
|
||||
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int r_ble_log_deinit_async(void);
|
||||
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
|
||||
extern void r_ble_log_async_output_dump_all(bool output);
|
||||
extern void esp_panic_handler_feed_wdts(void);
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||
|
||||
extern uint32_t _bt_bss_start;
|
||||
extern uint32_t _bt_bss_end;
|
||||
extern uint32_t _bt_controller_bss_start;
|
||||
@ -338,6 +367,8 @@ static void btdm_backup_dma_copy_wrapper(uint32_t reg, uint32_t mem_addr, uint32
|
||||
static void btdm_funcs_table_ready_wrapper(void);
|
||||
static bool coex_bt_wakeup_request(void);
|
||||
static void coex_bt_wakeup_request_end(void);
|
||||
static int64_t get_time_us_wrapper(void);
|
||||
static void assert_wrapper(void);
|
||||
|
||||
static void btdm_slp_tmr_callback(void *arg);
|
||||
|
||||
@ -345,6 +376,15 @@ static esp_err_t try_heap_caps_add_region(intptr_t start, intptr_t end);
|
||||
|
||||
static void bt_controller_deinit_internal(void);
|
||||
|
||||
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
|
||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
void esp_bt_read_ctrl_log_from_flash(bool output);
|
||||
static int esp_bt_controller_log_storage(uint32_t len, const uint8_t *addr, bool end);
|
||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||
#endif // #if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
@ -410,6 +450,8 @@ static const struct osi_funcs_t osi_funcs_ro = {
|
||||
._btdm_rom_table_ready = btdm_funcs_table_ready_wrapper,
|
||||
._coex_bt_wakeup_request = coex_bt_wakeup_request,
|
||||
._coex_bt_wakeup_request_end = coex_bt_wakeup_request_end,
|
||||
._get_time_us = get_time_us_wrapper,
|
||||
._assert = assert_wrapper,
|
||||
};
|
||||
|
||||
static DRAM_ATTR struct osi_funcs_t *osi_funcs_p;
|
||||
@ -438,6 +480,255 @@ static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock;
|
||||
static DRAM_ATTR esp_pm_lock_handle_t s_light_sleep_pm_lock;
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||
enum log_out_mode {
|
||||
LOG_DUMP_MEMORY,
|
||||
LOG_ASYNC_OUT,
|
||||
LOG_STORAGE_TO_FLASH,
|
||||
LOG_SPI_OUT,
|
||||
};
|
||||
|
||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_CTRL_LE_LOG_BUF1_SIZE, CONFIG_BT_CTRL_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_CTRL_LE_LOG_BUF2_SIZE};
|
||||
bool log_is_inited = false;
|
||||
#if CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY
|
||||
uint8_t log_output_mode = LOG_DUMP_MEMORY;
|
||||
#else
|
||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
uint8_t log_output_mode = LOG_STORAGE_TO_FLASH;
|
||||
#elif CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
|
||||
uint8_t log_output_mode = LOG_SPI_OUT;
|
||||
#else
|
||||
uint8_t log_output_mode = LOG_ASYNC_OUT;
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY
|
||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
static const esp_partition_t *log_partition;
|
||||
static uint32_t write_index = 0;
|
||||
static uint32_t next_erase_index = BLOCK_SIZE;
|
||||
static bool block_erased = false;
|
||||
static bool stop_write = false;
|
||||
static bool is_filled = false;
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
esp_bt_controller_log_storage(len, addr, end);
|
||||
#endif //CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_feed_wdts();
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
|
||||
if (end) {
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
|
||||
static IRAM_ATTR void esp_bt_controller_spi_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
return ble_log_spi_out_write(BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY, addr, len);
|
||||
}
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
|
||||
|
||||
void esp_ble_controller_log_dump_all(bool output)
|
||||
{
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
esp_bt_read_ctrl_log_from_flash(output);
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_feed_wdts();
|
||||
esp_rom_printf("\r\n[DUMP_START:");
|
||||
r_ble_log_async_output_dump_all(output);
|
||||
esp_rom_printf(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
}
|
||||
}
|
||||
|
||||
void esp_bt_log_output_mode_set(uint8_t output_mode)
|
||||
{
|
||||
log_output_mode = output_mode;
|
||||
}
|
||||
|
||||
uint8_t esp_bt_log_output_mode_get(void)
|
||||
{
|
||||
return log_output_mode;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
bool task_create;
|
||||
uint8_t buffers = 0;
|
||||
|
||||
if (log_is_inited) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||
#if CONFIG_BT_CTRL_LE_HCI_LOG_EN
|
||||
buffers |= ESP_BLE_LOG_BUF_HCI;
|
||||
#endif // CONFIG_BT_CTRL_LE_HCI_LOG_EN
|
||||
|
||||
switch (log_output_mode) {
|
||||
case LOG_DUMP_MEMORY:
|
||||
task_create = false;
|
||||
break;
|
||||
case LOG_ASYNC_OUT:
|
||||
case LOG_STORAGE_TO_FLASH:
|
||||
task_create = true;
|
||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
esp_bt_ctrl_log_partition_get_and_erase_first_block();
|
||||
}
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
break;
|
||||
case LOG_SPI_OUT:
|
||||
task_create = true;
|
||||
#if CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
|
||||
bt_controller_log_interface = esp_bt_controller_spi_log_interface;
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
|
||||
if (ret == ESP_OK) {
|
||||
log_is_inited = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void esp_bt_ontroller_log_deinit(void)
|
||||
{
|
||||
r_ble_log_deinit_async();
|
||||
log_is_inited = false;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void)
|
||||
{
|
||||
log_partition = NULL;
|
||||
assert(MAX_STORAGE_SIZE % BLOCK_SIZE == 0);
|
||||
// Find the partition map in the partition table
|
||||
log_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, PARTITION_NAME);
|
||||
assert(log_partition != NULL);
|
||||
// Prepare data to be read later using the mapped address
|
||||
ESP_ERROR_CHECK(esp_partition_erase_range(log_partition, 0, BLOCK_SIZE));
|
||||
write_index = 0;
|
||||
next_erase_index = BLOCK_SIZE;
|
||||
block_erased = false;
|
||||
is_filled = false;
|
||||
stop_write = false;
|
||||
}
|
||||
|
||||
static int esp_bt_controller_log_storage(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (len > MAX_STORAGE_SIZE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stop_write) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((write_index) % BLOCK_SIZE) >= THRESHOLD && !block_erased) {
|
||||
// esp_rom_printf("Ers nxt: %d,%d\n", next_erase_index, write_index);
|
||||
esp_partition_erase_range(log_partition, next_erase_index, BLOCK_SIZE);
|
||||
next_erase_index = (next_erase_index + BLOCK_SIZE) % MAX_STORAGE_SIZE;
|
||||
block_erased = true;
|
||||
}
|
||||
|
||||
if (((write_index + len) / BLOCK_SIZE) > (write_index / BLOCK_SIZE)) {
|
||||
block_erased = false;
|
||||
}
|
||||
|
||||
if (write_index + len <= MAX_STORAGE_SIZE) {
|
||||
esp_partition_write(log_partition, write_index, addr, len);
|
||||
write_index = (write_index + len) % MAX_STORAGE_SIZE;
|
||||
} else {
|
||||
uint32_t first_part_len = MAX_STORAGE_SIZE - write_index;
|
||||
esp_partition_write(log_partition, write_index, addr, first_part_len);
|
||||
esp_partition_write(log_partition, 0, addr + first_part_len, len - first_part_len);
|
||||
write_index = len - first_part_len;
|
||||
is_filled = true;
|
||||
// esp_rom_printf("old idx: %d,%d\n",next_erase_index, write_index);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
{
|
||||
esp_partition_mmap_handle_t mmap_handle;
|
||||
uint32_t read_index;
|
||||
const void *mapped_ptr;
|
||||
const uint8_t *buffer;
|
||||
uint32_t print_len;
|
||||
uint32_t max_print_len;
|
||||
esp_err_t err;
|
||||
|
||||
print_len = 0;
|
||||
max_print_len = 4096;
|
||||
err = esp_partition_mmap(log_partition, 0, MAX_STORAGE_SIZE, ESP_PARTITION_MMAP_DATA, &mapped_ptr, &mmap_handle);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE("FLASH", "Mmap failed: %s", esp_err_to_name(err));
|
||||
return;
|
||||
}
|
||||
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_feed_wdts();
|
||||
r_ble_log_async_output_dump_all(true);
|
||||
esp_bt_ontroller_log_deinit();
|
||||
stop_write = true;
|
||||
|
||||
buffer = (const uint8_t *)mapped_ptr;
|
||||
esp_panic_handler_feed_wdts();
|
||||
if (is_filled) {
|
||||
read_index = next_erase_index;
|
||||
} else {
|
||||
read_index = 0;
|
||||
}
|
||||
|
||||
esp_rom_printf("\r\nREAD_CHECK:%ld,%ld,%d\r\n",read_index, write_index, is_filled);
|
||||
esp_rom_printf("\r\n[DUMP_START:");
|
||||
while (read_index != write_index) {
|
||||
esp_rom_printf("%02x ", buffer[read_index]);
|
||||
if (print_len > max_print_len) {
|
||||
esp_panic_handler_feed_wdts();
|
||||
print_len = 0;
|
||||
}
|
||||
|
||||
print_len++;
|
||||
read_index = (read_index + 1) % MAX_STORAGE_SIZE;
|
||||
}
|
||||
|
||||
esp_rom_printf(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
esp_partition_munmap(mmap_handle);
|
||||
err = esp_bt_controller_log_init(log_output_mode);
|
||||
assert(err == ESP_OK);
|
||||
}
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||
|
||||
void IRAM_ATTR btdm_hw_mac_power_down_wrapper(void)
|
||||
{
|
||||
#if CONFIG_MAC_BB_PD
|
||||
@ -991,6 +1282,18 @@ static void coex_bt_wakeup_request_end(void)
|
||||
return;
|
||||
}
|
||||
|
||||
static IRAM_ATTR int64_t get_time_us_wrapper(void)
|
||||
{
|
||||
return esp_timer_get_time();
|
||||
}
|
||||
|
||||
static IRAM_ATTR void assert_wrapper(void)
|
||||
{
|
||||
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||
esp_ble_controller_log_dump_all(true);
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||
}
|
||||
|
||||
bool esp_vhci_host_check_send_available(void)
|
||||
{
|
||||
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
@ -1446,9 +1749,21 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
coex_init();
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
ble_log_spi_out_init();
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
|
||||
periph_module_enable(PERIPH_BT_MODULE);
|
||||
periph_module_reset(PERIPH_BT_MODULE);
|
||||
|
||||
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||
err = esp_bt_controller_log_init(log_output_mode);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(BT_LOG_TAG, "ble_controller_log_init failed %d", err);
|
||||
goto error;
|
||||
}
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||
|
||||
err = btdm_controller_init(cfg);
|
||||
|
||||
if (err != 0) {
|
||||
@ -1474,6 +1789,10 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
ble_log_spi_out_deinit();
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
|
||||
btdm_controller_deinit();
|
||||
|
||||
bt_controller_deinit_internal();
|
||||
@ -1552,6 +1871,10 @@ static void bt_controller_deinit_internal(void)
|
||||
#endif
|
||||
esp_phy_modem_deinit();
|
||||
|
||||
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||
esp_bt_ontroller_log_deinit();
|
||||
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||
|
||||
if (osi_funcs_p != NULL) {
|
||||
free(osi_funcs_p);
|
||||
osi_funcs_p = NULL;
|
||||
|
@ -283,144 +283,126 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
help
|
||||
This configures stack size of NimBLE controller task
|
||||
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
menu "Controller debug features"
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable controller log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable hci log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_QUEUE_SIZE
|
||||
int "Number of ble controller log async SPI output queues"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 4
|
||||
help
|
||||
The number of ble controller log async SPI output queues
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_TRANS_BUF_SIZE
|
||||
int "Size of ble controller log async SPI output transaction buffer size"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 512
|
||||
help
|
||||
The size of ble controller log async SPI output transaction buffer size
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_MOSI_IO_NUM
|
||||
int "GPIO number of SPI MOSI"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 25
|
||||
help
|
||||
GPIO number of SPI MOSI
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_SCLK_IO_NUM
|
||||
int "GPIO number of SPI SCLK"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 26
|
||||
help
|
||||
GPIO number of SPI SCLK
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_CS_IO_NUM
|
||||
int "GPIO number of SPI CS"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 27
|
||||
help
|
||||
GPIO number of SPI CS
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Store ble controller logs to flash memory.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
The size of ble controller log partition shall be a multiples of 4K.
|
||||
The name of log partition shall be "bt_ctrl_log".
|
||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the first BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
Configure the size of the second BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the BLE HCI LOG buffer.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
|
||||
config BT_LE_ERROR_SIM_ENABLED
|
||||
bool "Enable controller features for internal testing"
|
||||
default n
|
||||
|
||||
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
|
||||
int "BLE LL Resolving list size"
|
||||
@ -785,14 +767,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
|
||||
The value of upperlimitmax needs to be a power of 2.
|
||||
|
||||
config BT_LE_CTRL_CHAN_ASS_EN
|
||||
bool "Enable channel assessment"
|
||||
bool "Enable channel assessment(Experimental)"
|
||||
default n
|
||||
help
|
||||
If this option is enabled, The Controller will records the communication quality
|
||||
for each channel and then start a timer to check and update the channel map every 4 seconds.
|
||||
|
||||
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
|
||||
bool "Enable aux packet when ext adv data length is zero"
|
||||
bool "Enable aux packet when ext adv data length is zero(Experimental)"
|
||||
default y
|
||||
help
|
||||
When this option is enabled, auxiliary packets will be present in the events of
|
||||
|
106
components/bt/controller/esp32c5/ble.c
Normal file
106
components/bt/controller/esp32c5/ble.c
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_bt_cfg.h"
|
||||
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
int base_stack_initEnv(void);
|
||||
void base_stack_deinitEnv(void);
|
||||
int base_stack_enable(void);
|
||||
void base_stack_disable(void);
|
||||
|
||||
int conn_stack_initEnv(void);
|
||||
void conn_stack_deinitEnv(void);
|
||||
int conn_stack_enable(void);
|
||||
void conn_stack_disable(void);
|
||||
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
int conn_errorSim_initEnv(void);
|
||||
void conn_errorSim_deinitEnv(void);
|
||||
int conn_errorSim_enable(void);
|
||||
void conn_errorSim_disable(void);
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
|
||||
/* Local functions definition
|
||||
***************************************************************************
|
||||
*/
|
||||
int ble_stack_initEnv(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_deinitEnv(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_deinitEnv();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_deinitEnv();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_deinitEnv();
|
||||
}
|
||||
|
||||
int ble_stack_enable(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_disable(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_disable();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_disable();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_disable();
|
||||
}
|
12
components/bt/controller/esp32c5/ble_priv.h
Normal file
12
components/bt/controller/esp32c5/ble_priv.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
int ble_stack_initEnv(void);
|
||||
|
||||
void ble_stack_deinitEnv(void);
|
||||
|
||||
int ble_stack_enable(void);
|
||||
|
||||
void ble_stack_disable(void);
|
@ -34,6 +34,7 @@
|
||||
#include "os/endian.h"
|
||||
|
||||
#include "esp_bt.h"
|
||||
#include "ble_priv.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_pm.h"
|
||||
@ -111,12 +112,13 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int r_ble_log_deinit_async(void);
|
||||
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
|
||||
extern void r_ble_log_async_output_dump_all(bool output);
|
||||
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
|
||||
extern void esp_panic_handler_feed_wdts(void);
|
||||
extern int r_ble_log_ctrl_level_and_mod(uint8_t log_level, uint32_t mod_switch);
|
||||
extern int r_ble_ctrl_mod_type(uint16_t mod, uint32_t mod_type_switch);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -376,13 +378,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
r_ble_log_async_output_dump_all(true);
|
||||
esp_bt_ontroller_log_deinit();
|
||||
stop_write = true;
|
||||
|
||||
buffer = (const uint8_t *)mapped_ptr;
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
if (is_filled) {
|
||||
read_index = next_erase_index;
|
||||
} else {
|
||||
@ -394,7 +396,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
while (read_index != write_index) {
|
||||
esp_rom_printf("%02x ", buffer[read_index]);
|
||||
if (print_len > max_print_len) {
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
print_len = 0;
|
||||
}
|
||||
|
||||
@ -945,13 +947,19 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
|
||||
ret = r_ble_controller_init(cfg);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
ret = ble_stack_initEnv();
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_stack_initEnv failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
@ -991,6 +999,7 @@ free_controller:
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
os_msys_deinit();
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
modem_deint:
|
||||
esp_ble_unregister_bb_funcs();
|
||||
@ -1028,6 +1037,7 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
// modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -1081,6 +1091,12 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
r_ble_ll_scan_start_time_init_compensation(500);
|
||||
r_priv_sdk_config_insert_proc_time_set(500);
|
||||
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
|
||||
|
||||
if (ble_stack_enable() != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (r_ble_controller_enable(mode) != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
@ -1089,6 +1105,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
return ESP_OK;
|
||||
|
||||
error:
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1112,6 +1129,7 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
if (r_ble_controller_disable() != 0) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1380,7 +1398,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(1000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
@ -1401,7 +1419,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
BT_ASSERT_PRINT("\r\n[DUMP_START:");
|
||||
r_ble_log_async_output_dump_all(output);
|
||||
BT_ASSERT_PRINT(":DUMP_END]\r\n");
|
||||
@ -1621,3 +1639,36 @@ 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)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch(type) {
|
||||
case 0:
|
||||
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:
|
||||
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
|
||||
osi_assert_wrapper(__LINE__,__func__, type, reason);
|
||||
}
|
||||
break;
|
||||
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -315,144 +315,126 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
help
|
||||
This configures stack size of NimBLE controller task
|
||||
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
menu "Controller debug features"
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable controller log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable hci log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_QUEUE_SIZE
|
||||
int "Number of ble controller log async SPI output queues"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 4
|
||||
help
|
||||
The number of ble controller log async SPI output queues
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_TRANS_BUF_SIZE
|
||||
int "Size of ble controller log async SPI output transaction buffer size"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 512
|
||||
help
|
||||
The size of ble controller log async SPI output transaction buffer size
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_MOSI_IO_NUM
|
||||
int "GPIO number of SPI MOSI"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 1
|
||||
help
|
||||
GPIO number of SPI MOSI
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_SCLK_IO_NUM
|
||||
int "GPIO number of SPI SCLK"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 6
|
||||
help
|
||||
GPIO number of SPI SCLK
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_CS_IO_NUM
|
||||
int "GPIO number of SPI CS"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 7
|
||||
help
|
||||
GPIO number of SPI CS
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Store ble controller logs to flash memory.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
The size of ble controller log partition shall be a multiples of 4K.
|
||||
The name of log partition shall be "bt_ctrl_log".
|
||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the first BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
Configure the size of the second BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the BLE HCI LOG buffer.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
|
||||
config BT_LE_ERROR_SIM_ENABLED
|
||||
bool "Enable controller features for internal testing"
|
||||
default n
|
||||
|
||||
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
|
||||
int "BLE LL Resolving list size"
|
||||
@ -810,14 +792,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
|
||||
The value of upperlimitmax needs to be a power of 2.
|
||||
|
||||
config BT_LE_CTRL_CHAN_ASS_EN
|
||||
bool "Enable channel assessment"
|
||||
bool "Enable channel assessment(Experimental)"
|
||||
default n
|
||||
help
|
||||
If this option is enabled, The Controller will records the communication quality
|
||||
for each channel and then start a timer to check and update the channel map every 4 seconds.
|
||||
|
||||
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
|
||||
bool "Enable aux packet when ext adv data length is zero"
|
||||
bool "Enable aux packet when ext adv data length is zero(Experimental)"
|
||||
default y
|
||||
help
|
||||
When this option is enabled, auxiliary packets will be present in the events of
|
||||
|
106
components/bt/controller/esp32c6/ble.c
Normal file
106
components/bt/controller/esp32c6/ble.c
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_bt_cfg.h"
|
||||
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
int base_stack_initEnv(void);
|
||||
void base_stack_deinitEnv(void);
|
||||
int base_stack_enable(void);
|
||||
void base_stack_disable(void);
|
||||
|
||||
int conn_stack_initEnv(void);
|
||||
void conn_stack_deinitEnv(void);
|
||||
int conn_stack_enable(void);
|
||||
void conn_stack_disable(void);
|
||||
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
int conn_errorSim_initEnv(void);
|
||||
void conn_errorSim_deinitEnv(void);
|
||||
int conn_errorSim_enable(void);
|
||||
void conn_errorSim_disable(void);
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
|
||||
/* Local functions definition
|
||||
***************************************************************************
|
||||
*/
|
||||
int ble_stack_initEnv(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_deinitEnv(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_deinitEnv();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_deinitEnv();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_deinitEnv();
|
||||
}
|
||||
|
||||
int ble_stack_enable(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_disable(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_disable();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_disable();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_disable();
|
||||
}
|
12
components/bt/controller/esp32c6/ble_priv.h
Normal file
12
components/bt/controller/esp32c6/ble_priv.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
int ble_stack_initEnv(void);
|
||||
|
||||
void ble_stack_deinitEnv(void);
|
||||
|
||||
int ble_stack_enable(void);
|
||||
|
||||
void ble_stack_disable(void);
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "esp_bt.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "ble_priv.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_pm.h"
|
||||
#ifdef CONFIG_ESP_PHY_ENABLED
|
||||
@ -114,12 +115,13 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int r_ble_log_deinit_async(void);
|
||||
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
|
||||
extern void r_ble_log_async_output_dump_all(bool output);
|
||||
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
|
||||
extern void esp_panic_handler_feed_wdts(void);
|
||||
extern int r_ble_log_ctrl_level_and_mod(uint8_t log_level, uint32_t mod_switch);
|
||||
extern int r_ble_ctrl_mod_type(uint16_t mod, uint32_t mod_type_switch);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -379,13 +381,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
r_ble_log_async_output_dump_all(true);
|
||||
esp_bt_ontroller_log_deinit();
|
||||
stop_write = true;
|
||||
|
||||
buffer = (const uint8_t *)mapped_ptr;
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
if (is_filled) {
|
||||
read_index = next_erase_index;
|
||||
} else {
|
||||
@ -397,7 +399,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
while (read_index != write_index) {
|
||||
esp_rom_printf("%02x ", buffer[read_index]);
|
||||
if (print_len > max_print_len) {
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
print_len = 0;
|
||||
}
|
||||
|
||||
@ -963,13 +965,19 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
|
||||
ret = r_ble_controller_init(cfg);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
ret = ble_stack_initEnv();
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_stack_initEnv failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
@ -1012,6 +1020,7 @@ free_controller:
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
os_msys_deinit();
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
modem_deint:
|
||||
esp_ble_unregister_bb_funcs();
|
||||
@ -1049,6 +1058,7 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -1102,6 +1112,12 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
r_ble_ll_scan_start_time_init_compensation(500);
|
||||
r_priv_sdk_config_insert_proc_time_set(500);
|
||||
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
|
||||
|
||||
if (ble_stack_enable() != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (r_ble_controller_enable(mode) != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
@ -1110,6 +1126,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
return ESP_OK;
|
||||
|
||||
error:
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1133,6 +1150,7 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
if (r_ble_controller_disable() != 0) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1401,7 +1419,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(1000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
@ -1422,7 +1440,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
BT_ASSERT_PRINT("\r\n[DUMP_START:");
|
||||
r_ble_log_async_output_dump_all(output);
|
||||
BT_ASSERT_PRINT(":DUMP_END]\r\n");
|
||||
@ -1642,3 +1660,36 @@ 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)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch(type) {
|
||||
case 0:
|
||||
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:
|
||||
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
|
||||
osi_assert_wrapper(__LINE__,__func__, type, reason);
|
||||
}
|
||||
break;
|
||||
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -306,144 +306,126 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
help
|
||||
This configures stack size of NimBLE controller task
|
||||
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
menu "Controller debug features"
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable controller log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable hci log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_QUEUE_SIZE
|
||||
int "Number of ble controller log async SPI output queues"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 4
|
||||
help
|
||||
The number of ble controller log async SPI output queues
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_TRANS_BUF_SIZE
|
||||
int "Size of ble controller log async SPI output transaction buffer size"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 512
|
||||
help
|
||||
The size of ble controller log async SPI output transaction buffer size
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_MOSI_IO_NUM
|
||||
int "GPIO number of SPI MOSI"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 25
|
||||
help
|
||||
GPIO number of SPI MOSI
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_SCLK_IO_NUM
|
||||
int "GPIO number of SPI SCLK"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 26
|
||||
help
|
||||
GPIO number of SPI SCLK
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_CS_IO_NUM
|
||||
int "GPIO number of SPI CS"
|
||||
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
default 27
|
||||
help
|
||||
GPIO number of SPI CS
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Store ble controller logs to flash memory.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
The size of ble controller log partition shall be a multiples of 4K.
|
||||
The name of log partition shall be "bt_ctrl_log".
|
||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the first BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
Configure the size of the second BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the BLE HCI LOG buffer.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
|
||||
config BT_LE_ERROR_SIM_ENABLED
|
||||
bool "Enable controller features for internal testing"
|
||||
default n
|
||||
|
||||
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
|
||||
int "BLE LL Resolving list size"
|
||||
@ -811,14 +793,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
|
||||
The value of upperlimitmax needs to be a power of 2.
|
||||
|
||||
config BT_LE_CTRL_CHAN_ASS_EN
|
||||
bool "Enable channel assessment"
|
||||
bool "Enable channel assessment(Experimental)"
|
||||
default n
|
||||
help
|
||||
If this option is enabled, The Controller will records the communication quality
|
||||
for each channel and then start a timer to check and update the channel map every 4 seconds.
|
||||
|
||||
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
|
||||
bool "Enable aux packet when ext adv data length is zero"
|
||||
bool "Enable aux packet when ext adv data length is zero(Experimental)"
|
||||
default y
|
||||
help
|
||||
When this option is enabled, auxiliary packets will be present in the events of
|
||||
|
106
components/bt/controller/esp32h2/ble.c
Normal file
106
components/bt/controller/esp32h2/ble.c
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_bt_cfg.h"
|
||||
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
int base_stack_initEnv(void);
|
||||
void base_stack_deinitEnv(void);
|
||||
int base_stack_enable(void);
|
||||
void base_stack_disable(void);
|
||||
|
||||
int conn_stack_initEnv(void);
|
||||
void conn_stack_deinitEnv(void);
|
||||
int conn_stack_enable(void);
|
||||
void conn_stack_disable(void);
|
||||
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
int conn_errorSim_initEnv(void);
|
||||
void conn_errorSim_deinitEnv(void);
|
||||
int conn_errorSim_enable(void);
|
||||
void conn_errorSim_disable(void);
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
|
||||
/* Local functions definition
|
||||
***************************************************************************
|
||||
*/
|
||||
int ble_stack_initEnv(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_deinitEnv(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_deinitEnv();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_deinitEnv();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_deinitEnv();
|
||||
}
|
||||
|
||||
int ble_stack_enable(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_disable(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_disable();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_disable();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_disable();
|
||||
}
|
12
components/bt/controller/esp32h2/ble_priv.h
Normal file
12
components/bt/controller/esp32h2/ble_priv.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
int ble_stack_initEnv(void);
|
||||
|
||||
void ble_stack_deinitEnv(void);
|
||||
|
||||
int ble_stack_enable(void);
|
||||
|
||||
void ble_stack_disable(void);
|
@ -34,6 +34,7 @@
|
||||
#include "os/endian.h"
|
||||
|
||||
#include "esp_bt.h"
|
||||
#include "ble_priv.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_pm.h"
|
||||
@ -109,12 +110,13 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int r_ble_log_deinit_async(void);
|
||||
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
|
||||
extern void r_ble_log_async_output_dump_all(bool output);
|
||||
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
|
||||
extern void esp_panic_handler_feed_wdts(void);
|
||||
extern int r_ble_log_ctrl_level_and_mod(uint8_t log_level, uint32_t mod_switch);
|
||||
extern int r_ble_ctrl_mod_type(uint16_t mod, uint32_t mod_type_switch);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -377,13 +379,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
r_ble_log_async_output_dump_all(true);
|
||||
esp_bt_ontroller_log_deinit();
|
||||
stop_write = true;
|
||||
|
||||
buffer = (const uint8_t *)mapped_ptr;
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
if (is_filled) {
|
||||
read_index = next_erase_index;
|
||||
} else {
|
||||
@ -395,7 +397,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
while (read_index != write_index) {
|
||||
esp_rom_printf("%02x ", buffer[read_index]);
|
||||
if (print_len > max_print_len) {
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
print_len = 0;
|
||||
}
|
||||
|
||||
@ -939,13 +941,19 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
|
||||
ret = r_ble_controller_init(cfg);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
ret = ble_stack_initEnv();
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_stack_initEnv failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
@ -988,6 +996,7 @@ free_controller:
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
os_msys_deinit();
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
modem_deint:
|
||||
esp_ble_unregister_bb_funcs();
|
||||
@ -1023,6 +1032,7 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -1076,6 +1086,12 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
r_ble_ll_scan_start_time_init_compensation(500);
|
||||
r_priv_sdk_config_insert_proc_time_set(500);
|
||||
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
|
||||
|
||||
if (ble_stack_enable() != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (r_ble_controller_enable(mode) != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
@ -1084,6 +1100,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
return ESP_OK;
|
||||
|
||||
error:
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1107,6 +1124,7 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
if (r_ble_controller_disable() != 0) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1375,7 +1393,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(1000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
@ -1395,7 +1413,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
esp_panic_handler_feed_wdts();
|
||||
BT_ASSERT_PRINT("\r\n[DUMP_START:");
|
||||
r_ble_log_async_output_dump_all(output);
|
||||
BT_ASSERT_PRINT(":DUMP_END]\r\n");
|
||||
@ -1615,3 +1633,35 @@ 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)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch(type) {
|
||||
case 0:
|
||||
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:
|
||||
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
|
||||
osi_assert_wrapper(__LINE__,__func__, type, reason);
|
||||
}
|
||||
break;
|
||||
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 6093909e01930f8cda6f60510f8a412c6d1814e8
|
||||
Subproject commit fbbb054cbc5c8b5aa466208dc8d12ccc10d7e08c
|
@ -1 +1 @@
|
||||
Subproject commit ed99228396aaa18935b575d600bc19da38dc4746
|
||||
Subproject commit 2ce747aec8008d008fe34fa375a2aea3e7e48e9a
|
@ -1 +1 @@
|
||||
Subproject commit 5fedf4bb0e11e11d54d5f712ec17b72cc2c95fdc
|
||||
Subproject commit e17ca05e5e0acf39212811a08174d5c1c69cf165
|
@ -1 +1 @@
|
||||
Subproject commit 4cb60b2cd1c560a85effde18465b0412e715b048
|
||||
Subproject commit 08946905ec0dfcbfc7dd2919b27e43cbcbde66ed
|
@ -1 +1 @@
|
||||
Subproject commit 7d35fc30e8cada9567f97378e24608bc63b080e4
|
||||
Subproject commit e755a655979177c9551d5fb3613ebb4885aab3a5
|
@ -132,6 +132,26 @@ config BT_SDP_COMMON_ENABLED
|
||||
help
|
||||
This enables common SDP operation, such as SDP record creation and deletion.
|
||||
|
||||
config BT_SDP_PAD_LEN
|
||||
int "One or more BT SDP attributes total allocated length (bytes)"
|
||||
depends on BT_CLASSIC_ENABLED
|
||||
default 300
|
||||
range BT_SDP_ATTR_LEN 1024
|
||||
help
|
||||
This is the total size of all SDP attributes allowed.
|
||||
Any attributes that exceed this size are truncated.
|
||||
The default value is 300.
|
||||
|
||||
config BT_SDP_ATTR_LEN
|
||||
int "Single BT SDP attribute allocated length (bytes)"
|
||||
depends on BT_CLASSIC_ENABLED
|
||||
default 300
|
||||
range 300 1024
|
||||
help
|
||||
This is the maximum allowed size for a single SDP attribute.
|
||||
Any attributes that exceed this size are truncated.
|
||||
The default value is 300.
|
||||
|
||||
menuconfig BT_HFP_ENABLE
|
||||
bool "Hands Free/Handset Profile"
|
||||
depends on BT_CLASSIC_ENABLED
|
||||
@ -192,6 +212,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
|
||||
|
||||
menuconfig BT_PBAC_ENABLED
|
||||
bool "PBAP Client"
|
||||
depends on BT_CLASSIC_ENABLED
|
||||
@ -229,7 +257,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
|
||||
@ -241,8 +269,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"
|
||||
@ -318,7 +347,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
|
||||
@ -356,7 +385,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
|
||||
@ -389,6 +427,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
|
||||
@ -1169,15 +1224,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
|
||||
@ -1202,15 +1248,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
|
||||
@ -1221,23 +1258,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
|
||||
@ -1247,7 +1267,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
|
||||
@ -1256,15 +1276,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"
|
||||
@ -1287,6 +1332,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
|
||||
|
@ -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
|
||||
*/
|
||||
@ -16,6 +16,10 @@
|
||||
|
||||
#define LOG_TAG "HCI_API"
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
||||
#include "ble_log/ble_log_spi_out.h"
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
||||
|
||||
static esp_bluedroid_hci_driver_operations_t s_hci_driver_ops = { 0 };
|
||||
|
||||
esp_err_t esp_bluedroid_attach_hci_driver(const esp_bluedroid_hci_driver_operations_t *p_ops)
|
||||
@ -63,6 +67,9 @@ void hci_host_send_packet(uint8_t *data, uint16_t len)
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
bt_hci_log_record_hci_data(data[0], &data[1], len - 1);
|
||||
#endif
|
||||
#if (BT_BLE_LOG_SPI_OUT_HCI_ENABLED && !SOC_ESP_NIMBLE_CONTROLLER)
|
||||
ble_log_spi_out_write_with_ts(BLE_LOG_SPI_OUT_SOURCE_HCI_DOWNSTREAM, data, len);
|
||||
#endif // (BT_BLE_LOG_SPI_OUT_HCI_ENABLED && !SOC_ESP_NIMBLE_CONTROLLER)
|
||||
#if (BT_CONTROLLER_INCLUDED == TRUE)
|
||||
esp_vhci_host_send_packet(data, len);
|
||||
#else /* BT_CONTROLLER_INCLUDED == TRUE */
|
||||
|
@ -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,
|
||||
@ -1757,3 +1774,21 @@ esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cm
|
||||
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);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK;
|
||||
arg.set_vendor_evt_mask.evt_mask = event_mask;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
@ -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
|
||||
*/
|
||||
@ -230,6 +230,8 @@ typedef enum {
|
||||
ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT, /*!< When vendor hci command complete, the event comes */
|
||||
ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT, /*!< When set privacy mode complete, the event comes */
|
||||
ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT, /*!< When set CSA support complete, the event comes */
|
||||
ESP_GAP_BLE_SET_VENDOR_EVT_MASK_COMPLETE_EVT, /*!< When set vendor event mask complete, the event comes */
|
||||
ESP_GAP_BLE_VENDOR_HCI_EVT, /*!< When BLE vendor HCI event received, the event comes */
|
||||
ESP_GAP_BLE_EVT_MAX, /*!< when maximum advertising event complete, the event comes */
|
||||
} esp_gap_ble_cb_event_t;
|
||||
|
||||
@ -1291,6 +1293,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 +1352,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
|
||||
*/
|
||||
@ -1578,7 +1582,21 @@ typedef union {
|
||||
*/
|
||||
struct ble_set_csa_support_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate CSA support set operation success status */
|
||||
} set_csa_support_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT */
|
||||
} set_csa_support_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_VENDOR_EVT_MASK_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_set_vendor_evt_mask_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate set vendor event mask operation success status */
|
||||
} set_vendor_evt_mask_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_VENDOR_EVT_MASK_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_VENDOR_HCI_EVT
|
||||
*/
|
||||
struct ble_vendor_hci_event_evt_param {
|
||||
uint8_t subevt_code; /*!< Subevent code for vendor HCI event, the range is 0xC0 to 0xFF */
|
||||
uint8_t param_len; /*!< The length of the event parameter buffer */
|
||||
uint8_t *param_buf; /*!< The pointer of the event parameter buffer */
|
||||
} vendor_hci_evt; /*!< Event parameter buffer of ESP_GAP_BLE_VENDOR_HCI_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@ -2770,6 +2788,18 @@ esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_add
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select);
|
||||
|
||||
/**
|
||||
* @brief This function is used to control which vendor events are generated by the HCI for the Host.
|
||||
*
|
||||
* @param[in] event_mask: Bit0: Legacy scan request received event
|
||||
* Bit1: Vendor channel map update complete event
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -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)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -4599,6 +4607,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
|
||||
@ -4630,7 +4639,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
|
||||
@ -4650,6 +4661,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)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -5174,6 +5186,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
|
||||
@ -5191,7 +5204,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
|
||||
@ -5223,8 +5238,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
|
||||
@ -5239,6 +5255,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
|
||||
@ -5305,6 +5323,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
|
||||
@ -5319,10 +5338,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
|
||||
@ -5354,6 +5374,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
|
||||
@ -5393,6 +5414,7 @@ void bta_dm_ble_observe (tBTA_DM_MSG *p_data)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // #if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -5438,23 +5460,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
|
||||
@ -5492,6 +5498,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)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -5509,6 +5516,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
|
||||
@ -5532,29 +5540,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
|
||||
@ -5578,7 +5563,6 @@ void bta_dm_ble_set_adv_config_raw (tBTA_DM_MSG *p_data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_ble_set_scan_rsp
|
||||
@ -5624,7 +5608,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
|
||||
@ -5681,6 +5665,7 @@ void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
|
||||
|
||||
}
|
||||
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_ble_broadcast
|
||||
@ -5706,7 +5691,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
|
||||
@ -5814,7 +5801,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);
|
||||
@ -5824,11 +5813,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)
|
||||
{
|
||||
@ -5867,7 +5859,13 @@ 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)
|
||||
void bta_dm_ble_gap_set_vendor_evt_mask(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s, evt_mask = %d", __func__, p_data->ble_set_vendor_evt_mask.evt_mask);
|
||||
BTM_BleSetVendorEventMask(p_data->ble_set_vendor_evt_mask.evt_mask, p_data->ble_set_vendor_evt_mask.p_cback);
|
||||
}
|
||||
|
||||
#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,
|
||||
@ -5879,7 +5877,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;
|
||||
@ -5905,6 +5904,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);
|
||||
@ -5945,7 +5945,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);
|
||||
@ -5972,7 +5974,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__);
|
||||
@ -6017,8 +6021,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__);
|
||||
@ -6032,14 +6037,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,
|
||||
@ -6091,6 +6096,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
|
||||
@ -6122,7 +6128,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
|
||||
@ -6180,7 +6188,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
|
||||
@ -6207,7 +6217,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
|
||||
@ -6240,6 +6252,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)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -6416,6 +6429,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
|
||||
@ -6463,6 +6477,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
|
||||
|
@ -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)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -3038,6 +3013,19 @@ void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTA_SET_CSA_SUPPORT_CMPL_CBA
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleGapSetVendorEventMask(uint32_t evt_mask, tBTA_SET_VENDOR_EVT_MASK_CBACK *p_callback)
|
||||
{
|
||||
tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT;
|
||||
p_msg->evt_mask = evt_mask;
|
||||
p_msg->p_cback = p_callback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_VendorInit
|
||||
@ -3141,7 +3129,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 +3235,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 +3294,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 +3398,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 +3434,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 +3488,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 +3523,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)
|
||||
|
@ -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,14 +271,21 @@ 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 */
|
||||
bta_dm_ble_gap_set_csa_support, /* BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT */
|
||||
bta_dm_ble_gap_set_vendor_evt_mask, /* BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -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,14 +262,21 @@ 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,
|
||||
BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT,
|
||||
BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT,
|
||||
#endif
|
||||
BTA_DM_MAX_EVT
|
||||
};
|
||||
@ -368,10 +418,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 +680,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 +793,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 +858,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 +878,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 +905,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 +923,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 +934,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 +951,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 +995,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;
|
||||
@ -966,8 +1021,15 @@ typedef struct {
|
||||
tBTA_SET_CSA_SUPPORT_CMPL_CBACK *p_cback;
|
||||
} tBTA_DM_API_BLE_SET_CSA_SUPPORT;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 evt_mask;
|
||||
tBTA_SET_VENDOR_EVT_MASK_CBACK *p_cback;
|
||||
} tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK;
|
||||
|
||||
#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 +1038,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 +1086,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 +1103,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 +1302,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 +1355,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 +1368,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 +1394,90 @@ 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;
|
||||
tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK ble_set_vendor_evt_mask;
|
||||
#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 +1592,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 +1862,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 +1890,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 +1902,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 +1927,22 @@ 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)
|
||||
extern void bta_dm_ble_gap_set_vendor_evt_mask(tBTA_DM_MSG *p_data);
|
||||
#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 +1953,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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -441,6 +441,8 @@ typedef tBTM_SET_PRIVACY_MODE_CMPL_CBACK tBTA_SET_PRIVACY_MODE_CMPL_CBACK;
|
||||
|
||||
typedef tBTM_SET_CSA_SUPPORT_CMPL_CBACK tBTA_SET_CSA_SUPPORT_CMPL_CBACK;
|
||||
|
||||
typedef tBTM_SET_VENDOR_EVT_MASK_CBACK tBTA_SET_VENDOR_EVT_MASK_CBACK;
|
||||
|
||||
typedef tBTM_CMPL_CB tBTA_CMPL_CB;
|
||||
|
||||
typedef tBTM_VSC_CMPL tBTA_VSC_CMPL;
|
||||
@ -539,7 +541,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 +1051,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 +1065,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 +1259,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 +1279,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 +1627,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 +1636,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 +2518,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 +2648,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 +2735,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 +2812,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 +2871,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,15 +2912,19 @@ 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);
|
||||
|
||||
extern void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *p_callback);
|
||||
|
||||
extern void BTA_DmBleGapSetVendorEventMask(uint32_t evt_mask, tBTA_SET_VENDOR_EVT_MASK_CBACK *p_callback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleSetStorageParams
|
||||
@ -3065,7 +3065,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 +3080,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 +3095,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 +3182,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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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(¶m.ext_adv_report.params, ¶ms->ext_adv_report, sizeof(esp_ble_gap_ext_adv_report_t));
|
||||
@ -1128,6 +1117,8 @@ 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 @@ 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(¶m.period_adv_report, ¶ms->period_adv_report,
|
||||
@ -1177,6 +1170,8 @@ 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 @@ 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)
|
||||
{
|
||||
@ -1382,20 +1381,57 @@ static void btc_ble_set_csa_support_callback(UINT8 status)
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_ble_set_vendor_evt_mask_callback(UINT8 status)
|
||||
{
|
||||
esp_ble_gap_cb_param_t param;
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = ESP_GAP_BLE_SET_VENDOR_EVT_MASK_COMPLETE_EVT;
|
||||
|
||||
param.set_csa_support_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_ble_vendor_hci_event_callback(UINT8 subevt_code, UINT8 param_len, UINT8 *params)
|
||||
{
|
||||
esp_ble_gap_cb_param_t param = {0};
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = ESP_GAP_BLE_VENDOR_HCI_EVT;
|
||||
|
||||
param.vendor_hci_evt.subevt_code = subevt_code;
|
||||
param.vendor_hci_evt.param_len = param_len;
|
||||
param.vendor_hci_evt.param_buf = params;
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), btc_gap_ble_cb_deep_copy, btc_gap_ble_cb_deep_free);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
void btc_get_whitelist_size(uint16_t *length)
|
||||
{
|
||||
BTM_BleGetWhiteListSize(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 +1444,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 +1458,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 +1568,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 +1579,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 +1592,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 +1627,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 +1673,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 +1727,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 +1745,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 +1763,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 +1791,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;
|
||||
@ -1793,6 +1842,18 @@ void btc_gap_ble_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ESP_GAP_BLE_VENDOR_HCI_EVT: {
|
||||
if (src->vendor_hci_evt.param_len) {
|
||||
dst->vendor_hci_evt.param_buf = osi_malloc(src->vendor_hci_evt.param_len);
|
||||
if (dst->vendor_hci_evt.param_buf) {
|
||||
memcpy(dst->vendor_hci_evt.param_buf, src->vendor_hci_evt.param_buf,
|
||||
src->vendor_hci_evt.param_len);
|
||||
} else {
|
||||
BTC_TRACE_ERROR("%s, malloc failed\n", __func__);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BTC_TRACE_ERROR("%s, Unhandled deep copy %d\n", __func__, msg->act);
|
||||
break;
|
||||
@ -1804,6 +1865,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 +1895,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 +1923,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 +1932,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 +1941,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 +1957,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;
|
||||
@ -1929,6 +1998,13 @@ void btc_gap_ble_cb_deep_free(btc_msg_t *msg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ESP_GAP_BLE_VENDOR_HCI_EVT: {
|
||||
void *value = ((esp_ble_gap_cb_param_t *)msg->arg)->vendor_hci_evt.param_buf;
|
||||
if (value) {
|
||||
osi_free(value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BTC_TRACE_DEBUG("Unhandled deep free %d", msg->act);
|
||||
break;
|
||||
@ -1946,6 +2022,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 +2031,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 +2042,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 +2053,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 +2115,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 +2126,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 +2272,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 +2348,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 +2375,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 +2418,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 +2451,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 +2485,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,
|
||||
@ -2424,6 +2519,9 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
case BTC_GAP_BLE_SET_CSA_SUPPORT:
|
||||
BTA_DmBleGapSetCsaSupport(arg->set_csa_support.csa_select, btc_ble_set_csa_support_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK:
|
||||
BTA_DmBleGapSetVendorEventMask(arg->set_vendor_evt_mask.evt_mask, btc_ble_set_vendor_evt_mask_callback);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -2439,11 +2537,13 @@ void btc_gap_callback_init(void)
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BTM_BleGapRegisterCallback(btc_ble_5_gap_callback);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BTM_BleRegisterVendorHciEventCallback(btc_ble_vendor_hci_event_callback);
|
||||
}
|
||||
|
||||
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 +2551,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 +2559,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 +2567,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
|
||||
|
@ -903,14 +903,10 @@ void btc_hd_cb_handler(btc_msg_t *msg)
|
||||
btc_hd_cb_to_app(ESP_HIDD_INTR_DATA_EVT, ¶m);
|
||||
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) {
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
@ -109,6 +121,7 @@ typedef enum {
|
||||
BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT,
|
||||
BTC_GAP_BLE_SET_PRIVACY_MODE,
|
||||
BTC_GAP_BLE_SET_CSA_SUPPORT,
|
||||
BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK,
|
||||
} btc_gap_ble_act_t;
|
||||
|
||||
/* btc_ble_gap_args_t */
|
||||
@ -257,6 +270,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 +279,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;
|
||||
@ -281,6 +296,10 @@ typedef union {
|
||||
struct set_csa_support_args {
|
||||
uint8_t csa_select;
|
||||
} set_csa_support;
|
||||
// BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK
|
||||
struct set_vendor_evt_mask_args {
|
||||
uint32_t evt_mask;
|
||||
} set_vendor_evt_mask;
|
||||
} btc_ble_gap_args_t;
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
@ -301,7 +320,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 +356,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 +379,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;
|
||||
|
@ -73,6 +73,20 @@
|
||||
#define UC_BT_SDP_COMMON_ENABLED FALSE
|
||||
#endif
|
||||
|
||||
// SDP Pad Length
|
||||
#ifdef CONFIG_BT_SDP_PAD_LEN
|
||||
#define UC_SDP_MAX_PAD_LEN CONFIG_BT_SDP_PAD_LEN
|
||||
#else
|
||||
#define UC_SDP_MAX_PAD_LEN 300
|
||||
#endif
|
||||
|
||||
// SDP Max Attribute Length
|
||||
#ifdef CONFIG_BT_SDP_ATTR_LEN
|
||||
#define UC_SDP_MAX_ATTR_LEN CONFIG_BT_SDP_ATTR_LEN
|
||||
#else
|
||||
#define UC_SDP_MAX_ATTR_LEN 300
|
||||
#endif
|
||||
|
||||
//HFP(AG)
|
||||
#ifdef CONFIG_BT_HFP_AG_ENABLE
|
||||
#define UC_BT_HFP_AG_ENABLED CONFIG_BT_HFP_AG_ENABLE
|
||||
@ -108,6 +122,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
|
||||
@ -179,12 +200,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
|
||||
@ -352,14 +421,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
|
||||
|
@ -176,6 +176,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
|
||||
|
||||
#if UC_BT_GOEPC_ENABLED
|
||||
#ifndef RFCOMM_INCLUDED
|
||||
#define RFCOMM_INCLUDED TRUE
|
||||
@ -236,6 +240,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
|
||||
@ -433,6 +485,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
|
||||
@ -573,12 +629,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
|
||||
@ -1297,7 +1347,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
|
||||
@ -1551,13 +1666,14 @@
|
||||
#endif /* defined(HID_DEV_INCLUDED) && (HID_DEV_INCLUDED==TRUE) */
|
||||
#endif
|
||||
|
||||
/* The maximum length, in bytes, of all SDP attributes combined. */
|
||||
#ifndef SDP_MAX_PAD_LEN
|
||||
#define SDP_MAX_PAD_LEN 300
|
||||
#define SDP_MAX_PAD_LEN UC_SDP_MAX_PAD_LEN
|
||||
#endif
|
||||
|
||||
/* The maximum length, in bytes, of an attribute. */
|
||||
#ifndef SDP_MAX_ATTR_LEN
|
||||
#define SDP_MAX_ATTR_LEN 400
|
||||
#define SDP_MAX_ATTR_LEN UC_SDP_MAX_ATTR_LEN
|
||||
#endif
|
||||
|
||||
/* The maximum number of attribute filters supported by SDP databases. */
|
||||
|
@ -25,6 +25,9 @@
|
||||
#include "stack/bt_types.h"
|
||||
#include "bt_common.h"
|
||||
|
||||
#if (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
#include "ble_log/ble_log_spi_out.h"
|
||||
#endif // (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
static inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
|
||||
{
|
||||
uint16_t i;
|
||||
@ -217,20 +220,83 @@ static inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t l
|
||||
|
||||
/* Define tracing for BTM
|
||||
*/
|
||||
#if (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
#define BTM_TRACE_ERROR(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_ERROR, "BT_BTM", fmt, ## args); \
|
||||
if (btm_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(BTM, ERROR)) BT_PRINT_E("BT_BTM", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define BTM_TRACE_WARNING(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_WARN, "BT_BTM", fmt, ## args); \
|
||||
if (btm_cb.trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(BTM, WARNING)) BT_PRINT_W("BT_BTM", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define BTM_TRACE_API(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_INFO, "BT_BTM", fmt, ## args); \
|
||||
if (btm_cb.trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(BTM, API)) BT_PRINT_I("BT_BTM", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define BTM_TRACE_EVENT(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_DEBUG, "BT_BTM", fmt, ## args); \
|
||||
if (btm_cb.trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(BTM, EVENT)) BT_PRINT_D("BT_BTM", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define BTM_TRACE_DEBUG(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_DEBUG, "BT_BTM", fmt, ## args); \
|
||||
if (btm_cb.trace_level >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(BTM, DEBUG)) BT_PRINT_D("BT_BTM", fmt, ## args); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define BTM_TRACE_ERROR(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(BTM, ERROR)) BT_PRINT_E("BT_BTM", fmt, ## args);}
|
||||
#define BTM_TRACE_WARNING(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(BTM, WARNING)) BT_PRINT_W("BT_BTM", fmt, ## args);}
|
||||
#define BTM_TRACE_API(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(BTM,API)) BT_PRINT_I("BT_BTM", fmt, ## args);}
|
||||
#define BTM_TRACE_EVENT(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(BTM,EVENT)) BT_PRINT_D("BT_BTM", fmt, ## args);}
|
||||
#define BTM_TRACE_DEBUG(fmt, args...) {if (btm_cb.trace_level >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(BTM,DEBUG)) BT_PRINT_D("BT_BTM", fmt, ## args);}
|
||||
|
||||
#endif // (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
/* Define tracing for the L2CAP unit
|
||||
*/
|
||||
#if (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
#define L2CAP_TRACE_ERROR(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_ERROR, "BT_L2CAP", fmt, ## args); \
|
||||
if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(L2CAP, ERROR)) BT_PRINT_E("BT_L2CAP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define L2CAP_TRACE_WARNING(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_WARN, "BT_L2CAP", fmt, ## args); \
|
||||
if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(L2CAP, WARNING)) BT_PRINT_W("BT_L2CAP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define L2CAP_TRACE_API(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_INFO, "BT_L2CAP", fmt, ## args); \
|
||||
if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(L2CAP, API)) BT_PRINT_I("BT_L2CAP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define L2CAP_TRACE_EVENT(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_DEBUG, "BT_L2CAP", fmt, ## args); \
|
||||
if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(L2CAP, EVENT)) BT_PRINT_D("BT_L2CAP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define L2CAP_TRACE_DEBUG(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_DEBUG, "BT_L2CAP", fmt, ## args); \
|
||||
if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(L2CAP, DEBUG)) BT_PRINT_D("BT_L2CAP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define L2CAP_TRACE_ERROR(fmt, args...) {if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(L2CAP, ERROR)) BT_PRINT_E("BT_L2CAP", fmt, ## args);}
|
||||
#define L2CAP_TRACE_WARNING(fmt, args...) {if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(L2CAP, WARNING)) BT_PRINT_W("BT_L2CAP", fmt, ## args);}
|
||||
#define L2CAP_TRACE_API(fmt, args...) {if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(L2CAP,API)) BT_PRINT_I("BT_L2CAP", fmt, ## args);}
|
||||
#define L2CAP_TRACE_EVENT(fmt, args...) {if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(L2CAP,EVENT)) BT_PRINT_D("BT_L2CAP", fmt, ## args);}
|
||||
#define L2CAP_TRACE_DEBUG(fmt, args...) {if (l2cb.l2cap_trace_level >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(L2CAP,DEBUG)) BT_PRINT_D("BT_L2CAP", fmt, ## args);}
|
||||
|
||||
#endif // (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
|
||||
/* Define tracing for the SDP unit
|
||||
*/
|
||||
#define SDP_TRACE_ERROR(fmt, args...) {if (sdp_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(SDP, ERROR)) BT_PRINT_E("BT_SDP", fmt, ## args);}
|
||||
@ -248,11 +314,38 @@ static inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t l
|
||||
#define RFCOMM_TRACE_DEBUG(fmt, args...) {if (rfc_cb.trace_level >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(RFCOMM,DEBUG)) BT_PRINT_D("BT_RFCOMM", fmt, ## args);}
|
||||
|
||||
/* Generic Access Profile traces */
|
||||
#if (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
#define GAP_TRACE_ERROR(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_ERROR, "BT_GAP", fmt, ## args); \
|
||||
if (gap_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(GAP, ERROR)) BT_PRINT_E("BT_GAP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define GAP_TRACE_WARNING(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_WARN, "BT_GAP", fmt, ## args); \
|
||||
if (gap_cb.trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(GAP, WARNING)) BT_PRINT_W("BT_GAP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define GAP_TRACE_API(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_INFO, "BT_GAP", fmt, ## args); \
|
||||
if (gap_cb.trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(GAP, API)) BT_PRINT_I("BT_GAP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define GAP_TRACE_EVENT(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_DEBUG, "BT_GAP", fmt, ## args); \
|
||||
if (gap_cb.trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(GAP, EVENT)) BT_PRINT_D("BT_GAP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define GAP_TRACE_ERROR(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(GAP, ERROR)) BT_PRINT_E("BT_GAP", fmt, ## args);}
|
||||
#define GAP_TRACE_API(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(GAP,API)) BT_PRINT_I("BT_GAP", fmt, ## args);}
|
||||
#define GAP_TRACE_EVENT(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(GAP,EVENT)) BT_PRINT_D("BT_GAP", fmt, ## args);}
|
||||
#define GAP_TRACE_WARNING(fmt, args...) {if (gap_cb.trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(GAP, WARNING)) BT_PRINT_W("BT_GAP", fmt, ## args);}
|
||||
|
||||
#endif // (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
|
||||
/* define traces for HID Host */
|
||||
#define HIDH_TRACE_ERROR(fmt, args...) {if (hh_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(HIDH, ERROR)) BT_PRINT_E("BT_HIDH", fmt, ## args);}
|
||||
#define HIDH_TRACE_WARNING(fmt, args...) {if (hh_cb.trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(HIDH, WARNING)) BT_PRINT_W("BT_HIDH", fmt, ## args);}
|
||||
@ -354,20 +447,81 @@ static inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t l
|
||||
|
||||
/* Define tracing for the ATT/GATT unit
|
||||
*/
|
||||
#if (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
#define GATT_TRACE_ERROR(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_ERROR, "BT_GATT", fmt, ## args); \
|
||||
if (gatt_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(GATT, ERROR)) BT_PRINT_E("BT_GATT", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define GATT_TRACE_WARNING(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_WARN, "BT_GATT", fmt, ## args); \
|
||||
if (gatt_cb.trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(GATT, WARNING)) BT_PRINT_W("BT_GATT", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define GATT_TRACE_API(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_INFO, "BT_GATT", fmt, ## args); \
|
||||
if (gatt_cb.trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(GATT, API)) BT_PRINT_I("BT_GATT", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define GATT_TRACE_EVENT(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_DEBUG, "BT_GATT", fmt, ## args); \
|
||||
if (gatt_cb.trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(GATT, EVENT)) BT_PRINT_D("BT_GATT", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define GATT_TRACE_DEBUG(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_DEBUG, "BT_GATT", fmt, ## args); \
|
||||
if (gatt_cb.trace_level >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(GATT, DEBUG)) BT_PRINT_D("BT_GATT", fmt, ## args); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define GATT_TRACE_ERROR(fmt, args...) {if (gatt_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(GATT, ERROR)) BT_PRINT_E("BT_GATT", fmt, ## args);}
|
||||
#define GATT_TRACE_WARNING(fmt, args...) {if (gatt_cb.trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(GATT, WARNING)) BT_PRINT_W("BT_GATT", fmt, ## args);}
|
||||
#define GATT_TRACE_API(fmt, args...) {if (gatt_cb.trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(GATT,API)) BT_PRINT_I("BT_GATT", fmt, ## args);}
|
||||
#define GATT_TRACE_EVENT(fmt, args...) {if (gatt_cb.trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(GATT,EVENT)) BT_PRINT_D("BT_GATT", fmt, ## args);}
|
||||
#define GATT_TRACE_DEBUG(fmt, args...) {if (gatt_cb.trace_level >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(GATT,DEBUG)) BT_PRINT_D("BT_GATT", fmt, ## args);}
|
||||
|
||||
#endif // (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
/* Define tracing for the SMP unit
|
||||
*/
|
||||
#if (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
#define SMP_TRACE_ERROR(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_ERROR, "BT_SMP", fmt, ## args); \
|
||||
if (smp_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(SMP, ERROR)) BT_PRINT_E("BT_SMP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define SMP_TRACE_WARNING(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_WARN, "BT_SMP", fmt, ## args); \
|
||||
if (smp_cb.trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(SMP, WARNING)) BT_PRINT_W("BT_SMP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define SMP_TRACE_API(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_INFO, "BT_SMP", fmt, ## args); \
|
||||
if (smp_cb.trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(SMP, API)) BT_PRINT_I("BT_SMP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define SMP_TRACE_EVENT(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_DEBUG, "BT_SMP", fmt, ## args); \
|
||||
if (smp_cb.trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(SMP, EVENT)) BT_PRINT_D("BT_SMP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#define SMP_TRACE_DEBUG(fmt, args...) { \
|
||||
ble_log_spi_out_printf_enh(BLE_LOG_SPI_OUT_SOURCE_BLUEDROID, BLE_LOG_SPI_OUT_LEVEL_DEBUG, "BT_SMP", fmt, ## args); \
|
||||
if (smp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(SMP, DEBUG)) BT_PRINT_D("BT_SMP", fmt, ## args); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define SMP_TRACE_ERROR(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(SMP, ERROR)) BT_PRINT_E("BT_SMP", fmt, ## args);}
|
||||
#define SMP_TRACE_WARNING(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(SMP, WARNING)) BT_PRINT_W("BT_SMP", fmt, ## args);}
|
||||
#define SMP_TRACE_API(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(SMP,API)) BT_PRINT_I("BT_SMP", fmt, ## args);}
|
||||
#define SMP_TRACE_EVENT(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(SMP,EVENT)) BT_PRINT_D("BT_SMP", fmt, ## args);}
|
||||
#define SMP_TRACE_DEBUG(fmt, args...) {if (smp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(SMP,DEBUG)) BT_PRINT_D("BT_SMP", fmt, ## args);}
|
||||
|
||||
#endif // (BT_BLE_LOG_SPI_OUT_HOST_ENABLED && !CLASSIC_BT_INCLUDED)
|
||||
|
||||
extern UINT8 btif_trace_level;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -41,6 +41,10 @@
|
||||
#include "stack/hcimsgs.h"
|
||||
#include "hci_log/bt_hci_log.h"
|
||||
|
||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
||||
#include "ble_log/ble_log_spi_out.h"
|
||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
||||
|
||||
#define HCI_BLE_EVENT 0x3e
|
||||
#define PACKET_TYPE_TO_INBOUND_INDEX(type) ((type) - 2)
|
||||
#define PACKET_TYPE_TO_INDEX(type) ((type) - 1)
|
||||
@ -52,9 +56,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 +72,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 +82,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 +96,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 +115,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 +128,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 +146,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 +172,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 +235,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 +249,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 +259,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 +305,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 +431,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 +493,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 +529,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 +540,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)
|
||||
{
|
||||
@ -559,9 +571,14 @@ void bt_record_hci_data(uint8_t *data, uint16_t len)
|
||||
|
||||
static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
{
|
||||
#if (BT_BLE_LOG_SPI_OUT_HCI_ENABLED && !SOC_ESP_NIMBLE_CONTROLLER)
|
||||
ble_log_spi_out_write_with_ts(BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM, data, len);
|
||||
#endif // (BT_BLE_LOG_SPI_OUT_HCI_ENABLED && !SOC_ESP_NIMBLE_CONTROLLER)
|
||||
//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 +603,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 +632,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);
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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_ */
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -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)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -71,20 +71,26 @@ static tBTM_BLE_CTRL_FEATURES_CBACK *p_ctrl_le_feature_rd_cmpl_cback = NULL;
|
||||
#endif
|
||||
|
||||
tBTM_CallbackFunc conn_callback_func;
|
||||
// BLE vendor HCI event callback
|
||||
static tBTM_BLE_VENDOR_HCI_EVT_CBACK *ble_vs_evt_callback = NULL;
|
||||
/*******************************************************************************
|
||||
** Local functions
|
||||
*******************************************************************************/
|
||||
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 +252,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)
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -326,6 +353,11 @@ void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk
|
||||
conn_callback_func.set_pkt_data_length_cb = ptk_len_chane_cb;
|
||||
}
|
||||
|
||||
void BTM_BleRegisterVendorHciEventCallback(tBTM_BLE_VENDOR_HCI_EVT_CBACK *vendor_hci_evt_cb)
|
||||
{
|
||||
ble_vs_evt_callback = vendor_hci_evt_cb;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleUpdateAdvWhitelist
|
||||
@ -380,8 +412,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 +440,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 +548,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 +572,7 @@ tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT32 duration,
|
||||
|
||||
}
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleScan
|
||||
@ -612,7 +650,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 +711,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 +763,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 +945,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 +1187,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 +1202,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 +1341,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 +1366,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 +1394,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 +1487,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 +1582,7 @@ tBTM_STATUS BTM_BleStartAdv(void)
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleReadAdvParams
|
||||
@ -1638,6 +1616,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 +1675,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 +1733,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 +1810,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 +1877,7 @@ tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type
|
||||
return status;
|
||||
}
|
||||
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleWriteAdvData
|
||||
@ -1944,38 +1928,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 +1953,7 @@ tBTM_STATUS BTM_BleWriteAdvDataRaw(UINT8 *p_raw_adv, UINT32 raw_adv_len)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -2088,6 +2040,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 +2086,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 +2124,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 +2166,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 +2547,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 +2599,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 +2621,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 +2650,7 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_set_connectability
|
||||
@ -2716,7 +2698,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 +2720,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 +2787,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 +3498,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 +3541,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 +3828,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 +3837,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 +3845,7 @@ void btm_ble_process_direct_adv_pkt(UINT8 *p)
|
||||
// TODO
|
||||
}
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_start_scan
|
||||
@ -3890,6 +3883,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 +3933,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 +3987,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 +4000,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 +4014,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 +4027,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 +4060,6 @@ static BOOLEAN btm_ble_adv_states_operation(BTM_TOPOLOGY_FUNC_PTR *p_handler, UI
|
||||
return rt;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_start_adv
|
||||
@ -4174,14 +4171,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 +4192,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 +4203,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 +4218,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 +4229,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 +4253,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 +4272,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 +4314,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,12 +4540,34 @@ 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;
|
||||
}
|
||||
|
||||
static void btm_ble_vs_evt_callback(UINT8 len, UINT8 *p)
|
||||
{
|
||||
UINT8 sub_event;
|
||||
|
||||
if (!len || !p) {
|
||||
return;
|
||||
}
|
||||
|
||||
STREAM_TO_UINT8(sub_event, p);
|
||||
len--;
|
||||
|
||||
if (sub_event < HCI_VSE_LE_LEGACY_SCAN_REQ_RECEIVED_EVT) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ble_vs_evt_callback) {
|
||||
ble_vs_evt_callback(sub_event, len, p);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_init
|
||||
@ -4575,17 +4613,21 @@ 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
|
||||
|
||||
BTM_RegisterForVSEvents(btm_ble_vs_evt_callback, TRUE);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -4604,13 +4646,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 +4821,18 @@ BOOLEAN BTM_BleSetCsaSupport(UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN BTM_BleSetVendorEventMask(UINT32 evt_mask, tBTM_SET_VENDOR_EVT_MASK_CBACK *p_callback)
|
||||
{
|
||||
if (btsnd_hcic_ble_set_vendor_evt_mask(evt_mask) != TRUE) {
|
||||
BTM_TRACE_ERROR("LE SetVendorEventMask evt_mask=%x: error", evt_mask);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
btm_cb.ble_ctr_cb.set_vendor_evt_mask_cmpl_cb = p_callback;
|
||||
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 +4851,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 */
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
@ -781,6 +786,14 @@ void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HCI_VENDOR_BLE_SET_EVT_MASK: {
|
||||
uint8_t status;
|
||||
STREAM_TO_UINT8(status, p);
|
||||
if (ble_cb && ble_cb->set_vendor_evt_mask_cmpl_cb) {
|
||||
ble_cb->set_vendor_evt_mask_cmpl_cb(status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1074,6 +1087,7 @@ tBTM_STATUS BTM_WriteVoiceSettings(UINT16 settings)
|
||||
return (BTM_NO_RESOURCES);
|
||||
}
|
||||
|
||||
#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_EnableTestMode
|
||||
@ -1130,6 +1144,7 @@ tBTM_STATUS BTM_EnableTestMode(void)
|
||||
return (BTM_NO_RESOURCES);
|
||||
}
|
||||
}
|
||||
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
@ -381,6 +381,7 @@ typedef struct {
|
||||
UINT8 link_count[2]; /* total link count master and slave*/
|
||||
tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *update_exceptional_list_cmp_cb;
|
||||
tBTM_SET_CSA_SUPPORT_CMPL_CBACK *set_csa_support_cmpl_cb;
|
||||
tBTM_SET_VENDOR_EVT_MASK_CBACK *set_vendor_evt_mask_cmpl_cb;
|
||||
} tBTM_BLE_CB;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -388,12 +389,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 +412,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 +466,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 +514,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);
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
@ -1955,4 +1969,26 @@ BOOLEAN btsnd_hcic_ble_set_csa_support (UINT8 csa_select)
|
||||
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_vendor_evt_mask (UINT32 evt_mask)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
if ((p = HCI_GET_CMD_BUF (HCIC_PARAM_SIZE_BLE_SET_VENDOR_EVT_MASK)) == NULL) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
pp = (UINT8 *)(p + 1);
|
||||
|
||||
p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_SET_VENDOR_EVT_MASK;
|
||||
p->offset = 0;
|
||||
|
||||
UINT16_TO_STREAM (pp, HCI_VENDOR_BLE_SET_EVT_MASK);
|
||||
UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_BLE_SET_VENDOR_EVT_MASK);
|
||||
UINT32_TO_STREAM (pp, evt_mask);
|
||||
|
||||
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user