Compare commits

...

284 Commits

Author SHA1 Message Date
tgotic
7d7490b27b
Merge ea305cb805e26d0d581cac444803ee9ce5ae592e into 83e8f70ee4f7ddb6b874bdb81a1f75ceeeba58e4 2025-03-01 09:15:04 +00:00
Abhik Roy
83e8f70ee4 Merge branch 'lwip/ip_napt_enable_fix' into 'master'
fix(lwip): Fixed NULL pointer dereference in ip_napt_enable; add unit tests

Closes IDFGH-12823 and IDF-8155

See merge request espressif/esp-idf!36810
2025-02-27 20:09:10 +08:00
Wang Meng Yang
9f68b151db Merge branch 'bugfix/bt_ctrl_issues' into 'master'
fix(bt/controller): fixed some controller bugs on ESP32.

Closes IDFGH-14343, IDFGH-14392, and IDFGH-12607

See merge request espressif/esp-idf!37180
2025-02-27 19:39:46 +08:00
Chen Ji Chang
de853be81e Merge branch 'feat/h4_introduce_step4_rom_support' into 'master'
feat(esp32h4): add esp_rom and efuse files (stage4)

See merge request espressif/esp-idf!37160
2025-02-27 18:11:44 +08:00
Wu Zheng Hui
2d1c99e74f Merge branch 'fix/fix_bad_dslp_param_after_lightsleep' into 'master'
fix(esp_hw_support): Fixed the issue that light sleep destroyed the parameters of subsequent deep sleep

Closes PM-366 and BLERP-1602

See merge request espressif/esp-idf!37276
2025-02-27 15:51:55 +08:00
Frantisek Hrbata
4f968c3fc5 Merge branch 'contrib/github_pr_15401' into 'master'
Fix idf_as_lib example (GitHub PR)

Closes IDFGH-14655

See merge request espressif/esp-idf!37127
2025-02-27 15:00:12 +08:00
Song Ruo Jing
ce3d603e05 Merge branch 'feature/esp32h21_gdma_support' into 'master'
feat(gdma): add GDMA support for ESP32H21

Closes IDF-11603 and IDF-11604

See merge request espressif/esp-idf!37063
2025-02-27 14:07:52 +08:00
Chen Ji Chang
f02812544e Merge branch 'fix/fix_parlio_test_case' into 'master'
fix(parlio): increase test case success rate

See merge request espressif/esp-idf!37307
2025-02-27 14:04:38 +08:00
Mahavir Jain
e81a9285fe Merge branch 'bugfix/esp32s2_memprot_clear' into 'master'
fix(esp_hw_support): clear the memory protection interrupt status on boot

Closes IDFGH-5968 and IDFGH-14602

See merge request espressif/esp-idf!36801
2025-02-27 12:54:06 +08:00
Chen Jichang
a07e67893b fix(parlio): increase test case success ratio 2025-02-27 11:58:52 +08:00
C.S.M
dbd2aa8c54 Merge branch 'refactor/optimize_flash_iram_usage' into 'master'
refactor(spi_flash): optimize flash functions to save IRAM memory

See merge request espressif/esp-idf!36902
2025-02-27 11:26:23 +08:00
Michael (XIAO Xufeng)
80bc9d8828 Merge branch 'feat/h2_v1.2_compatibility' into 'master'
doc(compatibility): add compatibility info for h2 v1.2

See merge request espressif/esp-idf!37174
2025-02-27 09:03:07 +08:00
Jaroslav Burian
1f08a8c67e Merge branch 'fix/flush_esptool_output' into 'master'
fix(esptool): Fix flush output while flashing

Closes ESPTOOL-1014

See merge request espressif/esp-idf!37243
2025-02-27 06:34:45 +08:00
Island
371c7edb22 Merge branch 'dev/ble_log_spi_output' into 'master'
fix(ble): fix flushout and sync issues

See merge request espressif/esp-idf!37282
2025-02-26 23:00:40 +08:00
Martin Vychodil
8606eb43f7 Merge branch 'feat/optimize_vfs_mountpoint_table' into 'master'
feat(storage/vfs): improve mountpoint table memory usage

Closes IDF-12560

See merge request espressif/esp-idf!36613
2025-02-26 22:08:15 +08:00
Martin Vychodil
fec59ecb42 Merge branch 'docs/fatfs_unlink_discrepancy' into 'master'
docs(storage/fatfs): discrepancies between FATFS and POSIX

Closes IDFGH-14405 and DOC-10313

See merge request espressif/esp-idf!36941
2025-02-26 21:40:29 +08:00
Igor Masar
d53b0a9111 Merge branch 'fix/usb-hal-dwc-host-channel-num' into 'master'
fix(usb/hal/dwc): Correct host channel number calculation

See merge request espressif/esp-idf!37173
2025-02-26 21:19:51 +08:00
Tomas Rezucha
51fd02dd83 Merge branch 'fix/usb_phy_set_speed' into 'master'
fix(usb/phy): Fixed crash on external PHY init with speed != UNDEFINED

See merge request espressif/esp-idf!37218
2025-02-26 19:50:23 +08:00
C.S.M
8f371a5004 docs(spi_flash): Add docs for spi_flash IRAM usage 2025-02-26 18:29:35 +08:00
C.S.M
b66e140fbc refactor(spi_flash): optimize flash functions to save iram memory 2025-02-26 18:28:49 +08:00
Mahavir Jain
8014ffa225 Merge branch 'fix/esp_tee_aes_sha_prot' into 'master'
fix(esp_tee): Protect the AES/SHA clock registers from REE access

Closes IDF-8954 and IDF-7188

See merge request espressif/esp-idf!36783
2025-02-26 18:06:44 +08:00
Zhang Shu Xian
656415b8aa Merge branch 'docs/update_cn_translation_for_storage_fatfs' into 'docs/fatfs_unlink_discrepancy'
docs: Update CN translation for fatfs

See merge request espressif/esp-idf!37155
2025-02-26 17:50:42 +08:00
igor.masar
dfd8098716 fix(usb/hal/dwc): Correct host channel number calculation
The hardware field `ghwcfg2.numhstchnl` is zero-based, meaning the actual
number of available host channels is `numhstchnl + 1`. This off-by-one
error caused the USB Host controller to report N-1 channels instead of N,
leading to premature "No more HCD channels available" errors when
connecting multiple devices.

This issue affects ESP32-S2, ESP32-S3, and ESP32-P4.
2025-02-26 17:29:06 +08:00
Jaroslav Burian
64f4956d4f fix(esptool): Fix flush output while flashing
With the new esptool v5.0 the output is not flushed while flashing
the firmware. This commit fixes the issue by using python unbuffered mode.
2025-02-26 10:04:16 +01:00
Shu Chen
aa424235e2 Merge branch 'fix/fix_ot_uart_init_bug' into 'master'
fix(openthread): fix a bug of openthread uart init port

Closes TZ-1564

See merge request espressif/esp-idf!37284
2025-02-26 16:46:27 +08:00
Jin Cheng
309747bf9a fix(bt/controller): fixed some controller bugs on ESP32.
1. added a VSC to control whether to initiate lmp_auto_rate
        - Closes https://github.com/espressif/esp-idf/issues/15133
    2. fixed EA resource cleanup error after SNIFF negotiation failure
        - Closes https://github.com/espressif/esp-idf/issues/13605
    3. removed an assertion in SCO data TX handler after disconnection
        - Closes https://github.com/espressif/esp-idf/issues/15176
2025-02-26 16:31:06 +08:00
Michael (XIAO Xufeng)
70b474a08a Merge branch 'feat/c2_v2.0_compatibility' into 'master'
hw_support: Add compatibility information and Kconfig option for c2 v2.0

See merge request espressif/esp-idf!35831
2025-02-26 16:01:58 +08:00
Konstantin Kondrashov
8778ed2812 Merge branch 'feature/update_ring_buffer_doc' into 'master'
feat(esp_ringbuf): Update ring buffer doc

Closes IDFGH-14536

See merge request espressif/esp-idf!36760
2025-02-26 15:58:36 +08:00
Konstantin Kondrashov
038d99f3c5 feat(efuse): Generate efuse source files for ESP32-H4 2025-02-26 09:50:11 +02:00
Island
6aa557c845 Merge branch 'feat/add_save_debug_context_250226' into 'master'
Feat/add save debug context 250226

Closes BLERP-1561 and BLERP-1604

See merge request espressif/esp-idf!37281
2025-02-26 14:45:33 +08:00
Zhou Xiao
b144337020 fix(ble): fix flushout and sync issues 2025-02-26 12:27:22 +08:00
Wu Zheng Hui
132444cd08 Merge branch 'feat/support_esp32h21_modem_clock' into 'master'
feat(esp_hw_support): support esp32h21 modem clock

Closes PM-348

See merge request espressif/esp-idf!37082
2025-02-26 12:02:43 +08:00
Xu Si Yu
76c207250d fix(openthread): fix a bug of openthread uart init port 2025-02-26 11:53:55 +08:00
morris
548caad60b Merge branch 'doc/wrong_info_about_psram_support' into 'master'
docs(gpio): fix wrong psram support information

See merge request espressif/esp-idf!37280
2025-02-26 11:48:21 +08:00
zwl
da07b1fabe feat(ble): add a debug way to retain scene on ESP32-C5 2025-02-26 11:02:56 +08:00
zwl
bc299e784c feat(ble): add a debug way to retain scene on ESP32-C6 2025-02-26 11:00:12 +08:00
Island
efdce75bb1 Merge branch 'fix/feed_wdts_during_ble_log_dump_c2' into 'master'
fix(ble): add feed wdts during ble log dump for ESP32-C2

Closes BLERP-1598

See merge request espressif/esp-idf!37265
2025-02-26 10:42:59 +08:00
zwl
5b8ac71ace fix(ble): fixed common kconfig error when controller enable only 2025-02-26 10:37:35 +08:00
morris
3dc8c0f3cb docs(gpio): fix wrong psram support information
PSRAM is NOT supported on esp32c3, but IS supported on esp32c5 and
esp32c61
2025-02-26 10:23:18 +08:00
wuzhenghui
dd2bde0847
fix(esp_hw_support): fix lightsleep destroys deepsleep rtc parameters 2025-02-26 10:13:07 +08:00
Zhang Shuxian
26078bbf9a docs: Update CN translation for fatfs 2025-02-26 10:04:26 +08:00
Abhik Roy
c264d8c580 fix(lwip): Fixed NULL pointer dereference in ip_napt_enable; add unit tests
[LWIP submodule changes]: git log --oneline fa4dffdf..0a44efa1

Detailed description of the changes:
  - napt: Fixed NULL pointer dereference in ip_napt_enable (espressif/esp-lwip@0a44efa1)
  - napt: Added unit tests for napt (espressif/esp-lwip@865d7d0c)

Closes https://github.com/espressif/esp-lwip/issues/69
2025-02-26 00:24:10 +11:00
Island
0461e2ff88 Merge branch 'feat/add_ble_ctrl_log_module_on_esp32c3' into 'master'
feat(bt): Added BLE log module on ESP32-C3 and ESP32-S3(723439d)

Closes BLERP-1590 and BLERP-1591

See merge request espressif/esp-idf!37220
2025-02-25 20:40:41 +08:00
Laukik Hase
873409da6b
refactor(esp_tee): Simplify service call ASM routine
- Remove `mret` for jumping to the service call dispatcher; instead, enable
  interrupts and execute directly
- Fix potential corruption of the `t3` register when returning from a service
  call
- Simplify the secure service dispatcher function
2025-02-25 17:18:08 +05:30
Wang Meng Yang
909d81283d Merge branch 'docs/fix_some_coexist_doc_issue' into 'master'
docs(coex): update rf coexistence documents

See merge request espressif/esp-idf!36974
2025-02-25 19:33:14 +08:00
Chen Jichang
a74f9cbe63 feat(esp32h4): add esp_rom and efuse files (stage4) 2025-02-25 19:30:03 +08:00
Laukik Hase
5c4a527750
refactor(esp_tee): Remove explicit setting of the HP_CPU APM/TEE security mode 2025-02-25 16:49:08 +05:30
Laukik Hase
26fa7109f3
fix(esp_tee): Protect the AES/SHA clock registers from REE access 2025-02-25 16:49:08 +05:30
Omar Chebib
a99753d293 fix(esp_hw_support): clear the memory protection interrupt status on boot
Fixes https://github.com/espressif/esp-idf/issues/15359
2025-02-25 18:06:38 +08:00
Zhou Xiao
e2e8e7dce1 fix(ble): add feed wdts during ble log dump for ESP32-C2 2025-02-25 17:57:15 +08:00
Roman Leonov
d7222cc89e Merge branch 'feature/usb_host_ext_hub_error_handle' into 'master'
feat(ext_hub): Added device error handling

Closes IDF-10057

Closes https://github.com/espressif/esp-idf/issues/15437

See merge request espressif/esp-idf!33956
2025-02-25 17:18:46 +08:00
Song Ruo Jing
a4a28b57a3 feat(gdma): add GDMA support for ESP32H21 2025-02-25 17:05:48 +08:00
linruihao
9f0c8e7bfc docs(coex): update rf coexistence documents
- remove BLE connecting state in coexistence scenario
- remove WIFI section in H2 docs
2025-02-25 17:05:34 +08:00
Frantisek Hrbata
54cb6636ec ci: add idf_as_lib to patterns-build_system rules
The `idf_as_lib` example is used and tested in
`tools/test_build_system/test_cmake.py`. Include `idf_as_lib` in the
build_system rules to ensure the tests are executed whenever there is a
modification in the `idf_as_lib` example.

Expand the `test_build_custom_cmake_project` test to cover all supported
targets, including host build.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2025-02-25 08:54:02 +01:00
chenjianhua
d4c15e2cb6 feat(bt): Update bt lib for ESP32-C3 and ESP32-S3(723439d)
- Added BLE controller debug log trace
- Added BLE controller log module
2025-02-25 15:18:58 +08:00
Aditya Patwardhan
61f992a061 Merge branch 'contrib/github_pr_15291' into 'master'
fix(esp_http_client): Fix invalid content length header (GitHub PR)

Closes IDFGH-14528

See merge request espressif/esp-idf!37036
2025-02-25 13:03:12 +08:00
Chen Ji Chang
e7088bbd07 Merge branch 'feat/add_uart_support_on_h21' into 'master'
feat(uart): support uart on esp32h21

Closes IDF-11618, IDF-11620, and IDF-12143

See merge request espressif/esp-idf!37197
2025-02-25 11:26:09 +08:00
Gao Xu
d17b0ed4fe Merge branch 'feature/esp32h21_gpio_support' into 'master'
feat(esp32h21): support GPIO on esp32h21

Closes IDF-11611

See merge request espressif/esp-idf!36781
2025-02-25 11:12:54 +08:00
Igor Udot
13188dc33b Merge branch 'ci/update_patterns-build_check' into 'master'
ci: add build_system example to patterns-build_check

See merge request espressif/esp-idf!37191
2025-02-25 10:34:39 +08:00
Erhan Kurubas
e405583bae Merge branch 'update_usb_jtag_doc' into 'master'
docs(jtag): add esp32p4 usb jtag pin numbers

Closes DOC-10317

See merge request espressif/esp-idf!36698
2025-02-24 21:12:34 +08:00
morris
e964cc3ad5 Merge branch 'refactor/gptimer_isr_logs_opt_int' into 'master'
feat(gptimer): make start and stop function idempotent, also refactored the doc structure

Closes IDFGH-11157, IDFGH-12474, IDF-12513, and IDFCI-2734

See merge request espressif/esp-idf!36983
2025-02-24 20:51:42 +08:00
Roman Leonov
e815f68a50 docs(usb_host): Removed the limitation for Low-speed device connected via hub 2025-02-24 19:39:53 +08:00
Roman Leonov
858947e461 feat(ext_hub): Added support for low-speed devices, connected via hubs 2025-02-24 19:39:53 +08:00
Jiang Jiang Jian
837311c0ff Merge branch 'bugfix/pmkid_password_mismatch' into 'master'
fix(wifi): Fix wrong PMKSA cache entry being used when wifi password is changed

Closes WIFIBUG-622, WIFIBUG-648, and WIFIBUG-702

See merge request espressif/esp-idf!33285
2025-02-24 19:37:49 +08:00
Wan Lei
73eb376eb1 Merge branch 'feat/h21_gptimer_support' into 'master'
feat(driver_gptimer): esp32h21 add basic gptimer support

Closes IDF-11594

See merge request espressif/esp-idf!37028
2025-02-24 19:32:11 +08:00
Chen Jichang
028a16c01c feat(uart): support uart on esp32h21 2025-02-24 17:49:45 +08:00
gaoxu
7e54886a4e feat(esp32h21): move gpio intr source to gpio_ll.h 2025-02-24 17:32:01 +08:00
gaoxu
51ad6cfab0 feat(esp32h21): support RTC_IO and hysteresis on ESP32H21 2025-02-24 17:31:55 +08:00
gaoxu
d3acbe15aa feat(esp32h21): refactor gpio_ll to use io_mux_struct 2025-02-24 17:25:58 +08:00
gaoxu
760f134d84 feat(esp32h21): support GPIO on esp32h21 2025-02-24 17:24:16 +08:00
morris
046279155d Merge branch 'fix/spi_device_dynamic_freq_bug' into 'master'
fix(driver_spi): fixed wrong condition check in master driver device override_freq_hz feature

Closes IDF-12525

See merge request espressif/esp-idf!37222
2025-02-24 16:40:47 +08:00
Mahavir Jain
18c09cfe64 Merge branch 'fix/fix_security_app_readme' into 'master'
fix(security): Fixed README for security features app

See merge request espressif/esp-idf!37140
2025-02-24 16:08:39 +08:00
Mahavir Jain
e2fc36349a Merge branch 'contrib/github_pr_15388' into 'master'
fix(esp_http_client): Fix host header for IPv6 address literal (GitHub PR)

Closes IDFGH-14640

See merge request espressif/esp-idf!37035
2025-02-24 16:02:27 +08:00
Song Ruo Jing
c9dff55c9f Merge branch 'bugfix/gpio_standardization_fix' into 'master'
fix(gpio): minor improvement to output/input configuration step

Closes IDF-12240

See merge request espressif/esp-idf!36973
2025-02-24 15:56:59 +08:00
Armando (Dou Yiwen)
97b7b880c7 Merge branch 'refactor/rng_ll_c61' into 'master'
rng: refactor to use hal/ll apis for esp32c61

Closes IDF-12467

See merge request espressif/esp-idf!37019
2025-02-24 15:47:38 +08:00
Chen Ji Chang
33e81e572b Merge branch 'feat/h4_introduce_step2_3' into 'master'
feat(esp32h4): add soc register header files (stage 3/8, part 3/3)

See merge request espressif/esp-idf!37092
2025-02-24 15:39:11 +08:00
morris
5f70a525f0 doc(gptimer): refactor doc structure
Split into two parts: quick start and advanced usage
2025-02-24 15:04:19 +08:00
morris
9822433957 feat(gptimer): make start and stop function idempotent
Closes https://github.com/espressif/esp-idf/issues/12325
Closes https://github.com/espressif/esp-idf/issues/13486
2025-02-24 14:53:34 +08:00
Island
5f2a7f4d29 Merge branch 'feat/add_ble_spi_log' into 'master'
fix(ble/bluedroid): Support SPI log output options for HCI

Closes BLERP-1585 and BLERP-1586

See merge request espressif/esp-idf!37207
2025-02-24 14:37:41 +08:00
Mahavir Jain
37a4de8a71 Merge branch 'fix/incorrect_calculation_of_used_xip_pages' into 'master'
fix(esp_psram): Fix incorrect calculation of used XIP PSRAM pages

See merge request espressif/esp-idf!37069
2025-02-24 13:54:53 +08:00
morris
0d6b29c369 Merge branch 'chor/update_etm_register_esp32c61' into 'master'
change(etm): update soc register files for esp32c61

See merge request espressif/esp-idf!37152
2025-02-24 13:22:23 +08:00
Chen Jichang
62700fa36f feat(esp32h4): add soc register header files (stage2_3)
add soc headers made by hand
2025-02-24 12:20:27 +08:00
wanckl
90728ade83 fix(driver_spi): fixed wrong condition check in master driver device override_freq_hz feature 2025-02-24 11:50:42 +08:00
Armando
c7ee2d7157 refactor(pmu): replace regi2c registers with LL APIs 2025-02-24 11:16:48 +08:00
Armando
d598c9db7c refactor(rng): refactor to use hal/ll apis for c61 2025-02-24 11:16:48 +08:00
Aditya Patwardhan
877057db3d Merge branch 'fix/fix_timeout_issue_in_https_server' into 'master'
fix(esp-tls): Fixed the server session create API

Closes IDFGH-14201

See merge request espressif/esp-idf!36519
2025-02-23 19:07:00 +08:00
zhanghaipeng
b6903296ad fix(ble/bluedroid): Added SPI output support for Bluedroid host log 2025-02-23 17:23:54 +08:00
zhanghaipeng
e00ba3cbd1 fix(ble/bluedroid): Support SPI log output options for HCI 2025-02-23 11:46:47 +08:00
Tomas Rezucha
ca24a117c7 fix(usb/phy): Fixed crash on external PHY init with speed != UNDEFINED
Also deprecated usb_phy_otg_dev_set_speed()
and usb_phy_action() which are no longer used in esp-idf
2025-02-21 14:11:51 +01:00
wanckl
cfe4bf339f feat(driver_gptimer): esp32h21 add basic gptimer support 2025-02-21 20:22:41 +08:00
Erhan Kurubas
93b4ef13ae docs(jtag): add esp32p4 usb jtag pin numbers 2025-02-21 10:32:43 +01:00
Wang Meng Yang
26a1b69a2a Merge branch 'feat/add_sdk_config_for_sdp_size_option' into 'master'
feat(bt): Implement SDK Config SDP Size Options

See merge request espressif/esp-idf!36873
2025-02-21 17:03:52 +08:00
Island
1bfc6eddf0 Merge branch 'bugfix/fix_ble_report_len' into 'master'
fix(ble/bluedroid): Fix adv data and scan rsp data not reported together in BLE active scan

Closes BCI-493

See merge request espressif/esp-idf!37132
2025-02-21 15:29:43 +08:00
harshal.patil
a1e6387c16
fix(esp_psram): Fix incorrect calculation of used XIP PSRAM pages
The functions mmu_config_psram_text_segment() and mmu_config_psram_rodata_segment()
used to return the value of next start page in *out_page instead of the number
of pages used as mentioned in the documentation
2025-02-21 11:07:39 +05:30
Sarvesh Bodakhe
3d5bf355c3 fix(wifi): Fix wrong PMKSA cache entry being used when wifi password is changed 2025-02-21 10:54:57 +05:30
igor.udot
7bc8938469 ci: add build_system example to patterns-build_check 2025-02-21 12:25:45 +08:00
Jiang Jiang Jian
1633c1a2bb Merge branch 'docs/wifi_wpa3_ent_migration_guide_v5.4' into 'master'
docs(wifi): Add migration guide for WPA3-Enterprise authentication modes for v5.4

See merge request espressif/esp-idf!36827
2025-02-21 11:50:53 +08:00
Island
a38893d2d1 Merge branch 'feat/add_ble_log_spi_out_printf' into 'master'
feat(ble): add printf interface for ble log spi out

Closes BLERP-1582

See merge request espressif/esp-idf!37162
2025-02-21 10:47:34 +08:00
Marius Vikhammer
a5fe1e2a46 Merge branch 'feature/h21_panic' into 'master'
feat(esph21): bringup and test panic handler

Closes IDF-11546

See merge request espressif/esp-idf!37007
2025-02-21 10:25:03 +08:00
Martin Vychodil
af0f270e17 Merge branch 'bugfix/memprot_s2_intr_peri1' into 'master'
fix(security): ESP32S2 memory protection check for Peri1 RTCSLOW interrupt

See merge request espressif/esp-idf!37105
2025-02-21 01:43:44 +08:00
Aditya Patwardhan
43a7248501 Merge branch 'contrib/github_pr_14785' into 'master'
Removed dependency on esp32 to use secure element (GitHub PR)

Closes IDFGH-13955 and IDFGH-13922

See merge request espressif/esp-idf!36935
2025-02-21 00:52:38 +08:00
Aditya Patwardhan
786dcacd8b
fix(security): Fixed README for security features app 2025-02-20 22:05:48 +05:30
Jiang Jiang Jian
d6aff6d2a4 Merge branch 'bugfix/fix_cache_count_flash_pages_patchs_return_wrong_value' into 'master'
fix(rom): Fix s2 and s3 Cache_Count_Flash_Pages rom function wrapper

Closes IDFGH-14494

See merge request espressif/esp-idf!36594
2025-02-20 23:47:27 +08:00
Michael (XIAO Xufeng)
1aae76f524 doc(compatibility): add compatibility info for h2 v1.2 2025-02-20 22:10:01 +08:00
Xiao Xufeng
7361aca98b doc(compatibility): add compatibility info for c2 v2.0 2025-02-20 21:56:25 +08:00
Wu Zheng Hui
e57f02e920 Merge branch 'doc/add_wakeup_source_usage_precautions' into 'master'
change(doc): added more usage notes about PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP

Closes IDF-12166

See merge request espressif/esp-idf!36879
2025-02-20 21:00:15 +08:00
Song Ruo Jing
53d8b70e8b fix(gpio): fix IO output enable control
oen_sel and oen_inv_sel fields from func_out_sel_cfg register
2025-02-20 19:49:28 +08:00
Adam Múdry
bbd9acee93 Merge branch 'test/reenable_perf_benchmark_c61' into 'master'
test: Re-enable perf_benchmark test for C61

Closes IDF-10977

See merge request espressif/esp-idf!37073
2025-02-20 19:35:43 +08:00
gongyantao
57a52f571d change(bt): optimize the macro definition for sdp_max_pad_len 2025-02-20 19:12:40 +08:00
Chai Ji’e
50e3a2bcba Merge branch 'bugfix/fix_cpu_crash_bug_esp32' into 'master'
bugfix/fix_qa_fail_bug_esp32

See merge request espressif/esp-idf!36353
2025-02-20 18:56:01 +08:00
Song Ruo Jing
1d6bcb86ba fix(gpio): removed unnecessary step when routing input signal to a pin 2025-02-20 18:54:19 +08:00
Song Ruo Jing
a88bd155cd fix(ledc): overflowed integer argument in ledc_hal_clear_left_off_fade_param 2025-02-20 18:54:19 +08:00
Wan Lei
76133bc373 Merge branch 'fix/remove_gpio_hal_iomux_func_sel' into 'master'
fix(driver_gpio): remove gpio_hal_iomux_func_sel

See merge request espressif/esp-idf!33928
2025-02-20 18:52:35 +08:00
Sarvesh Bodakhe
9ed5ea1acf docs: Add migration guide for WPA3-Enterprise authentication modes for v5.4 2025-02-20 16:18:36 +05:30
Ren Peiying
f77183ceaf Merge branch 'docs/add_translation_for_5.5_protocols' into 'master'
docs: Update CN translation for 5.5/protocol

Closes DOC-10239

See merge request espressif/esp-idf!37124
2025-02-20 17:57:56 +08:00
Jiang Jiang Jian
f390fcbd90 Merge branch 'bugfix/fix_hid_reconnect_issue' into 'master'
feat(bt/bluedroid): Add Kconfig option to keep device bonding info when HID unplugging

See merge request espressif/esp-idf!36975
2025-02-20 17:25:34 +08:00
Zhou Xiao
f8efa4cd80 feat(ble): add printf and write with timestamp interface for ble log spi out 2025-02-20 17:21:52 +08:00
wuzhenghui
d305628c25
feat(hal): add esp32h21 modem_clock hal layer 2025-02-20 15:18:13 +08:00
wuzhenghui
88a3a6c58d
feat(soc): add esp32h21 modem_clock registers 2025-02-20 15:16:12 +08:00
Li Shuai
81e8b752fd Merge branch 'feat/support_esp32h21_pau' into 'master'
feat(esp_hw_support): support esp32h21 PAU

Closes PM-347

See merge request espressif/esp-idf!37065
2025-02-20 15:06:57 +08:00
chaijie@espressif.com
3a64c44d86 fix(esp32): Fixed qa program may fail issue when cpu 240m 2025-02-20 15:05:12 +08:00
Tomasz Kramkowski
af7b6b71ea fix(rom): Fix s2 and s3 Cache_Count_Flash_Pages rom function wrapper
The rom function on the s2 and s3 only counts one page for any pages
which are mapped to page 0 of flash as the Cache_Flash_To_SPIRAM_Copy
function attempts to map all flash page 0 mapped pages to one PSRAM
page.

As this function can be called for multiple regions, it needs to track
if a page mapped to page 0 has previously been accounted for by a
previous call. It does this using the page0_mapped in-out parameter.
This logic contains an error:

```
if (*page0_mapped == 0) {
    // BUG: If page0_count is 0, 1 is still added
    count = valid_flash_count + 1 - page0_count;
} else {
    count = valid_flash_count - page0_count;
}
*page0_mapped += page0_count;
return count;
```

The current Cache_Count_Flash_Pages wrapper in the idf attempts to
compensate for this bug by checking if the page0_mapped parameter was
changed by a call to the function and reducing the count if it has not.

This, however, will incorrectly over-compensate in situations where the
initial value of page0_mapped was not zero as the code above only
miscounts when it was zero.

This patch addresses the issue in this wrapper function by correctly
compensating for the bug only in cases where the final page0_mapped
value is 0.
2025-02-20 15:04:10 +08:00
morris
90d59288b1 change(etm): update soc register files for esp32c1
removed unavailable fields
2025-02-20 14:20:05 +08:00
Wu Zheng Hui
79ee0927d1 Merge branch 'fix/fix_s2_s3_rtc_iomux_clock_management' into 'master'
fix(esp_hw_support): fix esp32s2/esp32s3 RTC IOMUX clock management

Closes PM-341, IDFGH-8992, and IDFGH-11560

See merge request espressif/esp-idf!36831
2025-02-20 13:52:45 +08:00
renpeiying
0f3fb0c0fb docs: Update CN translation for 5.5/protocol 2025-02-20 11:59:08 +08:00
morris
4e073fe166 Merge branch 'refactor/change_blink_gpio_on_esp32s3' into 'master'
change(blink): default gpio changed for esp32s3 devkitc v1.1

See merge request espressif/esp-idf!37080
2025-02-20 11:02:20 +08:00
morris
45b1141f8f change(blink): default gpio changed for esp32s3 devkitc v1.1
https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-devkitc-1/user_guide.html

Also related to: https://github.com/espressif/esp-idf/issues/8547
2025-02-20 10:15:48 +08:00
Aleksei Apaseev
8355b832d3 Merge branch 'ci/add-python-func-and-fix-c-testcase-path-in-junit-report' into 'master'
ci: add python_func attribute and fix C testcase path resolution in JUnit reports

Closes RDT-1013, IDFCI-1990, IDFCI-1964, and IDFCI-1429

See merge request espressif/esp-idf!35058
2025-02-20 10:09:52 +08:00
Roman Leonov
c004b93669 Merge branch 'feature/usb_host_usbh_uid_presence_in_list' into 'master'
feature(usbh): Added uid presence check in USBH device object list

Closes IDF-10022

See merge request espressif/esp-idf!36705
2025-02-19 23:46:43 +08:00
Martin Vychodil
64ae64fb16 fix(security): Fixed ESP32S2 memory protection check for Peri1 RTCSLOW interrupt
- fixes the issue found in https://github.com/espressif/esp-idf/issues/15359
- extends debug printouts in the related tests
2025-02-19 14:14:27 +01:00
wuzhenghui
0f69fda3d5
change(doc): added more usage notes about PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP 2025-02-19 20:54:21 +08:00
zhanghaipeng
7f2cedc048 fix(ble/bluedroid): Fix adv data and scan rsp data not reported together in BLE active scan 2025-02-19 20:18:35 +08:00
Island
6b1d8dbbfb Merge branch 'change/ble_update_lib_20250217' into 'master'
change(ble): [AUTO_MR] 20250217 - Update ESP BLE Controller Lib

Closes BLERP-1562

See merge request espressif/esp-idf!37025
2025-02-19 19:53:24 +08:00
Darian Leung
3b28818ba4
fix(examples): idf_as_lib linux build
The Linux build was broken after IDF flash API was updated without updating
the Linux stub library in the example. This commit updates the spi_flash stub
library such that:

- The API now matches same API as IDF's spi_flash component
- Links the stub_esp32 library to pull in basic types and defines
2025-02-19 18:41:05 +08:00
Darian Leung
0b6922405d
fix(examples): idf_as_lib move flash_ops.c to spi_flash stub library
Example linux build of the example demonstrates "esp32" and "spi_flash" stub
libraries (roughly analogous to "esp_system" and "spi_flash" components).

This commit moves the "flash_ops.c" file to the "spi_flash" stub library as it
is a flash related funciton.

Also renamed the header to "esp_flash.h" (in order to match current header name
in IDF). This is a prerequisite to fixing the linux build of this example.
2025-02-19 18:41:05 +08:00
Darian Leung
5301eaf0d8
fix(examples): Fix idf_as_lib for esp32p4
The build-esp32p4.sh and run-esp32p4.sh scripts are not symbolic links to the
base scripts, leading to a "permission denied" error. This commit changes their
types to symbolic links, in line with the other targets.
2025-02-19 18:39:18 +08:00
Bernhard Heinloth
f31a0f7f61 fix(esp_http_client): Fix host header for IPv6 address literal
An IPv6 IP that occurs in the 'Host:' header of an HTTP request must be enclosed
in square brackets (RFC3986 section 3.2.2).

Searches for ':' in the host string to efficiently determine if the host is an
IPv6 IP address.
2025-02-19 10:41:05 +01:00
nilesh.kale
486f3cdb7b docs: update document to remove dependency of esp32 on secure element usage 2025-02-19 14:54:24 +05:30
Cristian Funes
bfa25448b7 change(secure-element): Removed dependency on esp32 to use secure element
Closes https://github.com/espressif/esp-idf/pull/14785
Closes https://github.com/espressif/esp-idf/issues/14761
2025-02-19 14:54:24 +05:30
Roman Leonov
46952c601d feat(usb_host): Added uid presence check in USBH device object list 2025-02-19 10:23:44 +01:00
Island
8ad16fd58d Merge branch 'feat/support_ble_vendor_hci_event_report' into 'master'
feat(bt/bluedroid): Support BLE vendor hci event reporting

Closes BLERP-1542

See merge request espressif/esp-idf!36800
2025-02-19 17:18:24 +08:00
wanckl
222b1ddbab fix(driver_gpio): remove gpio_hal_iomux_func_sel 2025-02-19 17:17:51 +08:00
Sudeep Mohanty
e01877ff2e Merge branch 'bug/xtensa_cpu1_sys_lockup' into 'master'
fix(panic_handler): Updated panic handler to use RTC WDT

Closes IDFGH-14379, IDFGH-14221, IDFGH-8665, and DOC-10263

See merge request espressif/esp-idf!36652
2025-02-19 17:11:10 +08:00
Chen Ji Chang
36335e38b6 Merge branch 'feat/h4_introduce_step2_2' into 'master'
feat(esp32h4): add soc register header files (stage 3/8, part 2/3)

See merge request espressif/esp-idf!37030
2025-02-19 16:27:31 +08:00
wuzhenghui
51205a8fd8
fix(esp_hw_support): fix esp32s2/esp32s3 RTC IOMUX clock management 2025-02-19 16:02:25 +08:00
Guillaume Souchere
7e93f4b5ed Merge branch 'fix/memory-utils-ptr-executable' into 'master'
fix(memory-utils): Missing case in esp_ptr_executable logic

Closes IDF-12458

See merge request espressif/esp-idf!36904
2025-02-19 15:27:11 +08:00
C.S.M
738ce191cd Merge branch 'refactor/remove_redundent_suspend_check' into 'master'
refactor(spi_flash): remove redundent flash suspend check

See merge request espressif/esp-idf!37083
2025-02-19 15:16:03 +08:00
Wei Yu Han
96af7b4a11 Merge branch 'docs/update_ble_feature_support_status' into 'master'
Docs: update ble feature support status

See merge request espressif/esp-idf!36452
2025-02-19 14:37:50 +08:00
Tomas Sebestik
463af2a065 Merge branch 'ci/update-mr-template-assignee' into 'master'
ci(mr-templates): update MR templates to auto-assign the MR author

See merge request espressif/esp-idf!37075
2025-02-19 14:29:48 +08:00
wuzhenghui
93cdad7a3b
feat(esp_hw_support): support esp32h21 retention link software trigger 2025-02-19 14:21:18 +08:00
Jiang Jiang Jian
d5f2447b88 Merge branch 'feature/c3_libphy_20250120' into 'master'
feat(phy): update esp32c3 libphy for rxdc cal opt

Closes ESPCS-987, ESPCS-988, and WIFIBUG-1005

See merge request espressif/esp-idf!36505
2025-02-19 13:44:01 +08:00
Michael (XIAO Xufeng)
c71d74e2f8 Merge branch 'feat/upload_status_to_s3' into 'master'
ci(all): upload support status when pushed go github

See merge request espressif/esp-idf!37064
2025-02-19 13:35:16 +08:00
Xiao Xufeng
bc1965a109 ci(all): upload support status when pushed go github 2025-02-19 13:23:28 +08:00
cjin
3df8f30816 change(ble): update esp32c6 lib to 7ead2d29 2025-02-19 12:07:26 +08:00
cjin
5c3829cebc change(ble): update esp32c5 lib to 7ead2d29 2025-02-19 12:07:26 +08:00
cjin
93fd1d91cb change(ble): update esp32h2 lib to 7ead2d29 2025-02-19 12:07:26 +08:00
zwl
01f9245da1 feat(ble): implement ble capture info user handler on ESP32-C5 2025-02-19 12:07:26 +08:00
zwl
180e67b547 feat(ble): implement ble capture info user handler on ESP32-C6 and ESP32-H2 2025-02-19 12:07:26 +08:00
Shen Weilong
c2449607dc change(ble): Supported cuttable architecture for ble 2025-02-19 12:07:16 +08:00
Shen Weilong
472320a7a3 change(ble): [AUTO_MR] Update lib_esp32c6 to 996fb939 2025-02-19 11:49:22 +08:00
Shen Weilong
f167fa8a6c change(ble): [AUTO_MR] Update lib_esp32c5 to 996fb939 2025-02-19 11:49:22 +08:00
Shen Weilong
34ae5db60d change(ble): [AUTO_MR] Update lib_esp32h2 to 996fb939 2025-02-19 11:49:22 +08:00
C.S.M
328665135c Merge branch 'fix/i2c_scl_freq_s2' into 'master'
fix(i2c): Fix scl frequency is wrong on esp32s2 in legacy i2c driver

Closes IDFGH-13739 and IDFGH-14539

See merge request espressif/esp-idf!37066
2025-02-19 11:36:27 +08:00
C.S.M
e111d92af6 refactor(spi_flash): remove redundent flash suspend check 2025-02-19 11:35:09 +08:00
morris
deb703cc68 Merge branch 'bugfix/dma_alignment_for_encryption_memory' into 'master'
fix(gdma): relax alignment constraint for internal memory

Closes IDFGH-14453

See merge request espressif/esp-idf!37055
2025-02-19 11:09:06 +08:00
Island
2c0381d23b Merge branch 'feat/improve_bt_log_spi_output_interface' into 'master'
Feat/improve bt log spi output interface

See merge request espressif/esp-idf!36912
2025-02-19 10:55:25 +08:00
Mitch Cairns
0d7b0c885c feat(bt): Implement SDK Config SDP size options
Closes https://github.com/espressif/esp-idf/pull/15321
2025-02-19 10:19:54 +08:00
Jiang Jiang Jian
7a5684d478 Merge branch 'bugfix/espnow_send_issue' into 'master'
fix(esp_wifi): Fix for issue in esp_now_send when wifi tx callback registered

See merge request espressif/esp-idf!36631
2025-02-19 09:56:25 +08:00
Omar Chebib
7559275fef Merge branch 'bugfix/freertos_wcaps_coproc' into 'master'
fix(freertos): fix a bug in `prvTaskDeleteWithCaps` related to coprocessors

Closes IDF-12202

See merge request espressif/esp-idf!36890
2025-02-19 09:39:05 +08:00
Tomas Sebestik
2f59c59350
ci(mr-templates): update MR templates to auto-assign the MR author 2025-02-18 15:54:01 +01:00
Sudeep Mohanty
b562afa08e fix(panic_handler): Updated panic handler to use RTC WDT
This commit updates the following:
- Updates the panic handler to use only the RTC WDT to reset the system.
- Refactors some of the panic handler code.
- Updates Bluetooth files where in they now feed the WDTs instead of
  reconfiguring them.
- Removes some unnecessary configuration of WDTs from various files.
- Added a unit test to verify that the system does not lock up when the
  panic handler is stuck.
- Updates the memprot unit tests to work with the refactored panic
  handler.

Closes https://github.com/espressif/esp-idf/issues/15166
Closes https://github.com/espressif/esp-idf/issues/15018
Closes https://github.com/espressif/esp-idf/issues/10110
2025-02-18 15:40:54 +01:00
wuzhenghui
727d0a687f
feat(hal): support esp32h21 pau hal layer 2025-02-18 21:06:38 +08:00
wuzhenghui
c11f49e2cb
feat(soc): update esp32h21 pau registers 2025-02-18 21:06:07 +08:00
Adam Múdry
fcb1e8ad5c test: Re-enable perf_benchmark test for C61 2025-02-18 13:53:56 +01:00
Ondrej Kosta
b5aef58afe Merge branch 'bugfix/ci_eth_ip' into 'master'
iperf fix on SH runners

Closes IDFCI-2718

See merge request espressif/esp-idf!36661
2025-02-18 19:51:54 +08:00
Ivan Grokhotkov
83eaa261af Merge branch 'bugfix/sdmmc_reset_pins_slot_width_v2' into 'master'
fix(sdmmc): fix missed deinitialization of CD and WP pins

See merge request espressif/esp-idf!37033
2025-02-18 19:22:25 +08:00
Chen Ji Chang
3ad70e9998 Merge branch 'feat/h4_introduce_step2_1' into 'master'
feat(esp32h4): add soc register header files (stage 3/8, part 1/3)

See merge request espressif/esp-idf!36982
2025-02-18 19:10:54 +08:00
C.S.M
dcfbac8c94 fix(i2c): Fix scl frequency is wrong on esp32s2 in legacy i2c driver,
Closes https://github.com/espressif/esp-idf/issues/15301,
Closes https://github.com/espressif/esp-idf/issues/14603
2025-02-18 17:34:35 +08:00
Aditya Patwardhan
d31654da96
fix(esp-tls): Fixed the server session create API
Added the option to define tls_handshake_timeout value
    for the esp_tls_server_session_create API.
    At the moment, the API gets stuck infinitely if
    the handshake is blocked on recieving more data
    and the peer connection has closed due to some issue.

    Closes https://github.com/espressif/esp-idf/issues/14999
2025-02-18 14:46:33 +05:30
Aditi
5b7cee8631 fix(esp_wifi): Fix for issue in esp_now_send when wifi tx callback registered 2025-02-18 14:36:19 +05:30
Abhik Roy
04133e0225 Merge branch 'contrib/github_pr_15057' into 'master'
feat(dhcps): Support for multiple DNS servers (GitHub PR)

Closes IDFGH-14266

See merge request espressif/esp-idf!36256
2025-02-18 17:06:09 +08:00
Chen Jichang
d68fcf1d7b feat(esp32h4): add soc register header files (stage2_2)
generated soc headers from csv and ro_csv folder(part2)
2025-02-18 16:42:22 +08:00
weiyuhan
6a584e9698 Updated BLE feature status 2025-02-18 16:23:35 +08:00
muhaidong
004ff87ea4 feat(phy): update libphy for RXDC cal opt, no antenna current opt, add cca api 2025-02-18 16:03:48 +08:00
Jeroen Domburg
5d63f251f9 Merge branch 'feature/bitscrambler_add_c5_insn' into 'master'
BitScrambler: Add support for addcti instruction as found in ESP32-C5

See merge request espressif/esp-idf!36906
2025-02-18 14:39:42 +08:00
Zhou Xiao
e41f619566 feat(ble): support ble log spi out for ESP32-C3 and ESP32-S3 2025-02-18 14:23:17 +08:00
Zhou Xiao
e2fbec5d2e feat(ble): support ble log spi out for ESP32 2025-02-18 14:23:05 +08:00
Zhou Xiao
608ecf63e2 change(ble): update ble log spi out config for ESP32-H2 2025-02-18 14:22:47 +08:00
Zhou Xiao
e61089e7e0 change(ble): update ble log spi out config for ESP32-C6 2025-02-18 14:22:30 +08:00
Zhou Xiao
58dc93bb99 change(ble): update ble log spi out config for ESP32-C5 2025-02-18 14:22:12 +08:00
Zhou Xiao
e4b698fc32 change(ble): update ble log spi out config for ESP32-C2 2025-02-18 14:21:53 +08:00
Zhou Xiao
2221133ba8 feat(ble): improved ble log spi output interface to support multisource log 2025-02-18 14:21:33 +08:00
Zhang Wen Xu
b3c4c58ee0 Merge branch 'support/ieee802154_get_rssi_comp_from_phy' into 'master'
feat(802.15.4): support ieee802154 get rssi comp from phylib

Closes TZ-1541

See merge request espressif/esp-idf!36475
2025-02-18 14:14:33 +08:00
morris
46d1d7a43f fix(gdma): relax alignment constraint for internal memory
external memory encryption should not affect internal memory alignment

Closes https://github.com/espressif/esp-idf/issues/15228
2025-02-18 13:37:22 +08:00
Omar Chebib
c95a12658e fix(freertos): fix a bug in prvTaskDeleteWithCaps related to coprocessors
When a coprocessor is used, the stack pointer is altered. It must be restored
before freeing the memory allocated to the task.
2025-02-18 11:59:04 +08:00
chenjianhua
1003ced6e9 feat(bt/bluedroid): Support BLE vendor hci event reporting 2025-02-18 11:32:33 +08:00
chenjianhua
fd4094e502 feat(bt/bluedroid): Support BLE setting vendor event mask 2025-02-18 11:32:21 +08:00
Wan Lei
f2c8b32075 Merge branch 'feat/spi_slave_pm_add_api' into 'master'
feat(spi_slave): add api for pm lock control

See merge request espressif/esp-idf!30766
2025-02-18 11:30:44 +08:00
Armando (Dou Yiwen)
f8ff9e47ed Merge branch 'fix/esp_mmu_vaddr_to_paddr_cannot_figure_psram_p4' into 'master'
mmu: vaddr to paddr cannot figure psram vaddr on esp32p4

Closes IDF-12483

See merge request espressif/esp-idf!36957
2025-02-18 11:29:47 +08:00
Island
7d751dcc8f Merge branch 'feat/optimize_ble_config_reduce_bin' into 'master'
Feat/optimize bluedroid host config and reduce bin size

Closes BLERP-1520

See merge request espressif/esp-idf!36599
2025-02-18 11:01:24 +08:00
Armando (Dou Yiwen)
e21e3f417f Merge branch 'fix/adc_func_register_not_reset_issue' into 'master'
adc: func register not reset issue

Closes IDF-12489

See merge request espressif/esp-idf!37001
2025-02-18 10:55:07 +08:00
Chen Jichang
c1149f24e0 feat(esp32h4): add soc register header files (stage2_1)
generated soc headers from csv folder(part1)
2025-02-18 10:49:15 +08:00
Kevin (Lao Kaiyao)
9f489c2ab0 Merge branch 'bugfix/fix_i2s_std_initializer_order_for_cpp_compiler' into 'master'
fix(i2s): fixed i2s_std initializer order for cpp compiler

Closes IDFGH-14660

See merge request espressif/esp-idf!36992
2025-02-18 10:13:49 +08:00
Kevin (Lao Kaiyao)
1bd8fabf5e Merge branch 'feature/i2s_support_change_freq_in_runtime' into 'master'
feat(i2s): support tuning rate dynamically

Closes IDF-11679

See merge request espressif/esp-idf!36537
2025-02-18 00:27:50 +08:00
Kevin (Lao Kaiyao)
581cbca5ab Merge branch 'feature/support_reconfig_touch_in_runtime' into 'master'
feat(touch): support runtime re-configuration

Closes IDF-11904

See merge request espressif/esp-idf!36797
2025-02-17 23:47:29 +08:00
Ivan Grokhotkov
6f49122b74
fix(sdmmc): fix missed deinitialization of CD and WP pins in f8f40ad
Related to https://github.com/espressif/esp-idf/issues/15330
2025-02-17 16:21:30 +01:00
wanlei
923255d7a7 feat(spi_slave): add api for pm lock control 2025-02-17 20:33:55 +08:00
zwx
664b0a772e feat(802.15.4): use btbb function to get rssi comp for h2 2025-02-17 19:04:44 +08:00
Aleksei Apaseev
c03b007644 ci: fix testcase path resolution in JUnit reports. switch to the different unity test report mode. add app_path to target test report 2025-02-17 18:55:53 +08:00
Jiang Jiang Jian
95ce1c08c1 Merge branch 'fix/add_sta_authmode_for_sta_connect' into 'master'
fix(wifi): Add sta authmode for sta connect event

Closes WIFIBUG-996

See merge request espressif/esp-idf!36508
2025-02-17 17:31:44 +08:00
Song Ruo Jing
fd2df5e2fc Merge branch 'bugfix/uart_async_rxtxtasks_example_stack_overflow' into 'master'
fix(uart): enlarged task stack size for uart_async_rxtxtasks example

Closes IDFGH-14607, IDF-12230, and IDFGH-12126

See merge request espressif/esp-idf!36903
2025-02-17 17:28:43 +08:00
Sudeep Mohanty
1160a86ba0 Merge branch 'test/fix_flaky_lp_uart_tests' into 'master'
fix(lp_uart): Fixed flaky LP UART unit tests

Closes IDFCI-2722

See merge request espressif/esp-idf!36943
2025-02-17 17:25:53 +08:00
laokaiyao
d2c5724873 feat(i2s): add i2s usb example with tuning feature 2025-02-17 17:11:01 +08:00
Jeroen Domburg
3aaaa2203a feat: BitScrambler: Add support for addcti instruction as found in ESP32-C5 2025-02-17 16:36:52 +08:00
Armando
78e6ce0d35 fix(adc): fixed adc function register not reset issue 2025-02-17 16:22:13 +08:00
laokaiyao
ad623893d4 feat(i2s): support tuning rate dynamically 2025-02-17 16:20:24 +08:00
Armando
43121c0d47 test(flash_mmap): added psram enabled test for esp32p4 as mmu is per target 2025-02-17 16:15:09 +08:00
Armando
fd09700aab test(mmu): added test for checking esp_mmu_vaddr_to_paddr with psram vaddrs 2025-02-17 16:15:09 +08:00
Armando
299d8115ed fix(mmu): fixed esp_mmu_vaddr_to_paddr cannot figure out psram vaddr issue on esp32p4 2025-02-17 16:15:09 +08:00
Song Ruo Jing
c465b75ed6 docs(uart): aligned the config order in the programming guide with examples
Closes https://github.com/espressif/esp-idf/issues/13182
2025-02-17 15:28:16 +08:00
Song Ruo Jing
f38a2e193d fix(uart): enlarged task stack size for uart_async_rxtxtasks example
Meanwhile, added CI pytest for some UART examples

Closes https://github.com/espressif/esp-idf/issues/15363
2025-02-17 15:28:08 +08:00
laokaiyao
aa791ead44 feat(touch): support runtime re-configuration 2025-02-17 15:25:30 +08:00
zhiweijian
69acda1785 feat(ble/bluedroid): reduce bluedrois host bin size and disable BLE_HOST_BG_CONNECT_EN 2025-02-17 14:55:55 +08:00
zhiweijian
d2d4d1518d feat(ble/bluedroid): disable bluedroid host unused functions 2025-02-17 14:51:58 +08:00
zhiweijian
fb08e4eafe feat(bt/bluedroid): optimize bluedroid menuconfig 2025-02-17 14:51:10 +08:00
Chen Jian Xing
0902e70e94 Merge branch 'bugfix/fix_delete_queue_error_in_espnow_example' into 'master'
fix(wifi): fix the delete queue error in espnow exapmle

Closes IDFGH-14632

See merge request espressif/esp-idf!36934
2025-02-17 14:50:15 +08:00
laokaiyao
7e0cb453e8 fix(i2s): fixed i2s_std initializer order for cpp compiler
Closes https://github.com/espressif/esp-idf/issues/15405
2025-02-17 14:44:48 +08:00
zhiweijian
0959beef72 feat(bt/bluedroid): delete unused host congest check 2025-02-17 14:35:46 +08:00
Marius Vikhammer
7bf01c9eea Merge branch 'docs/fix_gps_broken_link' into 'master'
docs(examples): fixed broken link in uart example readme

See merge request espressif/esp-idf!36635
2025-02-17 12:13:00 +08:00
linruihao
540b0131c2 feat(bt/bluedroid): Add Kconfig option to keep device bonding info when HID unplugging 2025-02-17 12:02:48 +08:00
Marius Vikhammer
91bff05d9f feat(esph21): bringup and test panic handler 2025-02-17 11:58:55 +08:00
Wang Meng Yang
4f2105d03e Merge branch 'feat/support_ble_debug_with_gpio' into 'master'
Support BLE debug with GPIO on ESP32

Closes BLERP-1519

See merge request espressif/esp-idf!36621
2025-02-17 10:29:46 +08:00
Wang Meng Yang
b51d4d2aed Merge branch 'feat/support_config_task_size_in_hid_example' into 'master'
Support change HID task size by Kconfig in HID example

Closes IDFGH-14561

See merge request espressif/esp-idf!36796
2025-02-17 10:27:30 +08:00
Abhik Roy
b3523a6fbe fix(dhcps): Fixed DNS server handling for previous breaking changes 2025-02-17 13:19:28 +11:00
Lorenzo Consolaro
0fd3984c72 feat(dhcps): Support for multiple DNS servers 2025-02-17 13:15:03 +11:00
Rahul Tank
d65d2fd4d1 Merge branch 'bugfix/handle_slave_extra_disconn' into 'master'
fix(nimble): Handle not sending disconnect event if connect was not sent

See merge request espressif/esp-idf!36835
2025-02-15 22:41:32 +08:00
Rahul Tank
35bd4605f8 fix(nimble): Handle not sending disconnect event if connect was not sent 2025-02-15 09:21:41 +05:30
Rahul Tank
9411fd0a76 Merge branch 'feat/long_read_offset' into 'master'
feat(nimble): Add offset in GATT server long read context

See merge request espressif/esp-idf!36798
2025-02-15 11:26:36 +08:00
Roman Leonov
bf944b7463 Merge branch 'feature/usb_host_enum_testing' into 'master'
feature(usb_host): Added test app for edge cases in stages during enumeration process

See merge request espressif/esp-idf!31421
2025-02-14 20:04:57 +08:00
tarun.kumar
147ffec4ac fix(wifi): Modify authmode to sta for sta connect event 2025-02-14 16:08:32 +05:30
Jiang Jiang Jian
403cc24a47 Merge branch 'bugfix/skip_memory_reordering_wpa2_semaphr' into 'master'
fix(esp_wifi): fixed stack corruption in WiFi tasks

Closes IDFGH-14617

See merge request espressif/esp-idf!36905
2025-02-14 14:02:12 +08:00
Mahavir Jain
e3e49d7463 Merge branch 'fix/make_scratch_buffer_dynamic' into 'master'
fix(esp_http_server): Make the http server scratch buffer dynamic

Closes IDF-11879

See merge request espressif/esp-idf!36651
2025-02-14 14:00:10 +08:00
Abhinav Kudnar
5d2000998a feat(nimble): Add offset in GATT server long read context 2025-02-14 11:20:47 +05:30
Rahul Tank
90bad97f01 Merge branch 'fix/blesync_periodic_adv' into 'master'
fix(nimble): Added sync reattempt for periodic advertisement

Closes BLERP-1521

See merge request espressif/esp-idf!36709
2025-02-14 13:45:35 +08:00
Island
5abfc05909 Merge branch 'change/ble_update_lib_20250212' into 'master'
change(ble): [AUTO_MR] 20250212 - Update ESP BLE Controller Lib

Closes BLERP-1554, BLERP-1555, BLERP-1556, BLERP-1482, BLERP-1465, BLERP-1550, BLERP-1515, BLERP-1529, BLERP-1452, BLERP-1451, BLERP-1504, BLERP-1517, BLERP-1388, BLERP-1530, BLERP-1516, and BLERP-1512

See merge request espressif/esp-idf!36892
2025-02-14 12:14:31 +08:00
zhanghaipeng
0a7888f839 fix(ble): Update bt lib for ESP32(2a2631f)
- Support ESP32 BLE GPIO DEBUG
2025-02-13 20:54:04 +08:00
Astha Verma
daf83d975f fix(nimble): Added sync reattempt for periodic adv 2025-02-13 18:22:59 +05:30
hrushikesh.bhosale
9846584def feat(esp_http_server): Modified the calculation of buf_len
Modified the calculation of buf_len, so that scratch buffer allocates
the memory according to requirement and not extra (except the last read chunk)
2025-02-13 17:15:07 +05:30
Sudeep Mohanty
800b5f8072 fix(lp_uart): Fixed flaky LP UART unit tests
This commit fixes some flaky LP UART multi device tests. It also adds
code to put the HP core to light sleep for few tests.
2025-02-13 12:28:26 +01:00
Roman Leonov
7c118fd072 feat(enum): Added test application to test enum driver with mocked device 2025-02-13 11:58:57 +01:00
zwl
9b00d2835e feat(ble): support enhanced controller log capabilities on ESP32-C5 2025-02-13 18:29:41 +08:00
zwl
bbcb4a2e1f feat(ble): support enhanced controller log capabilities on ESP32-C2 2025-02-13 18:29:41 +08:00
zwl
f598976c6b feat(ble): support enhanced controller log capabilities on ESP32-C6 and ESP32-H2 2025-02-13 18:29:41 +08:00
zwl
6cb617617d feat(ble): add channel assessment and enhanced connect function on ESP32-C5 2025-02-13 18:29:41 +08:00
zwl
0ffac92586 feat(ble): add channel assessment and enhanced connect function on ESP32-H2 2025-02-13 18:29:41 +08:00
zwl
821e587fda feat(ble): add channel assessment and enhanced connect function on ESP32-C6 2025-02-13 18:29:41 +08:00
Zhou Xiao
4579e083ef change(ble): [AUTO_MR] Update lib_esp32c6 to 1d7eebaf 2025-02-13 18:29:41 +08:00
Zhou Xiao
a1ccdb85da change(ble): [AUTO_MR] Update lib_esp32c5 to 1d7eebaf 2025-02-13 18:29:41 +08:00
Zhou Xiao
4f0e0f371a change(ble): [AUTO_MR] Update lib_esp32h2 to 1d7eebaf 2025-02-13 18:29:41 +08:00
Tomáš Rohlínek
09aae72bfa
docs(storage/fatfs): discrepancies between FATFS and POSIX
Closes https://github.com/espressif/esp-idf/issues/15187
2025-02-13 10:15:52 +01:00
Mitch Cairns
d4b3a7e99d feat(ble/bluedroid): Support change HID task size by Kconfig in HID example 2025-02-13 15:55:36 +08:00
zhangyanjiao
5b5521d45a fix(wifi): fix the delete queue error in espnow exapmle
Closes https://github.com/espressif/esp-idf/issues/15383
2025-02-13 15:48:14 +08:00
Guillaume Souchere
92d575379f fix(memory-utils): Missing case in esp_ptr_executable logic
esp_ptr_executable does not consider that the PSRAM and FLASH
memory mapping are not always matching.

Added a "pointer is in PSRAM" specific check in the logic to
fix the issue.
2025-02-13 07:56:58 +01:00
Kapil Gupta
b5eadb56e7 fix(esp_wifi): Fix stack corruption in wpa3 task 2025-02-12 23:14:53 +05:30
Kapil Gupta
534fce5fbf fix(esp_wifi): fixed Stack corruption in DPP task 2025-02-12 21:35:11 +05:30
Kapil Gupta
e48122f4a8 fix(esp_wifi): fixed Stack corruption in WPS processing 2025-02-12 21:34:53 +05:30
Kapil Gupta
4d83458e6b fix(esp_wifi): Fixed memory corruption in wifi enterprise
Closes https://github.com/espressif/esp-idf/issues/15370
2025-02-12 20:37:12 +05:30
Erast 
fa40d971a5 docs(ble/bluedroid): Optimize doc for implementation of a characteristic with 128 bit UUID 2025-02-12 14:57:15 +08:00
Nebojša Cvetković
fed1d41aa7 fix(ble/bluedroid): Don't log error on 16/128-bit UUID mixed descriptors 2025-02-12 14:57:15 +08:00
Nebojsa Cvetkovic
63b2dcc3a7 refactor(ble/bluedroid): Fix typos in gatt_sr.c 2025-02-12 14:57:15 +08:00
Nebojsa Cvetkovic
9b5a52e2f7 fix(ble/bluedroid): Allow 0 length indications 2025-02-12 14:57:15 +08:00
Nebojsa Cvetkovic
a8041a9953 refactor(ble/bluedroid): Fix typos in bta_gatts_act.c 2025-02-12 14:57:15 +08:00
Erhan Kurubas
37ef076c07 fix(coredump): disable uart txd pullup using gpio hal 2025-02-12 14:57:15 +08:00
Erhan Kurubas
21161b2fb3 fix(coredump): fix note section alignments 2025-02-12 14:57:15 +08:00
Erhan Kurubas
eaefd0bd25 fix(coredump): only clear high bit in PC when set 2025-02-12 14:57:15 +08:00
Ondrej Kosta
342202204c fix(esp_eth): init Ethernet after repl init in iperf example 2025-02-11 12:16:31 +01:00
hrushikesh.bhosale
97b6043435 feat(esp_http_server): Dynamically allocate http server's scratch buffer
In this commit, esp_http_server's http_parser scratch is made dynamic.
User is asked to give limit size for header and URI, according to which
scratch buufer allocates memory upto limits
2025-02-11 09:41:26 +05:30
Tomáš Rohlínek
67638981ec
feat(storage/vfs): cleanup path prefix handling 2025-02-07 10:34:24 +01:00
Konstantin Kondrashov
8155e60edf feat(esp_ringbuf): Update ring buffer doc
Closes https://github.com/espressif/esp-idf/issues/15298
2025-02-06 17:44:14 +02:00
Tomáš Rohlínek
a45b12a68b
feat(storage/vfs): improve mountpoint table memory usage 2025-01-30 09:07:51 +01:00
Christopher Durand
c0590f5b50 fix(esp_http_client): Fix invalid content length header
In case a request with no content is sent after one with the content
length header set the header of the previous request is sent with the
subsequent one.
For instance, an empty GET request after a PUT request will still
indicate the non-zero content length of the previous request.

This is fixed by clearing the content length header when it shouldn't be
set.
2025-01-27 12:09:23 +01:00
Marius Vikhammer
fb33d8bd9d docs(examples): fixed broken link in uart example readme 2025-01-26 11:23:09 +08:00
weiyuhan
d78461eb54 docs(ble): Updated the Bluetooth SIG Qualification information for ESP32C6 2025-01-16 19:55:34 +08:00
tgotic
ea305cb805 [BT] btc_spp_write mem leak
Fix potential memory leak in btc_spp_write().
btc_spp_arg_deep_free() doesn't free write.p_data allocated in btc_spp_arg_deep_copy().
Cases of write.p_data leak:
- btc_spp_write() fails
- fixed_queue_enqueue() fails
Memory will be freed if BTA_JvRfcommWrite() fails, when connection is closed (BTA_JV_RFCOMM_CLOSE_EVT).
2022-12-09 09:37:46 +01:00
795 changed files with 223582 additions and 8045 deletions

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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 版本低于 `需求版本` 会出现什么情况?

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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();

View File

@ -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)
@ -904,6 +917,9 @@ if(CONFIG_BT_ENABLED)
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
endif()
elseif(CONFIG_BT_CONTROLLER_ENABLED)
if(CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=esp_panic_handler")
endif()
if(CONFIG_IDF_TARGET_ESP32C6)
add_prebuilt_library(libble_app
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c6/esp32c6-bt-lib/esp32c6/libble_app.a")

View File

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

View File

@ -1,6 +1,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

View File

@ -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

View File

@ -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__

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -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)

View File

@ -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);
/**

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -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

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -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

View File

@ -528,6 +528,16 @@ config BTDM_BLE_VS_QA_SUPPORT
help
This enables BLE vendor HCI command and event for QA.
config BTDM_CTRL_CONTROLLER_DEBUG_MODE_1
visible if 0
bool "Enable Bluetooth controller debugging mode 1 (for internal use only)"
default n
depends on BT_ENABLED
help
Enables specific debugging features for the Bluetooth controller.
This option is strictly for internal debugging purposes and should not be enabled in production environments,
as it may impact performance and stability.
config BTDM_RESERVE_DRAM
hex
default 0xdb5c if BT_ENABLED

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -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();

View File

@ -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
@ -390,6 +356,19 @@ config BT_LE_LOG_HCI_BUF_SIZE
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_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_LL_RESOLV_LIST_SIZE
int "BLE LL Resolving list size"
range 1 5

View File

@ -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,13 +454,28 @@ 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");
portEXIT_CRITICAL_SAFE(&spinlock);
}
}
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
void esp_task_wdt_isr_user_handler(void)
{
esp_ble_controller_log_dump_all(true);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
void __real_esp_panic_handler(void *info);
void __wrap_esp_panic_handler (void *info)
{
esp_ble_controller_log_dump_all(true);
__real_esp_panic_handler(info);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* This variable tells if BLE is running */

View File

@ -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

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -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;

View File

@ -283,115 +283,127 @@ 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_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_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"
range 1 5
@ -538,6 +550,7 @@ config BT_LE_USE_ESP_TIMER
help
Set this option to use Esp Timer which has higher priority timer
instead of FreeRTOS timer
config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
bool "BLE adv report flow control supported"
default y
@ -722,3 +735,48 @@ config BT_CTRL_RUN_IN_FLASH_ONLY
Move most IRAM into flash. This will increase the usage of flash and reduce ble performance.
Because the code is moved to the flash, the execution speed of the code is reduced.
To have a small impact on performance, you need to enable flash suspend (SPI_FLASH_AUTO_SUSPEND).
menu "BLE disconnects when Instant Passed (0x28) occurs"
config BT_LE_CTRL_LLCP_CONN_UPDATE
bool "BLE ACL connection update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs during connection update procedure.
config BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
bool "BLE ACL channel map update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in channel map update procedure.
config BT_LE_CTRL_LLCP_PHY_UPDATE
bool "BLE ACL PHY update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in PHY update procedure.
endmenu
config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
int "The value of upperlimitmax during scan backoff procedure"
range 1 256
default 32
help
The value of upperlimitmax needs to be a power of 2.
config BT_LE_CTRL_CHAN_ASS_EN
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(Experimental)"
default y
help
When this option is enabled, auxiliary packets will be present in the events of
'Non-Connectable and Non-Scannable' regardless of whether the advertising length is 0.
If this option is not enabled, auxiliary packets will only be present when the advertising length is not 0.

View 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();
}

View 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);

View File

@ -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,15 @@ 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
extern int r_ble_controller_deinit(void);
extern int r_ble_controller_enable(uint8_t mode);
@ -266,10 +270,14 @@ esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
}
ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
if (ret != ESP_OK) {
return ret;
}
ret = r_ble_log_ctrl_level_and_mod(CONFIG_BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL, CONFIG_BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH);
if (ret == ESP_OK) {
log_is_inited = true;
}
return ret;
}
@ -370,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 {
@ -388,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;
}
@ -403,6 +411,22 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
assert(err == ESP_OK);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
void esp_task_wdt_isr_user_handler(void)
{
esp_ble_controller_log_dump_all(true);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
void __real_esp_panic_handler(void *info);
void __wrap_esp_panic_handler (void *info)
{
esp_ble_controller_log_dump_all(true);
__real_esp_panic_handler(info);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* This variable tells if BLE is running */
@ -923,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();
@ -969,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();
@ -1006,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
@ -1059,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;
@ -1067,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
@ -1090,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
@ -1358,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]);
}
@ -1379,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");
@ -1599,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;
}

View File

@ -154,6 +154,44 @@ extern "C" {
#define DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS (0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CONN_UPDATE
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (1<<0)
#else
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (0<<0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (1<<1)
#else
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (0<<1)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_PHY_UPDATE
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (1<<2)
#else
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (0<<2)
#endif
#define BT_LE_CTRL_LLCP_DISC_FLAG (BT_CTRL_BLE_LLCP_CONN_UPDATE | BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE | BT_CTRL_BLE_LLCP_PHY_UPDATE)
#ifdef CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX)
#else
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (256)
#endif
#if defined(CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#else
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (0)
#endif
#if defined(CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#else
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (0)
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#else

View File

@ -315,115 +315,127 @@ 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_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_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"
range 1 5
@ -748,3 +760,48 @@ config BT_CTRL_RUN_IN_FLASH_ONLY
Move most IRAM into flash. This will increase the usage of flash and reduce ble performance.
Because the code is moved to the flash, the execution speed of the code is reduced.
To have a small impact on performance, you need to enable flash suspend (SPI_FLASH_AUTO_SUSPEND).
menu "BLE disconnects when Instant Passed (0x28) occurs"
config BT_LE_CTRL_LLCP_CONN_UPDATE
bool "BLE ACL connection update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs during connection update procedure.
config BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
bool "BLE ACL channel map update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in channel map update procedure.
config BT_LE_CTRL_LLCP_PHY_UPDATE
bool "BLE ACL PHY update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in PHY update procedure.
endmenu
config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
int "The value of upperlimitmax during scan backoff procedure"
range 1 256
default 32
help
The value of upperlimitmax needs to be a power of 2.
config BT_LE_CTRL_CHAN_ASS_EN
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(Experimental)"
default y
help
When this option is enabled, auxiliary packets will be present in the events of
'Non-Connectable and Non-Scannable' regardless of whether the advertising length is 0.
If this option is not enabled, auxiliary packets will only be present when the advertising length is not 0.

View 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();
}

View 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);

View File

@ -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,15 @@ 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
extern int r_ble_controller_deinit(void);
extern int r_ble_controller_enable(uint8_t mode);
@ -269,10 +273,14 @@ esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
}
ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
if (ret != ESP_OK) {
return ret;
}
ret = r_ble_log_ctrl_level_and_mod(CONFIG_BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL, CONFIG_BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH);
if (ret == ESP_OK) {
log_is_inited = true;
}
return ret;
}
@ -373,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 {
@ -391,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;
}
@ -406,6 +414,22 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
assert(err == ESP_OK);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
void esp_task_wdt_isr_user_handler(void)
{
esp_ble_controller_log_dump_all(true);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
void __real_esp_panic_handler(void *info);
void __wrap_esp_panic_handler (void *info)
{
esp_ble_controller_log_dump_all(true);
__real_esp_panic_handler(info);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* This variable tells if BLE is running */
@ -941,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();
@ -990,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();
@ -1027,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
@ -1080,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;
@ -1088,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
@ -1111,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
@ -1379,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]);
}
@ -1400,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");
@ -1620,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;
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -154,6 +154,44 @@ extern "C" {
#define DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS (0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CONN_UPDATE
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (1<<0)
#else
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (0<<0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (1<<1)
#else
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (0<<1)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_PHY_UPDATE
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (1<<2)
#else
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (0<<2)
#endif
#define BT_LE_CTRL_LLCP_DISC_FLAG (BT_CTRL_BLE_LLCP_CONN_UPDATE | BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE | BT_CTRL_BLE_LLCP_PHY_UPDATE)
#ifdef CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX)
#else
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (256)
#endif
#if defined(CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#else
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (0)
#endif
#if defined(CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#else
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (0)
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#else

View File

@ -306,115 +306,127 @@ 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_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_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"
range 1 5
@ -658,7 +670,7 @@ config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD
again.
config BT_LE_MSYS_INIT_IN_CONTROLLER
bool
bool "Msys Mbuf Init in Controller"
default y
config BT_LE_TX_CCA_ENABLED
@ -749,3 +761,48 @@ config BT_CTRL_RUN_IN_FLASH_ONLY
Move most IRAM into flash. This will increase the usage of flash and reduce ble performance.
Because the code is moved to the flash, the execution speed of the code is reduced.
To have a small impact on performance, you need to enable flash suspend (SPI_FLASH_AUTO_SUSPEND).
menu "BLE disconnects when Instant Passed (0x28) occurs"
config BT_LE_CTRL_LLCP_CONN_UPDATE
bool "BLE ACL connection update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs during connection update procedure.
config BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
bool "BLE ACL channel map update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in channel map update procedure.
config BT_LE_CTRL_LLCP_PHY_UPDATE
bool "BLE ACL PHY update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in PHY update procedure.
endmenu
config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
int "The value of upperlimitmax during scan backoff procedure"
range 1 256
default 32
help
The value of upperlimitmax needs to be a power of 2.
config BT_LE_CTRL_CHAN_ASS_EN
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(Experimental)"
default y
help
When this option is enabled, auxiliary packets will be present in the events of
'Non-Connectable and Non-Scannable' regardless of whether the advertising length is 0.
If this option is not enabled, auxiliary packets will only be present when the advertising length is not 0.

View 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();
}

View 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);

View File

@ -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,15 @@ 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
extern int r_ble_controller_deinit(void);
extern int r_ble_controller_enable(uint8_t mode);
@ -267,6 +271,11 @@ esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
}
ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
if (ret != ESP_OK) {
return ret;
}
ret = r_ble_log_ctrl_level_and_mod(CONFIG_BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL, CONFIG_BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH);
if (ret == ESP_OK) {
log_is_inited = true;
}
@ -370,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 {
@ -388,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;
}
@ -403,6 +412,22 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
assert(err == ESP_OK);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
void esp_task_wdt_isr_user_handler(void)
{
esp_ble_controller_log_dump_all(true);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
void __real_esp_panic_handler(void *info);
void __wrap_esp_panic_handler (void *info)
{
esp_ble_controller_log_dump_all(true);
__real_esp_panic_handler(info);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* This variable tells if BLE is running */
@ -916,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();
@ -937,6 +968,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "controller_sleep_init failed %d", ret);
goto free_controller;
}
ESP_ERROR_CHECK(esp_read_mac((uint8_t *)mac, ESP_MAC_BT));
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Bluetooth MAC: %02x:%02x:%02x:%02x:%02x:%02x",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
@ -964,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();
@ -999,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
@ -1047,10 +1081,17 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
#if CONFIG_SW_COEXIST_ENABLE
coex_enable();
#endif // CONFIG_SW_COEXIST_ENABLE
#if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
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;
@ -1059,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
@ -1082,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
@ -1350,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]);
}
@ -1370,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");
@ -1590,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;
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -154,6 +154,44 @@ extern "C" {
#define DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS (0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CONN_UPDATE
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (1<<0)
#else
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (0<<0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (1<<1)
#else
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (0<<1)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_PHY_UPDATE
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (1<<2)
#else
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (0<<2)
#endif
#define BT_LE_CTRL_LLCP_DISC_FLAG (BT_CTRL_BLE_LLCP_CONN_UPDATE | BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE | BT_CTRL_BLE_LLCP_PHY_UPDATE)
#ifdef CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX)
#else
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (256)
#endif
#if defined(CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#else
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (0)
#endif
#if defined(CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#else
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (0)
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#else

@ -1 +1 @@
Subproject commit e847faba2d86e90b5f21d6310bb4723c4e32ba1c
Subproject commit fbbb054cbc5c8b5aa466208dc8d12ccc10d7e08c

@ -1 +1 @@
Subproject commit ed99228396aaa18935b575d600bc19da38dc4746
Subproject commit 2ce747aec8008d008fe34fa375a2aea3e7e48e9a

@ -1 +1 @@
Subproject commit e55480fc0db4c767434f5677188065f484aa5706
Subproject commit e17ca05e5e0acf39212811a08174d5c1c69cf165

@ -1 +1 @@
Subproject commit 9cf1bbd021d98b3da9ad8465e7fbfca8085f3a1d
Subproject commit 08946905ec0dfcbfc7dd2919b27e43cbcbde66ed

@ -1 +1 @@
Subproject commit 092666b0f427e4226325389fc53e4b8df4a8a1fc
Subproject commit e755a655979177c9551d5fb3613ebb4885aab3a5

View File

@ -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

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -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 */

View File

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

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -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

View File

@ -616,8 +616,10 @@ void bta_dm_disable (tBTA_DM_MSG *p_data)
#endif
#if BLE_INCLUDED == TRUE
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
// btm_ble_multi_adv_init is called when the host is enabled, so btm_ble_multi_adv_cleanup is called when the host is disabled.
btm_ble_multi_adv_cleanup();
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#endif
}
@ -970,7 +972,7 @@ void bta_dm_clear_white_list(tBTA_DM_MSG *p_data)
BTM_BleClearWhitelist(p_data->white_list.update_wl_cb);
#endif
}
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data)
{
#if (BLE_INCLUDED == TRUE)
@ -981,6 +983,7 @@ void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data)
}
#endif ///BLE_INCLUDED == TRUE
}
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
void bta_dm_read_rssi(tBTA_DM_MSG *p_data)
{
@ -991,6 +994,7 @@ void bta_dm_read_rssi(tBTA_DM_MSG *p_data)
}
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_set_visibility
@ -1080,6 +1084,7 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
}
}
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
@ -1211,6 +1216,7 @@ void bta_dm_add_device (tBTA_DM_MSG *p_data)
}
}
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_close_acl
@ -1256,7 +1262,9 @@ void bta_dm_close_acl(tBTA_DM_MSG *p_data)
/* otherwise, no action needed */
}
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_remove_all_acl
@ -1285,7 +1293,7 @@ void bta_dm_remove_all_acl(tBTA_DM_MSG *p_data)
}
}
}
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
/*******************************************************************************
**
@ -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

View File

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

View File

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

View File

@ -65,17 +65,19 @@ enum {
BTA_DM_API_SET_ACL_PKT_TYPES_EVT,
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
BTA_DM_API_SET_MIN_ENC_KEY_SIZE_EVT,
#endif
#endif
BTA_DM_API_SET_AFH_CHANNELS_EVT,
#if (SDP_INCLUDED == TRUE)
BTA_DM_API_GET_REMOTE_NAME_EVT,
#endif
BTA_DM_API_SET_VISIBILITY_EVT,
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
BTA_DM_ACL_CHANGE_EVT,
BTA_DM_API_ADD_DEVICE_EVT,
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
BTA_DM_API_REMOVE_ACL_EVT,
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
#if (SMP_INCLUDED == TRUE)
/* security API events */
BTA_DM_API_BOND_EVT,
@ -121,13 +123,23 @@ enum {
#endif ///SMP_INCLUDED == TRUE
BTA_DM_API_BLE_SET_BG_CONN_TYPE,
BTA_DM_API_BLE_CONN_PARAM_EVT,
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT,
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
BTA_DM_API_BLE_SCAN_PARAM_EVT,
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
/*******This event added by Yulong at 2016/10/25 to
support the scan filter setting for the APP******/
#if (BLE_42_SCAN_EN == TRUE)
BTA_DM_API_BLE_SCAN_FIL_PARAM_EVT,
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
BTA_DM_API_BLE_OBSERVE_EVT,
#endif // #if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
BTA_DM_API_BLE_SCAN_EVT,
#endif // #if (BLE_42_SCAN_EN == TRUE)
BTA_DM_API_UPDATE_CONN_PARAM_EVT,
/*******This event added by Yulong at 2016/9/9 to
support the random address setting for the APP******/
@ -135,15 +147,17 @@ enum {
BTA_DM_API_CLEAR_RAND_ADDR_EVT,
/*******This event added by Yulong at 2016/10/19 to
support stop the ble advertising setting by the APP******/
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
BTA_DM_API_BLE_STOP_ADV_EVT,
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
#if BLE_PRIVACY_SPT == TRUE
BTA_DM_API_LOCAL_PRIVACY_EVT,
#endif
BTA_DM_API_LOCAL_ICON_EVT,
BTA_DM_API_BLE_ADV_PARAM_EVT,
/*******This event added by Yulong at 2016/10/20 to
support setting the ble advertising param by the APP******/
#if (BLE_42_ADV_EN == TRUE)
BTA_DM_API_BLE_ADV_PARAM_All_EVT,
BTA_DM_API_BLE_SET_ADV_CONFIG_EVT,
/* Add for set raw advertising data */
@ -152,36 +166,55 @@ enum {
/* Add for set raw scan response data */
BTA_DM_API_BLE_SET_SCAN_RSP_RAW_EVT,
BTA_DM_API_BLE_BROADCAST_EVT,
#endif // #if (BLE_42_ADV_EN == TRUE)
BTA_DM_API_SET_DATA_LENGTH_EVT,
BTA_DM_API_BLE_SET_LONG_ADV_EVT,
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
BTA_DM_API_CFG_FILTER_COND_EVT,
BTA_DM_API_SCAN_FILTER_SETUP_EVT,
BTA_DM_API_SCAN_FILTER_ENABLE_EVT,
#endif
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
BTA_DM_API_BLE_MULTI_ADV_ENB_EVT,
BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT,
BTA_DM_API_BLE_MULTI_ADV_DATA_EVT,
BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT,
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
BTA_DM_API_BLE_SETUP_STORAGE_EVT,
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT,
BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT,
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT,
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
BTA_DM_API_BLE_TRACK_ADVERTISER_EVT,
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
BTA_DM_API_BLE_ENERGY_INFO_EVT,
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
BTA_DM_API_BLE_DISCONNECT_EVT,
#endif
#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
BTA_DM_API_ENABLE_TEST_MODE_EVT,
BTA_DM_API_DISABLE_TEST_MODE_EVT,
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
BTA_DM_API_EXECUTE_CBACK_EVT,
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
BTA_DM_API_REMOVE_ALL_ACL_EVT,
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
BTA_DM_API_REMOVE_DEVICE_EVT,
BTA_DM_API_BLE_SET_CHANNELS_EVT,
BTA_DM_API_UPDATE_WHITE_LIST_EVT,
BTA_DM_API_CLEAR_WHITE_LIST_EVT,
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT,
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
BTA_DM_API_READ_RSSI_EVT,
#if BLE_INCLUDED == TRUE
BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT,
@ -190,28 +223,38 @@ enum {
BTA_DM_API_READ_PHY_EVT,
BTA_DM_API_SET_PER_DEF_PHY_EVT,
BTA_DM_API_SET_PER_PHY_EVT,
#if (BLE_50_EXTEND_ADV_EN == TRUE)
BTA_DM_API_SET_EXT_ADV_RAND_ADDR_EVT,
BTA_DM_API_SET_EXT_ADV_PARAMS_EVT,
BTA_DM_API_CFG_ADV_DATA_RAW_EVT,
BTA_DM_API_EXT_ADV_ENABLE_EVT,
BTA_DM_API_EXT_ADV_SET_REMOVE_EVT,
BTA_DM_API_EXT_ADV_SET_CLEAR_EVT,
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#if (BLE_50_PERIODIC_ADV_EN == TRUE)
BTA_DM_API_PERIODIC_ADV_SET_PARAMS_EVT,
BTA_DM_API_PERIODIC_ADV_CFG_DATA_EVT,
BTA_DM_API_PERIODIC_ADV_ENABLE_EVT,
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
BTA_DM_API_PERIODIC_ADV_SYNC_EVT,
BTA_DM_API_PERIODIC_ADV_SYNC_CANCEL_EVT,
BTA_DM_API_PERIODIC_ADV_SYNC_TERMINATE_EVT,
BTA_DM_API_PERIODIC_ADV_ADD_DEV_TO_LSIT_EVT,
BTA_DM_API_PERIODIC_ADV_REMOVE_DEV_FROM_LSIT_EVT,
BTA_DM_API_PERIODIC_ADV_CLEAR_DEV_EVT,
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
BTA_DM_API_SET_EXT_SCAN_PARAMS_EVT,
BTA_DM_API_START_EXT_SCAN_EVT,
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
BTA_DM_API_SET_PERF_EXT_CONN_PARAMS_EVT,
BTA_DM_API_EXT_CONN_EVT,
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_DTM_TEST_EN == TRUE)
BTA_DM_API_DTM_ENH_TX_START_EVT,
BTA_DM_API_DTM_ENH_RX_START_EVT,
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
BTA_DM_API_PERIODIC_ADV_RECV_ENABLE_EVT,
BTA_DM_API_PERIODIC_ADV_SYNC_TRANS_EVT,
@ -219,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);

View File

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

View File

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

View File

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

View File

@ -723,8 +723,6 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
} else {
APPL_TRACE_ERROR("%s, malloc failed", __func__);
}
} else {
APPL_TRACE_ERROR("%s, incorrect length", __func__);
}
(*p_rcb->p_cback)(BTA_GATTS_CONF_EVT, &cb_data);
if (cb_data.req_data.value != NULL) {
@ -733,7 +731,7 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
}
}
} else {
APPL_TRACE_ERROR("Not an registered servce attribute ID: 0x%04x",
APPL_TRACE_ERROR("Not a registered service attribute ID: 0x%04x",
p_msg->api_indicate.attr_id);
}
}
@ -884,46 +882,11 @@ 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
**
** Description print loacl service database
** Description print local service database
**
** Returns none.
**

View File

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

View File

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

View File

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

View File

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

View File

@ -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);

View File

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

View File

@ -222,7 +222,7 @@ extern void bta_sys_register(UINT8 id, const tBTA_SYS_REG *p_reg);
extern void bta_sys_deregister(UINT8 id);
extern BOOLEAN bta_sys_is_register(UINT8 id);
extern UINT16 bta_sys_get_sys_features(void);
extern void bta_sys_sendmsg(void *p_msg);
extern BOOLEAN bta_sys_sendmsg(void *p_msg);
extern void bta_sys_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout_ms);
extern void bta_sys_stop_timer(TIMER_LIST_ENT *p_tle);
extern void bta_sys_free_timer(TIMER_LIST_ENT *p_tle);

View File

@ -1160,8 +1160,9 @@ tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id, int len, UINT8 *p
p_msg->p_data = p_data;
p_msg->len = len;
APPL_TRACE_API( "write ok");
bta_sys_sendmsg(p_msg);
status = BTA_JV_SUCCESS;
if (bta_sys_sendmsg(p_msg)) {
status = BTA_JV_SUCCESS;
}
}
return (status);
}

View File

@ -564,10 +564,10 @@ BOOLEAN bta_sys_is_register(UINT8 id)
** API functions and call-in functions.
**
**
** Returns void
** Returns true if message is posted to BTA, false otherwise
**
*******************************************************************************/
void bta_sys_sendmsg(void *p_msg)
BOOLEAN bta_sys_sendmsg(void *p_msg)
{
// There is a race condition that occurs if the stack is shut down while
// there is a procedure in progress that can schedule a task via this
@ -575,7 +575,9 @@ void bta_sys_sendmsg(void *p_msg)
// it gets used here; hence we check for NULL before using it.
if (btu_task_post(SIG_BTU_BTA_MSG, p_msg, OSI_THREAD_MAX_TIMEOUT) == false) {
osi_free(p_msg);
return FALSE;
}
return TRUE;
}
/*******************************************************************************

View File

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

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -30,6 +30,7 @@
#if (BLE_INCLUDED == TRUE)
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
#if BTC_DYNAMIC_MEMORY == FALSE
static tBTA_BLE_ADV_DATA gl_bta_adv_data;
static tBTA_BLE_ADV_DATA gl_bta_scan_rsp_data;
@ -37,33 +38,22 @@ static tBTA_BLE_ADV_DATA gl_bta_scan_rsp_data;
tBTA_BLE_ADV_DATA *gl_bta_adv_data_ptr;
tBTA_BLE_ADV_DATA *gl_bta_scan_rsp_data_ptr;
#endif
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
#if SCAN_QUEUE_CONGEST_CHECK
static list_t *adv_filter_list;
static osi_mutex_t adv_list_lock;
bool btc_check_adv_list(uint8_t * addr, uint8_t addr_type);
uint32_t btc_get_adv_list_length(void);
void btc_adv_list_refresh(void);
void btc_adv_list_lock(void);
void btc_adv_list_unlock(void);
static uint16_t btc_adv_list_count = 0;
#define BTC_ADV_LIST_MAX_LENGTH 50
#define BTC_ADV_LIST_MAX_COUNT 200
#endif
#define BTC_GAP_BLE_ADV_RPT_QUEUE_IDX (1)
#define BTC_GAP_BLE_ADV_RPT_BATCH_SIZE (10)
#define BTC_GAP_BLE_ADV_RPT_QUEUE_LEN_MAX (200)
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
typedef struct {
struct pkt_queue *adv_rpt_queue;
struct osi_event *adv_rpt_ready;
} btc_gap_ble_env_t;
static btc_gap_ble_env_t btc_gap_ble_env;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif
static inline void btc_gap_ble_cb_to_app(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
@ -102,6 +92,7 @@ static void btc_gap_ble_get_dev_name_callback(UINT8 status, char *name)
}
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
static void btc_gap_adv_point_cleanup(void **buf)
{
if (NULL == *buf) {
@ -495,6 +486,7 @@ static void btc_clear_adv_callback(uint8_t status)
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info)
{
@ -525,6 +517,7 @@ static void btc_ble_update_duplicate_exceptional_list(uint8_t subcode, uint32_t
BTA_DmUpdateDuplicateExceptionalList(subcode, info_type, device_info, p_update_duplicate_ignore_list_cback);
}
#if (BLE_42_ADV_EN == TRUE)
static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBTA_START_ADV_CMPL_CBACK start_adv_cback)
{
tBLE_BD_ADDR peer_addr;
@ -575,8 +568,9 @@ static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBT
&peer_addr,
start_adv_cback);
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
static void btc_scan_params_callback(tGATT_IF gatt_if, tBTM_STATUS status)
{
esp_ble_gap_cb_param_t param;
@ -641,20 +635,6 @@ static void btc_gap_ble_adv_pkt_handler(void *arg)
static void btc_process_adv_rpt_pkt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data)
{
#if SCAN_QUEUE_CONGEST_CHECK
if(btc_check_queue_is_congest()) {
BTC_TRACE_DEBUG("BtcQueue is congested");
if(btc_get_adv_list_length() > BTC_ADV_LIST_MAX_LENGTH || btc_adv_list_count > BTC_ADV_LIST_MAX_COUNT) {
btc_adv_list_refresh();
btc_adv_list_count = 0;
}
if(btc_check_adv_list(p_data->inq_res.bd_addr, p_data->inq_res.ble_addr_type)) {
return;
}
}
btc_adv_list_count ++;
#endif
// drop ADV packets if data queue length goes above threshold
btc_gap_ble_env_t *p_env = &btc_gap_ble_env;
if (pkt_queue_length(p_env->adv_rpt_queue) >= BTC_GAP_BLE_ADV_RPT_QUEUE_LEN_MAX) {
@ -770,10 +750,8 @@ static void btc_stop_scan_callback(tBTA_STATUS status)
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
#if SCAN_QUEUE_CONGEST_CHECK
btc_adv_list_refresh();
#endif
}
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
void btc_update_conn_param_callback (UINT8 status, BD_ADDR bd_addr, tBTM_LE_UPDATE_CONN_PRAMS *update_conn_params)
{
@ -986,6 +964,7 @@ 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(&param.ext_adv_report.params, &params->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(&param.period_adv_report, &params->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, &param, 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, &param, 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

View File

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

View File

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

View File

@ -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;

View File

@ -908,7 +908,12 @@ static void btc_spp_write(btc_spp_args_t *arg)
}
} else {
if (fixed_queue_enqueue(slot->tx.queue, arg->write.p_data, 0)) {
BTA_JvRfcommWrite(arg->write.handle, slot->id, arg->write.len, arg->write.p_data);
if (BTA_JvRfcommWrite(arg->write.handle, slot->id, arg->write.len, arg->write.p_data) == BTA_JV_SUCCESS) {
arg->write.p_data = NULL; // arg->write.p_data passed to tBTA_JV_API_RFCOMM_WRITE::p_data, set it to NULL to prevent freeing
} else {
arg->write.p_data = fixed_queue_try_remove_from_queue(slot->tx.queue, arg->write.p_data);
ret = ESP_SPP_FAILURE;
}
} else {
ret = ESP_SPP_NO_RESOURCE;
}
@ -968,6 +973,12 @@ void btc_spp_arg_deep_free(btc_msg_t *msg)
osi_free(arg->start_discovery.p_uuid_list);
}
break;
case BTC_SPP_ACT_WRITE:
if (arg->write.p_data) {
osi_free(arg->write.p_data);
arg->write.p_data = NULL;
}
break;
default:
break;
}

View File

@ -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

View File

@ -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. */

View File

@ -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;

View File

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

View File

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

View File

@ -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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -342,10 +342,10 @@ typedef struct {
tBTM_INQ_RESULTS_CB *p_scan_results_cb;
tBTM_CMPL_CB *p_scan_cmpl_cb;
TIMER_LIST_ENT scan_timer_ent;
#if (BLE_42_SCAN_EN == TRUE)
struct pkt_queue *adv_rpt_queue;
struct osi_event *adv_rpt_ready;
#endif // #if (BLE_42_SCAN_EN == TRUE)
/* background connection procedure cb value */
tBTM_BLE_CONN_TYPE bg_conn_type;
UINT32 scan_int;
@ -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);

View File

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

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