Compare commits

..

822 Commits

Author SHA1 Message Date
Ivan Grokhotkov cc5440f6a2 Merge branch 'update/version_3_3_6' into 'release/v3.3'
Update version to 3.3.6

See merge request espressif/esp-idf!16908
2022-01-25 15:44:41 +00:00
Ivan Grokhotkov 43e439698d versions: Update version to 3.3.6 2022-01-24 22:20:32 +01:00
Jiang Jiang Jian 56f6378727 Merge branch 'bugfix/bootloader_oversize_after_xmc' into 'release/v3.3'
bootloader: disable XMC startup flow by default to reduce bootloader size

See merge request espressif/esp-idf!16683
2022-01-21 06:33:31 +00:00
Jiang Jiang Jian 5ffe84bec4 Merge branch 'debug/bt2160_assert_crash_collsion_fix' into 'release/v3.3'
components/bt Fix for LLCP collision of local procedures during channel map update

See merge request espressif/esp-idf!16775
2022-01-21 04:15:14 +00:00
sushant.chougule 830126a3b7 Fix for assert crash in channel map update handling 2022-01-20 19:18:38 +05:30
Jiang Jiang Jian ea7b022cdf Merge branch 'bugfix/fix_rx_fragment_error_issue_v3.3' into 'release/v3.3'
esp_wifi: fix fragment issue(Backport v3.3)

See merge request espressif/esp-idf!16402
2022-01-20 07:58:04 +00:00
Michael (XIAO Xufeng) 91439e2c70 bootloader: disable XMC startup flow by default to reduce bootloader size 2022-01-20 02:15:38 +08:00
Michael (XIAO Xufeng) 9fc4057e9e Merge branch 'bugfix/xmc_overerase_v3.3' into 'release/v3.3'
bootloader: add xmc spi_flash startup flow to improve reliability (v3.3)

See merge request espressif/esp-idf!14780
2022-01-02 16:09:15 +00:00
Michael (XIAO Xufeng) 049f492b8a spi_flash: fix the corruption of ROM after calling bootloader_execute_flash_command
The user register, especially dummy related ones, needs to be restored, otherwise the ROM function will not work.

Introduced in dd40123129.
2021-12-31 02:13:48 +08:00
Michael (XIAO Xufeng) ccab4633de bootloader: add xmc spi_flash startup flow to improve reliability 2021-12-31 02:13:47 +08:00
Jiang Jiang Jian 327c22103b Merge branch 'feature/mbedtls-2.16.12-integration_v3.3' into 'release/v3.3'
mbedtls: upgrade to release v2.16.12 (v3.3)

See merge request espressif/esp-idf!16487
2021-12-24 03:21:54 +00:00
Mahavir Jain 0b84dcaf13 mbedtls: upgrade to release v2.16.12
For release notes, please refer to:
https://github.com/ARMmbed/mbedtls/releases/tag/v2.16.12
2021-12-21 14:09:15 +05:30
muhaidong 3d59008788 esp_wifi: fix fragment issue
1. fix(pp): fix fragment plt loss when 2td pn compare with 1th pn
2021-12-20 20:21:55 +08:00
Island a4fd697a57 Merge branch 'bugfix/cannot_change_indication_manually' into 'release/v3.3'
GATT_SendServiceChangeIndication can't send service change indication manually(v3.3)

See merge request espressif/esp-idf!16270
2021-12-15 03:54:58 +00:00
Yuan Hong Hui 64aaaf87a7 can't change indication manually 2021-12-08 11:05:07 +08:00
Island 485ea20eae Merge branch 'test/update_ble_mesh_console_files_forv3.3' into 'release/v3.3'
test: fix ble mesh send problem (v3.3)

See merge request espressif/esp-idf!14533
2021-12-03 08:38:45 +00:00
Michael (XIAO Xufeng) ab40f7ab0a Merge branch 'bugfix/fix_modbus_rs485_rts_en_fail_v33' into 'release/v3.3'
Bugfix/fix modbus rs485 rts en fail (backport v3.3)

See merge request espressif/esp-idf!14473
2021-12-03 03:29:56 +00:00
Michael (XIAO Xufeng) 1e02903c87 Merge branch 'bugfix/modbus_add_task_affinity_and_callbacks_v33' into 'release/v3.3'
freemodbus: add task affinity and callbacks (backport v3.3)

See merge request espressif/esp-idf!14547
2021-12-03 03:23:05 +00:00
Michael (XIAO Xufeng) a7fb697083 Merge branch 'bugfix/mcpwm-deadtime-preset-config-backport_v3.3' into 'release/v3.3'
MCPWM/deadtime: fix and sync preset deadtime modes with well-known definition (backport v3.3)

See merge request espressif/esp-idf!14626
2021-12-03 03:17:31 +00:00
Li Hang Fan 19f15190a2 MCPWM/deadtime: fix and sync preset deadtime modes with well-known definition (backport v3.3) 2021-12-03 03:17:30 +00:00
Jiang Jiang Jian 002db67195 Merge branch 'bugfix/fix_some_wifi_bugs_20211202_v3.3' into 'release/v3.3'
esp_wifi: fix some wifi bugs 20211202 (Backport v3.3)

See merge request espressif/esp-idf!16226
2021-12-03 02:44:40 +00:00
Wang Meng Yang 016a08a3bb Merge branch 'bugfix/proper_tx_acl_buf_3.3' into 'release/v3.3'
Fixed TX PDU ACL flush update error (v3.3)

See merge request espressif/esp-idf!16244
2021-12-03 02:28:31 +00:00
zhangyanjiao cd428d0346 esp_wifi: fix some wifi bugs
1. Fix airkiss and esptouch find channel crash issue
2. Fix softAP crash by adding NULL pointer check for handling public action frame
3. Ignore dirtyBuf check when buffer size is larger than 4092
4. Fix rf signal test without 9M rate issue
5. Fix issue with hidden AP scans after connecting AP
6. Fix the watchdog issue when receiving action frame
7. Clear hotspot bss when auth timeout happens
8. Fix the bug for esptouch find hidden AP fail
9. Fixed issue of reason code change from 15 to 204 when provide wrong password
10. Fix set config return value error
11. Fix ampdu age timer memory leak
12. Fix PMK not saved in NVS for SoftAP for PSK mode
2021-12-02 21:42:14 +08:00
Jiang Jiang Jian 30268103d5 Merge branch 'bugfix/wpa_supplicant_coverity_issue_fixes_v3.3' into 'release/v3.3'
Bugfix/wpa supplicant coverity issue fixes v3.3

See merge request espressif/esp-idf!12852
2021-12-02 12:00:11 +00:00
Yang Zhao 53a0cbd592 Fixed TX PDU ACL flush update error 2021-12-02 19:54:02 +08:00
Jiang Jiang Jian 80d5c63b36 Merge branch 'feature/btdm_add_new_api_get_conn_params_v3.3' into 'release/v3.3'
Component/bt: add new api to get connection parameters(backport release/v3.3)

See merge request espressif/esp-idf!16225
2021-12-02 08:07:51 +00:00
aditi_lonkar b67821b2a7 wifi_provisioning: Fix some memory leak issues by coverity static analyzer. 2021-12-02 13:07:52 +05:30
aditi_lonkar 88645a97b4 esp_http_client: Fix some memory leak issues by coverity static analyzer. 2021-12-02 13:07:52 +05:30
aditi_lonkar 776d24e83f fatfs: Fix some memory leak issues by coverity static analyzer. 2021-12-02 13:07:52 +05:30
aditi_lonkar 66d7cf8db5 tcp_transport: Fix some memory leak issues by coverity static analyzer. 2021-12-02 13:07:52 +05:30
zhiweijian 3eacc32c8c Component/bt: add new api to get connection parameters 2021-12-02 10:36:12 +08:00
liulinyan 5408374d63 Merge branch 'bugfix/ble_mesh_macro_OR_v3.3' into 'release/v3.3'
ble_mesh: stack: Fix using wrong | for OR between macros (v3.3)

See merge request espressif/esp-idf!16212
2021-12-02 00:27:56 +00:00
Jiang Jiang Jian 10db99e449 Merge branch 'bugfix/fix_modem_sleep_hw_error_mr_3.3' into 'release/v3.3'
Update esp32-bt-lib

See merge request espressif/esp-idf!16203
2021-12-01 15:41:06 +00:00
Jiang Jiang Jian 2c7b20ff13 Merge branch 'bugfix/ble_mesh_proxy_client_net_resend_v3.3' into 'release/v3.3'
ble_mesh: stack: Fix proxy client may fail to resend msg (v3.3)

See merge request espressif/esp-idf!16215
2021-12-01 14:21:25 +00:00
Jiang Jiang Jian 3078e504e3 Merge branch 'bugfix/heartbeat_filter_with_acceptlist_v3.3' into 'release/v3.3'
ble_mesh: stack: Fix heartbeat filter with accept list (v3.3)

See merge request espressif/esp-idf!15687
2021-12-01 14:20:59 +00:00
Jiang Jiang Jian ab6c21dd1f Merge branch 'bugfix/ble_mesh_node_set_name_status_check_v3.3' into 'release/v3.3'
ble_mesh: stack: Remove node set device name return status check (v3.3)

See merge request espressif/esp-idf!16214
2021-12-01 12:08:33 +00:00
liulinyan 2d572e2c15 Merge branch 'bugfix/ble_mesh_prov_use_diff_rand_v3.3' into 'release/v3.3'
ble_mesh: stack: Use different random for each provisioning (v3.3)

See merge request espressif/esp-idf!16216
2021-12-01 11:55:53 +00:00
liulinyan 94bbb4185c Merge branch 'update/ble_mesh_set_hsl_states_v3.3' into 'release/v3.3'
ble_mesh: stack: Enable updating lighting hsl state (v3.3)

See merge request espressif/esp-idf!16213
2021-12-01 11:50:13 +00:00
Yang Zhao ccc2ce93d6 Update esp32-bt-lib
It is abnormal when getting the deep sleep state bit. So we need to check
the state again and run the "ble_master_soft_rst()" if needed.
2021-12-01 17:45:18 +08:00
lly 24a79107d7 ble_mesh: stack: Use different random for each provisioning 2021-12-01 16:24:36 +08:00
lly 2840a77b0e ble_mesh: stack: Fix proxy client may fail to resend msg 2021-12-01 16:23:48 +08:00
lly 720be0f23f ble_mesh: stack: Remove node set device name return status check 2021-12-01 16:14:45 +08:00
lly cdf0e89a09 ble_mesh: stack: Enable updating lighting hsl state 2021-12-01 16:13:39 +08:00
lly bd5552faec ble_mesh: stack: Fix using wrong | for OR between macros 2021-12-01 16:11:20 +08:00
wangjialiang e85fc1f9c5 ble_mesh: stack: Fix heartbeat filter with accept list 2021-12-01 15:13:53 +08:00
Jiang Jiang Jian 46c4842c0e Merge branch 'bugfix/enable_gpio_20_v3.3' into 'release/v3.3'
gpio: Enable IO20 on ESP32 (backport v3.3)

See merge request espressif/esp-idf!15029
2021-12-01 05:59:34 +00:00
Jiang Jiang Jian 4baf48074c Merge branch 'feat/ble_mesh_support_ble_scan_v3.3' into 'release/v3.3'
ble_mesh: stack: Add BLE scan callback when mesh is enabled (v3.3)

See merge request espressif/esp-idf!13941
2021-12-01 05:56:29 +00:00
Wang Meng Yang e774f217b6 Merge branch 'bugfix/fix_static_check_error_mr_3.3' into 'release/v3.3'
Fix the high-impact issues from the code analysis report from customer

See merge request espressif/esp-idf!16155
2021-12-01 03:49:46 +00:00
Wang Meng Yang 0677774a52 Merge branch 'bugfix/leedarson_v3.3' into 'release/v3.3'
component_bt: Fix some code logic errors (v3.3)

See merge request espressif/esp-idf!16041
2021-12-01 03:49:37 +00:00
xiongweichao e21bfde305 Missing break in switch 2021-11-30 15:53:24 +08:00
xiongweichao 745e7e25c8 already defined in bt_target.h 2021-11-30 15:53:24 +08:00
xiongweichao b6f9c4b62a Dereference after null check 2021-11-30 15:53:24 +08:00
xiongweichao d0dd9d446c Dereference before null check 2021-11-30 15:53:24 +08:00
xiongweichao 0755078ee6 Logically dead code 2021-11-30 15:53:24 +08:00
Yang Zhao 63bd02b1d8 Fix the high-impact issues from the code analysis report from customer 2021-11-26 17:44:40 +08:00
Anton Maklakov 42fd5a948a Merge branch 'feature/docker_build_use_git_mirror_v3.3' into 'release/v3.3'
ci: use LOCAL_GIT_MIRROR in docker build job, if set (v3.3)

See merge request espressif/esp-idf!16114
2021-11-25 05:34:02 +00:00
Ivan Grokhotkov 86f31403e5 ci: use LOCAL_GIT_MIRROR in docker build job, if set
When the build runner has a local git mirror configured via
LOCAL_GIT_MIRROR variable, use that mirror when cloning IDF insider
the docker build job. Follows similar logic for
LOCAL_GITLAB_HTTPS_HOST, which is used for geo nodes.
2021-11-24 15:49:34 +01:00
Roland Dobai a6a39dbb41 Merge branch 'docs/fix_oocd_debug_level_opt_v3.3' into 'release/v3.3'
docs: Fixes OpenOCD debug level option (v3.3)

See merge request espressif/esp-idf!16063
2021-11-24 08:38:33 +00:00
Jiang Jiang Jian bdcc2cb638 Merge branch 'mesh/esp_mesh_send_block_time_v3.3' into 'release/v3.3'
esp_wifi_mesh: add esp_mesh_send_block_time to set blocking time of esp_mesh_send(backport v3.3)

See merge request espressif/esp-idf!13412
2021-11-24 08:37:20 +00:00
Roland Dobai 84ef653a1e Merge branch 'feature/oocd_ver_upgrade_v3.3' into 'release/v3.3'
tools: Updates OpenOCD version to 'v0.10.0-esp32-20211111' (v3.3)

See merge request espressif/esp-idf!16003
2021-11-24 08:35:46 +00:00
Sudeep Mohanty 6a18dba4cd Merge branch 'bugfix/ringbuf_read_pointer_wrap_v3.3' into 'release/v3.3'
ringbuf: Fix bug where comparision between a signed and unsigned operand resulted in incorrect free size for no-split/allow-split buffers (v3.3)

See merge request espressif/esp-idf!15893
2021-11-24 06:55:52 +00:00
Alexey Gerenkov a132363390 idf_tools: Adds 'linux-armhf' platform support 2021-11-23 12:04:47 +03:00
Alexey Gerenkov c985e5567a tools: Updates OpenOCD version to 'v0.10.0-esp32-20211111' 2021-11-23 12:04:47 +03:00
Alexey Gerenkov c2c33ac9a5 docs: Fixes OpenOCD debug level option 2021-11-23 11:50:54 +03:00
Anton Maklakov fb3dd453df Merge branch 'feature/ci_runner_failure_retries_v3.3' into 'release/v3.3'
ci: runner system failure retries (v3.3)

See merge request espressif/esp-idf!15729
2021-11-19 08:02:28 +00:00
Sudeep Mohanty 6e0fae9878 ringbuf: Fix bug where comparision between a signed and unsigned operand resulted in incorrect free size for no-split/allow-split buffers
This commit fixes a bug in no-split and allow-split ring buffers free buffer size calculation.
When the free size available in the buffers less than the size of one item header,
the function prvGetCurMaxSizeNoSplit/AllowSplit() incorrectly returned the maxItemSize instead of 0.
This is due to the comparision between a negative and a positive value
where both operands are treated as unsigned during the comparision operation,
thereby treating the negative operand as a large integer.

Also added new unit tests to test buffer-full and almost-full conditions
where this scenario is likely to be hit.

Closes https://github.com/espressif/esp-idf/issues/7344
Closes https://github.com/espressif/esp-idf/pull/7371
2021-11-18 15:31:57 +05:30
Wang Meng Yang 4cc7a85701 Merge branch 'bugfix/remove_assert_when_inq_done_3.3' into 'release/v3.3'
component_bt: fix crash after inquiry has finished (v3.3)

See merge request espressif/esp-idf!15683
2021-11-16 04:55:50 +00:00
Michael (XIAO Xufeng) 7a49a131d3 Merge branch 'feature/support_for_esp32_pico_v3_02_v3.3' into 'release/v3.3'
psram: support for esp32-pico-v3-02 (backport v3.3)

See merge request espressif/esp-idf!14156
2021-11-15 06:14:37 +00:00
xiongweichao 7b5456dd27 1. Fix the scan failed issue.
2. Fix connection failed with LG 5.0 phone
3. Remove assert when inquiry done
2021-11-11 11:54:00 +08:00
Chinmay Chhajed 20aec9c113 Merge branch 'bugfix/ble_conn_latency_max_value_v3.3' into 'release/v3.3'
BLE: Set connection max latency value to 499.

See merge request espressif/esp-idf!15760
2021-11-05 08:06:45 +00:00
Island 77619bafca Merge branch 'bugfix/ble_mesh_host_init_v3.3' into 'release/v3.3'
ble_mesh: nimble: return error if init host twice (v3.3)

See merge request espressif/esp-idf!15791
2021-11-05 03:13:49 +00:00
Island 0e8e3f3d28 Merge branch 'bugfix/sig_ble_mesh_errata_e16350_v3.3' into 'release/v3.3'
ble_mesh: stack: Apply the errata E16350 from Bluetooth SIG (v3.3)

See merge request espressif/esp-idf!15787
2021-11-05 03:10:03 +00:00
lly db313f2c00 ble_mesh: nimble: return error if init host twice 2021-11-03 19:21:27 +08:00
lly 95e27869f8 ble_mesh: stack: Apply the errata E16350 from Bluetooth SIG 2021-11-03 19:17:09 +08:00
Chinmay Chhajed ebc93210a1 BLE: Set connection max latency value to 499. 2021-11-01 17:25:40 +05:30
Anton Maklakov 1d5a967c4c ci: Add retries on runner system failures 2021-11-01 14:26:22 +07:00
shenjun 37e2e7599a esp_wifi_mesh: add esp_mesh_send_block_time to set blocking time of esp_mesh_send
1. fix the issue that layer2 node connect to lower-layer node when FIXED-ROOT root disappeared
2. add esp_mesh_send_block_time to set blocking time of esp_mesh_send
2021-11-01 15:20:54 +08:00
Anton Maklakov cc2e952edb Merge branch 'bugfix/yaml_loader_parameter_3.3' into 'release/v3.3'
ci: fix Loader parameter in yaml.loader() (3.3)

See merge request espressif/esp-idf!15746
2021-11-01 07:12:39 +00:00
Chen Yu Dong 678275045f ci: Fix Loader parameter in yaml.loader() 2021-11-01 11:44:55 +08:00
Anton Maklakov e0e1fab0ab Merge branch 'bugfix/support_py34-35_cffi_v3.3' into 'release/v3.3'
Tools: Constrain the cffi package for older pythons (v3.3)

See merge request espressif/esp-idf!15633
2021-10-26 09:29:33 +00:00
Sergei Silnov 77799ec529 Tools: Constrain the cffi package for older pythons 2021-10-25 12:39:20 +02:00
luchangjie c8f2193515 fix ble mesh send problem 2021-10-25 16:59:43 +08:00
Wang Meng Yang ff8531b08e Merge branch 'bugfix/bt_x_component_key_check_v3.3' into 'release/v3.3'
BT: Check only for same X component of public key in BR/EDR. (3.3)

See merge request espressif/esp-idf!15594
2021-10-25 02:33:39 +00:00
Chinmay Chhajed 6b64edca6d BT: Check only for same X component of public key in BR/EDR. 2021-10-21 13:38:16 +05:30
Anton Maklakov 15c97b5a58 Merge branch 'bugfix/retry_download_submodule_v3.3' into 'release/v3.3'
ci: retry download from Gitlab on error 500 (v3.3)

See merge request espressif/esp-idf!15562
2021-10-20 08:23:49 +00:00
Ivan Grokhotkov ab4613cadf ci: revert type annotations in gitlab_api.py to python2 compatible 2021-10-19 19:54:42 +07:00
Ivan Grokhotkov 2c011b6256 ci: retry Gitlab operations on error 500 2021-10-19 19:54:36 +07:00
Fu Hanxi a100174f47 ci: retry download artifacts 2021-10-19 19:53:28 +07:00
Ivan Grokhotkov f4909b8ac6 ci: fetch submodules from mirror, if enabled 2021-10-19 19:53:28 +07:00
Fu Hanxi 8340d36359 ci: retry download if catched IOError/EOFError 2021-10-19 19:53:28 +07:00
Anton Maklakov 4734765745 Merge branch 'ci/fix_deploy_docs_preview_url_v3.3' into 'release/v3.3'
ci: update docs preview url (v3.3)

See merge request espressif/esp-idf!15513
2021-10-19 11:51:01 +00:00
Marius Vikhammer e0ef3bb303 ci: update docs preview url 2021-10-14 14:38:18 +08:00
Roland Dobai 38d328b566 Merge branch 'bugfix/constrain_cryptography_v3.3' into 'release/v3.3'
Tools: Constrain the cryptography package version in order to avoid breaking changes (v3.3)

See merge request espressif/esp-idf!15464
2021-10-11 07:21:56 +00:00
Mahavir Jain 8a53a75ac3 Merge branch 'fix/update_https_example_root_certificate_v3.3' into 'release/v3.3'
Updated the root certificate of https examples (v3.3)

See merge request espressif/esp-idf!15441
2021-10-11 04:00:57 +00:00
Roland Dobai 638b7f5ff4 Tools: Constrain the cryptography package for avoiding breaking changes
The cryptography 35 release causes breaking changes. Some of
certificates are rendered invalid and the package cannot be build
without rust. See
https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst#3500---2021-09-29
for more details.
2021-10-10 19:27:22 +02:00
Harshit Malpani 881522c9b8 Update example test for esp_http_client 2021-10-07 17:24:20 +05:30
Harshit Malpani 7b271ac0ce Updated the root certificate of https examples 2021-10-07 17:09:41 +05:30
Mahavir Jain e72de12566 Merge branch 'feature/upgrade_nghttp2_component_v3.3' into 'release/v3.3'
nghttp2: upgrade to v1.41.0 release (v3.3)

See merge request espressif/esp-idf!15346
2021-10-05 05:40:18 +00:00
Vikram Dattu 03fc607492 Fixed broken http2_request example.
Implementation of `esp_tls_conn_new_sync` now uses timeout_ms value to
give up retries.

Specified this value to be 10 sec. (10 * 1000 ms).

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2021-09-29 09:48:47 +05:30
Mahavir Jain c6106b5ac0 nghttp2: upgrade to v1.41.0 release
Detailed changelog:
https://github.com/nghttp2/nghttp2/releases/tag/v1.41.0

Closes: https://github.com/espressif/esp-idf/issues/4883
Closes IDFGH-2821
2021-09-24 17:48:25 +05:30
lly 3924ca8f03 ble_mesh: ci: Add ble & ble mesh coex sdkconfig test files 2021-09-10 11:27:13 +08:00
lly 53d1eda84c ble_mesh: stack: Support reporting normal ble adv packets 2021-09-10 11:27:13 +08:00
lly e742889689 ble_mesh: stack: Add a btc file for ble coex functions
Previously if starting/stopping BLE advertising when BLE Mesh
is enabled, the corresponding events will be notified through
the callback registered by esp_ble_mesh_register_prov_callback().

With this commit, the func esp_ble_mesh_register_ble_callback()
needs to be invoked for resgitering the callback used for BLE
coexistence related functionalities (i.e. ADV/SCAN).
2021-09-10 11:27:13 +08:00
lly 437b215e62 ble_mesh: stack: Move ble scan funcitons to a single file 2021-09-10 11:27:13 +08:00
lly 033a596810 ble_mesh: stack: Optimize handling received mesh adv packets 2021-09-10 11:27:13 +08:00
Roland Dobai b95e11939d Merge branch 'feature/oocd_ver_upgrade_v3.3' into 'release/v3.3'
tools: Updates OpenOCD version to 'v0.10.0-esp32-20210902' (v3.3)

See merge request espressif/esp-idf!15136
2021-09-09 10:23:30 +00:00
Alexey Gerenkov c571273674 tools: Updates OpenOCD version to 'v0.10.0-esp32-20210902' 2021-09-08 21:29:26 +03:00
Wang Meng Yang b1d235ebb5 Merge branch 'bugfix/controller_hci_uart_sdkconfig_v3.3' into 'release/v3.3'
controller_hci_uart: fixed the sdkconfig.defaults in the example(backport v3.3)

See merge request espressif/esp-idf!14810
2021-09-08 06:06:04 +00:00
Wang Meng Yang 2a4b854a6d Merge branch 'bugfix/hf_disc_acl_no_disc_v3.3' into 'release/v3.3'
bugfix/acl can't disconnect when hfp_client disconnect [release/v3.3]

See merge request espressif/esp-idf!15060
2021-09-07 10:13:22 +00:00
Wang Meng Yang 3b30f7044c Merge branch 'bugfix/bt_spp_timer_collision_v3.3' into 'release/v3.3'
Fix timer collision in role switch(v3.3)

See merge request espressif/esp-idf!14822
2021-09-06 10:06:03 +00:00
Mahavir Jain c9033019f9 Merge branch 'feature/update_cjson_submodule_v3.3' into 'release/v3.3'
cJSON: Update submodule to v1.7.15 (v3.3)

See merge request espressif/esp-idf!15078
2021-09-06 09:50:53 +00:00
Wang Meng Yang ca87b35cf1 Merge branch 'bugfix/spp_connect_20_fail_v3.3' into 'release/v3.3'
component_bt: fix spp acceptor deadlock

See merge request espressif/esp-idf!14111
2021-09-06 09:38:44 +00:00
Mahavir Jain 216d0777fd Merge branch 'feature/update_expat_v3.3' into 'release/v3.3'
expat: Update library from 2.2.9 to 2.4.1(backport v3.3)

See merge request espressif/esp-idf!15072
2021-09-06 04:01:12 +00:00
jincheng 98cf27dbf8 fix timer collision in role switch 2021-09-06 10:36:54 +08:00
Shubham Kulkarni 63b2ca84c4 cJSON: Update submodule to latest release.
This update fixes NULL pointer dereference issues in previous release

Closes https://github.com/espressif/esp-idf/issues/7317
2021-09-06 07:45:57 +05:30
yuanjm 6f0848aa3d expat: Update library from 2.2.9 to 2.4.1 2021-09-03 19:28:02 +08:00
jincheng f4ce4efdb8 fix acl can not disconnect when hf_client disconnect 2021-09-03 11:03:52 +08:00
Alberto García Hierro aafbb8f5a8 Enable IO20 on ESP32
Some newer ESP32 variants (like ESP32-PICO-V3 and ESP32-PICO-MINI-02)
do implement this pin and it can be used as a normal GPIO.

Fixes #6016
Fixes #6837

Closes https://github.com/espressif/esp-idf/pull/6918

(cherry picked from commit 6deaefde69)
2021-09-01 10:48:59 +08:00
Wang Meng Yang e173e47322 Merge branch 'bugfix/SCO_connect_fail_after_peer_not_accept_sniff_v3.3' into 'release/v3.3'
bugfix/unable to initiate SCO connection when peer device not accept sniff mode (v3.3)

See merge request espressif/esp-idf!14399
2021-08-23 05:19:36 +00:00
Jiang Jiang Jian 07167c8c7b Merge branch 'bugfix/spp_memory_leak_v3.3' into 'release/v3.3'
Fix spp memory leak(v3.3)

See merge request espressif/esp-idf!14866
2021-08-20 02:51:59 +00:00
xiongweichao a6c52e1924 components/bt: fix spp memory leak 2021-08-19 14:53:20 +08:00
xiongweichao 873a759f48 fix spp acceptor deadlock 2021-08-19 08:11:44 +08:00
Island 6a2d7ef994 Merge branch 'bugfix/ble_mesh_cve_recommendation_v3.3' into 'release/v3.3'
ble_mesh: Update the SIG recommendations for CVE issues (v3.3)

See merge request espressif/esp-idf!14845
2021-08-18 12:42:36 +00:00
lly 71fc9de66b ble_mesh: Update the SIG recommendations for CVE issues 2021-08-18 11:01:17 +08:00
wangmengyang c631fdf33c controller_hci_uart: fixed the sdkconfig.defaults in the example 2021-08-16 16:39:43 +08:00
Zim Kalinowski 44e9dd3e29 Merge branch 'feature/skip_known_failure_cases_v3.3' into 'release/v3.3'
CI: Ignore Known Failure Cases Result (v3.3)

See merge request espressif/esp-idf!14652
2021-08-10 02:31:41 +00:00
Fu Hanxi 41a9d01ee5 feat(tiny_test_fw): ignore known failure cases result
py
2021-08-10 10:31:36 +08:00
Roland Dobai f189ba5883 Merge branch 'feature/oocd_ver_upgrade_v3.3' into 'release/v3.3'
tools: Updates OpenOCD version to 'v0.10.0-esp32-20210721' (v3.3)

See merge request espressif/esp-idf!14697
2021-08-09 15:01:11 +00:00
Alexey Gerenkov dafc6c27b7 tools: Updates OpenOCD version to 'v0.10.0-esp32-20210721' 2021-08-06 21:42:18 +03:00
Zim Kalinowski c406655e47 Merge branch 'bugfix/freertos_ut_suspend_v3.3' into 'release/v3.3'
freertos: Increases delta for UT - Test suspend-resume CPU. The number of... (v3.3)

See merge request espressif/esp-idf!14634
2021-08-05 05:12:02 +00:00
KonstantinKondrashov 8c987d0f04 freertos: Increases delta for UT - Test suspend-resume CPU. The number of tick_hook should be the same for both CPUs 2021-08-03 15:35:20 +05:00
Zim Kalinowski c621ea7c8c Merge branch 'bugfix/uart_sw_sw_flow_error_typo_v3.3' into 'release/v3.3'
uart: fix typo in error message (v3.3)

See merge request espressif/esp-idf!14617
2021-08-03 02:25:25 +00:00
Marius Vikhammer d5447f197d uart: fix typo in error message
Closes https://github.com/espressif/esp-idf/issues/7360
2021-08-03 09:31:12 +08:00
Krzysztof Budzynski 30d1564b3c Merge branch 'feature/self_hosted_v3.3' into 'release/v3.3'
docs: self host docs (v3.3)

See merge request espressif/esp-idf!12103
2021-07-30 11:13:14 +00:00
Marius Vikhammer 38b0870fab docs: self host docs
Move doc hosting from readthedocs to espressif servers

Update CI, Sphinx configs and add IDF Sphinx theme
2021-07-30 19:13:08 +08:00
Anton Maklakov 09840aeeaa Merge branch 'bugfix/ttfw_fix_flush_index_error_v3.3' into 'release/v3.3'
test: TTFW fix flush index error (v3.3)

See merge request espressif/esp-idf!14266
2021-07-30 06:35:24 +00:00
aleks e1374b9c7c freemodbus: add affinity option for modbus stack tasks 2021-07-28 10:07:17 +02:00
Mahavir Jain 8f0bcc570a Merge branch 'bugfix/fix_truncated_headers_for_esp_http_client_v3.3' into 'release/v3.3'
esp_http_client: Fix header truncated when responded header length over buffer_size (backport v3.3)

See merge request espressif/esp-idf!14387
2021-07-28 07:10:49 +00:00
yuanjm c47854f1fc esp_http_client: Optimize code structure 2021-07-27 20:01:05 +08:00
Clickau 4b07e33a12 esp_http_client: fix truncated headers
Signed-off-by: yuanjm <yuanjianmin@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/6370
2021-07-27 20:01:05 +08:00
Mahavir Jain f69d7cafce Merge branch 'fix/memory_leaks_identified_by_cppcheck_v3.3' into 'release/v3.3'
Fix/memory leaks identified by cppcheck (v3.3)

See merge request espressif/esp-idf!14505
2021-07-26 04:04:06 +00:00
Alex Henrie 5401610a4e Fix memory leak on error path in http_header_set_format 2021-07-25 07:59:27 +05:30
Alex Henrie f1ba2b3e3a Fix memory leak on error path in md5_printf 2021-07-25 07:59:10 +05:30
Jakob Hasse b2a9dc283b Merge branch 'bugfix/esp_event_any_id_unregister_3.3' into 'release/v3.3'
ESP Event: fix unregister documentation (backport 3.3)

See merge request espressif/esp-idf!14435
2021-07-23 07:49:09 +00:00
Roland Dobai 30f6bbf218 Merge branch 'ci/rename_test_log_path_v3.3' into 'release/v3.3'
CI: rename log path of IT jobs (v3.3)

See merge request espressif/esp-idf!14456
2021-07-22 13:22:12 +00:00
Zim Kalinowski c43792e792 Merge branch 'docs/fix_readme_links_v3.3' into 'release/v3.3'
docs: fixed dead readme links (v3.3)

See merge request espressif/esp-idf!14468
2021-07-22 02:43:00 +00:00
aleks a7ce9603de freemodbus: fix uart_wait_tx_done() reenable tx_done interrupt 2021-07-21 15:31:08 +02:00
Marius Vikhammer cc40b77c4c docs: fixed dead readme link 2021-07-21 17:45:12 +08:00
Mahavir Jain b37d504cd0 Merge branch 'feature/upgrade_mbedtls_to_v3.3' into 'release/v3.3'
mbedtls: upgrade to release v2.16.11 (v3.3)

See merge request espressif/esp-idf!14441
2021-07-21 09:44:08 +00:00
He Yin Ling 5f251dfc70 CI: rename log path of IT jobs 2021-07-21 10:37:03 +08:00
Mahavir Jain 08d29e2aaa mbedtls: upgrade to release v2.16.11
For detailed release notes please refer to:
https://github.com/ARMmbed/mbedtls/releases/tag/v2.16.11
2021-07-20 14:43:06 +05:30
Jakob Hasse 352fb9168a [esp_event]: fixed and improved docs
* Description of unregistering was incorrect
* Made clear that event loop arg mustn't be NULL
* Added parameter check in create function

Closes https://github.com/espressif/esp-idf/issues/6761
Closes IDFGH-4969
2021-07-20 16:09:53 +08:00
Jiang Jiang Jian fb3b6e0094 Merge branch 'bugfix/a2dp_deint_crash_v3.3' into 'release/v3.3'
component_bt: fix a2dp deinit crash(v3.3)

See merge request espressif/esp-idf!14422
2021-07-20 03:20:10 +00:00
xiongweichao e793571cc4 Not initialized or in the process of de-initialization, calling API will return ERR 2021-07-19 21:53:55 +08:00
xiongweichao b1985c2392 fix a2dp deinit crash 2021-07-19 21:53:49 +08:00
Mahavir Jain 28669ca32a Merge branch 'bugfix/update_ota_cert_v3.3' into 'release/v3.3'
OTA examples: Update server certificate (v3.3)

See merge request espressif/esp-idf!14358
2021-07-19 07:30:05 +00:00
xiongweichao cd40b05bd0 Add remove sniff when peer not accepted sniff mode 2021-07-19 10:53:23 +08:00
Chinmay Chhajed 4b81abe053 bt/controller: Fix for BLE ACL tx flush issue during reset. 2021-07-19 10:53:23 +08:00
Yang Zhao af8e81d18e 1.If the scan window set as 4 slots and the scan interval set as 5 slots,
then the device will crash when starting scanning.This commit is to fix this bug.
2.Remove duplicate events in r_lld_evt_end
2021-07-19 10:53:23 +08:00
Zim Kalinowski 700eee91ca Merge branch 'bugfix/prefetch_invalid_v3.3' into 'release/v3.3'
soc: add dummy bytes to ensure instr prefetch always valid (v3.3)

See merge request espressif/esp-idf!12997
2021-07-19 01:42:17 +00:00
Zim Kalinowski 41676c779c Merge branch 'docs/spi_max_transfer_sz_limit_v3.3' into 'release/v3.3'
spi_docs: Fixed the default value of max_transfer_sz_limit (backport v3.3)

See merge request espressif/esp-idf!14256
2021-07-16 05:57:32 +00:00
Zim Kalinowski 624eaf4d06 Merge branch 'nimble/fix_broadcaster_role_v3.3' into 'release/v3.3'
NimBLE: Fix build error for broadcaster role and bug in peer_dev_record (v3.3)

See merge request espressif/esp-idf!14306
2021-07-16 05:56:28 +00:00
Shubham Kulkarni fcca83efff OTA examples: Updated server certificate 2021-07-14 12:53:08 +05:30
Roland Dobai bcf14bca1e Merge branch 'bugfix/eclipse_make_decode_v3.3' into 'release/v3.3'
tools: Fix Eclipse build: “UnicodeDecodeError: 'ascii' codec can't decode byte” (v3.3)

See merge request espressif/esp-idf!12361
2021-07-13 15:34:50 +00:00
Prasad Alatkar 3deffb785f NimBLE: Fix build error for broadcaster role and bug in peer_dev_record (v3.3)
* Fix bug in nvs deletion of `ble_dev_record`.
* Update NimBLE submodule to nimble-1.1.0-idf-v3.3.
2021-07-13 13:55:37 +08:00
Angus Gratton bfd4f8646e Merge branch 'bugfix/mitigate_test_time_adjustment_happens_linearly_v3.3' into 'release/v3.3'
newlib: Mitigate UT - time adjustment happens linearly

See merge request espressif/esp-idf!14309
2021-07-13 04:31:44 +00:00
Mahavir Jain e2015eb371 Merge branch 'bugfix/heap_trace_invalid_addr_v3.3' into 'release/v3.3'
heap: fix backtrace termination (v3.3)

See merge request espressif/esp-idf!13899
2021-07-12 12:23:00 +00:00
Zim Kalinowski d93ad78b46 Merge branch 'feature/regi2c_add_lock_v3.3' into 'release/v3.3'
regi2c: add a spinlock for accessing (reg)I2C devices (backport v3.3)

See merge request espressif/esp-idf!13717
2021-07-09 07:34:18 +00:00
Marius Vikhammer 5b91a8173e soc: add dummy bytes to ensure instr prefetch always valid
The CPU might prefetch instructions, which means it in some cases
will try to fetch instruction located after the last instruction in
flash.text.

Add dummy bytes to ensure fetching these wont result in an error,
 e.g. MMU exceptions
2021-07-09 14:40:24 +08:00
KonstantinKondrashov 04a6aae1d1 newlib: Mitigate UT - time adjustment happens linearly 2021-07-08 19:21:44 +05:00
Jiang Jiang Jian ee3e817a93 Merge branch 'ajust_espnow_channel_config_range_v3.3' into 'release/v3.3'
ajust espnow channel range

See merge request espressif/esp-idf!13685
2021-07-07 03:25:53 +00:00
He Yin Ling 9d075a728a ttfw: fix incorrect length when flush data cache after expect:
data cache is unicode. while we use bytes in RegEx expect. The index of
matched pattern is calculated with bytes, could be different from
unicode. Now we fix this issue by using unicode in expect.
2021-07-05 20:19:00 +08:00
Michael (XIAO Xufeng) b59c06c107 spi_docs: Fixed the default value of max_transfer_sz.
(cherry picked from commit e89fabb963)
2021-07-05 14:36:46 +08:00
Ivan Grokhotkov 789914a405 Merge branch 'bugfix/cmake_export_ver_during_reqs_expansion_v3.3' into 'release/v3.3'
cmake: set IDF_VERSION_* variables at requirement expansion stage (v3.3)

See merge request espressif/esp-idf!14047
2021-07-02 12:50:46 +00:00
Krzysztof Budzynski 81befb2330 Merge branch 'docs/windows_installer_2.9_backport_3.3' into 'release/v3.3'
docs: update Windows Tools 2.9 installation - backport 3.3

See merge request espressif/esp-idf!14193
2021-07-02 05:52:22 +00:00
Juraj Michálek 594d681aae docs: update Windows Tools 2.9 installation 2021-06-30 12:51:12 +02:00
He Yin Ling a6176fa73e Merge branch 'test/merge_ble_mesh_node_and_provioner_in_console_v3.3' into 'release/v3.3'
Test:merge ble mesh node and provioner in console(backport v3.3)

See merge request espressif/esp-idf!9910
2021-06-30 06:14:43 +00:00
Lu Chang Jie 9dd12683e6 test: merge ble mesh node and provioner in console 2021-06-30 14:14:36 +08:00
Michael (XIAO Xufeng) 69af3d2a72 Merge branch 'bugfix/fix_adc-dma_reading_gap_for_esp32_backport_v3.3' into 'release/v3.3'
bugfix(adc): missing ranges of ADC codes in ESP32 (backport v3.3)

See merge request espressif/esp-idf!12876
2021-06-27 13:31:24 +00:00
chenjianqiang bc60eb65e2 psram: support for esp32-pico-v3-02
1. Support for 16Mbit PSRAM
2. Support for esp32-pico-v3-02
3. Use package identifier to look up SPI flash/PSRAM WP Pin, unless overridden

Closes https://github.com/espressif/esp-idf/issues/7189
2021-06-25 17:54:42 +08:00
Angus Gratton a130da9e79 Merge branch 'feature/ci_release_zips_v3.3' into 'release/v3.3'
ci: Use GitHub Actions to generate recursive source code zips for releases (v3.3)

See merge request espressif/esp-idf!13203
2021-06-24 23:43:27 +00:00
Jiang Jiang Jian b403b0dbd5 Merge branch 'bugfix/fix_amsdu_fragment_vulnerability_v3.3' into 'release/v3.3'
esp_wifi: fix amsdu & fragment vulnerabilities(v3.3)

See merge request espressif/esp-idf!14100
2021-06-24 09:50:38 +00:00
Mahavir Jain 557525eeb9 Merge branch 'bugfix/http_client_test_memcorupt_v3.3' into 'release/v3.3'
ci/test: Fix esp_http_client test not to use pointer after free (v3.3)

See merge request espressif/esp-idf!13706
2021-06-23 14:11:50 +00:00
Wang Meng Yang 26d8690525 Merge branch 'bugfix/ble_set_scan_param_error_v3.3' into 'release/v3.3'
Fix the bug when ble setting scan param

See merge request espressif/esp-idf!13980
2021-06-23 09:11:59 +00:00
Ivan Grokhotkov cba17ebc0a Merge branch 'feature/codeowners_v3.3' into 'release/v3.3'
add simplified CODEOWNERS file for older release branches (v3.3)

See merge request espressif/esp-idf!14094
2021-06-23 08:07:13 +00:00
David Cermak 1de77f5412 ci/test: Fix esp_http_client test not to use pointer after free 2021-06-23 08:39:42 +02:00
ChenJianxing 671ab9223c esp_wifi: fix amsdu & fragment vulnerabilities 2021-06-22 20:48:37 +08:00
Ivan Grokhotkov ec14f20421 add simplified CODEOWNERS file for older release branches 2021-06-22 09:23:52 +02:00
Angus Gratton 760ea137ee Merge branch 'bugfix/driver_spi_poll_test_stack_v3.3' into 'release/v3.3'
driver test: Increase stack for the "spi poll tasks" test (v3.3)

See merge request espressif/esp-idf!13810
2021-06-22 04:14:08 +00:00
Krzysztof Budzynski 6e136860ae Merge branch 'bugfix/make_docs_ldgen_v3.3' into 'release/v3.3'
docs: remove quotes in ldgen documentation for adding fragment file (v3.3)

See merge request espressif/esp-idf!14004
2021-06-22 03:28:03 +00:00
Anton Maklakov 6731c9daf3 Merge branch 'bugfix/iperf_basic_test_not_running' into 'release/v3.3'
CI: fix iperf basic test not running issue

See merge request espressif/esp-idf!13986
2021-06-22 03:19:42 +00:00
Island 708b72190f Merge branch 'feat/ble_mesh_make_unprov_beacon_interval_configurable_v3.3' into 'release/v3.3'
Feat/ble mesh make unprov beacon interval configurable (v3.3)

See merge request espressif/esp-idf!14067
2021-06-21 11:39:57 +00:00
wangjialiang 411abfd70f ble_mesh: stack: Fix crash for net_key_del when subnet is NULL 2021-06-21 14:57:17 +08:00
wangjialiang 84dd05439d ble_mesh: stack: Make unprovisioned beacon interval configurable.
Closes https://github.com/espressif/esp-idf/issues/6722
2021-06-21 14:55:10 +08:00
Ivan Grokhotkov b82577168a cmake: set IDF_VERSION_* variables at requirement expansion stage
Currently IDF_VERSION_* variables are not available to the component
CMakeLists.txt files at the requirements expansion stage. This makes
it harder to write component CMakeLists files compatible with
different IDF versions.

Include version.cmake from the requirements expansion script, add a
build system test.
2021-06-18 15:37:34 +02:00
Island f5fc806588 Merge branch 'bugfix/AuthValue_leak_v3.3' into 'release/v3.3'
ble_mesh: stack: Fix AuthValue Leak and Predictable AuthValue in Bluetooth... (v3.3)

See merge request espressif/esp-idf!14006
2021-06-18 09:02:29 +00:00
wangjialiang 35bbd1ba26 ble_mesh: stack: Fix AuthValue Leak and Predictable AuthValue in Bluetooth Mesh Provisioning Leads to MITM 2021-06-17 17:21:01 +08:00
Krzysztof 9d324fecb7 docs: remove quotes in ldgen documentation for adding fragment file 2021-06-17 10:07:04 +02:00
Island b3827a4b74 Merge branch 'bugfix/impersonation_attacks_and_AuthValue_disclosure_v3.3' into 'release/v3.3'
ble_mesh: stack: Add check the value of Provisioning Random & Confirmation... (v3.3)

See merge request espressif/esp-idf!13928
2021-06-17 03:39:23 +00:00
wangjialiang 78676e7a02 ble_mesh: stack: Add check the value of Provisioning Random & Confirmation sent and received by provisioner 2021-06-16 21:28:10 +08:00
Chen Yudong 4f0ab9ee73 ci: fix iperf basic test not running issue 2021-06-16 15:49:08 +08:00
Yang Zhao 77c7d3be1c bugfix:Set address resolution enable. If not set enable and the filter
policy is 2 or 3, the controller will reply with invalid param error.
2021-06-15 20:08:04 +08:00
He Yin Ling 1b076b5e42 Merge branch 'bugfix/python3_target_test_3.3' into 'release/v3.3'
CI: run target test with python3 (v3.3)

See merge request espressif/esp-idf!13460
2021-06-15 08:46:49 +00:00
Island b65a37795f Merge branch 'optimize/ble_mesh_miscellaneous_v3.3' into 'release/v3.3'
Optimize/ble mesh miscellaneous (v3.3)

See merge request espressif/esp-idf!13935
2021-06-10 09:21:49 +00:00
lly 9590db4cb6 ble_mesh: stack: Move bt_mesh_rand to mesh_common.c 2021-06-10 09:52:26 +08:00
lly b2bcbd5559 ble_mesh: stack: Remove useless BT_DBG_ENABLED in a few files 2021-06-10 09:52:09 +08:00
lly 94ca8b8917 ble_mesh: Replace zephyr integer types with C99 types [Zephyr] 2021-06-10 09:51:52 +08:00
lly 85ec75b970 ble_mesh: stack: Update ARRAY_SIZE definition 2021-06-10 09:50:27 +08:00
Chen Yudong a6fc744026 test: fix socket issue in iperf example test 2021-06-08 17:40:25 +08:00
He Yin Ling 35a7462e69 test: fix iperf example errors:
1. fix TypeError when running with python3
2. fix throughput chart x/y axis label error
3. make test case compatibile with iperf bin on earlier release branches
2021-06-08 17:40:14 +08:00
Chen Yudong 9703c1a32f CI: fix connection failures in asio example tests 2021-06-08 17:40:04 +08:00
Chen Yudong 62359f3442 ci: run target test with python3 2021-06-08 17:39:29 +08:00
Ivan Grokhotkov 19636db724 test: add a (non-automated) case for backtraces with ROM functions 2021-06-08 17:28:00 +10:00
Ivan Grokhotkov 11caa6fcf2 heap: recognize 0x40000000 as an address terminating the backtrace
On Xtensa, backtrace can not recover the two most significant bits of
the address, as the window call size is encoded in these bits.
Because of this, __builtin_return_address modifies these MSBs to
match those of the callee, "fixing" the address. An unfortunate side
effect is that the zero return address, which usually terminates the
backtrace, gets converted to 0x40000000. While there is a valid
instruction at this address, its occurrence in the backtrace is
highly unlikely: this is the first instruction of WindowOverflow4
vector, and IDF apps switch VECBASE to an IRAM location very early at
startup.
2021-06-08 17:28:00 +10:00
Angus Gratton ac6f6a3768 Merge branch 'bugfix/cmake_partition_md5sum_v3.3' into 'release/v3.3'
bugfix: Fix CMake partition md5sum generation (v3.3)

See merge request espressif/esp-idf!13884
2021-06-08 04:46:10 +00:00
Angus Gratton e2d6ce553d cmake: partition_table: Fix generation of MD5 for partition table when using CMake 2021-06-07 17:59:12 +10:00
Island cce139e5bd Merge branch 'bugfix/bt_impersonation_passkey_fix_v3.3' into 'release/v3.3'
Bluedroid: Check only x component of passkey to avoid passkey impersonation attack. (v3.3)

See merge request espressif/esp-idf!13762
2021-06-07 06:41:48 +00:00
Angus Gratton d7562e2b2c driver test: Increase stack for the "spi poll tasks" test
Current stack usage gets very close to overflowing
2021-06-07 02:11:26 +00:00
Wang Meng Yang c9cf530c51 Merge branch 'bugfix/invalid_feat_page_exec_v3.3' into 'release/v3.3'
bt controller: Fixed handling for invalid feature page.

See merge request espressif/esp-idf!13569
2021-06-07 01:35:22 +00:00
Angus Gratton 4e64cbb576 Merge branch 'bugfix/partition_table_integrity_check_v3.3' into 'release/v3.3'
paritition_table: Verify the partition table md5sum when loading in the app (v3.3)

See merge request espressif/esp-idf!13587
2021-06-04 08:26:21 +00:00
baohongde bb824d7a4b bugfix/fix crash when lmp flooding 2021-06-02 17:34:45 +08:00
baohongde 62a4a0dcaf Delete the option BLE ADV priority high
Fix controller task watchdog in Wi-Fi test
2021-06-02 14:44:09 +08:00
Angus Gratton 22487a65ac paritition_table: Verify the partition table md5sum when loading the app
Additionally, always enable the partition MD5 check if flash encryption is on in
Release mode. This ensures the partition table ciphertext has not been modified
(CVE-2021-27926).

The exception is pre-V3.1 ESP-IDF bootloaders and partition tables, which
don't have support for the MD5 entry.
2021-06-02 16:32:31 +10:00
gengyuchao 906dbd262e Backport: Fixed handling for invalid feature page. Add missing IRAM_ATTR in coex mode. 2021-06-02 11:55:42 +08:00
Wang Meng Yang f656c04d12 Merge branch 'bugfix/ble_timeout_disconnect_no_report_v3.3' into 'release/v3.3'
ble timeout disconnect but no report to host

See merge request espressif/esp-idf!13769
2021-06-02 02:51:17 +00:00
David Čermák 504a9e178f Merge branch 'feature/mqtt_intro_new_modes_v3.3' into 'release/v3.3'
MQTT:  Update submodule reference to support new config modes (v3.3)

See merge request espressif/esp-idf!13712
2021-06-01 05:55:43 +00:00
Ivan Grokhotkov c7add96e64 Merge branch 'bugfix/fix_idf_monitor_unicode_path_crash_v3.3' into 'release/v3.3'
tools: handle exception in case of logging Unicode characters (v3.3)

See merge request espressif/esp-idf!13045
2021-05-31 17:24:06 +00:00
David Cermak 4fce8182b9 MQTT: Update submodule reference to support new config modes
* Queueing publish messages to outbox when the client is not connected (default=off -> messages are queued if disconnected)
* Use of incremental msg-id instead of random id (default=off -> msg-id uses platform_random())
* Posting a new event-id if a queued message gets deleted from the outbox (default=off -> events are not posted)

Detailed description of included `esp-mqtt` changes
(da850b0add1e71b3659bfac5d797cc834dc3e89b...9ea804e0ab5368d5ab53ae2301a5fec9d1f12f1a)
* mqtt: Remove unused mqtt_header_state_t
  - esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/b7158a4aea69e95210a6dec5d1636f52a1795dbb
  - esp-mqtt MR: espressif/esp-mqtt!84
  - Merges https://github.com/espressif/esp-mqtt/pull/180
* Cleanup public include dirs
  - esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/f65d5d05db9b984065079e622e0adeac4c4c7db7
  - esp-mqtt MR: espressif/esp-mqtt!85
* Config: Add a new option to use incremental message id
  - esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/8bb4a26f46b9bb0b00f66d61671833a184fc7afa
  - esp-mqtt MR: espressif/esp-mqtt!85
  - Closes https://github.com/espressif/esp-mqtt/issues/176
* Publish: Add new API to enqueue qos>0 messages
  - esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/dc7fd5c0b1c132dc0e3c265db6bc2ac886f0f0b2
  - esp-mqtt MR: espressif/esp-mqtt!85
  - Closes https://github.com/espressif/esp-mqtt/issues/155
* Config: Add a new option to disable publishing when disconnected
  - esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/f44dcb1c26e47cc96eef379810a343246d8c265b
  - esp-mqtt MR: espressif/esp-mqtt!85
  - Related https://github.com/espressif/esp-mqtt/issues/177
* Events: Add new event to report deleted messages from outbox
  - esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/2e35d4d4d53a9a4d74c475de228e8c78f69a51bd
  - esp-mqtt MR: espressif/esp-mqtt!85
* Publish: Allow for qos=0 messages to be stored using esp_mqtt_client_enqueue()
  - esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/e2de0f3e3eb4d4afd4fdb5c2860a96a2ab8b1e21
  - esp-mqtt MR: espressif/esp-mqtt!85
2021-05-31 13:04:18 +00:00
Yang Zhao ea14555cf9 This issue is caused by modem sleep.The sleep interrupt will come the second time before the CLKN interrupt. If
we disable the sleep interrupt when it comes in the first time, the CLKN interrupt will never come.
2021-05-31 09:54:10 +00:00
Chinmay Chhajed fb55f9f397 Bluedroid: Check only x component of passkey to avoid passkey impersonation attack. 2021-05-31 07:12:57 +00:00
David Čermák 5198a7a46b Merge branch 'bugfix/ensure_rmii_clock_before_phy_reset' into 'release/v3.3'
ethernet: ensure RMII clock before PHY reset

See merge request espressif/esp-idf!13714
2021-05-31 06:53:37 +00:00
Michael (XIAO Xufeng) 6aaddf972c Merge branch 'bugfix/fix_dac_driver_self_contained_backport_v3.3' into 'release/v3.3'
fix dac header file self contained issue (backport v3.3)

See merge request espressif/esp-idf!12890
2021-05-26 10:06:31 +00:00
fuzhibo 4ec4d40af7 bugfix(adc): missing ranges of ADC codes in ESP32 2021-05-26 18:03:50 +08:00
Jiang Jiang Jian 0f80b6363c Merge branch 'nimble/fix_ble_sm_sc_pub_key_v3.3' into 'release/v3.3'
NimBLE: Fix MITM vulnerability and free AES context (v3.3)

See merge request espressif/esp-idf!13600
2021-05-26 04:10:41 +00:00
He Yin Ling 3bc41719ae Merge branch 'ci/ttfw_fix_dut_exception_not_added_to_junit_report_v3.3' into 'release/v3.3'
ttfw: fix DUT exception not added to junit report (v3.3)

See merge request espressif/esp-idf!13615
2021-05-26 03:13:53 +00:00
Omar Chebib 0fb2ff12b8 regi2c: add a spinlock for accessing (reg)I2C devices
When not compiling bootloader, a spinlock will be used for reading or writing
I2C internal devices/registers.
When compiling for bootloader, no need to use any lock.
2021-05-26 10:17:15 +08:00
Prasad Alatkar 9f56c39630 NimBLE: Fix MITM vulnerability and free AES context (v3.3) 2021-05-25 14:55:00 +00:00
Jiang Jiang Jian aacc7e07a6 Merge branch 'bugfix/fix_set_channel_error_after_wifi_stop_v3.3' into 'release/v3.3'
esp_wifi: Fix setting channel error after WiFi stop (backport v3.3)

See merge request espressif/esp-idf!13453
2021-05-25 14:29:07 +00:00
morris fc60e09295 ethernet: ensure RMII clock before PHY reset
Closes https://github.com/espressif/esp-idf/issues/6821
2021-05-25 18:51:25 +08:00
dongyou 6b263ae8cb ajust espnow channel range 2021-05-25 11:08:12 +08:00
Patryk Krzywdziński ea73e952a1 Fix eclipse build: “UnicodeDecodeError: 'ascii' codec can't decode byte”
Closes https://github.com/espressif/esp-idf/pull/6505
2021-05-21 20:59:28 +02:00
David Čermák d743f8502d Merge branch 'bugfix/mdns_coll_det_list' into 'release/v3.3'
mDNS: Fix of text length calculation when detecting a collision(Backport v3.3)

See merge request espressif/esp-idf!12026
2021-05-20 13:42:11 +00:00
suren.gabrielyan c4ee49edf1 mDNS: Fix of text length calculation when detecting a collision 2021-05-20 11:05:51 +00:00
suren.gabrielyan 86f4afa330 mDNS: Fix of collision detection during txt length calculation
Closes https://github.com/espressif/esp-idf/issues/6114
2021-05-20 11:05:51 +00:00
He Yin Ling 0c2fb10e0c ttfw: fix DUT exception not added to junit report 2021-05-20 16:53:52 +08:00
Island b3880ce487 Merge branch 'nimble/fix_host_flow_ctrl_v3.3' into 'release/v3.3'
NimBLE: Fix host flow control in NimBLE porting layer and host (release/v3.3)

See merge request espressif/esp-idf!13578
2021-05-19 09:51:10 +00:00
Prasad Alatkar c15ecf9fcd NimBLE: Update submodule to include host flow control fixes. 2021-05-17 20:14:16 +05:30
Prasad Alatkar 3bdb0ce5c1 NimBLE: Fix host flow control in NimBLE porting layer.
- Register `ble_hs_flow_acl_free` callback in NimBLE porting layer.
2021-05-17 20:11:53 +05:30
Michael (XIAO Xufeng) c0aee61ce0 Merge branch 'bugfix/fix_uart_module_enable_issue_v3.3' into 'release/v3.3'
Bugfix (uart): fix uart module reset issue (release V3.3)

See merge request espressif/esp-idf!8586
2021-05-13 06:55:15 +00:00
Jiang Jiang Jian 61a1e0d5c9 Merge branch 'bugfix/generate_value_0_when_prov_auth_v3.3' into 'release/v3.3'
ble_mesh: stack: Fix provisioning input or output count number should be at least 1 (v3.3)

See merge request espressif/esp-idf!13483
2021-05-08 12:53:48 +00:00
Jiang Jiang Jian 01cb29ba5a Merge branch 'bugfix/endianness_in_output_or_input_oob_v3.3' into 'release/v3.3'
ble_mesh: stack: Fix endianness error in output or input oob data of number (v3.3)

See merge request espressif/esp-idf!13470
2021-05-08 07:12:54 +00:00
wangjialiang f24f7ab97b ble_mesh: stack: Fix provisioning input or output count number should be at least 1
Closes https://github.com/espressif/esp-idf/issues/6863
2021-05-08 13:19:03 +08:00
wangjialiang e5f496149e ble_mesh: stack: Fix endianness error in output or input oob data of number
Closes https://github.com/espressif/esp-idf/issues/6862
2021-05-07 17:03:00 +08:00
Angus Gratton fa00fd5c8a Merge branch 'bugfix/freertos_addition_overflow_v3.3' into 'release/v3.3'
freertos: Fix addition overflow (v3.3)

See merge request espressif/esp-idf!13426
2021-05-07 08:18:03 +00:00
xiehang 1a47ecbfac esp_wifi: Fix setting channel error after WiFi stop 2021-05-06 14:06:29 +08:00
Angus Gratton 542c3e07a0 freertos: Check for arithmetic overflows on queue creation
Addition overflow check is from FreeRTOS kernel commit 47338393f1f79558f6144213409f09f81d7c4837
2021-05-04 18:38:15 +10:00
Angus Gratton 9772facaca Merge branch 'bugfix/espsecure_args_v3.3' into 'release/v3.3'
esptool: Update to fix espsecure.py sign_data default version argument (v3.3)

See merge request espressif/esp-idf!13321
2021-05-03 08:57:42 +00:00
Angus Gratton f845643608 esptool: Update to fix espsecure.py sign_data default version argument
Regression in Secure Boot signing, reported at https://github.com/espressif/esp-idf/issues/6831
2021-05-03 06:31:18 +00:00
Michael (XIAO Xufeng) a040ec1eec Merge branch 'bugfix/put_uart_isr_in_iram_v3.3' into 'release/v3.3'
uart: add option to put ISR in IRAM (v3.3)

See merge request espressif/esp-idf!13144
2021-05-01 14:28:58 +00:00
Jiang Jiang Jian 6d44b690b8 Merge branch 'bugfix/remove_redundant_other_core_cache_disable_v3.3' into 'release/v3.3'
[system]: Remove redundant othercore cache disable (backport v3.3)

See merge request espressif/esp-idf!13360
2021-04-30 09:17:50 +00:00
Jiang Jiang Jian ef7ae9a3ee Merge branch 'bugfix/wifi_softap_deep_sleep_current_opt_v3.3' into 'release/v3.3'
backport v3.3: optimize deep sleep current in wifi softap mode

See merge request espressif/esp-idf!13398
2021-04-30 02:50:33 +00:00
Li Shuai e74a36da43 deep sleep: optimize sleep current in wifi softap mode 2021-04-29 15:43:00 +08:00
morris dc9c0a9f6d uart: add option to put ISR in IRAM 2021-04-28 10:07:23 +00:00
Mahavir Jain 70cafac4bd Merge branch 'bugfix/esp_http_client_read_v3.3' into 'release/v3.3'
Fix esp_http_client_read for file size aligned to 289 bytes (v3.3)

See merge request espressif/esp-idf!13309
2021-04-28 10:03:47 +00:00
Shubham Kulkarni c8996feebb esp_http_client_read: Add check for esp_http_client_is_complete_data_received before returning ESP_FAIL
Closes: https://github.com/espressif/esp-idf/issues/6772
2021-04-28 05:00:45 +00:00
houwenxiang 8fcca01384 driver(uart): fix uart module reset issue (release V3.3)
On ESP32, due to fifo reset issue, UART2 will work incorrectly if reset the fifo of UART1(TX fifo and RX fifo). The software can workaround the RX fifo reset issue,

    while the TX fifo reset issue can not. When UART2 is used and UART1 is used as the log output port, a software reset can reproduce this issue. So we should reset the UART memory

    before the software reset to solve this problem.
2021-04-27 10:12:59 +00:00
wuzhenghui da31949530 remove othercore cache disable 2021-04-27 14:29:49 +08:00
Jiang Jiang Jian 0982de8c05 Merge branch 'bugfix/e8192_and_assert_param_v3.3' into 'release/v3.3'
Modify E8192 ELx200 ELx40 log level to LOGD

See merge request espressif/esp-idf!13170
2021-04-25 13:26:17 +00:00
xiongweichao f11f52b72f modify E8192 ELx200 ELx40 log level to LOGD 2021-04-25 10:33:47 +00:00
Angus Gratton 648f923015 ci: Use GitHub Actions to generate recursive source code zips for releases
We do this for all ESP-IDF releases, this step automates it.

Uses action added in https://github.com/espressif/github-actions/pull/10
2021-04-23 08:36:50 +00:00
Angus Gratton 01fedd2b05 Merge branch 'bugfix/calc_8m_freq_test_v3.3' into 'release/v3.3'
rtc: increase CI acceptance range for calc 8M test (v3.3)

See merge request espressif/esp-idf!13089
2021-04-23 07:31:00 +00:00
Jiang Jiang Jian 13a069f276 Merge branch 'component_bt/optimize_spp_stop_server_v3.3' into 'release/v3.3'
component_bt/Optimize SPP Stop Server API[backport v3.3]

See merge request espressif/esp-idf!13164
2021-04-22 05:59:52 +00:00
Jiang Jiang Jian aa8f1bef1e Merge branch 'bugfix/btdm_backport_ble_bugs_21_01_29_v3.3' into 'release/v3.3'
Bugfix/btdm backport ble bugs v3.3

See merge request espressif/esp-idf!12440
2021-04-22 05:59:38 +00:00
Jiang Jiang Jian c3678c5378 Merge branch 'feature/support_transport_keepalive_v3.3' into 'release/v3.3'
Feature/support transport keepalive v3.3 [backport v3.3]

See merge request espressif/esp-idf!12154
2021-04-22 05:59:05 +00:00
Jiang Jiang Jian 9ab19d7b68 Merge branch 'nimble/add_error_prints_acl_buf_v3.3' into 'release/v3.3'
NimBLE: Add error prints for ACL buffer exhaustion in NPL (v3.3)

See merge request espressif/esp-idf!12972
2021-04-22 05:58:24 +00:00
Jiang Jiang Jian cf79bfbc5f Merge branch 'bugfix/fix_wifi_interface_use_v3.3' into 'release/v3.3'
esp_wifi: Modify ESP_IF_WIFI_STA to WIFI_IF_STA  (backport v3.3)

See merge request espressif/esp-idf!12055
2021-04-22 05:57:04 +00:00
Jiang Jiang Jian 65b494567b Merge branch 'bugfix/ble_mesh_server_model_deinit_v3.3' into 'release/v3.3'
ble_mesh: stack: Fix deinit server models with no matching id (v3.3)

See merge request espressif/esp-idf!12317
2021-04-22 05:53:25 +00:00
Jiang Jiang Jian 22502bbd38 Merge branch 'bugfix/fix_tx_issue_after_esp_restart_v3.3' into 'release/v3.3'
components/bt: Shutdown Bluetooth before esp_restart.(V3.3)

See merge request espressif/esp-idf!11758
2021-04-22 05:52:18 +00:00
Jiang Jiang Jian 067f73d4ea Merge branch 'bugfix/btdm_assert_without_sw_coex_enable_v3.3' into 'release/v3.3'
components/bt: Fix assert without sw coexist enabled

See merge request espressif/esp-idf!12529
2021-04-22 05:51:39 +00:00
Jiang Jiang Jian a943d21126 Merge branch 'feature/add_a2dp_init_deinit_comp_evt' into 'release/v3.3'
feature/ Add A2DP Init and Deinit Complete Evt [backport v3.3]

See merge request espressif/esp-idf!10151
2021-04-22 05:51:24 +00:00
Jiang Jiang Jian fab97e2405 Merge branch 'bugfix/crash_on_enabling_verbose_logs_v3.3' into 'release/v3.3'
esp_wifi: Fixes issue of crashing when verbose logs are enabled (v3.3)

See merge request espressif/esp-idf!12492
2021-04-22 05:50:58 +00:00
Jiang Jiang Jian 94f5bc17a9 Merge branch 'bugfix/fix_arp_buffer_error_in_smart_config_v3.3' into 'release/v3.3'
bugfix/fix_arp_buffer_error_in_smart_config_v3.3

See merge request espressif/esp-idf!12291
2021-04-22 05:50:23 +00:00
Jiang Jiang Jian c3e3f8b490 Merge branch 'bugfix/fix_iperf_example_exception_handling_for_no_ap_found_v3.3' into 'release/v3.3'
bugfix/fix_iperf_example_exception_handling_for_no_ap_found_v3.3

See merge request espressif/esp-idf!12274
2021-04-22 05:49:00 +00:00
Jiang Jiang Jian eaa02c0ef8 Merge branch 'feat/ble_mesh_multiple_nvs_namespace_v3.3' into 'release/v3.3'
ble_mesh: stack: Provisioner supports multiple nvs namespaces (v3.3)

See merge request espressif/esp-idf!11950
2021-04-22 05:48:44 +00:00
Jiang Jiang Jian 5f03326833 Merge branch 'bugfix/fix_a2dp_underrun_issue_3_3' into 'release/v3.3'
Fix a2dp underrun issue [backport v3.3]

See merge request espressif/esp-idf!12280
2021-04-22 05:47:51 +00:00
Jiang Jiang Jian bc625858ae Merge branch 'bugfix/esp_pm_dump_critical_v3.3' into 'release/v3.3'
esp_pm: esp_pm_dump_locks: don't print from a critical section, and fix formatting (backport v3.3)

See merge request espressif/esp-idf!12017
2021-04-22 05:47:12 +00:00
Anton Maklakov c3251dcf29 Merge branch 'bugfix/ci/ci_fetch_submodule_fully_match_return_first_v3.3' into 'release/v3.3'
fix(ci): ci_fetch_submodule return full match name first (v3.3)

See merge request espressif/esp-idf!13214
2021-04-20 11:20:07 +00:00
Fu Hanxi 6828b0fcc7 fix(ci): ci_fetch_submodule return full match name first 2021-04-19 20:24:27 +08:00
liqigan 85be396cd3 add API esp_spp_stop_srv_scn to stop a specific server 2021-04-16 09:52:27 +08:00
Angus Gratton 63d482e162 Merge branch 'backport/anti-fi-check-sbv1-v3.3.3' into 'release/v3.3'
bootloader: Add fault injection resistance to Secure Boot bootloader verification

See merge request espressif/esp-idf!12738
2021-04-12 23:53:05 +00:00
Krzysztof Budzynski 600a0f841d Merge branch 'bugfix/doxygen_input_file_bug_v3.3' into 'release/v3.3'
docs: fix doxygen compile warnings for doxygen 1.9.1 (v3.3)

See merge request espressif/esp-idf!13080
2021-04-12 00:44:01 +00:00
Marius Vikhammer 9a338bc8c3 docs: fix doxygen compile warnings for doxygen 1.9.1
Newer versions of doxygen will give warnings for comments in
INPUT lists

Delete all comment lines to fix these warnings, our folder structure
stil gives an OK overview of what we are including
2021-04-12 08:43:57 +08:00
Marius Vikhammer a680159bbb rtc: increase CI acceptance range for calc 8M test 2021-04-09 15:06:55 +08:00
Juraj Michálek 0b0364c719 tools: handle exception in case of logging Unicode characters 2021-04-06 19:17:45 +02:00
Sachin Parekh 3c7f439d5b bootloader: Add fault injection resistance to Secure Boot bootloader verification 2021-03-31 17:54:45 +05:30
Angus Gratton 08ce445ab6 Merge branch 'feature/twdt_prints_backtrace_v3.3' into 'release/v3.3'
Add Task Watchdog backtrace printing (v3.3)

See merge request espressif/esp-idf!12624
2021-03-31 05:17:23 +00:00
Prasad Alatkar 2b18d3c628 NimBLE: Add error prints for ACL buffer exhaustion in NPL 2021-03-31 10:44:07 +05:30
Mahavir Jain 7c86027531 Merge branch 'bugfix/rtc_clk_cal_cycles_add_default_vals_for_all_sources_v3.3' into 'release/v3.3'
esp32xx: Fix default values for all RTC sources in RTC_CLK_CAL_CYCLES option (v3.3)

See merge request espressif/esp-idf!12421
2021-03-26 06:42:07 +00:00
Mahavir Jain 5713bb1bb8 Merge branch 'fix/esp_tls_add_warning_if_ca_chain_has_invalid_cert_v3.3' into 'release/v3.3'
esp_tls: Add warning if the CA chain provided contains one/more invalid cert

See merge request espressif/esp-idf!11942
2021-03-26 06:25:37 +00:00
Mahavir Jain 9eb39ef409 Merge branch 'bugfix/http_client_buffer_overread_v3.3' into 'release/v3.3'
esp_http_client: Fix buffer overread, update https_request example to use HTTP/1.1 (v3.3)

See merge request espressif/esp-idf!12111
2021-03-26 05:23:07 +00:00
Mahavir Jain dfdf9fe4e2 Merge branch 'bugfix/update_howsmyssl_cert_v3.3' into 'release/v3.3'
examples/protocols: update www.howsmyssl.com certificate to fix test failures (v3.3)

See merge request espressif/esp-idf!12214
2021-03-26 05:04:13 +00:00
Mahavir Jain f227fc69e5 Merge branch 'feature/upgrade_mbedtls_to_v3.3' into 'release/v3.3'
mbedtls: upgrade to v2.16.9 release (v3.3)

See merge request espressif/esp-idf!11902
2021-03-26 05:02:46 +00:00
Mahavir Jain 30c7be6542 Merge branch 'bugfix/httpd_session_close_lru_v3.3' into 'release/v3.3'
esp_http_server: Add flag in sock_db to identify httpd_sess_close is called from httpd_session_close_lru (v3.3)

See merge request espressif/esp-idf!12115
2021-03-26 04:56:52 +00:00
Mahavir Jain 12cb4243f5 examples/protocols: update www.howsmyssl.com certificate to fix test failures 2021-03-26 02:42:44 +00:00
Mahavir Jain 069de99a9e mbedtls: upgrade to v2.16.9 release
For details release notes please refer to:
https://github.com/ARMmbed/mbedtls/releases/tag/v2.16.9
2021-03-26 02:42:29 +00:00
Shubham Kulkarni b082ed5d2b Enable lru_purge_enable in simple HTTP server example 2021-03-26 02:41:50 +00:00
Shubham Kulkarni f5acc1e446 esp_http_server: Add lru_socket flag in sock_db to indicate httpd_sess_close is called from httpd_sess_close_lru 2021-03-26 02:41:50 +00:00
Shubham Kulkarni e16ab463d9 esp_http_client.c: Clear raw_len for response buffer after dispatching HTTP_EVENT_ON_FINISH event
Closes: https://github.com/espressif/esp-idf/issues/6146
2021-03-26 02:41:24 +00:00
Aditya Patwardhan 832128faf0 esp_tls: Add warning if the CA chain provided contains one/more invalid cert 2021-03-26 02:41:15 +00:00
Angus Gratton 85c43024cb Merge branch 'update/version_3_3_5' into 'release/v3.3'
Update version to 3.3.5

See merge request espressif/esp-idf!12901
2021-03-26 00:29:05 +00:00
xiehang 2091f4db1c esp_wifi: Modify WIFI_IF_AP to TCPIP_ADAPTER_IF_AP 2021-03-25 10:53:50 +08:00
xiehang 1975d39d44 esp_wifi: Modify ESP_IF_WIFI_AP to WIFI_IF_AP 2021-03-25 10:53:28 +08:00
xiehang ee2b8a65a0 esp_wifi: Modify ESP_IF_WIFI_STA to WIFI_IF_STA 2021-03-25 10:51:36 +08:00
He Yin Ling 03810c4a06 versions: Update version to 3.3.5 2021-03-25 10:23:16 +08:00
fuzhibo 61a68ae95e driver(dac): fix dac header file self contained issue 2021-03-24 17:12:11 +08:00
Jiang Jiang Jian 343521ab1a Merge branch 'bugfix/fix-modem-sleep-mr-v3.3' into 'release/v3.3'
Fix the bug of modem sleep

See merge request espressif/esp-idf!12861
2021-03-24 09:06:57 +00:00
“YangZhao” 8eb75313d4 Fix the bug of modem sleep which may lead to the crash issue "assert(-218959118,0)" 2021-03-23 21:29:33 +08:00
Jiang Jiang Jian b34dee5d9e Merge branch 'mesh/bugfix_fix_error_when_mesh_and_ble_enabled' into 'release/v3.3'
esp_wifi_mesh: fix error issue when both mesh and ble are enabled

See merge request espressif/esp-idf!11701
2021-03-23 06:41:56 +00:00
shenjun 73117b8c94 esp_wifi_mesh: fix error issue when both mesh and ble are enabled 2021-03-15 14:30:34 +08:00
Jiang Jiang Jian c43efe1502 Merge branch 'bugfix/revert_refactor_wifi_interface_v3.3' into 'release/v3.3'
Revert "Refactor wifi_interface_t" (v3.3)

See merge request espressif/esp-idf!12483
2021-03-15 03:26:08 +00:00
xiehang cd90dfa38b Revert "Refactor wifi_interface_t"
This reverts commit ae24692785.

Closes: https://github.com/espressif/arduino-esp32/issues/4905
2021-03-08 17:02:22 +08:00
Angus Gratton 0b1bc0b5b8 Merge branch 'bugfix/ttfw_example_test_fails_port_remains_open_v3.3' into 'release/v3.3'
ci: Fix CI issue if one example test fails, and if serial port returns some noise (v3.3)

See merge request espressif/esp-idf!12384
2021-03-07 23:42:24 +00:00
baohongde a10dac936c components/bt: Fix crash in Bluetooth when esp_restart 2021-03-05 21:54:47 +08:00
baohongde 2ad908f71e components/bt: Shutdown Bluetooth before esp_restart. 2021-03-05 21:54:20 +08:00
Jiang Jiang Jian 0bfff0b25a Merge branch 'bugfix/fix_csa_channel_crash_v3.3' into 'release/v3.3'
esp_wifi: fix CSA and BAR crash issue(v3.3)

See merge request espressif/esp-idf!12552
2021-03-05 12:31:58 +00:00
Darian Leung a1fd207aee Add Task Watchdog backtrace printing
This commit makes the Task Watchdog print the backtrace of both
cores when it times out.
2021-03-04 19:01:48 +11:00
Darian Leung 1786fc9ed2 esp32: Refactor backtrace and add esp_backtrace_print()
This commit refactors backtracing within the panic handler so that a common
function esp_backtrace_get_next_frame() is used iteratively to traverse a
callstack.

A esp_backtrace_print() function has also be added that allows the printing
of a backtrace at runtime. The esp_backtrace_print() function allows unity to
print the backtrace of failed test cases and jump back to the main test menu
without the need reset the chip. esp_backtrace_print() can also be used as a
debugging function by users.
2021-03-04 19:01:48 +11:00
Jiang Jiang Jian c8915cd157 Merge branch 'bugfix/fix_spp_can_not_connect_twice' into 'release/v3.3'
Bugfix/Fix SPP Reconnect Failed after Disconnet

See merge request espressif/esp-idf!12241
2021-03-04 03:37:21 +00:00
Angus Gratton a85b97a6f5 ci: ttfw: Encode serial port data to whatever the console encoding is
This is a bit of a hack, but gives us a way to always log it
2021-03-04 09:25:44 +11:00
ChenJianxing 88898e2f96 esp_wifi: fix CSA and BAR crash issue 2021-02-27 17:09:57 +08:00
aditi_lonkar d6cafddaa3 esp_wifi: Fixes issue of crashing when verbose logs are enabled. 2021-02-26 19:07:33 +05:30
baohongde 716edebbbd components/bt: Fix assert without sw coexist enabled 2021-02-26 14:44:57 +08:00
zhiweijian 47c0ce6fca add connection parameter check 2021-02-22 15:14:32 +08:00
zhiweijian c02d5a4d85 fix ble connection maximum latency is 499 2021-02-22 15:11:03 +08:00
zhiweijian 7ffe2c3136 disable bluedroid congest error log print 2021-02-22 14:58:59 +08:00
zhiweijian 208c2fb0fb fix read multi char failed(GATT_27001) 2021-02-22 14:56:10 +08:00
zhiweijian 1f4d3ac30a fix bluedroid repair faild if the two most significant bits of public address is '01' 2021-02-22 14:54:01 +08:00
zhiweijian 928e004208 fix ble read multi char err when the number of handles is more than 10 2021-02-22 14:51:33 +08:00
zhiweijian db72885f15 fix scan rsp length err 2021-02-22 14:45:05 +08:00
KonstantinKondrashov 1e4552533d esp32xx: Fix default values for all RTC sources in RTC_CLK_CAL_CYCLES option
Closes: https://github.com/espressif/esp-idf/issues/6037
2021-02-19 20:02:49 +08:00
Island 7a85334d80 Merge branch 'bugfix/ignore_null_valued_comb_key_3_3' into 'release/v3.3'
Bugfix/ignore null valued comb key 3 3

See merge request espressif/esp-idf!12362
2021-02-19 11:38:57 +00:00
Angus Gratton 0aca88a6e9 ci: Log failure to close any DUT 2021-02-15 10:54:50 +11:00
Chinmay Chhajed dcaaddae37 component/bt: Added check for NULL valued combination key. 2021-02-10 17:19:20 +05:30
Chinmay Chhajed 4936e8f86c Bluedroid: Do not initiate/accept connection with device having same BDADDR.
Added BD_ADDR comparison in l2cu_lcp_allocate and removed check from
security connection request handler as it's handled in l2cu_lcp_allocate
for both connection request and create connection.
2021-02-10 17:16:47 +05:30
Chinmay Chhajed 6a4e69f442 bt: removed esp_bt_get_mac()
There was no need for this function as there is already a way present to
fetch own mac address. Own mac addr can be fetched by calling
controller_get_interface().
2021-02-10 17:12:27 +05:30
lly 19a578c2e0 ble_mesh: stack: Fix deinit server models with no matching id 2021-02-07 11:20:44 +08:00
dongyou c505fe650f fix smartconfig issue when router reply arp late 2021-02-05 12:01:05 +08:00
weitianhua 94e84e6c0c Fix audio underrun issue with oppo x20 2021-02-04 19:39:39 +08:00
dongyou 44f22150f2 add exception handling for iperf example's scan when no ap was found 2021-02-04 17:59:13 +08:00
Jiang Jiang Jian d8082b7f39 Merge branch 'bugfix/espnow_recv_fail_v3.3' into 'release/v3.3'
fix the bug that espnow recv fail (v3.3)

See merge request espressif/esp-idf!12090
2021-02-04 16:10:43 +08:00
lly 4005df854f ble_mesh: ci: Add settings sdkconfig test files 2021-02-04 07:16:35 +00:00
lly 98e17de350 ble_mesh: stack: Provisioner supports multiple nvs namespaces
Now Provisioner can use different NVS namespaces to store
different instances of mesh information, for example, for
different user accounts.
2021-02-04 07:16:35 +00:00
liqigan 539718735b fix spp connect failed or discovery failed after the first connection release 2021-02-03 17:23:45 +08:00
Angus Gratton 92676f05fa Merge branch 'bugfix/force_sync_only_esptool_for_target_test_jobs' into 'release/v3.3'
ci: force sync only esptool for target test jobs (v3.3)

See merge request espressif/esp-idf!11904
2021-02-02 11:28:42 +08:00
Fu Hanxi 664597f4ce CI: only fetch esptool for target test jobs 2021-02-01 08:51:31 +00:00
Ivan Grokhotkov b9f6a5da51 make: fix undefined variable warning (IDF_SKIP_CHECK_SUBMODULES) 2021-02-01 08:51:31 +00:00
He Yin Ling a79c9402d6 ci: fix fetch submodule error on python3 2021-02-01 08:51:31 +00:00
He Yin Ling 6418be692a CI: build system do not check submodule for CI 2021-02-01 08:51:31 +00:00
He Yin Ling 729451ef60 CI: modify fetch submodule method:
download archive for submodules instead of clone
2021-02-01 08:51:31 +00:00
He Yin Ling 1b0a3f8924 CI: add utility gitlab_api 2021-02-01 08:51:31 +00:00
weitianhua 33ad4b6f84 Add A2DP Init and Deinit Complete Evt 2021-01-26 11:15:35 +08:00
yuanjm 36c3b8980d Make OTA example support keepalive 2021-01-25 17:48:54 +08:00
Shubham Kulkarni 8610ce4f34 Add options for esp_http_client and esp_websocket_client to support keepalive 2021-01-25 17:48:54 +08:00
yuanjm af50ceb5e6 Modify esp-tls and tcp_transport to support keep alive for tcp and ssl connection 2021-01-25 17:48:47 +08:00
zhangyanjiao a3740c97c9 fix the bug that espnow recv fail 2021-01-21 15:07:57 +08:00
Jiang Jiang Jian 3f15854d96 Merge branch 'bugfix/fix_some_wifi_bugs_0105_v3.3' into 'release/v3.3'
Bugfix/fix some wifi bugs 0105 v3.3 (backport v3.3)

See merge request espressif/esp-idf!11945
2021-01-18 21:22:48 +08:00
Jiang Jiang Jian 808f456442 Merge branch 'bugfix/fix_iperf_example_crash_issue_v3.3' into 'release/v3.3'
Bugfix/fix iperf example crash issue v3.3 (backport v3.3)

See merge request espressif/esp-idf!12018
2021-01-18 19:18:53 +08:00
Jiang Jiang Jian 854ccb743d Merge branch 'bugfix/bluedroid_avoid_same_bdaddr_conn_v3.3' into 'release/v3.3'
Bluedroid: Do not connect if peer BD_ADDR is same as own BD_ADDR. (v3.3)

See merge request espressif/esp-idf!11993
2021-01-18 14:35:25 +08:00
Jiang Jiang Jian 5ee8a808c8 Merge branch 'bugfix/fix_tcp_mss_issue_v3.3' into 'release/v3.3'
esp_wifi: The maximum value of modifying TCP MSS is 1460 (v3.3)

See merge request espressif/esp-idf!11999
2021-01-18 14:21:36 +08:00
Jiang Jiang Jian 71a50021ca Merge branch 'bugfix/fix_ping_specify_length_issue_v3.3' into 'release/v3.3'
bugfix: fix ICMP specify length issue (backport v3.3)

See merge request espressif/esp-idf!11988
2021-01-18 14:20:43 +08:00
Ivan Grokhotkov 5080a23ac3 esp_pm: fix formatting issues in esp_pm_dump_locks
- line was truncated because 64 characters were not sufficient
- length passed to snprintf should be full buffer length, not -1
- make the width of lock name field fixed
- fix alignment of lock type column
2021-01-15 12:46:46 +01:00
xiehang 3590a6816f example: Scan failure should not cause system crash 2021-01-15 19:45:59 +08:00
Ivan Grokhotkov 827bb925b7 esp_pm: esp_pm_dump_locks: don't print from a critical section
Reported in https://github.com/espressif/esp-idf/issues/1917
2021-01-15 12:45:45 +01:00
xiehang 2f4ef71beb example: do not check the return value of esp_wifi_connect() 2021-01-15 19:40:25 +08:00
Ivan Grokhotkov 7e63061fae Merge branch 'bugfix/xtensa_win_version' into 'release/v3.3'
Bugfix/xtensa win version

See merge request espressif/esp-idf!11983
2021-01-15 07:33:27 +08:00
xiehang a31000dcb6 esp_wifi: The maximum value of modifying TCP MSS is 1660 2021-01-14 19:50:24 +08:00
Chinmay Chhajed 092dc133cc Bluedroid: Do not connect if peer BD_ADDR is same as own BD_ADDR. 2021-01-14 14:32:58 +05:30
Juraj Michálek 8cef74c151 bugfix: correction of xtensa-esp32-elf version for Windows 2021-01-14 08:36:31 +01:00
ronghulin 675d6f26d4 bugfix: fix ICMP specify length issue 2021-01-14 14:40:13 +08:00
xiehang d3a27596a1 CI: Fix test_phy_rtc_cache_task stack overflow 2021-01-13 19:48:47 +08:00
xiehang 426736c769 bugfix: fix some wifi bugs
1. fix max tx power to 20dBm
2. fix the issue that the esp_wifi_sta_get_ap_info can't get country
2021-01-11 19:21:18 +08:00
xiehang ae24692785 esp_wifi: Update WiFi lib
1. Add check CSA state before CSA timer process
2. Change wifi scan duration from 120ms to 100ms
3. Using deport reg instead of ahb
4. Check TID in ieee80211_recv_bar()
5. Revert to report specific reason code when receiving deauth during 4-way-handshark
6. Fix the bug that tx ampdu parameter is not from peer device
7. Refactor wifi_interface_t
8. Faster WiFi station connect improvement, avoid 100ms passive scan
9. Add FCS failed packets filter
10.Update esp32 phy lib to v4660
11.Fix csa timer issue
12.Fix country code last byte to space instead of NULL
13.Fix softap cannot forward A-MSDU
14.Fix max tx power to 20dBm
15.Fix the issue that the esp_wifi_sta_get_ap_info can't get country
2021-01-11 19:21:13 +08:00
xiehang 3df5b89c91 esp_wifi: ESP32 phy add [sections:phy_iram] 2021-01-11 15:32:46 +08:00
xiehang 3a56cfc9b3 esp_wifi: optimize phy version log 2021-01-11 15:32:37 +08:00
Jiang Jiang Jian cd59d107b2 Merge branch 'bugfix/ble_mesh_node_id_adv_v3.3' into 'release/v3.3'
ble_mesh: stack: Fix Node ID adv with wrong timeout (v3.3)

See merge request espressif/esp-idf!11880
2021-01-11 11:46:41 +08:00
Jiang Jiang Jian 66a1b39814 Merge branch 'bugfix/add_macro_to_blufi' into 'release/v3.3'
component/bt: Add a macro to control the compilation of blufi.(backport v3.3)

See merge request espressif/esp-idf!11891
2021-01-11 11:45:14 +08:00
Jiang Jiang Jian 1df7be0e58 Merge branch 'feat/ble_mesh_provisioner_recv_hb_support_v3.3' into 'release/v3.3'
Feat/ble mesh provisioner recv hb support (v3.3)

See merge request espressif/esp-idf!11916
2021-01-11 11:44:27 +08:00
Jiang Jiang Jian d3bdcccd3b Merge branch 'bugfix/fix_wifi_stack_overflow_v3.3' into 'release/v3.3'
esp_wifi: Fix WiFi stack overflow issue (v3.3)

See merge request espressif/esp-idf!11889
2021-01-11 11:43:53 +08:00
lly 79a5037ee2 ble_mesh: ci: Add enabling hb recv sdkconfig file 2021-01-08 09:36:52 +08:00
lly e9caf68d6e ble_mesh: stack: Provisioner supports receiving heartbeat 2021-01-08 09:35:03 +08:00
xiehang 60291300a2 Revert "esp_wifi: Fix handling of multiple AP credentials in WPS"
This reverts commit de0d1fffcd.
2021-01-06 19:30:56 +08:00
wangcheng e9d28837ec component/bt: Add a macro to control the compilation of blufi. 2021-01-06 18:04:30 +08:00
lly 6c6ad3f772 ble_mesh: stack: Fix Node ID adv with wrong timeout 2021-01-05 20:16:42 +08:00
Jiang Jiang Jian 71df1f7422 Merge branch 'bugfix/btdm_blufi_data_sequence_not_reset_after_disconnect_v3.3' into 'release/v3.3'
component/bt: fix Blufi sends data after disconnect the seq still increase(backport v3.3)

See merge request espressif/esp-idf!10245
2021-01-05 11:10:35 +08:00
XieWenxiang d8b42e565c component/bt: fix Blufi sends data after disconnect the seq still increase(backport v3.3) 2021-01-05 01:53:33 +00:00
Jiang Jiang Jian 509de0aac3 Merge branch 'bugfix/mcpwm_period_error_v3.3' into 'release/v3.3'
bugfix(mcpwm_period_error): fix the issue of wrong period (backport v3.3)

See merge request espressif/esp-idf!7186
2021-01-05 09:53:22 +08:00
Jiang Jiang Jian f3aaa39c43 Merge branch 'bugfix/btdm_blufi_send_longer_custom_data_will_congested_v3.3' into 'release/v3.3'
component/bt: fix Blufi sends longer customer data will will lead congested(backport v3.3)

See merge request espressif/esp-idf!11724
2021-01-05 09:51:39 +08:00
Angus Gratton f61f54ee67 Merge branch 'feature/dis_uart_dl_mode_v3.3' into 'release/v3.3'
feature: Disable UART download mode (v3.3)

See merge request espressif/esp-idf!10767
2021-01-04 15:29:14 +08:00
Mahavir Jain 6917a40294 Merge branch 'fix/i2c_pm_lock_v3.3' into 'release/v3.3'
i2c: Acquire PM lock after acquiring mutex (v3.3)

See merge request espressif/esp-idf!11833
2020-12-30 18:50:14 +08:00
Sachin Parekh 25147f2560 i2c: Acquire PM lock after acquiring mutex 2020-12-30 13:25:40 +05:30
Jiang Jiang Jian 29e69a12d3 Merge branch 'feature/oocd_ver_backport_v3.3' into 'release/v3.3'
tools: Updates OpenOCD version to 'v0.10.0-esp32-20200709' (backport v3.3)

See merge request espressif/esp-idf!9750
2020-12-28 11:50:57 +08:00
Chen Zheng Wei d3eb487d40 mcpwm: fix the issue of wrong period (backport v3.3) 2020-12-28 03:48:11 +00:00
Jiang Jiang Jian c4aafb06ce Merge branch 'feature/nvs_erase_check_init_3.3' into 'release/v3.3'
NVS Flash: prevent erasing initialized partition (backport v3.3)

See merge request espressif/esp-idf!10072
2020-12-28 11:46:34 +08:00
Jiang Jiang Jian 777c8bbd44 Merge branch 'bugfix/bt_bluedroid_same_public_key_attack_v3.3' into 'release/v3.3'
Bluedroid: Fixes for some Bluetooth vulnerabilities. (v3.3)

See merge request espressif/esp-idf!11767
2020-12-28 11:41:19 +08:00
Chinmay Chhajed 0b84a1242e Bluedroid: Fixes for some vulnerabilities.
This commit fixes 'Impersonation in Passkey entry protocol'
(CVE-2020-26558) and suggests fixes for other vulnerabilites like
'Impersonation in the Pin Pairing Protocol' (CVE-2020-26555) and
'Authentication of the LE Legacy Pairing Protocol'

CVE-2020-26558 can be easily implemented if the peer device can
impersonate our public key. This commit adds a check by comparing our
and received public key and returns failed pairing if keys are same.

This commit also adds comments suggesting to use secure connection when
supported by all devices.
2020-12-25 16:03:33 +05:30
Jiang Jiang Jian cc8525f630 Merge branch 'bugfix/backport_v3.3_esp_tls_closing_fd0' into 'release/v3.3'
Bugfix/backport v3.3 esp tls closing fd0

See merge request espressif/esp-idf!11055
2020-12-24 16:05:11 +08:00
Anton Maklakov 0713c7dbb4 Merge branch 'feature/ci_relative_submodules_v3.3' into 'release/v3.3'
CI: relative submodules (v3.3)

See merge request espressif/esp-idf!11735
2020-12-24 11:13:06 +08:00
XieWenxiang b0719d3fc6 component/bt: fix Blufi sends longer customer data will will lead congested 2020-12-24 09:37:35 +08:00
Jiang Jiang Jian 8ff6e2eee5 Merge branch 'bugfix/wps_multiple_ap_creds_v3.3' into 'release/v3.3'
Bugfix/wps multiple ap creds v3.3 (backport v3.3)

See merge request espressif/esp-idf!11727
2020-12-23 23:33:46 +08:00
Anton Maklakov 6dfb8a5fc3 Merge branch 'bugfix/mdns_example_test_exit_v3.3' into 'release/v3.3'
ci: Fixed mdns example test to correctly exit helper thread

See merge request espressif/esp-idf!11676
2020-12-23 21:50:18 +08:00
Jiang Jiang Jian 1a6530156d Merge branch 'bugfix/fix_spp_vfs_dynamic_memory_bugs_v3.3' into 'release/v3.3'
component_bt/fix spp vfs demo crash when use dynamic memory[backport v3.3]

See merge request espressif/esp-idf!11725
2020-12-23 21:39:51 +08:00
Anton Maklakov 5487864df9 tools: Add a script for switching to real submodules in forks 2020-12-23 17:41:33 +07:00
Anton Maklakov d7d8857fc5 ci: Use relative submodule URLs over IDF. Correct CI accordindly
Clean up `before_script`s

    Update `check_submodule_sync`

    Remove tools/ci/mirror* stuff
2020-12-23 17:41:33 +07:00
Anton Maklakov 69cd53dbd9 ci: Remove unused IS_PRIVATE and IS_PUBLIC environment 2020-12-23 16:52:57 +07:00
xutao 9c252b8f22 bugfix: backport esp_tls_closing_fd0 to v3.3 2020-12-23 09:51:48 +00:00
xiehang 56416dddda esp_wifi: Updata WiFi lib
1. Fix handling of multiple AP credentials in WPS
2. Fix esp_wifi log levels
2020-12-23 15:48:06 +08:00
xiehang de0d1fffcd esp_wifi: Fix handling of multiple AP credentials in WPS
WPS can send multiple AP credentials, while existing implementation
will only use the first credentials which could be for the 5G band.
Fix this by passing these credentials to the App and attempting
to connect using each of those. Older Apps will remain compatible
without breaking WPS, but the issue will remain.
2020-12-23 15:05:28 +08:00
liqigan 46fa26b56f fix spp vfs demo crash when use dynamic memory 2020-12-23 14:44:48 +08:00
Jiang Jiang Jian 896180ec73 Merge branch 'bugfix/collection_bugfix_backport_for_3_3' into 'release/v3.3'
Bugfix/collection bugfix backport for 3 3

See merge request espressif/esp-idf!11708
2020-12-23 11:23:14 +08:00
Jiang Jiang Jian 1e747edd7d Merge branch 'bugfix/blufi_config_potential_double_free_v3.3' into 'release/v3.3'
component/bt: Fix a potential double free error.

See merge request espressif/esp-idf!11716
2020-12-23 11:22:40 +08:00
wangcheng 929ad413cb component/bt: Fix a potential double free error. 2020-12-22 19:09:15 +08:00
weitianhua 282d234ea5 components/bt: Fixed the problem of early release of pointer(p_ccb) in funcion 2020-12-22 15:12:55 +08:00
weitianhua 86de405578 Collection of bugfix backport for release/v3.3 2020-12-22 15:08:59 +08:00
Jiang Jiang Jian 3e6dd18075 Merge branch 'bugfix/revert_tx_optimization_v3.3' into 'release/v3.3'
esp_wifi: revert tx optimization(v3.3)

See merge request espressif/esp-idf!11688
2020-12-21 23:19:08 +08:00
Jiang Jiang Jian 1b4a46a28f Merge branch 'bugfix/ipv6_check_ns_na_packet_length' into 'release/v3.3'
lw-ip:bugfix for ipv6 check ns na packet length

See merge request espressif/esp-idf!11680
2020-12-21 23:18:27 +08:00
zhangyanjiao d5f9d1f748 Revert "esp_wifi: optimize WiFi TX performance"
This reverts commit 7b245e59c4.
2020-12-21 15:53:19 +08:00
Michael (XIAO Xufeng) ed420aacc0 Merge branch 'bugfix/WEL_DISABLE_V3.3' into 'release/v3.3'
spi_flash: ensure wel is diabled when flash is not being operated

See merge request espressif/esp-idf!11653
2020-12-21 15:48:51 +08:00
xueyunfei ee1f925dff bugfix for ipv6 check ns na packet length 2020-12-21 10:54:24 +08:00
Jiang Jiang Jian 0a80c654e9 Merge branch 'bugfix/decouple_wifi_bt_with_coex_v3.3' into 'release/v3.3'
esp_wifi: decouple Wi-Fi and bluetooth with coexist to reduce binary file size(backport v3.3)

See merge request espressif/esp-idf!11644
2020-12-20 16:26:40 +08:00
David Cermak 86dbff4297 ci: Fixed mdns example test to correctly exit helper thread 2020-12-18 16:54:04 +01:00
Ivan Grokhotkov 857e2f0943 Merge branch 'bugfix/docker_gdb_python_v3.3' into 'release/v3.3'
tools/docker: Add libpython2.7 in order to satisfy GDB dependencies (backport v3.3)

See merge request espressif/esp-idf!10310
2020-12-17 23:16:26 +08:00
Angus Gratton a461605003 efuse: Add ESP32 V3 'disable Download Mode' functionality 2020-12-17 17:44:21 +11:00
Xia Xiaotian 3cf6f36765 esp_wifi: decouple Wi-Fi and bluetooth with coexist to reduce binary file size 2020-12-17 14:21:59 +08:00
Cao Sen Miao 6d63c59ddb spi_flash: ensure sel is diabled when flash is not being operated 2020-12-17 10:58:49 +08:00
Martin Stejskal ace26dda76 tools/docker: Add libpython2.7 in order to satisfy GDB dependencies
It was not possible to run xtensa-esp32-elf-gdb from container due to
missing libpython2.7 library.

Merges https://github.com/espressif/esp-idf/pull/5817
Closes https://github.com/espressif/esp-idf/issues/5284
2020-12-16 02:50:32 +00:00
Ivan Grokhotkov 3ca579bc23 Merge branch 'test/disable_twai_example_ci_v3.3' into 'release/v3.3'
Temporarily disable TWAI network example test (backport v3.3)

See merge request espressif/esp-idf!11564
2020-12-16 04:22:50 +08:00
Mahavir Jain fb6fb2df3b Merge branch 'bugfix/redirection_v3.3' into 'release/v3.3'
esp_http_client: Skip check for redirection counter if status code is success, fix issue with digest auth, configurable user agent string. (v3.3)

See merge request espressif/esp-idf!11600
2020-12-14 20:20:20 +08:00
Jiang Jiang Jian f33381b8e8 Merge branch 'fixbug/baidu_tcp_recv_assert_for_3.3' into 'release/v3.3'
lw-ip:fix bug for tcp recv assert(backport 3.3)

See merge request espressif/esp-idf!11289
2020-12-14 19:00:45 +08:00
Scott Shell 6d104d49b4 Make the UserAgent string in esp-http-client configurable
Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/6044
2020-12-14 14:44:40 +05:30
Shubham Kulkarni 193fcc70dd http_auth.c: Fix crash when opaque field is not present in challenge string
Closes: https://github.com/espressif/esp-idf/issues/5888
2020-12-14 14:44:33 +05:30
Shubham Kulkarni 35d0b93ecf esp_http_client: Skip check for redirection counter if status code is success.
Set disable_auto_redirect in esp_http_client example to validate this condition in CI
2020-12-14 14:44:22 +05:30
Angus Gratton 6f3478dae0 Merge branch 'bugfix/esptool_version_v3.3' into 'release/v3.3'
esptool: Update esptool to latest v2.x version (backport v3.3)

See merge request espressif/esp-idf!11585
2020-12-14 15:14:45 +08:00
Jiang Jiang Jian 4767568837 Merge branch 'nimble/fix_misc_coverity_issue_v3.3' into 'release/v3.3'
Nimble: Fix misc issues in NimBLE NVS, `ble_eddystone`, recursive call and  L2CAP CoC (v3.3)

See merge request espressif/esp-idf!11393
2020-12-12 19:21:41 +08:00
Jiang Jiang Jian c2f5fc0c88 Merge branch 'optimize/ble_mesh_provision_dev_uuid_check_v3.3' into 'release/v3.3'
ble_mesh: stack: Need uuid when adding device for provisioning (v3.3)

See merge request espressif/esp-idf!11582
2020-12-12 17:57:37 +08:00
Jiang Jiang Jian e38adae62b Merge branch 'backport/need_commit_to_v3.3' into 'release/v3.3'
components/bt: Backport some fixes to v3.3

See merge request espressif/esp-idf!11470
2020-12-12 17:53:20 +08:00
radim.karnis 54ee2f2ebc Changed esptool version to latest v2.x 2020-12-11 13:29:19 +01:00
lly 60ebc7f8e3 ble_mesh: ci: Add PB-ADV & PB-GATT sdkconfig test files 2020-12-11 20:12:45 +08:00
lly bff66d7653 ble_mesh: stack: Need uuid when adding device for provisioning 2020-12-11 20:10:57 +08:00
Krzysztof Budzynski 17ca685a15 Merge branch 'feature/python2-deprecation-warn_v3.3' into 'release/v3.3'
Tools: Add Python 2 deprecation warning (v3.3)

See merge request espressif/esp-idf!11550
2020-12-11 16:31:18 +08:00
baohongde a36ed1c60b components/bt: insert the llcp packet to the top of the tx_prog linked list 2020-12-11 11:28:12 +08:00
wangcheng 04d28bdf40 components/bt: Fix ble disconnect issue in coex mode 2020-12-11 11:28:12 +08:00
baohongde 2711f35552 components/bt: Fix waking up fail while sleeping 2020-12-11 11:28:12 +08:00
baohongde fcbaa63c4e components/bt: Make sleep avaliable in hli(for future use) 2020-12-11 11:27:35 +08:00
baohongde 809a1ff74c components/coex: Some bugfix about ble dynamic prio
Rewrite ble dynamic prio to fix ble disconn in conn_param_update/channel_map_update
Rewrite ble dynamic prio in connection establishment
Fix ble dynamic prio with latency
Fix status bit set error when conn fail
2020-12-11 11:27:35 +08:00
wangcheng b8f061334a components/bt: backport requires commit to release v3.3 2020-12-11 11:27:35 +08:00
wangcheng c82ba10521 components/bt: fixed memory damage caused by bluetooth memory release 2020-12-11 11:27:35 +08:00
wangcheng 83ee0eef9e Fix BT controller dead issue when clkn overflow 2020-12-11 11:27:35 +08:00
wangcheng ddab5b2a2a component/bt: Fixed the watchdog timeout of btu task during multi-connection 2020-12-11 11:27:35 +08:00
wangcheng 3622e29465 components/bt: Fixed the state not synchronized between controller and host when disconnected. 2020-12-11 11:27:35 +08:00
wangcheng 510110228c btdm: Add comments to clarify the two different device names of GAP and ADV in the ble_spp_server_demo example, as the old example might confuse users. 2020-12-11 11:27:35 +08:00
wangmengyang 8744b8266b component/bt: fall back to main XTAL as Bluetooth sleep clock when EXT 32K CRYS is configured but not detected 2020-12-11 11:27:35 +08:00
Jiang Jiang Jian ab41d84a2f Merge branch 'bugfix/fix_spp_read_flow_control_v3.3' into 'release/v3.3'
component_bt/fix spp flow control and vfs write[backport 3.3]

See merge request espressif/esp-idf!11471
2020-12-10 22:50:56 +08:00
Jiang Jiang Jian 720a2a113e Merge branch 'bugfix/fix_some_wifi_bugs_1204_v3.3' into 'release/v3.3'
Bugfix/fix some wifi bugs 1204 v3.3

See merge request espressif/esp-idf!11504
2020-12-10 22:48:24 +08:00
Darian Leung fca496b4b6 twai: Temporarily disable network example test
Disabling network example test due to issue with synchronizing the
start of each DUT
2020-12-10 21:44:21 +08:00
daiziyan 228bec2371 add CN translation for adding python2 deprecation warning(MR 11115) 2020-12-10 14:04:57 +01:00
xiehang 65a1e1269f esp_wifi: Update wifi lib
1. Optimize WiFi log
2. Optimize 4way handshake failure time
3. Fix eapol frames encryption during reauth
4. Set softap beacon DTIM count according to TSF timer
5. Remove wifi tx buffer limits
6. Remove coexist warnings in ESP_WIFI_MESH
7. Update some APIs descriptions, tables format and typos
8. Fix wifi tx all
2020-12-10 02:55:22 +00:00
xiehang 7b245e59c4 esp_wifi: optimize WiFi TX performance 2020-12-10 02:55:22 +00:00
xiehang 42061dded1 esp_wifi: add limitation for setting maximum WiFi TX power
Limit the WiFi TX power range to 10dBm ~ 20.5 dBm
2020-12-10 02:55:22 +00:00
dongyou 1e519370dd Add documentation to avoid using WiFi modem sleep for WiFi/BT coexistence
Remove description of unusable API esp_wifi_restart()
Update esp_now_fetch_peer discription
Update table format prblm for esp_wifi_set_max_tx_power()
Update description for ssid and password
2020-12-10 02:55:22 +00:00
xiehang 022192411e esp_wifi: remove wifi tx buffer limits 2020-12-10 02:55:22 +00:00
xiehang afad32da9e esp_wifi: set softap beacon DTIM count according to TSF timer 2020-12-10 02:55:22 +00:00
xiehang 77b3ad8385 eps_wifi: Optimize WiFi debug log
1. Add esp_wifi_statis_dump()
2. Optimize WiFi related debug log
2020-12-10 02:55:22 +00:00
liqigan 7a52ed2f15 fix spp flow control and vfs write 2020-12-10 10:44:44 +08:00
martin.gano 7af26fa6d6 Tools: add Python 2 deprecation warning 2020-12-10 00:12:09 +01:00
Jiang Jiang Jian 0416586dcc Merge branch 'bugfix/add_protection_for_spp_api_3_3' into 'release/v3.3'
componnet_bt:/ Add protection for btc and some comment correction [backport v3.3]

See merge request espressif/esp-idf!11455
2020-12-09 22:10:26 +08:00
Michael (XIAO Xufeng) a2142eae7e Merge branch 'bugfix/phy_xpd_v3.3' into 'release/v3.3'
wifi: add set_xpd_sar override(backport v3.3)

See merge request espressif/esp-idf!11491
2020-12-09 10:49:55 +08:00
Island fca750b4ea Merge branch 'feature/btdm_support_some_ble_new_features_v3.3' into 'release/v3.3'
components/bt: backport some new features for Bluedroid BLE(release v3.3)

See merge request espressif/esp-idf!11464
2020-12-09 10:28:39 +08:00
Krzysztof Budzynski 6a1cf51938 Merge branch 'bugfix/sleep_comments_v3.3' into 'release/v3.3'
doc: Specify that sleep wakeup source restrictions apply to all current ESP32 revisions (v3.3)

See merge request espressif/esp-idf!8569
2020-12-08 17:42:13 +08:00
Cao Sen Miao 5490dbcaf7 adc_i2s: solve the i2s_adc issue when using wifi 2020-12-08 16:15:03 +08:00
Angus Gratton debd4ad723 doc: Specify that sleep wakeup source restrictions apply to all current ESP32 revisions
Closes https://github.com/espressif/esp-idf/issues/4681

Discussion https://esp32.com/viewtopic.php?f=13&t=15145
2020-12-08 18:00:11 +11:00
Jiang Jiang Jian a7ec2e6503 Merge branch 'bugfix/add_disconn_req_action_when_no_link_3_3' into 'release/v3.3'
component_bt/bugfix: add_disconn_req_action_when_no_link [backport v3.3]

See merge request espressif/esp-idf!11456
2020-12-07 12:11:47 +08:00
Michael (XIAO Xufeng) 24b910916a Merge branch 'bugfix/can_backport_accumulated_fixes_v3.3' into 'release/v3.3'
CAN backport accumulated fixes (backport v3.3)

See merge request espressif/esp-idf!11463
2020-12-04 23:57:09 +08:00
Darian Leung fcabc257a5 CAN: ISR runs when cache is disabled
This commit adds the feature where the CAN ISR will continue to
run even if the cache is disabled. Whilst cache is disabled, any
received messages will go into the RX queue, and any pending TX
messages in the TX queue will be transmitted. This feature should
be enabled using the CONFIG_CAN_ISR_IN_IRAM option.
2020-12-04 17:58:02 +08:00
Jiang Jiang Jian d96e1442b3 Merge branch 'bugfix/update_toolchain_5.2.0_psram_final_v3.3' into 'release/v3.3'
esp_wifi: Update WiFi toolchain to 1.22.0-97-gc752ad5 (backport v3.3)

See merge request espressif/esp-idf!11103
2020-12-04 11:57:30 +08:00
xiewenxiang a15ce322b5 component/bt: support BLE Read Attribute value by UUID 2020-12-03 21:04:21 +08:00
xiewenxiang dfefe7bfd7 component/bt: refactor ble random address setting 2020-12-03 20:44:58 +08:00
xiewenxiang ea678c3fd1 component/bt: support BLE Application Layer Encryption key size check 2020-12-03 20:36:19 +08:00
xiewenxiang 456d3461a1 component/bt: support BLE Authorization 2020-12-03 20:25:47 +08:00
xiewenxiang 1896249485 component/bt: fix incorrect encryption flag setting 2020-12-03 20:07:05 +08:00
weitianhua 3e3445811a Correct some debug log for BT Stack & Add protection for rfcomm close API in SPP 2020-12-03 19:29:20 +08:00
weitianhua 810e3b7d79 Separating AVRC & A2DP
1. Remove uneccessary macro
2. Add bda_addr for esp_bt_a2dp_disconn_req API
3. Rewrite a2dp clean_up function
2020-12-03 19:05:24 +08:00
Jiang Jiang Jian b4c0751692 Merge branch 'bugfix/fix_spp_dynamic_memory_bugs' into 'release/v3.3'
componet_bt/fix SPP init deynamic memory bugs

See merge request espressif/esp-idf!11435
2020-12-03 16:53:52 +08:00
xiehang d037923265 esp_wifi: Update WiFi toolchain to 1.22.0-97-gc752ad5 2020-12-03 15:54:55 +08:00
Darian Leung 3574ca6156 can: Fix critical section ESP_LOG functions
This commit removes any function calls within
the CAN driver that result in a call to ESP_LOG
whilst inside a critical section.

These function calls are either moved outside
critical sections (e.g., intr_alloc and gpio
functions), or substituted (e.g., assert()).
2020-12-02 21:50:38 +08:00
Darian Leung 35511d0e87 can: Fix semaphore take in critical section
This commit fixes can_reconfigure_alerts() which
could lead to a call to xSemaphoreTake() whilst
inside a critical section.
2020-12-02 21:41:47 +08:00
Darian Leung 540b401e95 CAN: Fix size of RX msg count field on the esp32
This commit fixes the size of the RX message count register field
on the esp32.
2020-12-02 21:40:17 +08:00
Jiang Jiang Jian aee3303084 Merge branch 'bugfix/fix_some_wifi_bugs_1202_v3.3' into 'release/v3.3'
esp_wifi: fix some wifi bugs 1202 (backport v3.3)

See merge request espressif/esp-idf!11437
2020-12-02 20:06:51 +08:00
Hrudaynath Dhabe e456bfedd7 wpa_supplicant: Fix configurable debug log feature's warning issue 2020-12-02 17:00:58 +08:00
GOPTIONS\pfrost b4b51f5a5e Reduce log level of hexdumps to verbose
Revert "Reduce log level of hexdumps to verbose"

Add a menuconfig option to enable or disable the logging in wpa_supplicant

Clarify help message
2020-12-02 16:53:49 +08:00
ronghulin 6d82b0a749 bugfix: fix TCP timer interval 2020-12-02 16:53:49 +08:00
ronghulin d77991744f fix TCP retransmission interval 2020-12-02 16:53:49 +08:00
Jan-Hendrik Frintrop e6bc6951af Fixed links to example directories for fast_scan and scan
Signed-off-by: ronghulin <ronghulin@espressif.com>

https://github.com/espressif/esp-idf/pull/5186
2020-12-02 16:53:49 +08:00
dongyou f70a819761 WIFI: Iperf example's parameter opt was uninitialized, may leads setsockoption invalide if it equal to 0 2020-12-02 16:53:49 +08:00
Angus Gratton 42f4fa4de6 Merge branch 'bugfix/blecent_example_test_v3.3' into 'release/v3.3'
Fix CI blecent example test (backport v3.3)

See merge request espressif/esp-idf!11320
2020-12-02 15:44:39 +08:00
liqigan 25774f41db fix SPP init deynamic memory bugs 2020-12-02 12:24:05 +08:00
Shivani Tipnis cbabe5bacc ci: Fix blecent example test
(cherry picked from commit fc146a98e4)
2020-11-30 22:49:31 +05:30
Artem Godlevskyi 7b030c3943 Added missing MYNEWT_VAL_BLE_L2CAP_COC_MPS definition
Signed-off-by: Prasad Alatkar <prasad.alatkar@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/5825
2020-11-30 18:51:13 +05:30
Prasad Alatkar 5900f9601e NimBLE: Fix misc coverity issues in NimBLE host
- NimBLE NVS : Additional check to account for NVS operation failure
- NimBLE host: Fix minor bug in ble_eddystone_set_adv_data_gen
- NimBLE host: remove recursive call, upstream PR: https://github.com/apache/mynewt-nimble/pull/857
2020-11-30 18:50:57 +05:30
Angus Gratton c33fc7821a Merge branch 'ci/fix_annotated_tag_check_v3.3' into 'release/v3.3'
ci: Fix annotated tag check (v3.3)

See merge request espressif/esp-idf!11334
2020-11-24 06:32:17 +08:00
Jiang Jiang Jian 31f5334ae1 Merge branch 'bugfix/btdm_spp_null_ptr_with_dynamic_memory_v3.3' into 'release/v3.3'
components/bt: Fix SPP using NULL point with dynamic memory

See merge request espressif/esp-idf!11330
2020-11-23 15:49:20 +08:00
Angus Gratton 7e2c75fae7 ci: Fix annotated tag check
Regression in 1612f84
2020-11-23 17:33:52 +11:00
liqigan b9bf3f7cc9 components/bt: Fix SPP using NULL point with dynamic memory 2020-11-23 11:48:34 +08:00
Jiang Jiang Jian fea21b8e44 Merge branch 'bugfix/backport_v3.3_fix_pthread_priority_inheritance' into 'release/v3.3'
pthread: fix the priority inheritance (backport v3.3)

See merge request espressif/esp-idf!11293
2020-11-21 17:51:42 +08:00
Jiang Jiang Jian 025b8c3f21 Merge branch 'feature/mqtt_submodule_update_23c8e1ec_v3.3' into 'release/v3.3'
MQTT: Update submodule reference to da850b (config, error flags, minor fixes) (v3.3)

See merge request espressif/esp-idf!11315
2020-11-21 17:26:18 +08:00
Jiang Jiang Jian e8a0ecddd8 Merge branch 'bugfix/att_buffer_count_fixed_v3.3' into 'release/v3.3'
Bugfix/att buffer count fixed v3.3

See merge request espressif/esp-idf!9164
2020-11-21 17:05:47 +08:00
Jiang Jiang Jian dc4856e292 Merge branch 'bugfix/backport_v3.3_fix_websocket_issue' into 'release/v3.3'
websocket_client: fix some issues for websocket client(backport v3.3)

See merge request espressif/esp-idf!11295
2020-11-21 16:20:28 +08:00
David Čermák a19f58355a Merge branch 'bugfix/fix_transport_ssl_blocking_v3.3' into 'release/v3.3'
transport_ssl: Fix a bug in transport_ssl (backport v3.3)

See merge request espressif/esp-idf!11294
2020-11-20 17:43:41 +08:00
David Cermak e846274e59 MQTT: Update submodule reference: config, error handle, minor fixes
Updates esp-mqtt reference to include fixes below related mainly to:
* configuration update (disable keepalive, network timeout)
* minor fixes (size_t for all sizes, unbalanced lock, api for
  outbox-size)
* extended error handle to include socket's errno

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

Config: Added config value to disable keepalive mechanism
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/8562437c8a50754998f7b5484773851fd1c42388
Related https://github.com/espressif/esp-mqtt/issues/179

Added esp_mqtt_client_get_outbox_size API
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/0a1d9d0300335ca98dd1fed8d2ec2411145877b0
Related https://github.com/espressif/esp-mqtt/pull/178

mqtt_outbox: Removed unused retry_count field from outbox_item_t
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/673086e13a7ff141929ddc9739da3d197f8a5720

config: Fixed typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/259baaec9671ea3c32afa3c27a1196fce5646974

Fixed missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/845c2a3a1e112af5dbe5f3a9ee8f6adb92a03757
Related https://github.com/espressif/esp-mqtt/issues/173
Related https://github.com/espressif/esp-mqtt/pull/174

Extended mqtt error handle to capture transport's socket errno (IDF
v4.3+)
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/23c8e1ecf5681d60032f8405990116a589290b57

Config: Added configuration value to set network timeout
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/a03228ac4639eeb324af99dcded44a1f4113d3c3
Related https://github.com/espressif/esp-mqtt/pull/166

Used size_t for all lengths to allow for other architectures
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/b9db8d90204c7f9a23165630fd74ad621516c0c7
2020-11-20 10:25:59 +01:00
xutao 9da4c47e74 websocket_client: fix some issues for websocket client(backport v3.3) 2020-11-19 15:54:36 +08:00
xutao cf4eba2f5d pthread: fix the priority inheritance (backport v3.3) 2020-11-19 15:30:49 +08:00
xueyunfei 858c7b122e fix bug for tcp recv assert 2020-11-19 11:27:14 +08:00
Island 2c6eb0bd74 Merge branch 'optimize/ble_mesh_gattc_conn_param_v3.3' into 'release/v3.3'
ble_mesh: stack: Update connection parameters used by Central (v3.3)

See merge request espressif/esp-idf!11285
2020-11-19 11:23:21 +08:00
Island adcab65d7d Merge branch 'feat/ble_mesh_node_local_data_func_v3.3' into 'release/v3.3'
ble_mesh: stack: Add node local netkey/appkey func (v3.3)

See merge request espressif/esp-idf!11282
2020-11-19 11:23:12 +08:00
lly 1a36790014 ble_mesh: stack: Update connection interval to 15ms 2020-11-18 20:25:26 +08:00
lly a9ac3e87db ble_mesh: stack: Update connection parameters used by Central 2020-11-18 20:25:14 +08:00
lly d2a99ec816 ble_mesh: stack: Fix wrong declaration of node bind AppKey func 2020-11-18 20:16:25 +08:00
lly 42bdf7ecc2 ble_mesh: stack: Add node local netkey/appkey func 2020-11-18 20:16:06 +08:00
Island f62e92c35f Merge branch 'optimize/ble_mesh_reduce_code_size_v3.3' into 'release/v3.3'
ble_mesh: stack: Optimization introduced to reduce code size (v3.3)

See merge request espressif/esp-idf!11250
2020-11-18 20:08:44 +08:00
Mahavir Jain 77119a793e Merge branch 'fix/protocomm_simple_ble_v3.3' into 'release/v3.3'
Protocomm/simple_ble: Fix gatt table map size to number of handles received  (v3.3)

See merge request espressif/esp-idf!11268
2020-11-18 12:14:35 +08:00
Prasad Alatkar c8354f0231 Protocomm/simple_ble: Make gatt table map size equal to number of handles received (v3.3)
- Fixes memcpy failure observed while adding 2 or more endpoints in
  wifi_provisioning.

 Closes IDF-2250

 Closes https://github.com/espressif/esp-idf/issues/6121
2020-11-17 16:27:29 +05:30
lly c6f809ec03 ble_mesh: example: Update sdkconfig test files for disabling Health Server model 2020-11-17 11:40:52 +08:00
lly 2c66a82434 ble_mesh: stack: Add a Kconfig option to make Health Server model optional 2020-11-17 11:40:31 +08:00
lly f1def7f24e ble_mesh: stack: Split model Kconfig menu into foundation and others 2020-11-17 11:39:07 +08:00
lly aecb897fb8 ble_mesh: example: Fix fast provisioning compile error 2020-11-17 11:37:32 +08:00
lly 10a396d17c ble_mesh: ci: Add disabling mesh model sdkconfig test files 2020-11-17 11:36:37 +08:00
lly d9ffe54991 ble_mesh: stack: Add Kconfig options to make server models optional 2020-11-17 11:33:10 +08:00
lly c90def0992 ble_mesh: stack: Use Kconfig option to make client models optional 2020-11-17 11:30:15 +08:00
lly 4c7a021acd ble_mesh: stack: Make some internal static functions inline 2020-11-17 11:29:28 +08:00
lly 841a015d6c ble_mesh: ci: Add disabling mesh deinit sdkconfig test files 2020-11-17 11:28:54 +08:00
lly 09ac1b596d ble_mesh: stack: Add a Kconfig option to make deinit optional 2020-11-17 11:19:49 +08:00
lly bc4ebea32c ble_mesh: stack: Introduce a new header file mesh_config.h 2020-11-17 11:18:14 +08:00
Jiang Jiang Jian 68b237fe53 Merge branch 'bugfix/customer_baidu_psram_stack_backtrace_v3.3' into 'release/v3.3'
backport v3.3: added psram stack check in backtrace

See merge request espressif/esp-idf!8460
2020-11-12 21:01:12 +08:00
Angus Gratton c823b14802 Merge branch 'bugfix/doc_remove_cmake_defconfig_v3.3' into 'release/v3.3'
Remove defconfig from idf.py (v3.3)

See merge request espressif/esp-idf!10086
2020-11-11 10:44:17 +08:00
Angus Gratton 7a08ec735f Merge branch 'bugfix/ci_use_local_mirror_for_getting_submodules_v3.3' into 'release/v3.3'
ci: Use local git mirror for getting submodules v3.3

See merge request espressif/esp-idf!10383
2020-11-11 08:05:52 +08:00
Island 53bbc94ced Merge branch 'bugfix/fix_node_test_func_not_set_role_v3.3' into 'release/v3.3'
ble_mesh: test: Fix node test function not update role flag (v3.3)

See merge request espressif/esp-idf!11043
2020-11-10 16:44:18 +08:00
lly 330f39ee23 ble_mesh: test: Fix node test function not update role flag 2020-11-09 02:42:36 +00:00
Jiang Jiang Jian 44ec7972bd Merge branch 'bugfix/fix_16mbit_psram_id_read_error_v3.3' into 'release/v3.3'
psram: fix 16mbit psram id read error (backport v3.3)

See merge request espressif/esp-idf!9441
2020-11-05 23:02:09 +08:00
Michael (XIAO Xufeng) 49ace4968f spiram: fix the read id failure
The issue is caused by:
1. The disable_qio_mode inside read_id may have side effects.
2. read_id twice may have side effects.

Fix this issue by moving disable_qio_mode out of read_id and only do it
once before read_id. And retry read_id only when the first one is
failed.

Issue introduced in 3ecbb59c15.
2020-11-05 06:11:29 +00:00
chenjianqiang 1903c05d53 psram: fix 16mbit psram id read error 2020-11-05 06:11:29 +00:00
Jiang Jiang Jian 5d42f3075e Merge branch 'feature/toolchain_gcc52_revert_PSRAM_fixes_2020r3_v3.3' into 'release/v3.3'
Update toolchain to 1.22.0-97-gc752ad5 (v3.3)

See merge request espressif/esp-idf!10348
2020-11-05 14:08:47 +08:00
Jiang Jiang Jian 8667591004 Merge branch 'bugfix/lwip_netdb_cpp_guards_v3.3' into 'release/v3.3'
lw-IP: Changed to C linkage in netdb.h for fixing bug when using mixed C/C++ code (v3.3)

See merge request espressif/esp-idf!11092
2020-11-05 14:00:42 +08:00
Jiang Jiang Jian e0a8eb60dd Merge branch 'feature/lwip_tcp_isn_hook_v3.3' into 'release/v3.3'
lw-ip: enable TCP ISN hook (v3.3)

See merge request espressif/esp-idf!11065
2020-11-05 12:10:59 +08:00
Jiang Jiang Jian 25781e7c88 Merge branch 'mesh/bugfix_1023_backport_v3.3' into 'release/v3.3'
esp_wifi_mesh: update wifi mesh libs(Backport v3.3)

See merge request espressif/esp-idf!11081
2020-11-05 12:08:19 +08:00
Anton Maklakov d429fd7031 ci: Use a local mirror for getting submodules 2020-11-04 10:19:57 +07:00
Anton Maklakov 1f78540cbb windows: Update the prebuilt MSYS2 environment to use then new toolchain
No other changes in the environment contents.
2020-11-04 10:08:00 +07:00
Ivan Grokhotkov 843889fd03 pthread: add dummy implementation of pthread_setcancelstate
Used by new versions of newlib in stdio functions.
2020-11-04 10:08:00 +07:00
Anton Maklakov 873aca4c0d newlib: Build psram libc with the new toolchain
Generated from commit 02c81fb7 in the newlib script repo
2020-11-04 10:08:00 +07:00
Anton Maklakov 81da2bae2a Update toolchain to 1.22.0-97-gc752ad5
Revert a part of PSRAM workaround because of regression
    Add a C++ locale fix for multithreading
2020-11-04 10:07:58 +07:00
Ivan Grokhotkov d8456c621e Merge branch 'bugfix/ci_clone_https_v3.3' into 'release/v3.3'
ci: use HTTPS for cloning in IT jobs (v3.3)

See merge request espressif/esp-idf!11098
2020-11-03 21:45:37 +08:00
Ivan Grokhotkov cc8f9cc539 ci: use HTTPS for cloning in IT jobs 2020-11-03 19:33:21 +08:00
mathiasbredholt 737fce72cc lwip: Changed to C linkage for fixing bug when using mixed C/C++ code
Merges https://github.com/espressif/esp-idf/pull/5900
2020-11-03 08:43:09 +01:00
shenjun a15f77e1c7 esp_wifi_mesh: update wifi mesh libs
1. Fix FIX-ROOT does not reconnect to router when disconnect reason is too many
2. Add API esp_mesh_print_scan_result
3. Modify not to reset mesh_xonseq of self and children when flush_upstream_packets
4. Fix not switch to a parent candidate which has the same layer and assoc as current parent
5. Fix not arm parent monitor when a parent candidate is cleared without sending an event to mesh layer
6. Fix the new voted root does not reconnect to router if rssi is weak
2020-11-03 15:23:28 +08:00
Mahavir Jain 652f43d9ee esp_netif: initialize TCP ISN hook if enabled in configuration 2020-11-02 16:01:58 +05:30
Mahavir Jain 516ca4698f lwip: provide configuration option to enable TCP ISN hook 2020-11-02 16:01:53 +05:30
Mahavir Jain 59112bbd76 tcp_isn: use ROM APIs for md5 calculations 2020-11-02 14:32:58 +05:30
Mahavir Jain a4ad6f7547 lwip: add custom TCP ISN hook implementation
Source:
https://git.savannah.nongnu.org/cgit/lwip/lwip-contrib.git/
2020-10-30 16:42:08 +05:30
Angus Gratton 71af965514 Merge branch 'bugfix/err_to_name_paths_windows_v3.3' into 'release/v3.3'
tools: fix path handling errors in gen_esp_err_to_name.py for Windows (v3.3)

See merge request espressif/esp-idf!10898
2020-10-30 15:12:42 +08:00
Angus Gratton 1960d3c700 Merge branch 'bugfix/ldgen_section_windows_line_ending_v3.3' into 'release/v3.3'
tools/ldgen: Fix parsing of section names on Windows (v3.3)

See merge request espressif/esp-idf!11037
2020-10-30 15:12:05 +08:00
Roland Dobai 3280f45259 tools/ldgen: Fix parsing of sections names on Windows 2020-10-29 08:34:57 +01:00
He Yin Ling 66d3783c89 Merge branch 'bugfix/relative_import_error' into 'release/v3.3'
bugfix: import error in example tests

See merge request espressif/esp-idf!11003
2020-10-29 10:42:51 +08:00
Jiang Jiang Jian ec4124676f Merge branch 'bugfix/bredr_bugfix_release_for_qa_dummy_disconnect_3_3' into 'release/v3.3'
Bugfix/bredr bugfix release for qa dummy disconnect 3.3

See merge request espressif/esp-idf!10649
2020-10-28 21:26:29 +08:00
Jiang Jiang Jian 3616ae4da4 Merge branch 'bugfix/add_clear_bond_complete_evt_3_3' into 'release/v3.3'
componenet_bt/bugfix: add remove bond device complete event 3.3

See merge request espressif/esp-idf!10658
2020-10-28 16:58:49 +08:00
Chen Yu Dong 312f100551 bugfix: import error in example tests
relative import error in lib_ble_client
import Queue error in blehr_test
import http server error in ota tests
2020-10-28 14:19:30 +08:00
Jiang Jiang Jian 39f26cce95 Merge branch 'bugfix/fix_dhcp_renew_fail_for_3.3' into 'release/v3.3'
lw-ip: Fix dhcp renew fail in t1 and will renew ip in t2 every 1s

See merge request espressif/esp-idf!10986
2020-10-28 11:21:46 +08:00
Jiang Jiang Jian 4e71047a2a Merge branch 'bugfix/fix_bredr_read_rssi_delta_v3.3' into 'release/v3.3'
Bugfix/Fix Read Rssi Delta Bug in Bredr [backport v3.3]

See merge request espressif/esp-idf!10810
2020-10-26 21:44:39 +08:00
Jiang Jiang Jian e5cf7bc370 Merge branch 'bugfix/fix_tsf_bug_v3.3' into 'release/v3.3'
WiFi: fix tsf bug (backport v3.3)

See merge request espressif/esp-idf!10951
2020-10-26 21:32:56 +08:00
zhangyanjiao 91fca12f6a esp_wifi: Fixed the bug for timestamp check, didn't disconnect AP when AP's timestamp decrease abnormally 2020-10-26 11:16:34 +00:00
xueyunfei 668347e9c1 fix(dhcp): Fix dhcp renew fail in t1 and will renew ip in t2 every 1s util renew successful.(backport 3.3) 2020-10-26 16:35:32 +08:00
Angus Gratton c1b49c419d Merge branch 'bugfix/ldgen_unicode_path_v3.3' into 'release/v3.3'
tools/ldgen: Parse paths with Unicode characters in archives (v3.3)

See merge request espressif/esp-idf!10967
2020-10-26 12:08:28 +08:00
Jiang Jiang Jian cd06c14265 Merge branch 'bugfix/fix_get_bond_device_list_v3.3' into 'release/v3.3'
bugfix/fix esp_bt_gap_get_bond_device_list bug [backport v3.3]

See merge request espressif/esp-idf!9669
2020-10-26 11:47:08 +08:00
Jiang Jiang Jian 410d59d53d Merge branch 'feature/esp_spp_stop_srv_v3.3' into 'release/v3.3'
bugfix/Add API esp_spp_stop_srv and fix collection of SPP [backport v3.3]

See merge request espressif/esp-idf!10010
2020-10-26 11:46:56 +08:00
Jiang Jiang Jian 77486506e3 Merge branch 'bugfix/fix_hci_max_page_num_v3.3' into 'release/v3.3'
bugfix/Support for more Bluetooth HID devices [backport v3.3]

See merge request espressif/esp-idf!9663
2020-10-26 11:46:11 +08:00
Michael (XIAO Xufeng) adaed2c79d Merge branch 'spi_dma_close_before_cpu_reset_v3.3' into 'release/v3.3'
spi: fix issue with closing DMA before CPU reset (3.3)

See merge request espressif/esp-idf!10865
2020-10-25 23:51:21 +08:00
He Yin Ling 4a9f946278 Merge branch 'feature/move_auto_test_script_to_new_repo_3.3' into 'release/v3.3'
ci: move auto_test_script to new repo (backport 3.3)

See merge request espressif/esp-idf!10881
2020-10-24 09:26:11 +08:00
Chen Yu Dong 632530ef3c test: move auto test script to new repo (backport)
known issues +
2020-10-24 09:26:08 +08:00
Roland Dobai ef43198018 tools/ldgen: Parse paths with Unicode characters in archives
Closes https://github.com/espressif/esp-idf/issues/5996
2020-10-23 13:46:19 +02:00
Jiang Jiang Jian 4a3e7bc40d Merge branch 'bugfix/udpv6_fail_to_receive_data_for_the_first_time' into 'release/v3.3'
lw-ip:udpv6 failed to receive data for the first time

See merge request espressif/esp-idf!10942
2020-10-23 15:25:55 +08:00
boblane c5b23a85b8 Some Bluetooth devices - such as an Xbox One S controller (model 1708) - report more than two external features pages and are rejected immediately. Pages 1 and 2 are marked as unhandled in btm_devctl.c anyway, so there is no reason to block devices with more pages.
(IDFGH-3515)
Signed-off-by: liqigan <liqigan@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/5481
Closes https://github.com/espressif/esp-idf/issues/5470
2020-10-23 06:14:24 +00:00
liqigan 35b2eeaa65 add API esp_spp_stop_srv(), fix the error parameter in esp-idf/examples/bluetooth/bluedroid/classic_bt/bt_spp_initiator/main/example_spp_initiator_demo.c and fix collection of SPP
Closes https://github.com/espressif/esp-idf/issues/5409
Closes https://github.com/espressif/esp-idf/pull/5408

See merge request !9114
2020-10-22 08:33:39 +00:00
boblane fc6f480e89 fix esp_bt_gap_get_bond_device_list bug
Closes https://github.com/espressif/esp-idf/issues/5395
2020-10-22 06:32:16 +00:00
Angus Gratton 394d0ecb65 Merge branch 'bugfix/embed_file_symbol_names_v3.3' into 'release/v3.3'
cmake: fix C identifier generation from embedded file (v3.3)

See merge request espressif/esp-idf!10667
2020-10-22 12:16:49 +08:00
xueyunfei 2e3dfd23e7 udpv6 failed to receive data for the first time 2020-10-22 11:40:04 +08:00
Mahavir Jain 83809a37a7 Merge branch 'bugfix/esp_idf_version_v3.3' into 'release/v3.3'
Add __ASSEMBLER__ flag in esp_idf_version.h to fix build failure with assembly files (v3.3)

See merge request espressif/esp-idf!10902
2020-10-21 20:07:54 +08:00
liqigan d61459e692 modify read rssi related function names
Closes https://github.com/espressif/esp-idf/issues/5660
2020-10-20 12:31:50 +00:00
Jiang Jiang Jian 5543b6a85b Merge branch 'bugfix/fix_some_wifi_bugs_0924_v3.3' into 'release/v3.3'
fix some wifi bugs 0924 (v3.3)

See merge request espressif/esp-idf!10615
2020-10-20 20:29:50 +08:00
Island d25b00bd5e Merge branch 'bugfix/ble_mesh_autorsp_description_v3.3' into 'release/v3.3'
esp_ble_mesh: api: fixed comment about autoresp (v3.3)

See merge request espressif/esp-idf!10891
2020-10-19 16:34:26 +08:00
Shubham Kulkarni 5a287c3a31 esp_idf_version.h: Add __ASSEMBLER__ flag to fix build failure with assembly files 2020-10-19 13:23:20 +05:30
Marius Vikhammer a1c57aa022 tools: fix path handling errors in gen_esp_err_to_name.py for Windows
Exclude paths that were specified with slash as a path separator were compared
as strings. This would fail on Windows which uses backslash as a path separator.
2020-10-19 14:44:33 +08:00
andreachiara b097435596 esp_ble_mesh: api: fixed comment about autoresp 2020-10-19 11:32:52 +08:00
Armando 2a0dc304c0 spi: fix issue with closing DMA before CPU reset 2020-10-16 14:13:32 +08:00
Renz Bagaporo b94c309fd9 cmake: fix C identifier generation from embedded file 2020-10-15 21:29:24 +08:00
Alexey Gerenkov 495ffcc899 tools: Updates OpenOCD version to 'v0.10.0-esp32-20200709' 2020-10-14 19:03:06 +00:00
Island 3901f38de6 Merge branch 'optimize/ble_mesh_make_buf_config_invisible_v3.3' into 'release/v3.3'
ble_mesh: stack: Make mesh buf debug option invisible (v3.3)

See merge request espressif/esp-idf!10797
2020-10-13 19:51:59 +08:00
Island 58c5b7a1bf Merge branch 'feat/ble_mesh_device_properties_v2_v3.3' into 'release/v3.3'
Feat/ble mesh device properties v2 (v3.3)

See merge request espressif/esp-idf!10790
2020-10-13 19:50:17 +08:00
lly 0d92639439 ble_mesh: stack: Make mesh buf debug option invisible 2020-10-13 09:31:47 +00:00
lly 23a21f92be ble_mesh: stack: Add mesh device properties v2 definitions
Also fixes wrong characteristic value length of some device
properties.
2020-10-13 09:30:16 +00:00
lly aa329b08ce ble_mesh: stack: Move device property to model common part 2020-10-13 09:30:16 +00:00
Island 7d8d841659 Merge branch 'bugfix/ble_mesh_proxy_cfg_replay_v3.3' into 'release/v3.3'
Bugfix/ble mesh proxy cfg replay (v3.3)

See merge request espressif/esp-idf!10821
2020-10-13 17:24:11 +08:00
zhangyanjiao a5b5467dca esp_wifi:
1. Optimize some debug logs for probe response
2. Optimize phy and soc files
3. Fix the bug that no event for connect
4. Fix the bug that set_channel doesn't work for softAP
5. Drop receiving packets from myself
2020-10-13 17:22:47 +08:00
lly 18cc96d188 ble_mesh: stack: Store kr phase after value changed [Zephyr] 2020-10-13 14:32:51 +08:00
lly 3e61d519c1 ble_mesh: stack: Fix rpl not check by proxy cfg [Zephyr] 2020-10-13 14:32:36 +08:00
David Čermák ad0b1ac8d7 Merge branch 'feature/mqtt_sub_update_01594bf1_v3.3' into 'release/v3.3'
MQTT: Update submodule reference (Backport v3.3)

See merge request espressif/esp-idf!10234
2020-10-13 14:13:52 +08:00
David Čermák 651dc8788f Merge branch 'bugfix/ws_stop_deadlock_v3.3' into 'release/v3.3'
Websocket client: avoid deadlock if stop called from event handler (Backport v3.3)

See merge request espressif/esp-idf!10229
2020-10-13 14:12:52 +08:00
David Čermák 31d272e460 Merge branch 'bugfix/openss_strict_verify_mode_3.3' into 'release/v3.3'
openssl: made verification mode conversion to mbetls modes more strict (v3.3)

See merge request espressif/esp-idf!10502
2020-10-13 14:10:54 +08:00
Island b4338b61a2 Merge branch 'bugfix/ble_mesh_node_deinit_v3.3' into 'release/v3.3'
ble_mesh: stack: Persistent storage misc fixes (v3.3)

See merge request espressif/esp-idf!10815
2020-10-13 14:06:23 +08:00
Jiang Jiang Jian 5d1da96e3e Merge branch 'bugfix/ipv6_address_get_fail_after_wifi_disconnect_for_3.3' into 'release/v3.3'
lw-ip:ipv6 address get fail after wifi disconnect for 3.3(backport 3.3)

See merge request espressif/esp-idf!10792
2020-10-13 12:28:46 +08:00
lly 542b6bdbc1 ble_mesh: stack: Persistent storage misc fixes
* Fix the issue that deinit node with "erase_flash"
  set to true, but info is not erased from nvs
* Reuse bt_mesh_cfg_reset() when deinit node
* Optimize Provisioner related erase operations
* No store pending timeout will be used when Node
  is not provisioned OR Provisioner is disabled
  and erase operation is performed
* Change the default timeout for settings operation
  to 0, and rpl store rate to 0
2020-10-13 10:55:58 +08:00
Island 733aaa4af0 Merge branch 'bugfix/ble_mesh_settings_fix_v3.3' into 'release/v3.3'
Bugfix/ble mesh settings fix (v3.3)

See merge request espressif/esp-idf!10786
2020-10-13 10:50:07 +08:00
Marius Vikhammer 0b42900063 Websocket client: avoid deadlock if stop called from event handler 2020-10-12 10:15:55 +00:00
Marius Vikhammer 22ce545187 MQTT: Update submodule reference
SSL: add config option for skipping common name check
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/5e8950e681e5419d85e0ffc0d72a78cdeb894fd7)
Closes https://github.com/espressif/esp-mqtt/issues/158

Websocket: Allow the query part of the uri to be a part of the path
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/40b06deb10d27219c66ddb2e1a628caf0fc2547f)
Closes https://github.com/espressif/esp-mqtt/issues/161

Config: Add check for consistency between config settings
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/8a412c147de5cce4b2c2a612915755cf551a1675)

Add IDF version check for secure element feature
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/db4bce01ab6d8e4ad81e59995def48b5728d9b36)

Fix esp_mqtt_client_stop deadlock
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/5e17dcaeb257f847386478119935ecd360f47377)
Closes https://github.com/espressif/esp-mqtt/issues/163

Add dispatch error event for read errors
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/d4aaec08ff13b5a599f114cba8ada684901c7e54
Closes https://github.com/espressif/esp-idf/issues/5704

Cleanup expired messages when offline
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/bdadd77c6e24382234c1960600ac2bdf4a6ace9d
Closes https://github.com/espressif/esp-idf/issues/5668

esp_mqtt_client_publish now returns msg id for QoS > 0 when offline
esp-mqtt commit: https://github.com/espressif/esp-mqtt/commit/f7325bfa10c7cacabb76e58fcd2e1622a9e1b589
2020-10-12 10:15:19 +00:00
David Cermak 4a1016411b openssl: made verification mode conversion to mbetls modes more strict 2020-10-12 10:14:21 +00:00
xueyunfei a9f6748de9 lw-ip:ipv6 address get fail after wifi disconnect for 3.3 2020-10-12 10:58:50 +08:00
lly b4c3c87c75 ble_mesh: stack: Use settings_core_erase when deinit 2020-10-12 10:02:05 +08:00
lly 3940ab80a3 ble_mesh: stack: Fix storing next net_idx and app_idx 2020-10-12 10:02:05 +08:00
lly d7c2d66d55 ble_mesh: stack: Continue restore even if failure happens
Previously we have used this solution for node info
restore. Here use the same solution for other mesh
information restore.
2020-10-12 10:02:05 +08:00
lly 4fc62b7983 ble_mesh: stack: Split model settings store and clear 2020-10-12 10:02:05 +08:00
lly de15e502a7 ble_mesh: stack: Erase netkey and appkey with key index 2020-10-12 10:02:05 +08:00
lly d51431fff5 ble_mesh: stack: Add clear hb_pub in settings 2020-10-12 10:02:05 +08:00
lly d4651bbb30 ble_mesh: stack: Transport rx reset settings update
When reset the rx info of transport layer, the
rpl list will always cleared, and rpl stored
in the nvs will only be erased when erase flag
is true and BLE_MESH_SETTINGS is enabled.
Compared with the previous solution, it should
be more clear.
2020-10-12 10:02:05 +08:00
lly e202225bd1 ble_mesh: stack: Use erase settings functions 2020-10-12 10:02:05 +08:00
lly 1a3515ab76 ble_mesh: stack: Use mutex for settings operation
Also expose the settings functions with the parameter
bt_mesh_nvs_handle_t, which will be used for further
updates.
2020-10-12 10:02:05 +08:00
lly a662d14a4e ble_mesh: stack: Add role check before enabling device 2020-10-12 10:02:05 +08:00
lly 4dcbe2bd7a ble_mesh: stack: Define a type for mesh nvs handle 2020-10-12 10:01:47 +08:00
lly 22d01ba674 ble_mesh: ci: Enable settings in sdkconfig.ci.xxx 2020-10-12 08:49:52 +08:00
Jiang Jiang Jian 4782dde73a Merge branch 'bugfix/fix_ble_hci_desync_deadlock_v3.3' into 'release/v3.3'
components/bt: Fix for HCI desync deadlock issue in BLE controller.

See merge request espressif/esp-idf!10625
2020-10-09 19:52:42 +08:00
Jiang Jiang Jian 151e4e156f Merge branch 'bugfix/nimble_host_rcv_pkt_length_check_v3.3' into 'release/v3.3'
NimBLE: host_rcv_pkt event buf size check. (v3.3)

See merge request espressif/esp-idf!10761
2020-10-09 15:19:47 +08:00
Chinmay Chhajed 1aa40de934 NimBLE: host_rcv_pkt event buf size check.
Check if the size of HCI event buffer is greater than the received HCI
packet. If not then abort with the error message.
2020-10-09 09:32:37 +05:30
Angus Gratton 471d79edae Merge branch 'bugfix/ci_auto_checkout_revision_of_project_used_in_ci_v3.3' into 'release/v3.3'
CI: get git describe from annotated tags (v3.3)

See merge request espressif/esp-idf!10676
2020-10-08 16:44:49 +08:00
Mahavir Jain 1ffeff5948 Merge branch 'bugfix/bootloader_anti_rollback_mmap_v3.3' into 'release/v3.3'
bootloader_support: fix issue in memory mapping for getting app descriptor (v3.3)

See merge request espressif/esp-idf!10737
2020-10-08 16:31:35 +08:00
Angus Gratton 0f6b7ad3cf Merge branch 'bugfix/bootloader_common_get_sha256_of_partition_v3.3' into 'release/v3.3'
bootloader_support: Fix bootloader_common_get_sha256_of_partition(), can handle a long image (v3.3)

See merge request espressif/esp-idf!9955
2020-10-08 13:11:46 +08:00
Angus Gratton 111e0361c9 ci: Check version tags are always annotated
Closes https://github.com/espressif/esp-idf/issues/3114
2020-10-07 13:53:45 +11:00
Angus Gratton 6c2bffe53c build system: Also get IDF version from annotated tags only
Builds on previous commit.

Note: Getting the project version still pases --tags so still works with plain
tags, to keep compatibility for existing projects
2020-10-07 13:53:45 +11:00
Mahavir Jain 0167a5e96d bootloader_support: fix issue in memory mapping for getting app descriptor
For getting secure_version field in anti rollback case, bootloader tries
to map whole firmware partition but fails for cases where partition size
is beyond available MMU free pages capacity.

Fix here ensures to map only required length upto application descriptor
size in firmware partition.

Closes https://github.com/espressif/esp-idf/issues/5911
2020-10-06 14:43:12 +05:30
Michael (XIAO Xufeng) 021e1189c5 Merge branch 'bugfix/mcpwm_fault_init_copypaste_typo_bp3.3' into 'release/v3.3'
MCPWM: Fix PWM-fault init function that read config incorrectly (backport v3.3)

See merge request espressif/esp-idf!9550
2020-10-02 14:20:12 +08:00
He Yin Ling 936c803ccb CI: get git describe from annotated tags:
we should only parse IDF version from annotated tags
2020-09-30 11:34:28 +08:00
xutao 85d63af301 tcp_transport: fix an issue when use 2020-09-30 11:34:00 +08:00
Chinmay Chhajed 02893a2038 components/bt: Fix for HCI desync deadlock issue in BLE controller. 2020-09-29 21:35:15 +05:30
Jiang Jiang Jian cd86bc9d8d Merge branch 'bugfix/confirmed_bugfix_from_baidu_proj_3.3' into 'release/v3.3'
Confirmed bugfix from Baidu Project 3.3

See merge request espressif/esp-idf!10548
2020-09-29 20:48:50 +08:00
Jiang Jiang Jian 9401c59f89 Merge branch 'bugfix/customer_baidu_int_wdt_v3.3' into 'release/v3.3'
backport v3.3: add soft solution for esp32 eco3 live lock issue

See merge request espressif/esp-idf!9217
2020-09-29 14:04:00 +08:00
baohongde 67edd0c10e components/bt: Replace task post with btc_inter_profile_call, when post message from btc_dm to btc_gap 2020-09-28 19:36:23 +08:00
baohongde abf6cecde1 components/bt: Fix clear bond fail when connected without ble included 2020-09-28 16:21:25 +08:00
xiongweichao 67276f5d26 add remove bond device complete event 2020-09-28 16:14:52 +08:00
xiongweichao 3c0aee8595 1.revert dummy command
2.fix send MEDIA_CTRL command in disconnect
2020-09-28 12:00:28 +08:00
xiongweichao 2233b5d25e 1.fix test case dummy
2.fix sink send media control ESP_A2D_MEDIA_CHECK_SRC_RDY
2020-09-28 11:55:46 +08:00
Jiang Jiang Jian a55f0ebbd5 Merge branch 'bugfix/wifi_spin_lock_allocation_in_PSRAM_v3.3' into 'release/v3.3'
wifi: Fix spin lock allocation in PSRAM bug(v3.3)

See merge request espressif/esp-idf!10550
2020-09-27 12:49:32 +08:00
Jiang Jiang Jian e49a6b95ed Merge branch 'bugfix/fix_ipv6_nd6_max_queue_num_v3.3' into 'release/v3.3'
lw-ip: fix IPv6 ND6 queue too much pkts cause no mem issue(backport v3.3)

See merge request espressif/esp-idf!10177
2020-09-27 12:47:30 +08:00
Jiang Jiang Jian 4a037fa911 Merge branch 'bugfix/can_mmap_after_get_enough_free_mmu_pages_v3.3' into 'release/v3.3'
flash_mmap: can mmap after get enough free MMU pages (backport v3.3)

See merge request espressif/esp-idf!10587
2020-09-27 12:46:42 +08:00
Island 0b792c44eb Merge branch 'optimize/ble_mesh_provisioner_delete_dev_v3.3' into 'release/v3.3'
ble_mesh: stack: Optimize Provisioner delete device function (v3.3)

See merge request espressif/esp-idf!10606
2020-09-27 10:53:19 +08:00
lly 81354cf24f ble_mesh: stack: Optimize Provisioner delete device function
Since we have provided separate functions for deleting node
information with node's unicast address, device uuid, etc.
So we update the behavior of this function, which will only
be used to delete device information which is not provisioned
or just under provisioning.
2020-09-25 14:04:58 +08:00
Angus Gratton fcadbaf97c Merge branch 'update/release_v3.3.4' into 'release/v3.3'
v3.3: Update to v3.3.4

See merge request espressif/esp-idf!10520
2020-09-25 10:21:30 +08:00
ChenJianxing 186ad2f6aa lwip: fix IPv6 ND6 queue too much pkts cause no mem issue and add menuconfig item for this params. 2020-09-24 10:43:23 +08:00
jiangguangming 4f3ddbb299 flash_mmap: restore interrupt and cache before err return 2020-09-24 10:06:18 +08:00
jiangguangming 9debc7248a flash_mmap: can mmap after get enough free MMU pages 2020-09-24 10:06:18 +08:00
Jiang Jiang Jian fb18b12efe Merge branch 'bugfix/bt_linkup_fallback_event_v3.3' into 'release/v3.3'
Bluedroid: Fixes cases having fallback to link up event. (v3.3)

See merge request espressif/esp-idf!9805
2020-09-22 16:44:07 +08:00
Jiang Jiang Jian 251676181a Merge branch 'bugfix/backport_some_lwip_bugs_0910_v3.3' into 'release/v3.3'
lw-ip:backport bugfix lw-ip for v3.3

See merge request espressif/esp-idf!10409
2020-09-22 14:18:30 +08:00
dongyou e12593a79f Fix spin lock allocation in PSRAM bug 2020-09-22 14:11:25 +08:00
weitianhua 7f9a4d25ef Confirmed bugfix from Baidu Project 2020-09-22 11:57:00 +08:00
Michael (XIAO Xufeng) 4afc8facde Merge branch 'fixbug/sdmmc_spi_highspeed_v3.3' into 'release/v3.3'
sdmmc: fix the probe issue that forbid sdspi working in highspeed mode(backport v3.3)

See merge request espressif/esp-idf!9838
2020-09-21 11:10:09 +08:00
Angus Gratton c73a00e073 Merge branch 'bugfix/espcoredump_fix_error_reported_for_blank_partition_v33' into 'release/v3.3'
Bugfix/espcoredump fix error reported for blank partition (backport v3.3)

See merge request espressif/esp-idf!9625
2020-09-21 10:45:05 +08:00
Michael (XIAO Xufeng) f2f13eb8e8 Merge branch 'bugfix/spi_master_multiple_dev_with_diff_cs_lvl_3.3' into 'release/v3.3'
spi_master: correctly set cs polarity (3.3)

See merge request espressif/esp-idf!10406
2020-09-21 10:21:22 +08:00
aleks c9f4b0aba8 espcoredump: fix error reported for blank partition 2020-09-21 01:29:24 +00:00
Ivan Grokhotkov 6e284ea84b Merge branch 'bugfix/parttool_example_test_fail_v3.3' into 'release/v3.3'
examples/parttool: fix the test to work on parallel test runner (backport v3.3)

See merge request espressif/esp-idf!10376
2020-09-18 23:30:58 +08:00
Angus Gratton 34961db9c1 Merge branch 'release/v3.3' into update/release_v3.3.4 2020-09-18 19:44:26 +10:00
Angus Gratton b64b375234 version: Update to v3.3.4 2020-09-18 19:42:21 +10:00
xueyunfei 315cbe05cf backport bugfix lwip for v3.3 2020-09-18 02:28:13 +00:00
Island f54f776905 Merge branch 'bugfix/ble_mesh_check_stack_init_v3.3' into 'release/v3.3'
ble_mesh: stack: Check if mesh stack initialized before init vendor client (v3.3)

See merge request espressif/esp-idf!10484
2020-09-18 09:40:14 +08:00
Michael (XIAO Xufeng) c7a9851de0 Merge branch 'bugfix/fix_bugs_in_gpio_unit_test_v3.3' into 'release/v3.3'
bugfix(ut): fix gpio output and input mode test(backport v3.3)

See merge request espressif/esp-idf!10023
2020-09-18 02:17:42 +08:00
lly 1f32a8d95e ble_mesh: stack: Check if mesh stack initialized before init vendor client 2020-09-17 11:28:02 +08:00
Ivan Grokhotkov c3e8fb73c7 Merge branch 'bugfix/missing_regex_error_stub' into 'release/v3.3'
Add missing regex_error stub

See merge request espressif/esp-idf!8852
2020-09-16 04:50:54 +08:00
Ivan Grokhotkov 9dda741a99 Merge branch 'bugfix/nvs_no_throw_v3.3' into 'release/v3.3'
NVS: Changed all new to new (nothrow) (backport v3.3)

See merge request espressif/esp-idf!7858
2020-09-16 02:49:09 +08:00
Jakob Hasse 5d45705ca1 NVS Flash: prevent erasing initialized partition
Closes https://github.com/espressif/esp-idf/issues/4755
Closes https://github.com/espressif/esp-idf/issues/2777

* nvs_flash_erase_partition() checks whether
  the parition in question is initialized
  already and will return an error if so
* reflect changes in the documentation
2020-09-15 18:45:42 +00:00
Jakob Hasse a7e1c144e2 Add missing regex_error stub
Closes IDFGH-3153

* avoids linker error
2020-09-15 18:20:09 +00:00
Angus Gratton 8a79415c2e Merge branch 'bugfix/ulp_as_version_v3.3' into 'release/v3.3'
ulp: fix ULP assembler version detection for localized systems (v3.3)

See merge request espressif/esp-idf!10396
2020-09-15 15:09:30 +08:00
Angus Gratton 1d8bf5356b Merge branch 'bugfix/eclipse_make_py3_v3.3' into 'release/v3.3'
tools: Fix Python 3 incompatibility for building with Eclipse on Windows (v3.3)

See merge request espressif/esp-idf!10401
2020-09-15 15:06:54 +08:00
Angus Gratton d7ea1b0a08 Merge branch 'bugfix/ut_ext_win_open_file_v3.3' into 'release/v3.3'
Tools: Close temporary file before invoking external tools accessing it (v3.3)

See merge request espressif/esp-idf!9858
2020-09-15 14:27:34 +08:00
Ivan Grokhotkov 65d829826e Merge branch 'feature/ci_fix_docker_build_v3.3' into 'release/v3.3'
ci: Use git mirror for docker image (v3.3)

See merge request espressif/esp-idf!10448
2020-09-15 01:47:56 +08:00
Wielebny666 bca1beb3f0 spi_master: correctly set cs polarity
All devices must be added to the same spi line before use.
2020-09-14 11:58:10 +00:00
Sergei Silnov 4f11ecebbc ci: Use git mirror for docker image 2020-09-14 13:11:44 +02:00
Island 64adabfd3a Merge branch 'bugfix/ble_mesh_prov_iv_index_v3.3' into 'release/v3.3'
ble_mesh: stack: Using the latest iv_index for provisioning (v3.3)

See merge request espressif/esp-idf!10419
2020-09-14 14:17:53 +08:00
Michael (XIAO Xufeng) cbcb218418 Merge branch 'bugfix/fix_i2s_reset_issue_v3.3' into 'release/v3.3'
driver(I2S): Fix I2S reset issue for release/v3.3

See merge request espressif/esp-idf!9586
2020-09-14 10:45:50 +08:00
Jiang Jiang Jian cec88e11ed Merge branch 'component/seperate_bta_jv_l2c_3.3' into 'release/v3.3'
Component/seperate bta jv l2c 3.3

See merge request espressif/esp-idf!9651
2020-09-11 19:38:36 +08:00
lly 34f30a878e ble_mesh: stack: Using the latest iv_index for provisioning
Provisioner should always uses the latest IV Index for provisioning.
For example, if the current IV Index is 0x00000001, but prov->iv_index
is still initialized with 0x00000000, and if Provisioner uses prov->
iv_index for provisioning, this will cause the Provisioner failing to
control the node.
So here bt_mesh.iv_index is used instead of prov->iv_index.
2020-09-11 07:58:20 +00:00
Jiang Jiang Jian 908938bc3c Merge branch 'bugfix/fix_some_wifi_bugs_0907_v3.3' into 'release/v3.3'
bugfix: fix some wifi bugs (backport v3.3)

See merge request espressif/esp-idf!10318
2020-09-10 22:33:18 +08:00
Roland Dobai 518e1da637 tools: Fix Python 3 incompatibility for building with Eclipse on Windows 2020-09-10 09:47:29 +02:00
Roland Dobai cccdd13937 ulp: fix ULP assembler version detection for localized systems 2020-09-10 09:36:22 +02:00
Island 6c5fc42114 Merge branch 'feat/ble_mesh_use_model_c_v3.3' into 'release/v3.3'
ble_mesh: stack: Use model callback for operations [Zephyr] (v3.3)

See merge request espressif/esp-idf!10365
2020-09-10 10:40:19 +08:00
Island 7514850962 Merge branch 'bugfix/ble_mesh_remove_assert_v3.3' into 'release/v3.3'
ble_mesh: stack: Avoid using assert in mesh stack (v3.3)

See merge request espressif/esp-idf!10361
2020-09-10 10:39:21 +08:00
Island fa24dd7f6d Merge branch 'bugfix/ble_mesh_nimble_ccc_handle_v3.3' into 'release/v3.3'
ble_mesh: nimble: Fix updating ccc handle with wrong value (v3.3)

See merge request espressif/esp-idf!10357
2020-09-10 10:38:31 +08:00
Ivan Grokhotkov e1fd76a11f examples/parttool: fix the test to work on parallel test runner
Pass the DUT port to parttool_example.py as an argument.
2020-09-09 18:40:53 +02:00
lly 9b70ddbb77 ble_mesh: stack: Use model callback for operations [Zephyr]
- Previously when a model is initialized or deinitialized, in the
  access layer, we need to check the model id with the ids in the
  table in order to find the proper model operation function.
- Currently all the operation functions of each model will be set
  during the mesh initialization. When the model is found, we can
  directly use the corresponding callback for different operations.
- Currently only init/deinit operations are registered, later we
  will add more operations.
2020-09-09 14:01:17 +08:00
lly 1090c12acd ble_mesh: stack: Avoid using assert in mesh stack 2020-09-09 10:58:18 +08:00
lly d79e95e6e0 ble_mesh: nimble: Fix updating ccc handle with wrong value 2020-09-09 10:50:40 +08:00
Michael (XIAO Xufeng) a3ef2bbe33 Merge branch 'feature/vfs_uart_set_line_ending_v3.3' into 'release/v3.3'
feature: support vfs uart set line endings with specified uart number release/v3.3

See merge request espressif/esp-idf!9595
2020-09-09 10:36:59 +08:00
ronghulin a571bc0d0a bugfix: fix some wifi bugs
1. add sta connect again ap sent disconnect event
2. add set/get inactive time api
3. fix connect hidden AP doesn't update information
4. add rf test long short support
2020-09-08 14:18:00 +08:00
He Yin Ling 3b79b6b5da Merge branch 'bugfix/remove_auto_conn_case_v3.3' into 'release/v3.3'
test: remove auto conn case because we do not support this anymore (v3.3)

See merge request espressif/esp-idf!9943
2020-09-07 20:45:52 +08:00
Michael (XIAO Xufeng) 7e6572a34d Merge branch 'bugfix/spi_flash_yield_coredump_v3.3' into 'release/v3.3'
spi_flash: don't call vTaskDelay in non-os context (backport v3.3)

See merge request espressif/esp-idf!10300
2020-09-07 13:26:56 +08:00
Ivan Grokhotkov 93ad53c09d spi_flash: don't call vTaskDelay in non-os context
Fixes regression in core dump, when a crash happens in interrupt
context.
2020-09-04 21:30:01 +02:00
Krzysztof Budzynski 10d40d1448 Merge branch 'bugfix/macos_toolchain_url_v3.3' into 'release/v3.3'
docs: Fix toolchain URL generation for macos (v3.3)

See merge request espressif/esp-idf!10028
2020-09-04 23:08:01 +08:00
Krzysztof Budzynski 0af1da4416 Merge branch 'doc/broken_readme_links_v3.3' into 'release/v3.3'
Docs: Fix broken README links (v3.3)

See merge request espressif/esp-idf!9504
2020-09-04 23:05:57 +08:00
Island 77e3b100eb Merge branch 'bugfix/ble_mesh_sensor_example_fix_v3.3' into 'release/v3.3'
ble_mesh: example: Fix sensor data wrong iteration (v3.3)

See merge request espressif/esp-idf!10276
2020-09-04 16:55:14 +08:00
lly 073542063c ble_mesh: example: Fix sensor data wrong iteration 2020-09-04 11:57:08 +08:00
Mahavir Jain b5ac1871de Merge branch 'feature/upgrade_mbedtls_to_v3.3' into 'release/v3.3'
mbedtls: update to mbedtls release v2.16.7 (v3.3)

See merge request espressif/esp-idf!9909
2020-09-03 18:59:16 +08:00
Mahavir Jain 2ad0565e3a mbedtls: update to mbedtls release v2.16.7
For detailed release notes, please refer to:
https://github.com/ARMmbed/mbedtls/releases/tag/mbedtls-2.16.7
2020-09-03 05:10:30 +00:00
Michael (XIAO Xufeng) ad75a51f43 Merge branch 'ci/test_spi_speed_psram_enabled_3.3' into 'release/v3.3'
driver test: disable the spi master performance test when psram is used (v3.3)

See merge request espressif/esp-idf!9639
2020-09-02 08:53:04 +08:00
Michael (XIAO Xufeng) 6552aef2e7 driver test: disable the spi master performance test when psram is used 2020-09-01 16:41:59 +00:00
Island 468c30843c Merge branch 'bugfix/ble_mesh_example_compile_warn_v3.3' into 'release/v3.3'
Bugfix/ble mesh example compile warn (v3.3)

See merge request espressif/esp-idf!10225
2020-09-01 19:16:23 +08:00
lly f8bf6b1f91 ble_mesh: example: Remove some useless included header files 2020-09-01 14:14:13 +08:00
Carlos Sobrinho 5725cb9342 Fix compilation warnings about portmacro being already define. 2020-09-01 14:13:42 +08:00
Jiang Jiang Jian b2b47b4465 Merge branch 'bugfix/fix_some_wifi_bugs_0703_v3.3' into 'release/v3.3'
fix some wifi bugs 0703 (v3.3)

See merge request espressif/esp-idf!9537
2020-09-01 11:34:29 +08:00
Jiang Jiang Jian ad2a05a391 Merge branch 'doc/add_UUID_description_in_gattc_demo_backport_v3.3' into 'release/v3.3'
docs:add 128-bit UUID description backport v3.3

See merge request espressif/esp-idf!9226
2020-09-01 11:01:06 +08:00
Jiang Jiang Jian fee489e770 Merge branch 'bugfix/fix_build_err_in_cpp_backport_v3.3' into 'release/v3.3'
ble_hid_device_demo: fix build if building with c++ backport v3.3

See merge request espressif/esp-idf!9234
2020-09-01 11:00:21 +08:00
Island 173c76cb04 Merge branch 'bugfix/ble_mesh_client_msg_optimize_v3.3' into 'release/v3.3'
Bugfix/ble mesh client msg optimize (v3.3)

See merge request espressif/esp-idf!10207
2020-09-01 09:33:39 +08:00
Jiang Jiang Jian c30a264d21 Merge branch 'bugfix/put_periph_module_enable/diable_into_iram_v3.3' into 'release/v3.3'
wifi, bt: move esp_phy_common_clock_disable into periph_ctrl and put it into IRAM(v3.3)

See merge request espressif/esp-idf!10109
2020-08-31 19:23:26 +08:00
lly 31060cf42b ble_mesh: stack: Client model related code clean 2020-08-31 13:18:53 +08:00
lly 8a19d03a1c ble_mesh: stack: Rename cfg & health client status recv func 2020-08-31 13:18:48 +08:00
lly d5e9fc092c ble_mesh: stack: Check client msg result in common func 2020-08-31 13:18:42 +08:00
lly 8ae06fde5f ble_mesh: stack: Fix no events for some error conditions 2020-08-31 13:18:37 +08:00
lly 90e2bbe330 ble_mesh: stack: Move client role set to the msg function 2020-08-31 13:18:31 +08:00
lly 9aa33c344a ble_mesh: stack: Remove some not used client parameters 2020-08-31 13:18:25 +08:00
lly 7cb6b85ec9 ble_mesh: stack: Remove some not used variables & functions 2020-08-31 13:18:18 +08:00
lly f11e347e2e ble_mesh: stack: Update client model msg send 2020-08-31 13:18:11 +08:00
Mahavir Jain ba47806b8d Merge branch 'bugfix/http_client_read_v3.3' into 'release/v3.3'
Fix error handling in esp_http_client_read and esp_https_ota_perform (v3.3)

See merge request espressif/esp-idf!9205
2020-08-31 13:04:10 +08:00
Mahavir Jain cfcc189a89 Merge branch 'bugfix/softap_prov_session_v3.3' into 'release/v3.3'
protocomm_httpd: Restart security session if request is received on a new session (v3.3)

See merge request espressif/esp-idf!9118
2020-08-31 13:01:12 +08:00
Island 41debcfbd2 Merge branch 'bugfix/ble_mesh_health_current_status_recv_v3.3' into 'release/v3.3'
ble_mesh: stack: Fix recv health current status incorrectly (v3.3)

See merge request espressif/esp-idf!10196
2020-08-31 11:15:13 +08:00
lly 726c74ff39 ble_mesh: stack: Fix recv health current status incorrectly 2020-08-28 17:40:59 +08:00
Island 6a2652c685 Merge branch 'bugfix/ble_mesh_misc_updates_v3.3' into 'release/v3.3'
Bugfix/ble mesh misc updates (v3.3)

See merge request espressif/esp-idf!10187
2020-08-28 17:32:10 +08:00
lly c7cb56b507 ble_mesh: ci: Enable friend & low power in build check 2020-08-28 10:51:30 +08:00
lly ff1132d2e4 ble_mesh: stack: Only keep func pointer for very common log
Currently only keep func pointer for the followings:
- Invalid parameter (mesh btc & mesh stack)
- Out of memory (mesh btc & mesh stack)
- Unknown act (mesh btc)
- Invalid model user data (mesh stack)
- BT_DBG("%s", __func__) (mesh btc & mesh stack)
- A few other specific situations (buf ref debug, send status check)
2020-08-28 10:51:17 +08:00
lly 6ea6de8d42 ble_mesh: stack: Make proxy server & client functions clear 2020-08-28 10:51:02 +08:00
Island 7e26c8ddda Merge branch 'bugfix/ble_mesh_add_misc_check_v3.3' into 'release/v3.3'
Bugfix/ble mesh add misc check (v3.3)

See merge request espressif/esp-idf!9633
2020-08-28 10:43:55 +08:00
Angus Gratton f043a3da97 Merge branch 'update/release_v3.3.3' into 'release/v3.3'
version: Update to v3.3.3

See merge request espressif/esp-idf!10180
2020-08-27 19:38:21 +08:00
lly f6cc9afaa9 ble_mesh: stack: Add proxy cfg pdu length check 2020-08-27 11:20:50 +00:00
lly 55489bb41a ble_mesh: stack: Rework using dev flag to check scan status
Different bluetooth host has different behaviors, so it's better
to maintain a scan check mechanism of BLE Mesh itself.
Fixes an issue when only PB-GATT is enabled for node, which will
output a scan error log when the device is provisioned.
2020-08-27 11:20:50 +00:00
lly 43ffec0bd7 ble_mesh: example: Add result check during mesh init 2020-08-27 11:20:50 +00:00
lly c1c4990f75 ble_mesh: stack: Add more checks about input prov bearers 2020-08-27 11:20:50 +00:00
Island 72f029abc3 Merge branch 'feat/ble_mesh_use_iram_for_mem_alloc_v3.3' into 'release/v3.3'
Feat/ble mesh use diff ram for mem alloc (v3.3)

See merge request espressif/esp-idf!9619
2020-08-27 19:19:23 +08:00
Island c902b1fa24 Merge branch 'bugfix/ble_mesh_update_send_ttl_v3.3' into 'release/v3.3'
Bugfix/ble mesh update send ttl v3.3

See merge request espressif/esp-idf!9564
2020-08-27 19:19:01 +08:00
Angus Gratton 78003e9437 docs: Fix toolchain URL generation for macos
Didn't backport the new URL scheme when we updated the toolchain version.

Have put a link on the server so in this case the "osx" toolchain URL remains
valid.

Closes https://github.com/espressif/esp-idf/issues/5720
2020-08-27 14:10:35 +10:00
lly 2a6b0d68ce ble_mesh: stack: Rename mesh adv queue and relay queue 2020-08-26 08:24:55 +00:00
lly da068a639f ble_mesh: stack: Use macros for adv task name & prio 2020-08-26 08:24:55 +00:00
lly df8b2c5f3a ble_mesh: stack: Make freertos static allocation visible 2020-08-26 08:24:55 +00:00
lly a194c415a8 ble_mesh: stack: Update option of using DRAM/SPIRAM for memory allocation 2020-08-26 08:24:55 +00:00
weitianhua 33546a0094 Fix tsk watchdog when running spp vfs demo 2020-08-26 15:33:48 +08:00
weitianhua 8fb47ab0c2 Seperate BTA_JV_L2CAP for less bin size 2020-08-26 15:33:48 +08:00
zhangyanjiao 09113e163b esp wifi bugfix:
1. Fix TX DMA buffer issue
2. API esp_wifi_get_config add acquisition sta.listen_interval
3. Configure bandwidth and phy mode to store NVS
4. If AP's tsf has been restarted, STA will disconnect from AP.
5. Do not reset softAP's tsf except it restart
6. Fix the wifi regdomain update bug
7. Fix the bug for airkiss find hidden AP fail
8. Fix addba and first ampdu send bar
9. Fix WiFi fragment issue
10. Fix WiFi fragment issue
2020-08-26 14:43:53 +08:00
zhangyanjiao 85ca89ee4a esp_wifi: Add API to get available internal heap size 2020-08-26 14:43:35 +08:00
dongyou 9825d0004f Add IRAM_ATTR wifi_bt_common_module_enable/disable()
Deleted duplicated spinlock and counter.
2020-08-24 14:00:22 +08:00
houwenxiang c7f33524b4 driver(I2S): Fix I2S reset issue for release/v3.3
`i2s_start` reseting I2S in incorrect order causeing the word-order error.
2020-08-24 01:25:39 +00:00
Chen Yi Qun c2ead692aa bugfix(ut): fix gpio output and input mode test(backport v3.3) 2020-08-20 06:25:40 +00:00
Sergei Silnov 01a2ab9329 Remove mention of idf.py defconfig
Closes https://github.com/espressif/esp-idf/issues/5075
2020-08-18 16:07:46 +02:00
houwenxiang a293dfea7a feature: support vfs uart set line endings with specified uart number release/v3.3 2020-08-14 14:35:44 +08:00
Angus Gratton 9ff108dcd0 Merge branch 'fix/prov_ble_read_offset_v3.3' into 'release/v3.3'
BLE provisioning: Add check for valid ble read offset (v3.3)

See merge request espressif/esp-idf!9747
2020-08-13 16:29:02 +08:00
Michael (XIAO Xufeng) 0a75f2d5f8 Merge branch 'bugfix/fix_adc_dac_conflict_backportv3.3' into 'release/v3.3'
Driver(adc): Disable the synchronization operation function of ADC1 and DAC (backport v3.3)

See merge request espressif/esp-idf!9364
2020-08-13 09:51:25 +08:00
Prasad Alatkar fbdcfc8e4a BLE provisioning: Add check for valid ble read offset 2020-08-12 08:46:01 +00:00
Jiang Jiang Jian 22e3c00b48 Merge branch 'bugfix/fix_udp_tx_performance_issue_v3.3' into 'release/v3.3'
lw-ip: fix udp tx packet loss issue (backport v3.3)

See merge request espressif/esp-idf!10007
2020-08-12 16:16:47 +08:00
xiehang 7952bed766 lwip: fix udp tx packet loss issue 2020-08-12 10:38:42 +08:00
Li Shuai ab63b48f6f add soft solution for esp32 eco3 live lock issue 2020-08-12 02:16:53 +00:00
Jiang Jiang Jian 8ab3cb0b12 Merge branch 'bugfix/fix_IPv6_memory_leak_issue' into 'release/v3.3'
lw-ip: fix IPv6 memory leak issue

See merge request espressif/esp-idf!9933
2020-08-11 22:09:50 +08:00
ronghulin cb78c1083f bugfix: fix IPv6 memory leak issue 2020-08-11 14:19:06 +08:00
Jiang Jiang Jian 7e1c529b00 Merge branch 'bugfix/param_check_instant_tx_octets_adv_ubderrun_v3.3' into 'release/v3.3'
component/bt: add connect parameter, fix instant reverse, fix tx default octets, fix assert(1024,0)

See merge request espressif/esp-idf!9484
2020-08-11 14:11:03 +08:00
Jiang Jiang Jian f538307629 Merge branch 'bugfix/ipv6_fragment_for_3.3' into 'release/v3.3'
lw-ip:fix bug for ipv6 fragment(backport 3.3)

See merge request espressif/esp-idf!9655
2020-08-11 14:09:11 +08:00
xueyunfei 68ecc44d34 fix bug for ipv6 fragment 2020-08-11 09:45:02 +08:00
Jiang Jiang Jian b244afc208 Merge branch 'feature/make_tcp_rto_configurable_v3.3' into 'release/v3.3'
make TCP rto time configurable (backport v3.3)

See merge request espressif/esp-idf!9610
2020-08-10 21:17:45 +08:00
Wang Cheng bfaa14bfdd component/bt: Fix buffer count deinit crash. 2020-08-10 11:43:54 +08:00
wangcheng 12d476427f components/bt: Add api to query the number of available buffers for the current connection 2020-08-10 11:43:54 +08:00
baohongde debda4a63f Fix ble disconnect due to instant of channel map update is too small
Set AFH in time
Fix ble connecting fail in coexist
2020-08-10 11:43:54 +08:00
baohongde b76f5b2ef2 Coexistence: Add coexist API to enable BLE connection dynamic priority 2020-08-10 11:43:54 +08:00
wangcheng d674016d64 component/bt: add connect parameter, fix instant reverse, fix tx default octets, fix assert(1024,0), fix assert(512,0) 2020-08-10 11:43:17 +08:00
KonstantinKondrashov 9ce137139b bootloader: Adds bootloader_sha256_flash_contents() 2020-08-07 23:10:29 +08:00
Piyush Shah 52c089fba7 protocomm_httpd: Restart security session if request is received on a new session
This commit fixes a bug as well as changes a behaviour.

Bugfix: During softap/httpd based provisioning, if a session was closed
midway and a new one started, it would never proceed if the http server
assigns same socket number to the new session (which happens almost always).
Now, if a session is closed, using the http callbacks, the older session
data is cleared so that a new one can be created.

Behavioural change: If a client (mobile app particularly) does not use
persistent http session i.e. all provisioning communication on the same
socket, the provisioning may fail. Earlier, since the session context was
not getting cleared, even if the client closed a session and continued
on a new one, it would go through if the socket number assigned was same
(which happens almost always).

Ideally, from a security perspective, all communication related
to secure provisioning must happen on the same socket, and so, this
change is required.
2020-08-06 18:25:53 +00:00
KonstantinKondrashov 035783039b bootloader_support: Fix bootloader_common_get_sha256_of_partition, can handle a long image
Closes: IDFGH-3594
2020-08-05 23:21:52 +08:00
Hou Chen Yao 2e89f963d7 remove auto conn case because we do not support this anymore 2020-08-05 18:04:34 +08:00
Li Shuai b1990352bb added psram stack check in backtrace 2020-08-04 05:46:45 +00:00
He Yin Ling aa6730f0e2 Merge branch 'bugfix/checkout_ref_auto_test_script' into 'release/v3.3'
CI: IT jobs use incorrect auto test script branch

See merge request espressif/esp-idf!9867
2020-07-31 17:45:04 +08:00
Jiang Jiang Jian 593ca2255c Merge branch 'mesh/bugfix_set_type_v3.3' into 'release/v3.3'
Mesh/bugfix (backport v3.3)

See merge request espressif/esp-idf!9179
2020-07-30 21:17:11 +08:00
Chen Yudong dc5eeb8e4b ci: fix auto test script uses incorrect branch 2020-07-30 20:55:37 +08:00
Roland Dobai 62fea80a01 Tools: Close temporary file before invoking external tools accessing it 2020-07-29 20:24:30 +02:00
Jiang Jiang Jian 44791067ec Merge branch 'nimble/nrpa_support_v3.3' into 'release/v3.3'
NimBLE: Add Non-Resolvable private address support and misc fixes (Backport v3.3)

See merge request espressif/esp-idf!9735
2020-07-29 16:35:25 +08:00
Michael (XIAO Xufeng) 55bb42dc63 sdmmc: fix the probe issue that forbid sdspi working in highspeed mode
SD cards don't support CMD7 (select_card) in SPI mode. Highspeed probe
of sdspi will fail in this step and stop working in highspeed mode.
Remove the CMD7 in enable_hs_mode_and_check to fix this issue.

Please note that, on ESP32, you have to use the IOMUX pins to use sdspi
in 40MHz, otherwise the initialization process will report reading issue
and fail.
2020-07-28 19:09:38 +08:00
Wielebny666 fc8ba15b33 Fix init MCPWM Fault line via config struct
Signed-off-by: wubowen <wubowen@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/5491
Closes https://github.com/espressif/esp-idf/issues/5433
2020-07-28 03:44:36 +00:00
Chinmay Chhajed 6bbb75f219 Bluedroid: Fixes cases having fallback to link up event.
Signed-off-by: Chinmay Chhajed <chinmay.chhajed@espressif.com>
2020-07-27 14:08:03 +05:30
Angus Gratton 4f5577446b Merge branch 'bugfix/rs485_test_temp_disable_v33' into 'release/v3.3'
Bugfix/rs485 test temp disable v33 (backport v3.3)

See merge request espressif/esp-idf!9521
2020-07-24 11:14:57 +08:00
Prasad Alatkar 7aab15f33d NimBLE: Add Non-Resolvable private address support and misc bug fixes (Backport v3.3)
- Merges https://github.com/espressif/esp-nimble/pull/12
- Fixes repeated pairing failure in RPA feature

Closes https://github.com/espressif/esp-idf/issues/5530
2020-07-23 11:28:42 +05:30
aleks b64f4bced8 ci: temporarily disable RS485 related tests 2020-07-22 08:46:57 +00:00
Angus Gratton bf02206096 Merge branch 'ci/workaround_multiple_ci_failures_v3.3' into 'release/v3.3'
CI: workaround multiple ci failures (v3.3)

See merge request espressif/esp-idf!9687
2020-07-22 11:54:45 +08:00
yuanjm e5066c9969 feat(lwip): make LWIP TCP rto time configurable 2020-07-20 07:58:06 +00:00
Angus Gratton 07942e3991 Merge branch 'bugfix/cmake_bugfixes_v3.3' into 'release/v3.3'
CMake-related bugfixes (v3.3)

See merge request espressif/esp-idf!8069
2020-07-20 08:43:52 +08:00
Angus Gratton 62a187b55b Merge branch 'feature/msys2_toolchain_v3.3' into 'release/v3.3'
windows: Update the prebuilt MSYS2 environment to use new toolchain

See merge request espressif/esp-idf!9624
2020-07-20 08:23:08 +08:00
He Yin Ling 858e12a040 CI: do not run cases likely to fail 2020-07-19 15:30:15 +08:00
He Yin Ling bfb7757feb CI: disable cases with test env SSC_T5_1 2020-07-19 15:26:29 +08:00
He Yin Ling de82bd5d19 CI: temp allow mesh job to fail as runner is not stable 2020-07-19 15:24:55 +08:00
He Yin Ling 9a205c654d CI: remove incorrect MTU related cases 2020-07-19 15:23:21 +08:00
Angus Gratton ff2fef7e91 windows: Update the prebuilt MSYS2 environment to use then new toolchain
No other changes in the environment contents.
2020-07-15 12:04:09 +10:00
chenyudong 83fdac780c mesh/ci: fix MESH_EST_0216 2020-07-10 17:57:36 +08:00
chenyudong 7c95474f6c mesh: backport some bugfixes
1. If the root is specified (FIXED-ROOT) by set type or set parent, change ie.mesh_type to MESH_ROOT before connect to router.
2. Release esp_mesh_recv_toDS when the root becomes non-root.
3. esp_mesh_set_type now supports MESH_IDLE and MESH_STA.
4. Fix ie.rc_rssi is not updated during scan and vote.
5. Fix ie.mesh_type do not match ie.layer caused by parent switch.
6. Fix during root switch, the original root doesn't disconnect from the router after it receives the switch request from the new voted root. (root switch happens by invoking esp_mesh_waive_root).
7. Fix the routing announce timer is not stopped immediately in a new root if the new root is transformed from non-root.
8. Choose the candidate with less ie.assoc when doing parent switch.
2020-07-10 17:57:34 +08:00
lly 28c0673376 ble_mesh: stack: Add two application macros for TTL 2020-07-10 09:15:56 +08:00
lly 9eb66d49e4 ble_mesh: stack: Update send_ttl in btc when recv a msg
Update send_ttl mainly for server models. When a server model
receives a message, and the status is required to be replied
by the application, we need to set send_ttl to the msg context.
If send_ttl is not updated in btc, and the applcation does not
set the TTL either, then the status will be replied with TTL=0,
which may cause the client side (e.g. the phone App) failed to
receive the status.

Closes https://github.com/espressif/esp-idf/issues/5300
2020-07-10 09:15:49 +08:00
Shubham Kulkarni b45e2699b2 Increase receive timeout in sdkconfig.ci to fix CI failures 2020-07-08 10:02:07 +05:30
Shubham Kulkarni e84ad136b9 esp_https_ota.c: Add fix to return failure if (-1) is returned from esp_http_client_read
Closes https://github.com/espressif/esp-idf/issues/4960
2020-07-08 10:00:48 +05:30
Shubham Kulkarni 22926742be esp_http_client.c: In esp_http_client_read, add fix to return (-1) if esp_transport_read fails 2020-07-08 10:00:48 +05:30
Marius Vikhammer a3ef357b8d Docs: fix broken example README links 2020-07-07 18:22:55 +08:00
fuzhibo 44887f5fde Driver(adc): Disable the synchronization operation function of ADC1 and DAC
Closes IDF-1585
2020-07-01 06:16:35 +00:00
wangcheng 095098da0f components/bt:Fixed the problem of incomplete data packets caused by disordered acl data packets 2020-06-30 15:56:49 +08:00
wangcheng 58feea1a0e components/bt: Consider link_xmit_data_q in congest events to prevent excessive memory usage 2020-06-30 15:56:17 +08:00
Elvis Dukaj 048fd80450 ble_hid_device_demo: fix build if building with c++
Signed-off-by: Elvis Dukaj <elvis.dukaj@gmail.com>
Signed-off-by: liminyang <liminyang@example.com>

Merges https://github.com/espressif/esp-idf/pull/5191
2020-06-18 15:52:56 +08:00
liminyang 6ac7ceef9e docs:perfect 128-bit UUID description
The previous description is not easy for the reader to understand, some changees have been made to perfect it.
Closes https://github.com/espressif/esp-idf/issues/5057
2020-06-18 15:02:44 +08:00
Renz Bagaporo 07830df4d3 examples: split source files for one of the ulp examples 2020-03-23 13:12:49 +08:00
Renz Christian Bagaporo d497c4babd ldgen: fix build issue on make when build dir is a symlink
Fixes an issue where build fails if the build directory is a symlink.
The issue is caused by the rule target and the final executable dependency
not matching.

Closes https://github.com/espressif/esp-idf/issues/3626
2020-03-23 13:12:49 +08:00
Renz Christian Bagaporo 2d28fd2563 cmake: fix build failure when git repo is initialized but no first commit
Closes https://github.com/espressif/esp-idf/issues/3920
2020-03-23 13:12:49 +08:00
Renz Bagaporo 1592f338a6 ci: add test for partition_table target 2020-03-23 13:12:49 +08:00
Renz Christian Bagaporo 0ee287cd32 partition_table: output partition table info for partition_table target 2020-03-23 13:12:49 +08:00
Jakob Hasse 58cf509495 NVS: Changed all new to new (nothrow) 2020-03-04 15:26:34 +08:00
866 changed files with 33797 additions and 52833 deletions
+17
View File
@@ -0,0 +1,17 @@
name: Create zip file with recursive source clone for release
on:
push:
tags:
- v*
jobs:
release_zips:
name: Create release zip file
runs-on: ubuntu-20.04
steps:
- name: Create a recursive clone source zip
uses: espressif/github-actions/release_zips@master
env:
RELEASE_PROJECT_NAME: ESP-IDF
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+205 -138
View File
@@ -7,6 +7,12 @@ stages:
- deploy
- post_check
default:
retry:
max: 2
# In case of a runner failure we could hop to another one, or a network error could go away.
when: runner_system_failure
variables:
# System environment
@@ -19,10 +25,19 @@ variables:
GET_SOURCES_ATTEMPTS: "10"
ARTIFACT_DOWNLOAD_ATTEMPTS: "10"
# We use get-full-sources.sh script to fetch the submodules and/or re-fetch the repo
# if it was corrupted (if submodule update fails this can happen)
GIT_STRATEGY: fetch
# GIT_STRATEGY is not defined here.
# Use an option from "CI / CD Settings" - "General pipelines".
# we will download archive for each submodule instead of clone.
# we don't do "recursive" when fetch submodule as they're not used in CI now.
GIT_SUBMODULE_STRATEGY: none
SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
# by default we will fetch all submodules
# jobs can overwrite this variable to only fetch submodules they required
# set to "none" if don't need to fetch submodules
SUBMODULES_TO_FETCH: "all"
# tell build system do not check submodule update as we download archive instead of clone
IDF_SKIP_CHECK_SUBMODULES: 1
UNIT_TEST_BUILD_SYSTEM: make
# IDF environment
@@ -33,21 +48,17 @@ variables:
APPLY_BOT_FILTER_SCRIPT: "$CI_PROJECT_DIR/tools/ci/apply_bot_filter.py"
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
# Docker images
# Docker images
BOT_DOCKER_IMAGE_TAG: ":latest"
# target test repo parameters
TEST_ENV_CONFIG_REPO: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/ci-test-runner-configs.git"
CI_AUTO_TEST_SCRIPT_REPO_URL: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/auto_test_script.git"
CI_AUTO_TEST_SCRIPT_REPO_BRANCH: "ci/v3.1"
# Versioned esp-idf-doc env image to use for all document building jobs
ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env:v7"
# When 'fetch' strategy is used, Gitlab removes untracked files before checking out
# new revision. However if the new revision doesn't include some of the submodules
# which were present in the old revision, such submodule directories would not be
# removed by the checkout. This extra step ensures that these stale submodules
# are removed.
.git_clean_stale_submodules: &git_clean_stale_submodules >
find . -name '.git' -not -path './.git' -printf '%P\n'
| sed 's|/.git||'
| xargs -I {} sh -c '
grep -q {} .gitmodules
|| (echo "Removing {}, has .git directory but not in .gitmodules file"
&& rm -rf {});'
# before each job, we need to check if this job is filtered by bot stage/job filter
.apply_bot_filter: &apply_bot_filter
@@ -58,9 +69,14 @@ variables:
tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
fi
.show_submodule_urls: &show_submodule_urls |
git config --get-regexp '^submodule\..*\.url$' || true
.fetch_submodules: &fetch_submodules |
python $SUBMODULE_FETCH_TOOL -s $SUBMODULES_TO_FETCH
before_script:
- source tools/ci/setup_python.sh
- *git_clean_stale_submodules
# apply bot filter in before script
- *apply_bot_filter
# add gitlab ssh key
@@ -70,48 +86,33 @@ before_script:
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- if [ "${LOCAL_GITLAB_SSH_SERVER:-}" ]; then SRV=${LOCAL_GITLAB_SSH_SERVER##*@};SRV=${SRV%%:*};printf "Host %s\n\tStrictHostKeyChecking no\n" "${SRV}" >> ~/.ssh/config; fi
# Download and install tools, if needed
- *setup_tools_unless_target_test
# Set IS_PRIVATE or IS_PUBLIC depending on if our branch is public or not
#
# (the same regular expressions are used to set these are used in 'only:' sections below
# Set some options and environment for CI
- source tools/ci/configure_ci_environment.sh
# fetch the submodules (& if necessary re-fetch repo) from gitlab
- time ./tools/ci/get-full-sources.sh
- export PYTHONPATH="${PYTHONPATH}:${CI_PROJECT_DIR}/tools/ci/python_packages"
- *fetch_submodules
# used for check scripts which we want to run unconditionally
.do_nothing_before_no_filter:
before_script: &do_nothing_before_no_filter
.before_script_lesser_nofilter: &before_script_lesser_nofilter
variables:
GIT_SUBMODULE_STRATEGY: none
before_script:
- echo "Not setting up GitLab key, not fetching submodules, not applying bot filter"
- source tools/ci/setup_python.sh
- *git_clean_stale_submodules
- source tools/ci/configure_ci_environment.sh
# used for everything else where we want to do no prep, except for bot filter
.do_nothing_before:
before_script: &do_nothing_before
- source tools/ci/setup_python.sh
- *git_clean_stale_submodules
# apply bot filter in before script
- *apply_bot_filter
.before_script_lesser: &before_script_lesser
variables:
GIT_SUBMODULE_STRATEGY: none
before_script:
- echo "Not setting up GitLab key, not fetching submodules"
- source tools/ci/configure_ci_environment.sh
.add_gitlab_key_before:
before_script: &add_gitlab_key_before
- source tools/ci/setup_python.sh
- *git_clean_stale_submodules
# apply bot filter in before script
- *apply_bot_filter
- echo "Not fetching submodules"
- source tools/ci/configure_ci_environment.sh
# add gitlab ssh key
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
build_template_app:
stage: build
@@ -291,25 +292,18 @@ build_examples_cmake:
- mkdir -p ${LOG_PATH}
- ${IDF_PATH}/tools/ci/build_examples_cmake.sh
build_docs:
.build_docs_template: &build_docs_template
stage: build
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
image: $ESP_IDF_DOC_ENV_IMAGE
tags:
- build_docs
artifacts:
when: always
paths:
# English version of documentation
- docs/en/doxygen-warning-log.txt
- docs/en/sphinx-warning-log.txt
- docs/en/sphinx-warning-log-sanitized.txt
- docs/en/_build/html
- docs/sphinx-err-*
# Chinese version of documentation
- docs/zh_CN/doxygen-warning-log.txt
- docs/zh_CN/sphinx-warning-log.txt
- docs/zh_CN/sphinx-warning-log-sanitized.txt
- docs/zh_CN/_build/html
- docs/*/*.txt
- docs/_build/*/html/*
- docs/_build/*/latex/*
expire_in: 4 days
only:
variables:
@@ -317,17 +311,32 @@ build_docs:
- $BOT_LABEL_BUILD
- $BOT_LABEL_BUILD_DOCS
- $BOT_LABEL_REGULAR_TEST
dependencies: []
script:
# Active python 3.6.10 env as this is where Sphinx is installed
- source /opt/pyenv/activate && pyenv global 3.6.10
# Setup a build dir with both languages to simplify deployment
- cd docs
- mkdir -p _build/$DOCLANG
- ./check_lang_folder_sync.sh
- cd en
- cd $DOCLANG
- make gh-linkcheck
- make html
- ../check_doc_warnings.sh
- cd ../zh_CN
- make gh-linkcheck
- make html
- make latexpdf LATEXMKOPTS="--f --interaction=nonstopmode --quiet --outdir=build"
- ../check_doc_warnings.sh
- mv -f _build/* ../_build/$DOCLANG
build_docs_en:
extends: .build_docs_template
variables:
DOCLANG: "en"
build_docs_zh_CN:
extends: .build_docs_template
variables:
DOCLANG: "zh_CN"
.check_job_template: &check_job_template
stage: check
@@ -335,7 +344,7 @@ build_docs:
tags:
- host_test
dependencies: []
before_script: *do_nothing_before_no_filter
<<: *before_script_lesser_nofilter
verify_cmake_style:
<<: *check_job_template
@@ -363,7 +372,12 @@ build_docker:
DOCKER_TMP_IMAGE_NAME: "idf_tmp_image"
before_script: []
script:
- export DOCKER_BUILD_ARGS="--build-arg IDF_CLONE_URL=${CI_REPOSITORY_URL} --build-arg IDF_CLONE_BRANCH_OR_TAG=${CI_COMMIT_REF_NAME} --build-arg IDF_CHECKOUT_REF=${CI_COMMIT_TAG:-$CI_COMMIT_SHA}"
- export LOCAL_CI_REPOSITORY_URL=$CI_REPOSITORY_URL
- if [ -n "$LOCAL_GITLAB_HTTPS_HOST" ]; then export LOCAL_CI_REPOSITORY_URL="https://gitlab-ci-token:${CI_JOB_TOKEN}@${LOCAL_GITLAB_HTTPS_HOST}/${CI_PROJECT_PATH}"; fi
- if [ -n "$LOCAL_GIT_MIRROR" ]; then export LOCAL_CI_REPOSITORY_URL="${LOCAL_GIT_MIRROR}/${CI_PROJECT_PATH}"; fi
- echo "Using repository at $LOCAL_CI_REPOSITORY_URL"
- export DOCKER_BUILD_ARGS="--build-arg IDF_CLONE_URL=${LOCAL_CI_REPOSITORY_URL} --build-arg IDF_CLONE_BRANCH_OR_TAG=${CI_COMMIT_REF_NAME} --build-arg IDF_CHECKOUT_REF=${CI_COMMIT_TAG:-$CI_COMMIT_SHA}"
# Build
- docker build --tag ${DOCKER_TMP_IMAGE_NAME} ${DOCKER_BUILD_ARGS} tools/docker/
# We can't mount $PWD/examples/get-started/blink into the container, see https://gitlab.com/gitlab-org/gitlab-ce/issues/41227.
@@ -605,7 +619,7 @@ push_to_github:
- $BOT_TRIGGER_WITH_LABEL == null
when: on_success
dependencies: []
before_script: *do_nothing_before
<<: *before_script_lesser
script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
@@ -617,45 +631,67 @@ push_to_github:
- git remote add github git@github.com:espressif/esp-idf.git
- tools/ci/push_to_github.sh
deploy_docs:
.deploy_docs_template:
extends: .before_script_lesser
stage: deploy
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
image: $ESP_IDF_DOC_ENV_IMAGE
tags:
- deploy
- shiny
dependencies:
- build_docs_en
- build_docs_zh_CN
variables:
DOCS_BUILD_DIR: "${IDF_PATH}/docs/_build/"
PYTHONUNBUFFERED: 1
script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $DOCS_DEPLOY_PRIVATEKEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host $DOCS_DEPLOY_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_DEPLOY_SERVER_USER\n" >> ~/.ssh/config
- export GIT_VER=$(git describe --always)
- ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.6.10 ${IDF_PATH}/tools/ci/deploy_docs.py
# deploys docs to CI_DOCKER_REGISTRY webserver, for internal review
deploy_docs_preview:
extends: .deploy_docs_template
only:
refs:
- master
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
- triggers
variables:
- $BOT_TRIGGER_WITH_LABEL == null
- $BOT_LABEL_BUILD_DOCS
dependencies:
- build_docs
before_script: *do_nothing_before
script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
- export GIT_VER=$(git describe --always)
- cd docs/en/_build/
- mv html $GIT_VER
- tar czvf $GIT_VER.tar.gz $GIT_VER
- scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/en
- ssh $DOCS_SERVER -x "cd $DOCS_PATH/en && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
- cd ../../zh_CN/_build/
- mv html $GIT_VER
- tar czvf $GIT_VER.tar.gz $GIT_VER
- scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/zh_CN
- ssh $DOCS_SERVER -x "cd $DOCS_PATH/zh_CN && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
# add link to preview doc
- echo "[document preview][en] $CI_DOCKER_REGISTRY/docs/esp-idf/en/${GIT_VER}/index.html"
- echo "[document preview][zh_CN] $CI_DOCKER_REGISTRY/docs/esp-idf/zh_CN/${GIT_VER}/index.html"
variables:
TYPE: "preview"
# older branches use DOCS_DEPLOY_KEY, DOCS_SERVER, DOCS_SERVER_USER, DOCS_PATH for preview server so we keep these names for 'preview'
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PATH"
DOCS_DEPLOY_URL_BASE: "https://$DOCS_PREVIEW_SERVER_URL/docs/esp-idf"
# deploy docs to production webserver
deploy_docs_production:
extends: .deploy_docs_template
only:
refs:
# The DOCS_PROD_* variables used by this job are "Protected" so these branches must all be marked "Protected" in Gitlab settings
- master
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
variables:
- $BOT_TRIGGER_WITH_LABEL == null
variables:
TYPE: "preview"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esp-idf"
check_doc_links:
stage: host_test
@@ -717,7 +753,7 @@ check_examples_cmake_make:
- master
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
before_script: *do_nothing_before
<<: *before_script_lesser
script:
- tools/ci/check_examples_cmake_make.sh
@@ -728,14 +764,13 @@ check_python_style:
paths:
- flake8_output.txt
expire_in: 1 week
before_script: *do_nothing_before
<<: *before_script_lesser
script:
# run it only under Python 3 (it is very slow under Python 2)
- ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.4.8 python -m flake8 --config=$IDF_PATH/.flake8 --output-file=flake8_output.txt --tee --benchmark $IDF_PATH
check_kconfigs:
<<: *check_job_template
before_script: *do_nothing_before
artifacts:
when: on_failure
paths:
@@ -746,6 +781,7 @@ check_kconfigs:
- tools/*/*/Kconfig*.new
- tools/*/*/*/Kconfig*.new
expire_in: 1 week
<<: *before_script_lesser
script:
- ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh ${IDF_PATH}/tools/test_check_kconfigs.py
- ${IDF_PATH}/tools/check_kconfigs.py
@@ -760,7 +796,7 @@ check_ut_cmake_make:
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
dependencies: []
before_script: *do_nothing_before
<<: *before_script_lesser
script:
- tools/ci/check_ut_cmake_make.sh
@@ -768,12 +804,22 @@ check_submodule_sync:
<<: *check_job_template
tags:
- github_sync
retry: 2
variables:
GIT_STRATEGY: clone
retry: 2
GIT_SUBMODULE_STRATEGY: none
PUBLIC_IDF_URL: "https://github.com/espressif/esp-idf.git"
before_script: []
after_script: []
script:
- git submodule deinit --force .
# setting the default remote URL to the public one, to resolve relative location URLs
- git config remote.origin.url ${PUBLIC_IDF_URL}
# check if all submodules are correctly synced to public repostory
- git submodule update --init --recursive
- git submodule init
- *show_submodule_urls
- git submodule update --recursive
- echo "IDF was cloned from ${PUBLIC_IDF_URL} completely"
check_artifacts_expire_time:
<<: *check_job_template
@@ -792,6 +838,18 @@ check_pipeline_triggered_by_label:
# We want to make sure some jobs are always executed to detect regression.
- test "$BOT_LABEL_REGULAR_TEST" = "true" || exit -1
# For release tag pipelines only, make sure the tag was created with 'git tag -a' so it will update
# the version returned by 'git describe'
check_version_tag:
extends: .check_job_template
only:
refs:
- /^v\d+\.\d+(\.\d+)?($|-)/
variables:
- $BOT_TRIGGER_WITH_LABEL == null
script:
- (git cat-file -t $CI_COMMIT_REF_NAME | grep tag) || (echo "ESP-IDF versions must be annotated tags." && exit 1)
assign_test:
tags:
- assign_test
@@ -806,6 +864,11 @@ assign_test:
variables:
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
INTEGRATION_CONFIG_OUTPUT_PATH: "${CI_PROJECT_DIR}/components/idf_test/integration_test/CIConfigs"
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/auto_test_script/TestCaseFiles"
ASSIGN_TEST_CASE_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIAssignTestCases.py"
PYTHONPATH: "${CI_PROJECT_DIR}/auto_test_script/packages"
PYTHON_VER: 3.7.7
artifacts:
paths:
- components/idf_test/*/CIConfigs
@@ -824,11 +887,11 @@ assign_test:
# assign unit test cases
- python $TEST_FW_PATH/CIAssignUnitTest.py $IDF_PATH/components/idf_test/unit_test/TestCaseAll.yml $IDF_PATH/.gitlab-ci.yml $IDF_PATH/components/idf_test/unit_test/CIConfigs
# clone test script to assign tests
- git clone $TEST_SCRIPT_REPOSITORY
- ./tools/ci/retry_failed.sh git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
- ./tools/ci/retry_failed.sh git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
- cd auto_test_script
# assgin integration test cases
- python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
- python ${ASSIGN_TEST_CASE_SCRIPT} -t $TEST_CASE_FILE_PATH -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin -o $INTEGRATION_CONFIG_OUTPUT_PATH
.define_config_file_name: &define_config_file_name |
JOB_NAME_PREFIX=$(echo ${CI_JOB_NAME} | awk '{print $1}')
@@ -860,21 +923,25 @@ assign_test:
reports:
junit: $LOG_PATH/*/XUNIT_RESULT.xml
variables:
SUBMODULES_TO_FETCH: "components/esptool_py/esptool"
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/examples/test_configs"
LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
PYTHON_VER: 3
script:
- *define_config_file_name
# first test if config file exists, if not exist, exit 0
- test -e $CONFIG_FILE || exit 0
# clone test env configs
- git clone $TEST_ENV_CONFIG_REPOSITORY
- ./tools/ci/retry_failed.sh git clone $TEST_ENV_CONFIG_REPO
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
- cd $TEST_FW_PATH
# git clone the known failure cases repo, run test
- ./tools/ci/retry_failed.sh git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases
# run test
- python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
- cd $TEST_FW_PATH
- python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE --known_failure_cases_file $CI_PROJECT_DIR/known_failure_cases/known_failure_cases.txt
.unit_test_template: &unit_test_template
<<: *example_test_template
@@ -922,26 +989,30 @@ assign_test:
- $LOG_PATH
expire_in: 1 week
variables:
SUBMODULES_TO_FETCH: "none"
LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
LOG_PATH: "${CI_PROJECT_DIR}/TEST_LOGS"
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/auto_test_script/TestCaseFiles"
MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/components/idf_test/integration_test/CIConfigs"
before_script: *add_gitlab_key_before
KNOWN_ISSUE_FILE: "${CI_PROJECT_DIR}/components/idf_test/integration_test/KnownIssues"
PYTHONPATH: "${CI_PROJECT_DIR}/auto_test_script/packages"
CI_RUNNER_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIRunner.py"
PYTHON_VER: 3.7.7
script:
- *define_config_file_name
# first test if config file exists, if not exist, exit 0
- test -e $CONFIG_FILE || exit 0
# clone local test env configs
- git clone $TEST_ENV_CONFIG_REPOSITORY
- ./tools/ci/retry_failed.sh git clone $TEST_ENV_CONFIG_REPO
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
- cd ci-test-runner-configs
# clone test bench
- git clone $TEST_SCRIPT_REPOSITORY
- ./tools/ci/retry_failed.sh git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
- ./tools/ci/retry_failed.sh git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
- cd auto_test_script
- cat ${KNOWN_ISSUE_FILE} >> ${TEST_CASE_FILE_PATH}/KnownIssues
# run test
- python CIRunner.py -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
- python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
nvs_compatible_test:
<<: *test_template
@@ -959,17 +1030,17 @@ nvs_compatible_test:
# first test if config file exists, if not exist, exit 0
- test -e $CONFIG_FILE || exit 0
# clone local test env configs
- git clone $TEST_ENV_CONFIG_REPOSITORY
- ./tools/ci/retry_failed.sh git clone $TEST_ENV_CONFIG_REPO
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
- cd ci-test-runner-configs
# clone test bench
- git clone $TEST_SCRIPT_REPOSITORY
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
- cd auto_test_script
- ./tools/ci/retry_failed.sh git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
- ./tools/ci/retry_failed.sh git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
- python $CHECKOUT_REF_SCRIPT auto_test_script "$CI_PROJECT_DIR/auto_test_script/TestCaseFiles"
# prepare nvs bins
- ./Tools/prepare_nvs_bin.sh
- cd auto_test_script
- ./tools/prepare_nvs_bin.sh
# run test
- python CIRunner.py -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
- python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
example_test_001:
<<: *example_test_template
@@ -984,6 +1055,14 @@ example_test_002:
tags:
- ESP32
- Example_ShieldBox_Basic
variables:
SUBMODULES_TO_FETCH: "all"
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/examples/test_configs"
LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
PYTHON_VER: 3
.example_test_003:
<<: *example_test_template
@@ -1234,12 +1313,7 @@ UT_029:
UT_030:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
UT_031:
<<: *unit_test_template
parallel: 3
tags:
- ESP32_IDF
- UT_T1_1
@@ -1324,7 +1398,7 @@ IT_002:
IT_003:
<<: *test_template
parallel: 13
parallel: 14
tags:
- ESP32_IDF
- SSC_T2_5
@@ -1344,7 +1418,7 @@ IT_005:
IT_006:
<<: *test_template
parallel: 8
parallel: 13
tags:
- ESP32_IDF
- SSC_T1_6
@@ -1368,13 +1442,6 @@ IT_009:
- ESP32_IDF
- SSC_T1_3
IT_010:
<<: *test_template
parallel: 4
tags:
- ESP32_IDF
- SSC_T5_1
IT_011:
<<: *test_template
tags:
@@ -1414,6 +1481,7 @@ IT_015:
IT_016:
<<: *test_template
allow_failure: true
tags:
- ESP32_IDF
- SSC_T50_MESH1
@@ -1426,7 +1494,6 @@ IT_017:
IT_018:
<<: *test_template
parallel: 2
tags:
- ESP32_IDF
- SSC_T1_9
+6
View File
@@ -0,0 +1,6 @@
# For the syntax of this file, see:
#
# https://docs.gitlab.com/ee/user/project/code_owners.html#the-syntax-of-code-owners-files
#
* @esp-idf-codeowners/all-maintainers
+24 -19
View File
@@ -1,75 +1,80 @@
#
# All the relative URL paths are intended to be GitHub ones
# For Espressif's public projects please use '../../espressif/proj', not a '../proj'
#
[submodule "components/esp32/lib"]
path = components/esp32/lib
url = https://github.com/espressif/esp32-wifi-lib.git
url = ../../espressif/esp32-wifi-lib.git
[submodule "components/esptool_py/esptool"]
path = components/esptool_py/esptool
url = https://github.com/espressif/esptool.git
url = ../../espressif/esptool.git
[submodule "components/bt/lib"]
path = components/bt/lib
url = https://github.com/espressif/esp32-bt-lib.git
url = ../../espressif/esp32-bt-lib.git
[submodule "components/micro-ecc/micro-ecc"]
path = components/micro-ecc/micro-ecc
url = https://github.com/kmackay/micro-ecc.git
url = ../../kmackay/micro-ecc.git
[submodule "components/coap/libcoap"]
path = components/coap/libcoap
url = https://github.com/obgm/libcoap.git
url = ../../obgm/libcoap.git
[submodule "components/aws_iot/aws-iot-device-sdk-embedded-C"]
path = components/aws_iot/aws-iot-device-sdk-embedded-C
url = https://github.com/espressif/aws-iot-device-sdk-embedded-C.git
url = ../../espressif/aws-iot-device-sdk-embedded-C.git
[submodule "components/nghttp/nghttp2"]
path = components/nghttp/nghttp2
url = https://github.com/nghttp2/nghttp2.git
url = ../../nghttp2/nghttp2.git
[submodule "components/libsodium/libsodium"]
path = components/libsodium/libsodium
url = https://github.com/jedisct1/libsodium.git
url = ../../jedisct1/libsodium.git
[submodule "components/spiffs/spiffs"]
path = components/spiffs/spiffs
url = https://github.com/pellepl/spiffs.git
url = ../../pellepl/spiffs.git
[submodule "components/json/cJSON"]
path = components/json/cJSON
url = https://github.com/DaveGamble/cJSON.git
url = ../../DaveGamble/cJSON.git
[submodule "components/mbedtls/mbedtls"]
path = components/mbedtls/mbedtls
url = https://github.com/espressif/mbedtls.git
url = ../../espressif/mbedtls.git
[submodule "components/asio/asio"]
path = components/asio/asio
url = https://github.com/espressif/asio.git
url = ../../espressif/asio.git
[submodule "components/expat/expat"]
path = components/expat/expat
url = https://github.com/libexpat/libexpat.git
url = ../../libexpat/libexpat.git
[submodule "components/lwip/lwip"]
path = components/lwip/lwip
url = https://github.com/espressif/esp-lwip.git
url = ../../espressif/esp-lwip.git
[submodule "components/mqtt/esp-mqtt"]
path = components/mqtt/esp-mqtt
url = https://github.com/espressif/esp-mqtt.git
url = ../../espressif/esp-mqtt.git
[submodule "components/protobuf-c/protobuf-c"]
path = components/protobuf-c/protobuf-c
url = https://github.com/protobuf-c/protobuf-c
url = ../../protobuf-c/protobuf-c.git
[submodule "components/unity/unity"]
path = components/unity/unity
url = https://github.com/ThrowTheSwitch/Unity
url = ../../ThrowTheSwitch/Unity.git
[submodule "examples/build_system/cmake/import_lib/main/lib/tinyxml2"]
path = examples/build_system/cmake/import_lib/main/lib/tinyxml2
url = https://github.com/leethomason/tinyxml2
url = ../../leethomason/tinyxml2.git
[submodule "components/nimble/nimble"]
path = components/nimble/nimble
url = https://github.com/espressif/esp-nimble.git
url = ../../espressif/esp-nimble.git
+8 -2
View File
@@ -1,7 +1,5 @@
# Espressif IoT Development Framework
[![Documentation Status](https://readthedocs.com/projects/espressif-esp-idf/badge/?version=latest)](https://docs.espressif.com/projects/esp-idf/en/latest/?badge=latest)
ESP-IDF is the official development framework for the [ESP32](https://espressif.com/en/products/hardware/esp32/overview) chip.
# Developing With ESP-IDF
@@ -13,6 +11,14 @@ See setup guides for detailed instructions to set up the ESP-IDF:
* [Getting Started Guide for the stable ESP-IDF version](https://docs.espressif.com/projects/esp-idf/en/stable/get-started/)
* [Getting Started Guide for the latest (master branch) ESP-IDF version](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/)
### Non-GitHub forks
ESP-IDF uses relative locations as its submodules URLs ([.gitmodules](.gitmodules)). So they link to GitHub.
If ESP-IDF is forked to a Git repository which is not on GitHub, you will need to run the script
[tools/set-submodules-to-github.sh](tools/set-submodules-to-github.sh) after git clone.
The script sets absolute URLs for all submodules, allowing `git submodule update --init --recursive` to complete.
If cloning ESP-IDF from GitHub, this step is not needed.
## Finding a Project
As well as the [esp-idf-template](https://github.com/espressif/esp-idf-template) project mentioned in Getting Started, ESP-IDF comes with some example projects in the [examples](examples) directory.
+4
View File
@@ -276,6 +276,10 @@ def erase_ota_partition(args):
def main():
if sys.version_info[0] < 3:
print("WARNING: Support for Python 2 is deprecated and will be removed in future versions.")
elif sys.version_info[0] == 3 and sys.version_info[1] < 6:
print("WARNING: Python 3 versions older than 3.6 are not supported.")
global quiet
parser = argparse.ArgumentParser("ESP-IDF OTA Partitions Tool")
+50 -8
View File
@@ -28,20 +28,34 @@ menu "Bootloader config"
default 4 if LOG_BOOTLOADER_LEVEL_DEBUG
default 5 if LOG_BOOTLOADER_LEVEL_VERBOSE
config BOOTLOADER_SPI_CUSTOM_WP_PIN
bool "Use custom SPI Flash WP Pin when flash pins set in eFuse (read help)"
depends on FLASHMODE_QIO || FLASHMODE_QOUT
default y if BOOTLOADER_SPI_WP_PIN != 7 # backwards compatibility, can remove in IDF 5
default n
help
This setting is only used if the SPI flash pins have been overridden by setting the eFuses
SPI_PAD_CONFIG_xxx, and the SPI flash mode is QIO or QOUT.
When this is the case, the eFuse config only defines 3 of the 4 Quad I/O data pins. The WP pin (aka
ESP32 pin "SD_DATA_3" or SPI flash pin "IO2") is not specified in eFuse. The same pin is also used
for external SPIRAM if it is enabled.
If this config item is set to N (default), the correct WP pin will be automatically used for any
Espressif chip or module with integrated flash. If a custom setting is needed, set this config item to
Y and specify the GPIO number connected to the WP.
config BOOTLOADER_SPI_WP_PIN
int "SPI Flash WP Pin when customising pins via eFuse (read help)"
int "Custom SPI Flash WP Pin"
range 0 33
default 7
depends on FLASHMODE_QIO || FLASHMODE_QOUT
#depends on BOOTLOADER_SPI_CUSTOM_WP_PIN # backwards compatibility, can uncomment in IDF 5
help
This value is ignored unless flash mode is set to QIO or QOUT *and* the SPI flash pins have been
overriden by setting the eFuses SPI_PAD_CONFIG_xxx.
The option "Use custom SPI Flash WP Pin" must be set or this value is ignored
When this is the case, the eFuse config only defines 3 of the 4 Quad I/O data pins. The WP pin (aka ESP32
pin "SD_DATA_3" or SPI flash pin "IO2") is not specified in eFuse. That pin number is compiled into the
bootloader instead.
The default value (GPIO 7) is correct for WP pin on ESP32-D2WD integrated flash.
If burning a customized set of SPI flash pins in eFuse and using QIO or QOUT mode for flash, set this
value to the GPIO number of the SPI flash WP pin.
choice BOOTLOADER_VDDSDIO_BOOST
bool "VDDSDIO LDO voltage"
@@ -219,6 +233,16 @@ menu "Bootloader config"
It allow to test anti-rollback implemention without permanent write eFuse bits.
In partition table should be exist this partition `emul_efuse, data, 5, , 0x2000`.
config BOOTLOADER_FLASH_XMC_SUPPORT_ENA
bool "Enable the support for flash chips of XMC (READ HELP FIRST)"
default n
help
Perform the startup flow recommended by XMC. Please consult XMC for the details of this flow.
XMC chips will be forbidden to be used, when this option is disabled.
Due to the limitation of Flash size, this flow is disabled by default on IDF v3.3. You may need to disable
some bootloader features to enable it.
endmenu # Bootloader
@@ -403,6 +427,7 @@ menu "Security features"
config FLASH_ENCRYPTION_ENABLED
bool "Enable flash encryption on boot (READ DOCS FIRST)"
default N
select PARTITION_TABLE_MD5 if !ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS
help
If this option is set, flash contents will be encrypted by the bootloader on first boot.
@@ -524,4 +549,21 @@ menu "Security features"
Reflashable mode so that a new Secure Boot digest can be flashed at the same time as plaintext firmware.
This combination is not secure and should not be used for a production system.
config SECURE_DISABLE_ROM_DL_MODE
bool "Permanently disable ROM Download Mode"
depends on ESP32_REV_MIN_3
default n
help
If set, during startup the app will burn an eFuse bit to permanently disable the UART ROM
Download Mode. This prevents any future use of esptool.py, espefuse.py and similar tools.
Once disabled, if the SoC is booted with strapping pins set for ROM Download Mode
then an error is printed instead.
It is recommended to enable this option in any production application where Flash
Encryption and/or Secure Boot is enabled and access to Download Mode is not required.
It is also possible to permanently disable Download Mode by calling
esp_efuse_disable_rom_download_mode() at runtime.
endmenu # Security features
@@ -75,6 +75,7 @@ SECTIONS
.dram0.bss (NOLOAD) :
{
. = ALIGN (8);
_dram_start = ABSOLUTE(.);
_bss_start = ABSOLUTE(.);
*(.dynsbss)
*(.sbss)
@@ -151,7 +152,7 @@ SECTIONS
*(.gnu.linkonce.lit4.*)
_lit4_end = ABSOLUTE(.);
. = ALIGN(4);
_heap_start = ABSOLUTE(.);
_dram_end = ABSOLUTE(.);
} >dram_seg
.iram.text :
@@ -163,6 +164,14 @@ SECTIONS
*(.fini.literal)
*(.fini)
*(.gnu.version)
/** CPU will try to prefetch up to 16 bytes of
* of instructions. This means that any configuration (e.g. MMU, PMS) must allow
* safe access to up to 16 bytes after the last real instruction, add
* dummy bytes to ensure this
*/
. += 16;
_text_end = ABSOLUTE(.);
_etext = .;
} > iram_seg
@@ -14,6 +14,7 @@
#pragma once
#include "sdkconfig.h"
#include "esp_image_format.h"
#ifdef __cplusplus
@@ -66,6 +67,20 @@ void bootloader_flash_gpio_config(const esp_image_header_t* pfhdr);
*/
void bootloader_flash_dummy_config(const esp_image_header_t* pfhdr);
/**
* @brief Return the pin number used for custom SPI flash and/or SPIRAM WP pin
*
* Can be determined by eFuse values in most cases, or overriden in configuration
*
* This value is only meaningful if the other SPI flash pins are overriden via eFuse.
*
* This value is only meaningful if flash is set to QIO or QOUT mode, or if
* SPIRAM is enabled.
*
* @return Pin number to use, or -1 if the default should be kept
*/
int bootloader_flash_get_wp_pin(void);
#ifdef __cplusplus
}
#endif
@@ -110,7 +110,11 @@ esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length);
* is enabled but secure boot is not used. This should protect against
* serial re-flashing of an unauthorised code in absence of secure boot.
*
* @return
* @note To support disabling UART Download Mode on ESP32 V3 only, this function
* doesn't write protect FLASH_CRYPT_CNT but instead sets it to the max value
* (effectively the same result but allows burning the UART_DL_DIS efuse later on,
* as this is otherwise also disabled if FLASH_CRYPT_CNT is write protected.)
*
*/
void esp_flash_write_protect_crypt_cnt();
@@ -123,6 +123,19 @@ typedef struct {
esp_err_t esp_secure_boot_verify_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest);
/** @brief Verify the ECDSA secure boot signature block for Secure Boot.
*
* Calculates Deterministic ECDSA w/ SHA256 based on the SHA256 hash of the image. ECDSA signature
* verification must be enabled in project configuration to use this function.
*
* Similar to esp_secure_boot_verify_signature(), but can be used when the digest is precalculated.
* @param sig_block Pointer to ECDSA signature block data
* @param image_digest Pointer to 32 byte buffer holding SHA-256 hash.
* @param verified_digest Pointer to 32 byte buffer that will receive verified digest if verification completes. (Used during bootloader implementation only, result is invalid otherwise.)
*
*/
esp_err_t esp_secure_boot_verify_ecdsa_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest);
#define FLASH_OFFS_SECURE_BOOT_IV_DIGEST 0
/** @brief Secure boot IV+digest header */
@@ -22,6 +22,7 @@
#define FLASH_SECTOR_SIZE 0x1000
#define FLASH_BLOCK_SIZE 0x10000
#define MMAP_ALIGNED_MASK 0x0000FFFF
/* Provide a Flash API for bootloader_support code,
that can be used from bootloader or app code.
@@ -35,7 +36,7 @@
*
* @return Number of free pages
*/
uint32_t bootloader_mmap_get_free_pages();
uint32_t bootloader_mmap_get_free_pages(void);
/**
* @brief Map a region of flash to data memory
@@ -26,7 +26,7 @@
typedef void *bootloader_sha256_handle_t;
bootloader_sha256_handle_t bootloader_sha256_start();
bootloader_sha256_handle_t bootloader_sha256_start(void);
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len);
@@ -14,6 +14,7 @@
#pragma once
#include "esp_image_format.h"
#include "bootloader_config.h"
/**
* @brief Load partition table.
@@ -62,3 +63,17 @@ __attribute__((noreturn)) void bootloader_utility_load_boot_image(const bootload
* It is not recommended to call this function from an app (if called, the app will abort).
*/
__attribute__((noreturn)) void bootloader_reset(void);
/** @brief Generates the digest of the data between offset & offset+length.
*
* This function should be used when the size of the data is larger than 3.2MB.
* The MMU capacity is 3.2MB (50 pages - 64KB each). This function generates the SHA-256
* of the data in chunks of 3.2MB, considering the MMU capacity.
*
* @param[in] flash_offset Offset of the data in flash.
* @param[in] len Length of data in bytes.
* @param[out] digest Pointer to buffer where the digest is written, if ESP_OK is returned.
*
* @return ESP_OK if secure boot digest is generated successfully.
*/
esp_err_t bootloader_sha256_flash_contents(uint32_t flash_offset, uint32_t len, uint8_t *digest);
@@ -32,6 +32,22 @@ void bootloader_enable_qio_mode(void);
*/
uint32_t bootloader_read_flash_id();
/**
* @brief Read the SFDP of the flash
*
* @param sfdp_addr Address of the parameter to read
* @param miso_byte_num Bytes to read
* @return The read SFDP, little endian, 4 bytes at most
*/
uint32_t bootloader_flash_read_sfdp(uint32_t sfdp_addr, unsigned int miso_byte_num);
/**
* @brief Startup flow recommended by XMC. Call at startup before any erase/write operation.
*
* @return ESP_OK When startup successfully, otherwise ESP_FAIL (indiciating you should reboot before erase/write).
*/
esp_err_t bootloader_flash_xmc_startup(void);
#ifdef __cplusplus
}
#endif
@@ -26,6 +26,8 @@
#include "esp_flash_partitions.h"
#include "bootloader_flash.h"
#include "bootloader_common.h"
#include "bootloader_config.h"
#include "bootloader_utility.h"
#include "soc/gpio_periph.h"
#include "soc/efuse_reg.h"
#include "soc/rtc.h"
@@ -186,22 +188,7 @@ esp_err_t bootloader_common_get_sha256_of_partition (uint32_t address, uint32_t
size = data.image_len;
}
// If image is type by data then hash is calculated for entire image.
const void *partition_bin = bootloader_mmap(address, size);
if (partition_bin == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", address, size);
return ESP_FAIL;
}
bootloader_sha256_handle_t sha_handle = bootloader_sha256_start();
if (sha_handle == NULL) {
bootloader_munmap(partition_bin);
return ESP_ERR_NO_MEM;
}
bootloader_sha256_data(sha_handle, partition_bin, size);
bootloader_sha256_finish(sha_handle, out_sha_256);
bootloader_munmap(partition_bin);
return ESP_OK;
return bootloader_sha256_flash_contents(address, size, out_sha_256);
}
int bootloader_common_select_otadata(const esp_ota_select_entry_t *two_otadata, bool *valid_two_otadata, bool max)
@@ -247,13 +234,15 @@ esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t
return ESP_ERR_INVALID_ARG;
}
const uint8_t *image = bootloader_mmap(partition->offset, partition->size);
const uint32_t app_desc_offset = sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t);
const uint32_t mmap_size = app_desc_offset + sizeof(esp_app_desc_t);
const uint8_t *image = bootloader_mmap(partition->offset, mmap_size);
if (image == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", partition->offset, partition->size);
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", partition->offset, mmap_size);
return ESP_FAIL;
}
memcpy(app_desc, image + sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t), sizeof(esp_app_desc_t));
memcpy(app_desc, image + app_desc_offset, sizeof(esp_app_desc_t));
bootloader_munmap(image);
if (app_desc->magic_word != ESP_APP_DESC_MAGIC_WORD) {
@@ -25,6 +25,7 @@
#include "soc/spi_reg.h"
#include "soc/spi_pins.h"
#include "flash_qio_mode.h"
#include "bootloader_common.h"
#include "bootloader_flash_config.h"
void bootloader_flash_update_id()
@@ -75,18 +76,11 @@ void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
uint32_t pkg_ver = chip_ver & 0x7;
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) {
// For ESP32D2WD the SPI pins are already configured
// flash clock signal should come from IO MUX.
PIN_FUNC_SELECT(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);
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) {
// For ESP32PICOD2 the SPI pins are already configured
// flash clock signal should come from IO MUX.
PIN_FUNC_SELECT(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);
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
// For ESP32PICOD4 the SPI pins are already configured
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 ||
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 ||
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 ||
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.
PIN_FUNC_SELECT(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);
@@ -163,4 +157,33 @@ void IRAM_ATTR bootloader_flash_dummy_config(const esp_image_header_t* pfhdr)
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + g_rom_spiflash_dummy_len_plus[0],
SPI_USR_DUMMY_CYCLELEN_S);
}
#define ESP32_D2WD_WP_GPIO 7 /* ESP32-D2WD & ESP32-PICO-D4 has this GPIO wired to WP pin of flash */
#define ESP32_PICO_V3_GPIO 18 /* ESP32-PICO-V3* use this GPIO for WP pin of flash */
int bootloader_flash_get_wp_pin(void)
{
#if CONFIG_BOOTLOADER_SPI_CUSTOM_WP_PIN
return CONFIG_BOOTLOADER_SPI_WP_PIN; // can be set for bootloader when QIO or QOUT config in use
#elif CONFIG_SPIRAM_CUSTOM_SPIWP_SD3_PIN
return CONFIG_SPIRAM_SPIWP_SD3_PIN; // can be set for app when DIO or DOUT config used for PSRAM only
#else
// no custom value, find it based on the package eFuse value
uint8_t chip_ver;
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
switch(pkg_ver) {
case EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5:
return ESP32_D2WD_WP_GPIO;
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2:
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4:
/* Same package IDs are used for ESP32-PICO-V3 and ESP32-PICO-D4, silicon version differentiates */
chip_ver = bootloader_common_get_chip_revision();
return (chip_ver < 3) ? ESP32_D2WD_WP_GPIO : ESP32_PICO_V3_GPIO;
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302:
return ESP32_PICO_V3_GPIO;
default:
return SPI_IOMUX_PIN_NUM_WP;
}
#endif
}
@@ -145,6 +145,16 @@ static esp_err_t bootloader_main()
#endif
bootloader_clock_configure();
uart_console_configure();
#if CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT_ENA
/* Check and run XMC startup flow. The function depends on the clock and console, so it's run right after these stuff
* are initialized. */
if (bootloader_flash_xmc_startup() != ESP_OK) {
ESP_LOGE(TAG, "failed when running XMC startup flow, reboot!");
return ESP_FAIL;
}
#endif
wdt_reset_check();
ESP_LOGI(TAG, "ESP-IDF %s 2nd stage bootloader", IDF_VER);
@@ -21,7 +21,7 @@
// App version is a wrapper around mbedTLS SHA API
#include <mbedtls/sha256.h>
bootloader_sha256_handle_t bootloader_sha256_start()
bootloader_sha256_handle_t bootloader_sha256_start(void)
{
mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)malloc(sizeof(mbedtls_sha256_context));
if (!ctx) {
@@ -53,6 +53,7 @@ void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest
}
mbedtls_sha256_free(ctx);
free(handle);
handle = NULL;
}
#else // Bootloader version
@@ -70,7 +71,7 @@ static const size_t BLOCK_WORDS = (64/sizeof(uint32_t));
// Words in final SHA256 digest
static const size_t DIGEST_WORDS = (32/sizeof(uint32_t));
bootloader_sha256_handle_t bootloader_sha256_start()
bootloader_sha256_handle_t bootloader_sha256_start(void)
{
// Enable SHA hardware
ets_sha_enable();
@@ -703,3 +703,39 @@ void bootloader_reset(void)
abort(); /* This function should really not be called from application code */
#endif
}
esp_err_t bootloader_sha256_flash_contents(uint32_t flash_offset, uint32_t len, uint8_t *digest)
{
if (digest == NULL) {
return ESP_ERR_INVALID_ARG;
}
/* Handling firmware images larger than MMU capacity */
uint32_t mmu_free_pages_count = bootloader_mmap_get_free_pages();
bootloader_sha256_handle_t sha_handle = NULL;
sha_handle = bootloader_sha256_start();
if (sha_handle == NULL) {
return ESP_ERR_NO_MEM;
}
while (len > 0) {
uint32_t mmu_page_offset = ((flash_offset & MMAP_ALIGNED_MASK) != 0) ? 1 : 0; /* Skip 1st MMU Page if it is already populated */
uint32_t partial_image_len = MIN(len, ((mmu_free_pages_count - mmu_page_offset) * SPI_FLASH_MMU_PAGE_SIZE)); /* Read the image that fits in the free MMU pages */
const void * image = bootloader_mmap(flash_offset, partial_image_len);
if (image == NULL) {
bootloader_sha256_finish(sha_handle, NULL);
return ESP_FAIL;
}
bootloader_sha256_data(sha_handle, image, partial_image_len);
bootloader_munmap(image);
flash_offset += partial_image_len;
len -= partial_image_len;
}
bootloader_sha256_finish(sha_handle, digest);
return ESP_OK;
}
@@ -18,6 +18,7 @@
#include <soc/cpu.h>
#include <esp_image_format.h>
#include <esp_secure_boot.h>
#include <esp_fault.h>
#include <esp_log.h>
#include <esp_spi_flash.h>
#include <bootloader_flash.h>
@@ -25,6 +26,7 @@
#include <bootloader_sha.h>
#include "bootloader_util.h"
#include "bootloader_common.h"
#include "soc/soc_memory_layout.h"
/* Checking signatures as part of verifying images is necessary:
- Always if secure boot is enabled
@@ -92,7 +94,7 @@ static esp_err_t verify_segment_header(int index, const esp_image_segment_header
static esp_err_t verify_checksum(bootloader_sha256_handle_t sha_handle, uint32_t checksum_word, esp_image_metadata_t *data);
static esp_err_t __attribute__((unused)) verify_secure_boot_signature(bootloader_sha256_handle_t sha_handle, esp_image_metadata_t *data);
static esp_err_t __attribute__((unused)) verify_secure_boot_signature(bootloader_sha256_handle_t sha_handle, esp_image_metadata_t *data,uint8_t *image_digest, uint8_t *verified_digest);
static esp_err_t __attribute__((unused)) verify_simple_hash(bootloader_sha256_handle_t sha_handle, esp_image_metadata_t *data);
static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_t *part, esp_image_metadata_t *data)
@@ -108,6 +110,12 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_
uint32_t checksum_word = ESP_ROM_CHECKSUM_INITIAL;
bootloader_sha256_handle_t sha_handle = NULL;
#ifdef SECURE_BOOT_CHECK_SIGNATURE
/* used for anti-FI checks */
uint8_t image_digest[HASH_LEN] = { [ 0 ... 31] = 0xEE };
uint8_t verified_digest[HASH_LEN] = { [ 0 ... 31 ] = 0x01 };
#endif
if (data == NULL || part == NULL) {
return ESP_ERR_INVALID_ARG;
}
@@ -196,7 +204,7 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_
if (!is_bootloader) {
#ifdef SECURE_BOOT_CHECK_SIGNATURE
// secure boot images have a signature appended
err = verify_secure_boot_signature(sha_handle, data);
err = verify_secure_boot_signature(sha_handle, data, image_digest, verified_digest);
#else
// No secure boot, but SHA-256 can be appended for basic corruption detection
if (sha_handle != NULL && !esp_cpu_in_ocd_debug_mode()) {
@@ -226,7 +234,22 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_
}
#ifdef BOOTLOADER_BUILD
if (do_load) { // Need to deobfuscate RAM
#ifdef SECURE_BOOT_CHECK_SIGNATURE
/* If signature was checked in bootloader build, verified_digest should equal image_digest
This is to detect any fault injection that caused signature verification to not complete normally.
Any attack which bypasses this check should be of limited use as the RAM contents are still obfuscated, therefore we do the check
immediately before we deobfuscate.
Note: the conditions for making this check are the same as for setting verify_sha above, but on ESP32 SB V1 we move the test for
"only verify signature in bootloader" into the macro so it's tested multiple times.
*/
ESP_FAULT_ASSERT(data->start_addr == ESP_BOOTLOADER_OFFSET || memcmp(image_digest, verified_digest, HASH_LEN) == 0);
#endif // SECURE_BOOT_CHECK_SIGNATURE
if (do_load && ram_obfs_value[0] != 0 && ram_obfs_value[1] != 0) { // Need to deobfuscate RAM
for (int i = 0; i < data->image.segment_count; i++) {
uint32_t load_addr = data->segments[i].load_addr;
if (should_load(load_addr)) {
@@ -298,6 +321,127 @@ static esp_err_t verify_image_header(uint32_t src_addr, const esp_image_header_t
return err;
}
#ifdef BOOTLOADER_BUILD
/* Check the region load_addr - load_end doesn't overlap any memory used by the bootloader, registers, or other invalid memory
*/
static bool verify_load_addresses(int segment_index, intptr_t load_addr, intptr_t load_end, bool print_error, bool no_recurse)
{
/* Addresses of static data and the "loader" section of bootloader IRAM, all defined in ld script */
const char *reason = NULL;
extern int _dram_start, _dram_end, _loader_text_start, _loader_text_end;
void *load_addr_p = (void *)load_addr;
void *load_end_p = (void *)load_end;
if (load_end == load_addr) {
return true; // zero-length segments are fine
}
assert(load_end > load_addr); // data_len<16MB is checked in verify_segment_header() which is called before this, so this should always be true
if (esp_ptr_in_dram(load_addr_p) && esp_ptr_in_dram(load_end_p)) { /* Writing to DRAM */
/* Check if we're clobbering the stack */
intptr_t sp = (intptr_t)get_sp();
if (bootloader_util_regions_overlap(sp - STACK_LOAD_HEADROOM, SOC_ROM_STACK_START,
load_addr, load_end)) {
reason = "overlaps bootloader stack";
goto invalid;
}
/* Check if we're clobbering static data
(_dram_start.._dram_end includes bss, data, rodata sections in DRAM)
*/
if (bootloader_util_regions_overlap((intptr_t)&_dram_start, (intptr_t)&_dram_end, load_addr, load_end)) {
reason = "overlaps bootloader data";
goto invalid;
}
/* LAST DRAM CHECK (recursive): for D/IRAM, check the equivalent IRAM addresses if needed
Allow for the possibility that even though both pointers are IRAM, only part of the region is in a D/IRAM
section. In which case we recurse to check the part which falls in D/IRAM.
Note: We start with SOC_DIRAM_DRAM_LOW/HIGH and convert that address to IRAM to account for any reversing of word order
(chip-specific).
*/
if (!no_recurse && bootloader_util_regions_overlap(SOC_DIRAM_DRAM_LOW, SOC_DIRAM_DRAM_HIGH, load_addr, load_end)) {
intptr_t iram_load_addr, iram_load_end;
if (esp_ptr_in_diram_dram(load_addr_p)) {
iram_load_addr = (intptr_t)esp_ptr_diram_dram_to_iram(load_addr_p);
} else {
iram_load_addr = (intptr_t)esp_ptr_diram_dram_to_iram((void *)SOC_DIRAM_DRAM_LOW);
}
if (esp_ptr_in_diram_dram(load_end_p)) {
iram_load_end = (intptr_t)esp_ptr_diram_dram_to_iram(load_end_p);
} else {
iram_load_end = (intptr_t)esp_ptr_diram_dram_to_iram((void *)SOC_DIRAM_DRAM_HIGH);
}
if (iram_load_end < iram_load_addr) {
return verify_load_addresses(segment_index, iram_load_end, iram_load_addr, print_error, true);
} else {
return verify_load_addresses(segment_index, iram_load_addr, iram_load_end, print_error, true);
}
}
}
else if (esp_ptr_in_iram(load_addr_p) && esp_ptr_in_iram(load_end_p)) { /* Writing to IRAM */
/* Check for overlap of 'loader' section of IRAM */
if (bootloader_util_regions_overlap((intptr_t)&_loader_text_start, (intptr_t)&_loader_text_end,
load_addr, load_end)) {
reason = "overlaps loader IRAM";
goto invalid;
}
/* LAST IRAM CHECK (recursive): for D/IRAM, check the equivalent DRAM address if needed
Allow for the possibility that even though both pointers are IRAM, only part of the region is in a D/IRAM
section. In which case we recurse to check the part which falls in D/IRAM.
Note: We start with SOC_DIRAM_IRAM_LOW/HIGH and convert that address to DRAM to account for any reversing of word order
(chip-specific).
*/
if (!no_recurse && bootloader_util_regions_overlap(SOC_DIRAM_IRAM_LOW, SOC_DIRAM_IRAM_HIGH, load_addr, load_end)) {
intptr_t dram_load_addr, dram_load_end;
if (esp_ptr_in_diram_iram(load_addr_p)) {
dram_load_addr = (intptr_t)esp_ptr_diram_iram_to_dram(load_addr_p);
} else {
dram_load_addr = (intptr_t)esp_ptr_diram_iram_to_dram((void *)SOC_DIRAM_IRAM_LOW);
}
if (esp_ptr_in_diram_iram(load_end_p)) {
dram_load_end = (intptr_t)esp_ptr_diram_iram_to_dram(load_end_p);
} else {
dram_load_end = (intptr_t)esp_ptr_diram_iram_to_dram((void *)SOC_DIRAM_IRAM_HIGH);
}
if (dram_load_end < dram_load_addr) {
return verify_load_addresses(segment_index, dram_load_end, dram_load_addr, print_error, true);
} else {
return verify_load_addresses(segment_index, dram_load_addr, dram_load_end, print_error, true);
}
}
/* Sections entirely in RTC memory won't overlap with a vanilla bootloader but are valid load addresses, thus skipping them from the check */
} else if (esp_ptr_in_rtc_iram_fast(load_addr_p) && esp_ptr_in_rtc_iram_fast(load_end_p)){
return true;
} else if (esp_ptr_in_rtc_dram_fast(load_addr_p) && esp_ptr_in_rtc_dram_fast(load_end_p)){
return true;
} else if (esp_ptr_in_rtc_slow(load_addr_p) && esp_ptr_in_rtc_slow(load_end_p)) {
return true;
} else { /* Not a DRAM or an IRAM or RTC Fast IRAM, RTC Fast DRAM or RTC Slow address */
reason = "bad load address range";
goto invalid;
}
return true;
invalid:
if (print_error) {
ESP_LOGE(TAG, "Segment %d 0x%08x-0x%08x invalid: %s", segment_index, load_addr, load_end, reason);
}
return false;
}
#endif // BOOTLOADER_BUILD
static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segment_header_t *header, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum)
{
esp_err_t err;
@@ -337,37 +481,11 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme
(do_load)?"load":(is_mapping)?"map":"");
}
#ifdef BOOTLOADER_BUILD
/* Before loading segment, check it doesn't clobber bootloader RAM. */
if (do_load) {
const intptr_t load_end = load_addr + data_len;
if (load_end <= (intptr_t) SOC_DIRAM_DRAM_HIGH) {
/* Writing to DRAM */
intptr_t sp = (intptr_t)get_sp();
if (load_end > sp - STACK_LOAD_HEADROOM) {
/* Bootloader .data/.rodata/.bss is above the stack, so this
* also checks that we aren't overwriting these segments.
*
* TODO: This assumes specific arrangement of sections we have
* in the ESP32. Rewrite this in a generic way to support other
* layouts.
*/
ESP_LOGE(TAG, "Segment %d end address 0x%08x too high (bootloader stack 0x%08x limit 0x%08x)",
index, load_end, sp, sp - STACK_LOAD_HEADROOM);
return ESP_ERR_IMAGE_INVALID;
}
} else {
/* Writing to IRAM */
const intptr_t loader_iram_start = (intptr_t) &_loader_text_start;
const intptr_t loader_iram_end = (intptr_t) &_loader_text_end;
if (bootloader_util_regions_overlap(loader_iram_start, loader_iram_end,
load_addr, load_end)) {
ESP_LOGE(TAG, "Segment %d (0x%08x-0x%08x) overlaps bootloader IRAM (0x%08x-0x%08x)",
index, load_addr, load_end, loader_iram_start, loader_iram_end);
return ESP_ERR_IMAGE_INVALID;
}
if (do_load && data_len > 0) {
if (!verify_load_addresses(index, load_addr, load_addr + data_len, true, false)) {
return ESP_ERR_IMAGE_INVALID;
}
}
#endif // BOOTLOADER_BUILD
@@ -377,6 +495,10 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme
int32_t data_len_remain = data_len;
while (data_len_remain > 0) {
#if defined(SECURE_BOOT_CHECK_SIGNATURE) && defined(BOOTLOADER_BUILD)
/* Double check the address verification done above */
ESP_FAULT_ASSERT(!do_load || verify_load_addresses(0, load_addr, load_addr + data_len_remain, false, false));
#endif
uint32_t offset_page = ((data_addr & MMAP_ALIGNED_MASK) != 0) ? 1 : 0;
/* Data we could map in case we are not aligned to PAGE boundary is one page size lesser. */
data_len = MIN(data_len_remain, ((free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE));
@@ -572,28 +694,33 @@ static esp_err_t verify_checksum(bootloader_sha256_handle_t sha_handle, uint32_t
static void debug_log_hash(const uint8_t *image_hash, const char *caption);
static esp_err_t verify_secure_boot_signature(bootloader_sha256_handle_t sha_handle, esp_image_metadata_t *data)
static esp_err_t verify_secure_boot_signature(bootloader_sha256_handle_t sha_handle, esp_image_metadata_t *data, uint8_t *image_digest, uint8_t *verified_digest)
{
uint8_t image_hash[HASH_LEN] = { 0 };
#ifdef SECURE_BOOT_CHECK_SIGNATURE
uint32_t end = data->start_addr + data->image_len;
ESP_LOGI(TAG, "Verifying image signature...");
// For secure boot, we calculate the signature hash over the whole file, which includes any "simple" hash
// appended to the image for corruption detection
if (data->image.hash_appended) {
const void *simple_hash = bootloader_mmap(data->start_addr + data->image_len - HASH_LEN, HASH_LEN);
const void *simple_hash = bootloader_mmap(end - HASH_LEN, HASH_LEN);
bootloader_sha256_data(sha_handle, simple_hash, HASH_LEN);
bootloader_munmap(simple_hash);
}
bootloader_sha256_finish(sha_handle, image_hash);
bootloader_sha256_finish(sha_handle, image_digest);
// Log the hash for debugging
debug_log_hash(image_hash, "Calculated secure boot hash");
debug_log_hash(image_digest, "Calculated secure boot hash");
// Use hash to verify signature block
const esp_secure_boot_sig_block_t *sig_block = bootloader_mmap(data->start_addr + data->image_len, sizeof(esp_secure_boot_sig_block_t));
esp_err_t err = esp_secure_boot_verify_signature_block(sig_block, image_hash);
esp_err_t err = ESP_ERR_IMAGE_INVALID;
const void *sig_block;
ESP_FAULT_ASSERT(memcmp(image_digest, verified_digest, HASH_LEN) != 0); /* sanity check that these values start differently */
sig_block = bootloader_mmap(data->start_addr + data->image_len, sizeof(esp_secure_boot_sig_block_t));
err = esp_secure_boot_verify_ecdsa_signature_block(sig_block, image_digest, verified_digest);
bootloader_munmap(sig_block);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Secure boot signature verification failed");
@@ -614,6 +741,7 @@ static esp_err_t verify_secure_boot_signature(bootloader_sha256_handle_t sha_han
return ESP_ERR_IMAGE_INVALID;
}
#endif // SECURE_BOOT_CHECK_SIGNATURE
return ESP_OK;
}
@@ -199,19 +199,22 @@ static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_cry
ESP_LOGD(TAG, "All flash regions checked for encryption pass");
uint32_t new_flash_crypt_cnt;
#ifdef CONFIG_FLASH_ENCRYPTION_DISABLE_PLAINTEXT
ESP_LOGI(TAG, "Setting FLASH_CRYPT_CNT efuse to max...");
new_flash_crypt_cnt = EFUSE_FLASH_CRYPT_CNT;
#else
/* Set least significant 0-bit in flash_crypt_cnt */
int ffs_inv = __builtin_ffs((~flash_crypt_cnt) & EFUSE_RD_FLASH_CRYPT_CNT);
/* ffs_inv shouldn't be zero, as zero implies flash_crypt_cnt == EFUSE_RD_FLASH_CRYPT_CNT (0x7F) */
uint32_t new_flash_crypt_cnt = flash_crypt_cnt + (1 << (ffs_inv - 1));
new_flash_crypt_cnt = flash_crypt_cnt + (1 << (ffs_inv - 1));
if (new_flash_crypt_cnt != EFUSE_FLASH_CRYPT_CNT) {
ESP_LOGW(TAG, "Not disabling FLASH_CRYPT_CNT - plaintext flashing is still possible");
}
#endif
ESP_LOGD(TAG, "FLASH_CRYPT_CNT 0x%x -> 0x%x", flash_crypt_cnt, new_flash_crypt_cnt);
REG_SET_FIELD(EFUSE_BLK0_WDATA0_REG, EFUSE_FLASH_CRYPT_CNT, new_flash_crypt_cnt);
#ifdef CONFIG_FLASH_ENCRYPTION_DISABLE_PLAINTEXT
ESP_LOGI(TAG, "Write protecting FLASH_CRYPT_CNT efuse...");
REG_SET_BIT(EFUSE_BLK0_WDATA0_REG, EFUSE_WR_DIS_FLASH_CRYPT_CNT);
#else
ESP_LOGW(TAG, "Not disabling FLASH_CRYPT_CNT - plaintext flashing is still possible");
#endif
esp_efuse_burn_new_values();
@@ -348,12 +351,19 @@ esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length)
return err;
}
void esp_flash_write_protect_crypt_cnt()
void esp_flash_write_protect_crypt_cnt()
{
if (!esp_flash_encryption_enabled()) {
ESP_LOGE(TAG, "flash encryption not enabled!");
return;
}
uint32_t efuse_blk0 = REG_READ(EFUSE_BLK0_RDATA0_REG);
bool flash_crypt_wr_dis = efuse_blk0 & EFUSE_WR_DIS_FLASH_CRYPT_CNT;
if(!flash_crypt_wr_dis) {
REG_WRITE(EFUSE_BLK0_WDATA0_REG, EFUSE_WR_DIS_FLASH_CRYPT_CNT);
unsigned flash_crypt_cnt = REG_GET_FIELD(EFUSE_BLK0_RDATA0_REG, EFUSE_FLASH_CRYPT_CNT);
if(!flash_crypt_wr_dis && flash_crypt_cnt != EFUSE_FLASH_CRYPT_CNT) {
/* Disable by setting flash_crypt_cnt to max, to still allow disabling UART DL mode on ESP32 rev 3 */
REG_SET_FIELD(EFUSE_BLK0_WDATA0_REG, EFUSE_FLASH_CRYPT_CNT, EFUSE_FLASH_CRYPT_CNT);
esp_efuse_burn_new_values();
}
}
@@ -13,9 +13,12 @@
// limitations under the License.
#include <stddef.h>
#include <stdint.h>
#include "bootloader_flash_config.h"
#include "esp_attr.h"
#include "flash_qio_mode.h"
#include "esp_log.h"
#include "esp_err.h"
#include "rom/ets_sys.h"
#include "rom/spi_flash.h"
#include "rom/efuse.h"
#include "soc/spi_struct.h"
@@ -36,8 +39,12 @@
#define CMD_RDSR 0x05
#define CMD_RDSR2 0x35 /* Not all SPI flash uses this command */
#define CMD_OTPEN 0x3A /* Enable OTP mode, not all SPI flash uses this command */
#define CMD_RDSFDP 0x5A /* Read the SFDP of the flash */
static const char *TAG = "qio_mode";
#define BYTESHIFT(VAR, IDX) (((VAR) >> ((IDX) * 8)) & 0xFF)
static DRAM_ATTR char TAG[] = "qio_mode";
typedef unsigned (*read_status_fn_t)();
typedef void (*write_status_fn_t)(unsigned);
@@ -71,12 +78,6 @@ static unsigned read_status_8b_xmc25qu64a();
/* Write 8 bit status of XM25QU64A */
static void write_status_8b_xmc25qu64a(unsigned new_status);
#define ESP32_D2WD_WP_GPIO 7 /* ESP32-D2WD has this GPIO wired to WP pin of flash */
#ifndef CONFIG_BOOTLOADER_SPI_WP_PIN // Set in menuconfig if SPI flasher config is set to a quad mode
#define CONFIG_BOOTLOADER_SPI_WP_PIN ESP32_D2WD_WP_GPIO
#endif
/* Array of known flash chips and data to enable Quad I/O mode
Manufacturer & flash ID can be tested by running "esptool.py
@@ -121,7 +122,7 @@ static uint32_t execute_flash_command(uint8_t command, uint32_t mosi_data, uint8
/* dummy_len_plus values defined in ROM for SPI flash configuration */
extern uint8_t g_rom_spiflash_dummy_len_plus[];
uint32_t bootloader_read_flash_id()
uint32_t IRAM_ATTR bootloader_read_flash_id(void)
{
uint32_t id = execute_flash_command(CMD_RDID, 0, 0, 24);
id = ((id & 0xff) << 16) | ((id >> 16) & 0xff) | (id & 0xff00);
@@ -169,22 +170,6 @@ static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn,
uint32_t status;
const uint32_t spiconfig = ets_efuse_get_spiconfig();
if (spiconfig != EFUSE_SPICONFIG_SPI_DEFAULTS && spiconfig != EFUSE_SPICONFIG_HSPI_DEFAULTS) {
// spiconfig specifies a custom efuse pin configuration. This config defines all pins -except- WP,
// which is compiled into the bootloader instead.
//
// Most commonly an overriden pin mapping means ESP32-D2WD or ESP32-PICOD4.
//Warn if chip is ESP32-D2WD/ESP32-PICOD4 but someone has changed the WP pin
//assignment from that chip's WP pin.
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
if (CONFIG_BOOTLOADER_SPI_WP_PIN != ESP32_D2WD_WP_GPIO &&
(pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 ||
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 ||
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4)) {
ESP_LOGW(TAG, "Chip is ESP32-D2WD/ESP32-PICOD4 but flash WP pin is different value to internal flash");
}
}
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
status = read_status_fn();
@@ -218,7 +203,8 @@ static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn,
esp_rom_spiflash_config_readmode(mode);
esp_rom_spiflash_select_qio_pins(CONFIG_BOOTLOADER_SPI_WP_PIN, spiconfig);
int wp_pin = bootloader_flash_get_wp_pin();
esp_rom_spiflash_select_qio_pins(wp_pin, spiconfig);
return ESP_OK;
}
@@ -271,37 +257,171 @@ static void write_status_8b_xmc25qu64a(unsigned new_status)
execute_flash_command(CMD_WRDI, 0, 0, 0); /* Exit OTP mode */
}
static uint32_t execute_flash_command(uint8_t command, uint32_t mosi_data, uint8_t mosi_len, uint8_t miso_len)
IRAM_ATTR static uint32_t bootloader_flash_execute_command_common(
uint8_t command,
uint32_t addr_len, uint32_t address,
uint8_t dummy_len,
uint8_t mosi_len, uint32_t mosi_data,
uint8_t miso_len)
{
uint32_t old_ctrl_reg = SPIFLASH.ctrl.val;
uint32_t old_user_reg = SPIFLASH.user.val;
uint32_t old_user1_reg = SPIFLASH.user1.val;
SPIFLASH.ctrl.val = SPI_WP_REG_M; // keep WP high while idle, otherwise leave DIO mode
SPIFLASH.user.usr_dummy = 0;
SPIFLASH.user.usr_addr = 0;
//command phase
SPIFLASH.user.usr_command = 1;
SPIFLASH.user2.usr_command_bitlen = 7;
SPIFLASH.user2.usr_command_value = command;
SPIFLASH.user.usr_miso = miso_len > 0;
SPIFLASH.miso_dlen.usr_miso_dbitlen = miso_len ? (miso_len - 1) : 0;
//addr phase
SPIFLASH.user.usr_addr = addr_len > 0;
SPIFLASH.user1.usr_addr_bitlen = addr_len - 1;
SPIFLASH.addr = (addr_len > 0)? (address << (32-addr_len)) : 0;
//dummy phase
if (miso_len > 0) {
uint32_t total_dummy = dummy_len + g_rom_spiflash_dummy_len_plus[1];
SPIFLASH.user.usr_dummy = total_dummy > 0;
SPIFLASH.user1.usr_dummy_cyclelen = total_dummy - 1;
} else {
SPIFLASH.user.usr_dummy = 0;
SPIFLASH.user1.usr_dummy_cyclelen = 0;
}
//output data
SPIFLASH.user.usr_mosi = mosi_len > 0;
SPIFLASH.mosi_dlen.usr_mosi_dbitlen = mosi_len ? (mosi_len - 1) : 0;
SPIFLASH.data_buf[0] = mosi_data;
if (g_rom_spiflash_dummy_len_plus[1]) {
/* When flash pins are mapped via GPIO matrix, need a dummy cycle before reading via MISO */
if (miso_len > 0) {
SPIFLASH.user.usr_dummy = 1;
SPIFLASH.user1.usr_dummy_cyclelen = g_rom_spiflash_dummy_len_plus[1] - 1;
} else {
SPIFLASH.user.usr_dummy = 0;
SPIFLASH.user1.usr_dummy_cyclelen = 0;
}
}
//input data
SPIFLASH.user.usr_miso = miso_len > 0;
SPIFLASH.miso_dlen.usr_miso_dbitlen = miso_len ? (miso_len - 1) : 0;
SPIFLASH.cmd.usr = 1;
while(SPIFLASH.cmd.usr != 0)
{ }
SPIFLASH.ctrl.val = old_ctrl_reg;
return SPIFLASH.data_buf[0];
SPIFLASH.user.val = old_user_reg;
SPIFLASH.user1.val = old_user1_reg;
uint32_t ret = SPIFLASH.data_buf[0];
if (miso_len < 32) {
//set unused bits to 0
ret &= ~(UINT32_MAX << miso_len);
}
return ret;
}
static uint32_t IRAM_ATTR execute_flash_command(uint8_t command, uint32_t mosi_data, uint8_t mosi_len, uint8_t miso_len)
{
const uint8_t addr_len = 0;
const uint8_t address = 0;
const uint8_t dummy_len = 0;
return bootloader_flash_execute_command_common(command, addr_len, address,
dummy_len, mosi_len, mosi_data, miso_len);
}
/*******************************************************************************
* XMC startup flow
******************************************************************************/
#define XMC_SUPPORT CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT_ENA
#define XMC_VENDOR_ID 0x20
#if BOOTLOADER_BUILD
#define BOOTLOADER_FLASH_LOG(level, ...) ESP_LOG##level(TAG, ##__VA_ARGS__)
#else
#define BOOTLOADER_FLASH_LOG(level, ...) ESP_DRAM_LOG##level(TAG, ##__VA_ARGS__)
#define ESP_DRAM_LOGE( tag, format, ... ) ESP_DRAM_LOG_IMPL(tag, format, ESP_LOG_ERROR, E, ##__VA_ARGS__)
#define ESP_DRAM_LOGW( tag, format, ... ) ESP_DRAM_LOG_IMPL(tag, format, ESP_LOG_WARN, E, ##__VA_ARGS__)
#define ESP_DRAM_LOGI( tag, format, ... ) ESP_DRAM_LOG_IMPL(tag, format, ESP_LOG_INFO, E, ##__VA_ARGS__)
#define ESP_DRAM_LOGD( tag, format, ... ) ESP_DRAM_LOG_IMPL(tag, format, ESP_LOG_DEBUG, E, ##__VA_ARGS__)
#define ESP_DRAM_LOGV( tag, format, ... ) ESP_DRAM_LOG_IMPL(tag, format, ESP_LOG_VERBOSE, E, ##__VA_ARGS__)
#define ESP_DRAM_LOG_IMPL(tag, format, log_level, log_tag_letter, ...) do { \
if (LOG_LOCAL_LEVEL >= (log_level)) { \
ets_printf(DRAM_STR(#log_tag_letter " %s: " format "\n"), tag, ##__VA_ARGS__); \
}} while(0)
#endif
#if XMC_SUPPORT || !BOOTLOADER_BUILD
// cmd(0x5A) + 24bit address + 8 cycles dummy
uint32_t IRAM_ATTR bootloader_flash_read_sfdp(uint32_t sfdp_addr, unsigned int miso_byte_num)
{
const uint8_t command = CMD_RDSFDP;
const uint8_t addr_len = 24;
const uint8_t dummy_len = 8;
const uint8_t mosi_len = 0;
const uint32_t mosi_data = 0;
const uint8_t miso_len = miso_byte_num * 8;
return bootloader_flash_execute_command_common(command, addr_len, sfdp_addr,
dummy_len, mosi_len, mosi_data, miso_len);
}
//strictly check the model
static IRAM_ATTR bool is_xmc_chip_strict(uint32_t rdid)
{
uint32_t vendor_id = BYTESHIFT(rdid, 2);
uint32_t mfid = BYTESHIFT(rdid, 1);
uint32_t cpid = BYTESHIFT(rdid, 0);
if (vendor_id != XMC_VENDOR_ID) {
return false;
}
bool matched = false;
if (mfid == 0x40) {
if (cpid >= 0x13 && cpid <= 0x20) {
matched = true;
}
} else if (mfid == 0x41) {
if (cpid >= 0x17 && cpid <= 0x20) {
matched = true;
}
} else if (mfid == 0x50) {
if (cpid >= 0x15 && cpid <= 0x16) {
matched = true;
}
}
return matched;
}
esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
{
// If the RDID value is a valid XMC one, may skip the flow
const bool fast_check = true;
if (fast_check && is_xmc_chip_strict(g_rom_flashchip.device_id)) {
BOOTLOADER_FLASH_LOG(D, "XMC chip detected by RDID (%08X), skip.", g_rom_flashchip.device_id);
return ESP_OK;
}
// Check the Manufacturer ID in SFDP registers (JEDEC standard). If not XMC chip, no need to run the flow
const int sfdp_mfid_addr = 0x10;
uint8_t mf_id = (bootloader_flash_read_sfdp(sfdp_mfid_addr, 1) & 0xff);
if (mf_id != XMC_VENDOR_ID) {
BOOTLOADER_FLASH_LOG(D, "non-XMC chip detected by SFDP Read (%02X), skip.", mf_id);
return ESP_OK;
}
BOOTLOADER_FLASH_LOG(I, "XM25QHxxC startup flow");
// Enter DPD
execute_flash_command(0xB9, 0, 0, 0);
// Enter UDPD
execute_flash_command(0x79, 0, 0, 0);
// Exit UDPD
execute_flash_command(0xFF, 0, 0, 0);
// Delay tXUDPD
ets_delay_us(2000);
// Release Power-down
execute_flash_command(0xAB, 0, 0, 0);
ets_delay_us(20);
// Read flash ID and check again
g_rom_flashchip.device_id = bootloader_read_flash_id();
if (!is_xmc_chip_strict(g_rom_flashchip.device_id)) {
return ESP_FAIL;
}
return ESP_OK;
}
#endif //XMC_SUPPORT
@@ -15,11 +15,22 @@
#include "bootloader_flash.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
#include "uECC.h"
#ifdef BOOTLOADER_BUILD
#include "uECC_verify_antifault.h"
#else
#include "mbedtls/sha256.h"
#include "mbedtls/x509.h"
#include "mbedtls/md.h"
#include "mbedtls/platform.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include <string.h>
#endif
#include <sys/param.h>
@@ -38,38 +49,17 @@ extern const uint8_t signature_verification_key_end[] asm("_binary_signature_ver
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN];
const uint8_t *data;
uint8_t verified_digest[DIGEST_LEN] = { 0 }; /* ignored in this function */
const esp_secure_boot_sig_block_t *sigblock;
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
bootloader_sha256_handle_t handle = bootloader_sha256_start();
esp_err_t err = bootloader_sha256_flash_contents(src_addr, length, digest);
uint32_t free_page_count = bootloader_mmap_get_free_pages();
ESP_LOGD(TAG, "free data page_count 0x%08x", free_page_count);
int32_t data_len_remain = length;
uint32_t data_addr = src_addr;
while (data_len_remain > 0) {
uint32_t offset_page = ((data_addr & MMAP_ALIGNED_MASK) != 0) ? 1 : 0;
/* Data we could map in case we are not aligned to PAGE boundary is one page size lesser. */
uint32_t data_len = MIN(data_len_remain, ((free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE));
data = (const uint8_t *) bootloader_mmap(data_addr, data_len);
if(!data) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", data_addr, data_len);
bootloader_sha256_finish(handle, NULL);
return ESP_FAIL;
}
bootloader_sha256_data(handle, data, data_len);
bootloader_munmap(data);
data_addr += data_len;
data_len_remain -= data_len;
if (err != ESP_OK) {
return err;
}
/* Done! Get the digest */
bootloader_sha256_finish(handle, digest);
// Map the signature block
sigblock = (const esp_secure_boot_sig_block_t *) bootloader_mmap(src_addr + length, sizeof(esp_secure_boot_sig_block_t));
if(!sigblock) {
@@ -77,20 +67,27 @@ esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
return ESP_FAIL;
}
// Verify the signature
esp_err_t err = esp_secure_boot_verify_signature_block(sigblock, digest);
err = esp_secure_boot_verify_ecdsa_signature_block(sigblock, digest, verified_digest);
// Unmap
bootloader_munmap(sigblock);
return err;
}
#ifdef BOOTLOADER_BUILD
esp_err_t esp_secure_boot_verify_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest)
{
uint8_t verified_digest[DIGEST_LEN] = { 0 };
return esp_secure_boot_verify_ecdsa_signature_block(sig_block, image_digest, verified_digest);
}
esp_err_t esp_secure_boot_verify_ecdsa_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
ptrdiff_t keylen;
bool is_valid;
keylen = signature_verification_key_end - signature_verification_key_start;
if(keylen != SIGNATURE_VERIFICATION_KEYLEN) {
if (keylen != SIGNATURE_VERIFICATION_KEYLEN) {
ESP_LOGE(TAG, "Embedded public verification key has wrong length %d", keylen);
return ESP_FAIL;
}
@@ -102,11 +99,88 @@ esp_err_t esp_secure_boot_verify_signature_block(const esp_secure_boot_sig_block
ESP_LOGD(TAG, "Verifying secure boot signature");
is_valid = uECC_verify(signature_verification_key_start,
is_valid = uECC_verify_antifault(signature_verification_key_start,
image_digest,
DIGEST_LEN,
sig_block->signature,
uECC_secp256r1());
uECC_secp256r1(),
verified_digest);
ESP_LOGD(TAG, "Verification result %d", is_valid);
return is_valid ? ESP_OK : ESP_ERR_IMAGE_INVALID;
}
#else // BOOTLOADER_BUILD
esp_err_t esp_secure_boot_verify_ecdsa_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
#if !(defined(CONFIG_MBEDTLS_ECDSA_C) && defined(CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED))
ESP_LOGE(TAG, "Signature verification requires ECDSA & SECP256R1 curve enabled");
return ESP_ERR_NOT_SUPPORTED;
#else
ptrdiff_t keylen;
/* Note: in IDF app image verification we don't add any fault injection resistance, boot-time checks only */
memset(verified_digest, 0, DIGEST_LEN);
keylen = signature_verification_key_end - signature_verification_key_start;
if (keylen != SIGNATURE_VERIFICATION_KEYLEN) {
ESP_LOGE(TAG, "Embedded public verification key has wrong length %d", keylen);
return ESP_FAIL;
}
if (sig_block->version != 0) {
ESP_LOGE(TAG, "image has invalid signature version field 0x%08x", sig_block->version);
return ESP_FAIL;
}
ESP_LOGD(TAG, "Verifying secure boot signature");
int ret;
mbedtls_mpi r, s;
mbedtls_mpi_init(&r);
mbedtls_mpi_init(&s);
/* Extract r and s components from RAW ECDSA signature of 64 bytes */
#define ECDSA_INTEGER_LEN 32
ret = mbedtls_mpi_read_binary(&r, &sig_block->signature[0], ECDSA_INTEGER_LEN);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_mpi_read_binary(1), err:%d", ret);
return ESP_FAIL;
}
ret = mbedtls_mpi_read_binary(&s, &sig_block->signature[ECDSA_INTEGER_LEN], ECDSA_INTEGER_LEN);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_mpi_read_binary(2), err:%d", ret);
mbedtls_mpi_free(&r);
return ESP_FAIL;
}
/* Initialise ECDSA context */
mbedtls_ecdsa_context ecdsa_context;
mbedtls_ecdsa_init(&ecdsa_context);
mbedtls_ecp_group_load(&ecdsa_context.grp, MBEDTLS_ECP_DP_SECP256R1);
size_t plen = mbedtls_mpi_size(&ecdsa_context.grp.P);
if (keylen != 2 * plen) {
ESP_LOGE(TAG, "Incorrect ECDSA key length %d", keylen);
ret = ESP_FAIL;
goto cleanup;
}
/* Extract X and Y components from ECDSA public key */
MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ecdsa_context.Q.X, signature_verification_key_start, plen));
MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ecdsa_context.Q.Y, signature_verification_key_start + plen, plen));
MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&ecdsa_context.Q.Z, 1));
ret = mbedtls_ecdsa_verify(&ecdsa_context.grp, image_digest, DIGEST_LEN, &ecdsa_context.Q, &r, &s);
ESP_LOGD(TAG, "Verification result %d", ret);
cleanup:
mbedtls_mpi_free(&r);
mbedtls_mpi_free(&s);
mbedtls_ecdsa_free(&ecdsa_context);
return ret == 0 ? ESP_OK : ESP_ERR_IMAGE_INVALID;
#endif // CONFIG_MBEDTLS_ECDSA_C && CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED
}
#endif // BOOTLOADER_BUILD
+4 -1
View File
@@ -319,6 +319,7 @@ if(CONFIG_BT_ENABLED)
"esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c"
"esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c"
"esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c"
"esp_ble_mesh/btc/btc_ble_mesh_ble.c"
"esp_ble_mesh/btc/btc_ble_mesh_config_model.c"
"esp_ble_mesh/btc/btc_ble_mesh_generic_model.c"
"esp_ble_mesh/btc/btc_ble_mesh_health_model.c"
@@ -368,15 +369,17 @@ if(CONFIG_BT_ENABLED)
"esp_ble_mesh/mesh_core/provisioner_prov.c"
"esp_ble_mesh/mesh_core/proxy_client.c"
"esp_ble_mesh/mesh_core/proxy_server.c"
"esp_ble_mesh/mesh_core/settings_uid.c"
"esp_ble_mesh/mesh_core/settings.c"
"esp_ble_mesh/mesh_core/scan.c"
"esp_ble_mesh/mesh_core/test.c"
"esp_ble_mesh/mesh_core/transport.c"
"esp_ble_mesh/mesh_models/common/device_property.c"
"esp_ble_mesh/mesh_models/client/client_common.c"
"esp_ble_mesh/mesh_models/client/generic_client.c"
"esp_ble_mesh/mesh_models/client/lighting_client.c"
"esp_ble_mesh/mesh_models/client/sensor_client.c"
"esp_ble_mesh/mesh_models/client/time_scene_client.c"
"esp_ble_mesh/mesh_models/server/device_property.c"
"esp_ble_mesh/mesh_models/server/generic_server.c"
"esp_ble_mesh/mesh_models/server/lighting_server.c"
"esp_ble_mesh/mesh_models/server/sensor_server.c"
+256 -102
View File
@@ -342,21 +342,6 @@ menu Bluetooth
If you set `BLE_ADV_REPORT_DISCARD_THRSHOLD` to a small value or printf every adv lost event, it
may cause adv packets lost more.
menuconfig BTDM_COEX_BT_OPTIONS
bool "Coexistence Bluetooth Side Options"
depends on SW_COEXIST_ENABLE
default n
help
Options of Bluetooth Side of WiFi and bluetooth coexistence.
config BTDM_COEX_BLE_ADV_HIGH_PRIORITY
bool "Improve BLE ADV priority for WiFi & BLE coexistence"
depends on BTDM_COEX_BT_OPTIONS
default n
help
Improve BLE ADV coexistence priority to make it better performance.
For example, BLE mesh need to enable this option to improve BLE adv performance.
endmenu
menuconfig BLUEDROID_ENABLED
@@ -480,6 +465,13 @@ menu Bluetooth
help
This option can be disabled when the app work only on gatt client mode
config GATTS_BLUFI_ENABLE
bool "Include blufi function"
depends on GATTS_ENABLE
default y
help
This option can be close when the app does not require blufi function.
choice GATTS_SEND_SERVICE_CHANGE_MODE
prompt "GATTS Service Change Mode"
default GATTS_SEND_SERVICE_CHANGE_AUTO
@@ -1738,12 +1730,101 @@ if BLE_MESH
option in the Bluetooth Controller section in menuconfig, which is
"Scan Duplicate By Device Address and Advertising Data".
config BLE_MESH_ALLOC_FROM_PSRAM_FIRST
bool "BLE Mesh will first allocate memory from PSRAM"
choice BLE_MESH_MEM_ALLOC_MODE
prompt "Memory allocation strategy"
default BLE_MESH_MEM_ALLOC_MODE_INTERNAL
help
Allocation strategy for BLE Mesh stack, essentially provides ability to
allocate all required dynamic allocations from,
- Internal DRAM memory only
- External SPIRAM memory only
- Either internal or external memory based on default malloc()
behavior in ESP-IDF
Recommended mode here is always internal, since that is most preferred
from security perspective. But if application requirement does not allow
sufficient free internal memory then alternate mode can be selected.
config BLE_MESH_MEM_ALLOC_MODE_INTERNAL
bool "Internal DRAM"
config BLE_MESH_ALLOC_FROM_PSRAM_FIRST
bool "External SPIRAM"
depends on SPIRAM_SUPPORT
config BLE_MESH_MEM_ALLOC_MODE_DEFAULT
bool "Default alloc mode"
depends on SPIRAM_SUPPORT
help
Enable this option to use the default memory allocation strategy when
external SPIRAM is enabled. See the SPIRAM options for more details.
endchoice # BLE_MESH_MEM_ALLOC_MODE
config BLE_MESH_FREERTOS_STATIC_ALLOC
bool "Enable FreeRTOS static allocation"
depends on SUPPORT_STATIC_ALLOCATION && SPIRAM_SUPPORT
default n
help
When this option is enabled, BLE Mesh stack will try to allocate memory
from PSRAM firstly. This will save the internal RAM if PSRAM exists.
Enable this option to use FreeRTOS static allocation APIs for BLE Mesh,
which provides the ability to use different dynamic memory (i.e. SPIRAM)
for FreeRTOS objects.
If this option is disabled, the FreeRTOS static allocation APIs will not
be used, and internal DRAM will be allocated for FreeRTOS objects.
choice BLE_MESH_FREERTOS_STATIC_ALLOC_MODE
prompt "Memory allocation for FreeRTOS objects"
depends on BLE_MESH_FREERTOS_STATIC_ALLOC
help
Choose the memory to be used for FreeRTOS objects.
config BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL
bool "External SPIRAM"
depends on SPIRAM_SUPPORT
help
If enabled, BLE Mesh allocates dynamic memory from external SPIRAM for
FreeRTOS objects, i.e. mutex, queue, and task stack. External SPIRAM
can only be used for task stack when SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
is enabled. See the SPIRAM options for more details.
endchoice # BLE_MESH_FREERTOS_STATIC_ALLOC_MODE
config BLE_MESH_DEINIT
bool "Support de-initialize BLE Mesh stack"
default y
help
If enabled, users can use the function esp_ble_mesh_deinit() to de-initialize
the whole BLE Mesh stack.
menu "BLE Mesh and BLE coexistence support"
config BLE_MESH_SUPPORT_BLE_ADV
bool "Support sending normal BLE advertising packets"
default n
help
When selected, users can send normal BLE advertising packets
with specific API.
if BLE_MESH_SUPPORT_BLE_ADV
config BLE_MESH_BLE_ADV_BUF_COUNT
int "Number of advertising buffers for BLE advertising packets"
default 3
range 1 255
help
Number of advertising buffers for BLE packets available.
endif # BLE_MESH_SUPPORT_BLE_ADV
config BLE_MESH_SUPPORT_BLE_SCAN
bool "Support scanning normal BLE advertising packets"
default n
help
When selected, users can register a callback and receive normal BLE
advertising packets in the application layer.
endmenu # BLE Mesh and BLE coexistence support
config BLE_MESH_FAST_PROV
bool "Enable BLE Mesh Fast Provisioning"
@@ -1838,6 +1919,28 @@ if BLE_MESH
This option specifies how many application keys the Provisioner can have.
Indeed, this value decides the number of the application keys which can be added by a Provisioner.
config BLE_MESH_PROVISIONER_RECV_HB
bool "Support receiving Heartbeat messages"
default n
help
When this option is enabled, Provisioner can call specific functions to enable
or disable receiving Heartbeat messages and notify them to the application layer.
if BLE_MESH_PROVISIONER_RECV_HB
config BLE_MESH_PROVISIONER_RECV_HB_FILTER_SIZE
int "Maximum number of filter entries for receiving Heartbeat messages"
default 3
range 1 1000
help
This option specifies how many heartbeat filter entries Provisioner supports.
The heartbeat filter (acceptlist or rejectlist) entries are used to store a
list of SRC and DST which can be used to decide if a heartbeat message will
be processed and notified to the application layer by Provisioner.
Note: The filter is an empty rejectlist by default.
endif # BLE_MESH_PROVISIONER_RECV_HB
endif # BLE_MESH_PROVISIONER
# Virtual option enabled whenever Generic Provisioning layer is needed
@@ -1857,6 +1960,19 @@ if BLE_MESH
advertising bearer. This option should be enabled if PB-ADV is
going to be used during provisioning procedure.
config BLE_MESH_UNPROVISIONED_BEACON_INTERVAL
int "Interval between two consecutive Unprovisioned Device Beacon"
depends on BLE_MESH_NODE && BLE_MESH_PB_ADV
default 5
default 3 if BLE_MESH_FAST_PROV
range 1 100
help
This option specifies the interval of sending two consecutive unprovisioned
device beacon, users can use this option to change the frequency of sending
unprovisioned device beacon. For example, if the value is 5, it means the
unprovisioned device beacon will send every 5 seconds. When the option of
BLE_MESH_FAST_PROV is selected, the value is better to be 3 seconds, or less.
config BLE_MESH_PB_GATT
bool "Provisioning support using GATT (PB-GATT)"
select BLE_MESH_PROXY
@@ -1919,7 +2035,7 @@ if BLE_MESH
advertising bearer.
config BLE_MESH_NET_BUF_POOL_USAGE
bool "BLE Mesh net buffer pool usage tracking"
bool
default y
help
Enable BLE Mesh net buffer pool tracking. This option is used to introduce another
@@ -1941,28 +2057,6 @@ if BLE_MESH
if BLE_MESH_SETTINGS
config BLE_MESH_SPECIFIC_PARTITION
bool "Use a specific NVS partition for BLE Mesh"
default n
help
When selected, the mesh stack will use a specified NVS partition instead of
default NVS partition. Note that the specified partition must be registered
with NVS using nvs_flash_init_partition() API, and the partition must exists
in the csv file.
When Provisioner needs to store a large amount of nodes' information in the
flash (e.g. more than 20), this option is recommended to be enabled.
if BLE_MESH_SPECIFIC_PARTITION
config BLE_MESH_PARTITION_NAME
string "Name of the NVS partition for BLE Mesh"
default "ble_mesh"
help
This value defines the name of the specified NVS partition used by the
mesh stack.
endif # BLE_MESH_SPECIFIC_PARTITION
config BLE_MESH_STORE_TIMEOUT
int "Delay (in seconds) before storing anything persistently"
range 0 1000000
@@ -1977,7 +2071,7 @@ if BLE_MESH
config BLE_MESH_SEQ_STORE_RATE
int "How often the sequence number gets updated in storage"
range 0 1000000
default 6
default 0
help
This value defines how often the local sequence number gets updated in
persistent storage (i.e. flash). e.g. a value of 100 means that the
@@ -1992,7 +2086,7 @@ if BLE_MESH
config BLE_MESH_RPL_STORE_TIMEOUT
int "Minimum frequency that the RPL gets updated in storage"
range 0 1000000
default 5
default 0
help
This value defines in seconds how soon the RPL (Replay Protection List)
gets written to persistent storage after a change occurs. If the node
@@ -2028,6 +2122,50 @@ if BLE_MESH
in advance before recovering node information and make sure the node
information recovering could work as expected.
config BLE_MESH_SPECIFIC_PARTITION
bool "Use a specific NVS partition for BLE Mesh"
default n
help
When selected, the mesh stack will use a specified NVS partition instead of
default NVS partition. Note that the specified partition must be registered
with NVS using nvs_flash_init_partition() API, and the partition must exists
in the csv file.
When Provisioner needs to store a large amount of nodes' information in the
flash (e.g. more than 20), this option is recommended to be enabled.
config BLE_MESH_PARTITION_NAME
string "Name of the NVS partition for BLE Mesh"
depends on BLE_MESH_SPECIFIC_PARTITION
default "ble_mesh"
help
This value defines the name of the specified NVS partition used by the
mesh stack.
config BLE_MESH_USE_MULTIPLE_NAMESPACE
bool "Support using multiple NVS namespaces by Provisioner"
depends on BLE_MESH_PROVISIONER
default n
help
When selected, Provisioner can use different NVS namespaces to store
different instances of mesh information.
For example, if in the first room, Provisioner uses NetKey A, AppKey
A and provisions three devices, these information will be treated as
mesh information instance A. When the Provisioner moves to the second
room, it uses NetKey B, AppKey B and provisions two devices, then the
information will be treated as mesh information instance B.
Here instance A and instance B will be stored in different namespaces.
With this option enabled, Provisioner needs to use specific functions
to open the corresponding NVS namespace, restore the mesh information,
release the mesh information or erase the mesh information.
config BLE_MESH_MAX_NVS_NAMESPACE
int "Maximum number of NVS namespaces"
depends on BLE_MESH_USE_MULTIPLE_NAMESPACE
default 2
range 1 255
help
This option specifies the maximum NVS namespaces supported by Provisioner.
endif # if BLE_MESH_SETTINGS
config BLE_MESH_SUBNET_COUNT
@@ -2109,24 +2247,6 @@ if BLE_MESH
SDU size is 60 bytes, which leaves 56 bytes for application layer data
using a 4-byte MIC, or 52 bytes using an 8-byte MIC.
config BLE_MESH_SUPPORT_BLE_ADV
bool "Support sending normal BLE advertising packets"
default n
help
When selected, users can send normal BLE advertising packets
with specific API.
if BLE_MESH_SUPPORT_BLE_ADV
config BLE_MESH_BLE_ADV_BUF_COUNT
int "Number of advertising buffers for BLE advertising packets"
default 3
range 1 255
help
Number of advertising buffers for BLE packets available.
endif # BLE_MESH_SUPPORT_BLE_ADV
config BLE_MESH_IVU_DIVIDER
int "Divider for IV Update state refresh timer"
default 4
@@ -2521,104 +2641,138 @@ if BLE_MESH
uses 0 as the timeout value when sending acknowledged messages, then
the default value will be used which is four seconds.
menu "Support for BLE Mesh Client Models"
menu "Support for BLE Mesh Foundation models"
config BLE_MESH_CFG_CLI
bool "Configuration Client Model"
bool "Configuration Client model"
help
Enable support for Configuration client model.
Enable support for Configuration Client model.
config BLE_MESH_HEALTH_CLI
bool "Health Client Model"
bool "Health Client model"
help
Enable support for Health client model.
Enable support for Health Client model.
config BLE_MESH_HEALTH_SRV
bool "Health Server model"
default y
help
Enable support for Health Server model.
endmenu #Support for BLE Mesh Foundation models
menu "Support for BLE Mesh Client/Server models"
config BLE_MESH_GENERIC_ONOFF_CLI
bool "Generic OnOff Client Model"
bool "Generic OnOff Client model"
help
Enable support for Generic OnOff client model.
Enable support for Generic OnOff Client model.
config BLE_MESH_GENERIC_LEVEL_CLI
bool "Generic Level Client Model"
bool "Generic Level Client model"
help
Enable support for Generic Level client model.
Enable support for Generic Level Client model.
config BLE_MESH_GENERIC_DEF_TRANS_TIME_CLI
bool "Generic Default Transition Time Client Model"
bool "Generic Default Transition Time Client model"
help
Enable support for Generic Default Transition Time client model.
Enable support for Generic Default Transition Time Client model.
config BLE_MESH_GENERIC_POWER_ONOFF_CLI
bool "Generic Power OnOff Client Model"
bool "Generic Power OnOff Client model"
help
Enable support for Generic Power OnOff client model.
Enable support for Generic Power OnOff Client model.
config BLE_MESH_GENERIC_POWER_LEVEL_CLI
bool "Generic Power Level Client Model"
bool "Generic Power Level Client model"
help
Enable support for Generic Power Level client model.
Enable support for Generic Power Level Client model.
config BLE_MESH_GENERIC_BATTERY_CLI
bool "Generic Battery Client Model"
bool "Generic Battery Client model"
help
Enable support for Generic Battery client model.
Enable support for Generic Battery Client model.
config BLE_MESH_GENERIC_LOCATION_CLI
bool "Generic Location Client Model"
bool "Generic Location Client model"
help
Enable support for Generic Location client model.
Enable support for Generic Location Client model.
config BLE_MESH_GENERIC_PROPERTY_CLI
bool "Generic Property Client Model"
bool "Generic Property Client model"
help
Enable support for Generic Property client model.
Enable support for Generic Property Client model.
config BLE_MESH_SENSOR_CLI
bool "Sensor Client Model"
bool "Sensor Client model"
help
Enable support for Sensor client model.
Enable support for Sensor Client model.
config BLE_MESH_TIME_CLI
bool "Time Client Model"
bool "Time Client model"
help
Enable support for Time client model.
Enable support for Time Client model.
config BLE_MESH_SCENE_CLI
bool "Scene Client Model"
bool "Scene Client model"
help
Enable support for Scene client model.
Enable support for Scene Client model.
config BLE_MESH_SCHEDULER_CLI
bool "Scheduler Client Model"
bool "Scheduler Client model"
help
Enable support for Scheduler client model.
Enable support for Scheduler Client model.
config BLE_MESH_LIGHT_LIGHTNESS_CLI
bool "Light Lightness Client Model"
bool "Light Lightness Client model"
help
Enable support for Light Lightness client model.
Enable support for Light Lightness Client model.
config BLE_MESH_LIGHT_CTL_CLI
bool "Light CTL Client Model"
bool "Light CTL Client model"
help
Enable support for Light CTL client model.
Enable support for Light CTL Client model.
config BLE_MESH_LIGHT_HSL_CLI
bool "Light HSL Client Model"
bool "Light HSL Client model"
help
Enable support for Light HSL client model.
Enable support for Light HSL Client model.
config BLE_MESH_LIGHT_XYL_CLI
bool "Light XYL Client Model"
bool "Light XYL Client model"
help
Enable support for Light XYL client model.
Enable support for Light XYL Client model.
config BLE_MESH_LIGHT_LC_CLI
bool "Light LC Client Model"
bool "Light LC Client model"
help
Enable support for Light LC client model.
Enable support for Light LC Client model.
endmenu
config BLE_MESH_GENERIC_SERVER
bool "Generic server models"
default y
help
Enable support for Generic server models.
config BLE_MESH_SENSOR_SERVER
bool "Sensor server models"
default y
help
Enable support for Sensor server models.
config BLE_MESH_TIME_SCENE_SERVER
bool "Time and Scenes server models"
default y
help
Enable support for Time and Scenes server models.
config BLE_MESH_LIGHTING_SERVER
bool "Lighting server models"
default y
help
Enable support for Lighting server models.
endmenu #Support for BLE Mesh Client/Server models
config BLE_MESH_IV_UPDATE_TEST
bool "Test the IV Update Procedure"
+56 -2
View File
@@ -29,6 +29,10 @@ esp_err_t esp_a2d_sink_init(void)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_on_init || g_a2dp_sink_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
@@ -46,6 +50,10 @@ esp_err_t esp_a2d_sink_deinit(void)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_on_deinit || g_a2dp_sink_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
@@ -63,6 +71,10 @@ esp_err_t esp_a2d_sink_register_data_callback(esp_a2d_sink_data_cb_t callback)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_sink_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_A2DP;
@@ -83,6 +95,10 @@ esp_err_t esp_a2d_sink_connect(esp_bd_addr_t remote_bda)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_on_deinit || g_a2dp_sink_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
bt_status_t stat;
btc_av_args_t arg;
btc_msg_t msg;
@@ -105,15 +121,21 @@ esp_err_t esp_a2d_sink_disconnect(esp_bd_addr_t remote_bda)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_on_deinit || g_a2dp_sink_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
bt_status_t stat;
btc_msg_t msg;
btc_av_args_t arg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_A2DP;
msg.act = BTC_AV_SINK_API_DISCONNECT_EVT;
/* Switch to BTC context */
stat = btc_transfer_context(&msg, NULL, 0, NULL);
memcpy(&(arg.disconn), remote_bda, sizeof(bt_bdaddr_t));
stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL);
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}
@@ -125,6 +147,10 @@ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_sink_ongoing_deinit || g_a2dp_source_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
if (callback == NULL) {
return ESP_FAIL;
}
@@ -139,6 +165,10 @@ esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_on_deinit || g_a2dp_sink_ongoing_deinit || g_a2dp_source_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
bt_status_t stat;
btc_av_args_t arg;
btc_msg_t msg;
@@ -162,6 +192,10 @@ esp_err_t esp_a2d_source_init(void)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_on_init || g_a2dp_source_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
@@ -179,6 +213,10 @@ esp_err_t esp_a2d_source_deinit(void)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_on_deinit || g_a2dp_source_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
@@ -196,6 +234,10 @@ esp_err_t esp_a2d_source_connect(esp_bd_addr_t remote_bda)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_on_deinit || g_a2dp_source_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
bt_status_t stat;
btc_av_args_t arg;
btc_msg_t msg;
@@ -218,15 +260,23 @@ esp_err_t esp_a2d_source_disconnect(esp_bd_addr_t remote_bda)
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_on_deinit || g_a2dp_source_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
bt_status_t stat;
btc_av_args_t arg;
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_A2DP;
msg.act = BTC_AV_SRC_API_DISCONNECT_EVT;
memset(&arg, 0, sizeof(btc_av_args_t));
/* Switch to BTC context */
stat = btc_transfer_context(&msg, NULL, 0, NULL);
memcpy(&(arg.src_disconn), remote_bda, sizeof(bt_bdaddr_t));
stat = btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL);
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}
@@ -236,6 +286,10 @@ esp_err_t esp_a2d_source_register_data_callback(esp_a2d_source_data_cb_t callbac
return ESP_ERR_INVALID_STATE;
}
if (g_a2dp_source_ongoing_deinit) {
return ESP_ERR_INVALID_STATE;
}
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_A2DP;
+2 -1
View File
@@ -23,7 +23,7 @@
#include "osi/future.h"
#include "btc_gatts.h"
#include "btc_gatt_util.h"
#if (BLUFI_INCLUDED == TRUE)
esp_err_t esp_blufi_register_callbacks(esp_blufi_callbacks_t *callbacks)
{
if (esp_bluedroid_get_status() == ESP_BLUEDROID_STATUS_UNINITIALIZED) {
@@ -162,3 +162,4 @@ esp_err_t esp_blufi_send_custom_data(uint8_t *data, uint32_t data_len)
return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), btc_blufi_call_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif ///BLUFI_INCLUDED == TRUE
+1 -1
View File
@@ -30,7 +30,7 @@ const uint8_t *esp_bt_dev_get_address(void)
esp_err_t esp_bt_dev_set_device_name(const char *name)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_dev_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
+12 -4
View File
@@ -117,6 +117,7 @@ esp_err_t esp_bluedroid_init(void)
{
btc_msg_t msg;
future_t **future_p;
bt_status_t ret;
if (esp_bt_controller_get_status() != ESP_BT_CONTROLLER_STATUS_ENABLED) {
LOG_ERROR("Controller not initialised\n");
@@ -135,23 +136,30 @@ esp_err_t esp_bluedroid_init(void)
future_p = btc_main_get_future_p(BTC_MAIN_INIT_FUTURE);
*future_p = future_new();
if (*future_p == NULL) {
LOG_ERROR("Bluedroid initialise failed\n");
LOG_ERROR("Bluedroid Initialize Fail!");
return ESP_ERR_NO_MEM;
}
btc_init();
/*
* BTC Init
*/
ret = btc_init();
if (ret != BT_STATUS_SUCCESS) {
LOG_ERROR("Bluedroid Initialize Fail");
return ESP_FAIL;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_MAIN_INIT;
msg.act = BTC_MAIN_ACT_INIT;
if (btc_transfer_context(&msg, NULL, 0, NULL) != BT_STATUS_SUCCESS) {
LOG_ERROR("Bluedroid initialise failed\n");
LOG_ERROR("Bluedroid Initialize Fail!");
return ESP_FAIL;
}
if (future_await(*future_p) == FUTURE_FAIL) {
LOG_ERROR("Bluedroid initialise failed\n");
LOG_ERROR("Bluedroid Initialize Fail!");
return ESP_FAIL;
}
+69 -33
View File
@@ -33,7 +33,7 @@ esp_err_t esp_ble_gap_register_callback(esp_gap_ble_cb_t callback)
esp_err_t esp_ble_gap_config_adv_data(esp_ble_adv_data_t *adv_data)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -58,7 +58,7 @@ esp_err_t esp_ble_gap_config_adv_data(esp_ble_adv_data_t *adv_data)
esp_err_t esp_ble_gap_set_scan_params(esp_ble_scan_params_t *scan_params)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -77,7 +77,7 @@ esp_err_t esp_ble_gap_set_scan_params(esp_ble_scan_params_t *scan_params)
esp_err_t esp_ble_gap_start_scanning(uint32_t duration)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -93,7 +93,7 @@ esp_err_t esp_ble_gap_start_scanning(uint32_t duration)
esp_err_t esp_ble_gap_stop_scanning(void)
{
btc_msg_t msg;
btc_msg_t msg = {0};
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -105,7 +105,7 @@ esp_err_t esp_ble_gap_stop_scanning(void)
esp_err_t esp_ble_gap_start_advertising(esp_ble_adv_params_t *adv_params)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -120,7 +120,7 @@ esp_err_t esp_ble_gap_start_advertising(esp_ble_adv_params_t *adv_params)
esp_err_t esp_ble_gap_stop_advertising(void)
{
btc_msg_t msg;
btc_msg_t msg = {0};
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -134,22 +134,37 @@ esp_err_t esp_ble_gap_stop_advertising(void)
esp_err_t esp_ble_gap_update_conn_params(esp_ble_conn_update_params_t *params)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if(!params) {
LOG_ERROR("%s,params is NULL", __func__);
return ESP_FAIL;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_UPDATE_CONN_PARAM;
memcpy(&arg.conn_update_params.conn_params, params, sizeof(esp_ble_conn_update_params_t));
if (ESP_BLE_IS_VALID_PARAM(params->min_int, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
ESP_BLE_IS_VALID_PARAM(params->max_int, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
ESP_BLE_IS_VALID_PARAM(params->timeout, ESP_BLE_CONN_SUP_TOUT_MIN, ESP_BLE_CONN_SUP_TOUT_MAX) &&
(params->latency <= ESP_BLE_CONN_LATENCY_MAX || params->latency == ESP_BLE_CONN_PARAM_UNDEF) &&
((params->timeout * 10) >= ((1 + params->latency) * ((params->max_int * 5) >> 1))) && params->min_int <= params->max_int) {
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_UPDATE_CONN_PARAM;
memcpy(&arg.conn_update_params.conn_params, params, sizeof(esp_ble_conn_update_params_t));
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
} else {
LOG_ERROR("%s,invalid connection params:min_int = %d, max_int = %d, latency = %d, timeout = %d",\
__func__, params->min_int, params->max_int, params->latency, params->timeout);
return ESP_FAIL;
}
}
esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_data_length)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -166,7 +181,7 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_
esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -181,7 +196,7 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr)
esp_err_t esp_ble_gap_clear_rand_addr(void)
{
btc_msg_t msg;
btc_msg_t msg = {0};
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -194,7 +209,7 @@ esp_err_t esp_ble_gap_clear_rand_addr(void)
esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -210,7 +225,7 @@ esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable)
esp_err_t esp_ble_gap_config_local_icon (uint16_t icon)
{
esp_err_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -289,7 +304,7 @@ esp_err_t esp_ble_gap_config_local_icon (uint16_t icon)
esp_err_t esp_ble_gap_update_whitelist(bool add_remove, esp_bd_addr_t remote_bda)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
@@ -322,7 +337,7 @@ esp_err_t esp_ble_gap_set_prefer_conn_params(esp_bd_addr_t bd_addr,
uint16_t min_conn_int, uint16_t max_conn_int,
uint16_t slave_latency, uint16_t supervision_tout)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
@@ -390,7 +405,7 @@ uint8_t *esp_ble_resolve_adv_data( uint8_t *adv_data, uint8_t type, uint8_t *len
esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_len)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -412,7 +427,7 @@ esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_l
esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
@@ -429,7 +444,7 @@ esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr)
esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_data_len)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -451,7 +466,7 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
esp_err_t esp_ble_gap_add_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
@@ -475,7 +490,7 @@ esp_err_t esp_ble_gap_add_duplicate_scan_exceptional_device(esp_ble_duplicate_ex
esp_err_t esp_ble_gap_remove_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
@@ -499,7 +514,7 @@ esp_err_t esp_ble_gap_remove_duplicate_scan_exceptional_device(esp_ble_duplicate
esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_exceptional_list_type_t list_type)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
@@ -537,7 +552,7 @@ esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
}
}
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -555,7 +570,7 @@ esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
esp_err_t esp_ble_set_encryption(esp_bd_addr_t bd_addr, esp_ble_sec_act_t sec_act)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -572,7 +587,7 @@ esp_err_t esp_ble_set_encryption(esp_bd_addr_t bd_addr, esp_ble_sec_act_t sec_ac
esp_err_t esp_ble_gap_security_rsp(esp_bd_addr_t bd_addr, bool accept)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -590,7 +605,7 @@ esp_err_t esp_ble_gap_security_rsp(esp_bd_addr_t bd_addr, bool accept)
esp_err_t esp_ble_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t passkey)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -608,7 +623,7 @@ esp_err_t esp_ble_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t pas
esp_err_t esp_ble_confirm_reply(esp_bd_addr_t bd_addr, bool accept)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -625,7 +640,7 @@ esp_err_t esp_ble_confirm_reply(esp_bd_addr_t bd_addr, bool accept)
esp_err_t esp_ble_remove_bond_device(esp_bd_addr_t bd_addr)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
@@ -672,7 +687,7 @@ esp_err_t esp_ble_oob_req_reply(esp_bd_addr_t bd_addr, uint8_t *TK, uint8_t len)
return ESP_ERR_INVALID_ARG;
}
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -692,7 +707,7 @@ esp_err_t esp_ble_oob_req_reply(esp_bd_addr_t bd_addr, uint8_t *TK, uint8_t len)
esp_err_t esp_ble_gap_disconnect(esp_bd_addr_t remote_device)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -705,6 +720,27 @@ esp_err_t esp_ble_gap_disconnect(esp_bd_addr_t remote_device)
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_gap_ble_set_authorization(esp_bd_addr_t bd_addr, bool authorize)
{
if (!bd_addr) {
return ESP_ERR_INVALID_ARG;
}
if (BTM_Ble_Authorization(bd_addr, authorize)) {
return ESP_OK;
}
return ESP_FAIL;
}
esp_err_t esp_ble_get_current_conn_params(esp_bd_addr_t bd_addr, esp_gap_conn_params_t *conn_params)
{
if(!bd_addr || !conn_params) {
return ESP_ERR_INVALID_ARG;
}
if(BTM_GetCurrentConnParams(bd_addr, &conn_params->interval, &conn_params->latency, &conn_params->timeout)) {
return ESP_OK;
}
return ESP_ERR_NOT_FOUND;
}
+2 -8
View File
@@ -213,7 +213,7 @@ esp_err_t esp_bt_gap_remove_bond_device(esp_bd_addr_t bd_addr)
int esp_bt_gap_get_bond_device_num(void)
{
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_FAIL;
return ESP_ERR_INVALID_STATE;
}
return btc_storage_get_num_bt_bond_devices();
}
@@ -221,7 +221,6 @@ int esp_bt_gap_get_bond_device_num(void)
esp_err_t esp_bt_gap_get_bond_device_list(int *dev_num, esp_bd_addr_t *dev_list)
{
int ret;
int dev_num_total;
if (dev_num == NULL || dev_list == NULL) {
return ESP_ERR_INVALID_ARG;
@@ -231,12 +230,7 @@ esp_err_t esp_bt_gap_get_bond_device_list(int *dev_num, esp_bd_addr_t *dev_list)
return ESP_ERR_INVALID_STATE;
}
dev_num_total = btc_storage_get_num_bt_bond_devices();
if (*dev_num > dev_num_total) {
*dev_num = dev_num_total;
}
ret = btc_storage_get_bonded_bt_devices_list((bt_bdaddr_t *)dev_list, *dev_num);
ret = btc_storage_get_bonded_bt_devices_list((bt_bdaddr_t *)dev_list, dev_num);
return (ret == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
@@ -31,7 +31,7 @@
*/
esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatt_com_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -50,9 +50,33 @@ esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu)
#if (BLE_INCLUDED == TRUE)
extern uint16_t L2CA_GetFreePktBufferNum_LE(void);
/**
* @brief This function is called to get currently sendable packets number on controller,
* the function is called only in BLE running core and single connection now.
*
* @return
* sendable packets number on controller
*
*/
uint16_t esp_ble_get_sendable_packets_num ()
uint16_t esp_ble_get_sendable_packets_num (void)
{
return L2CA_GetFreePktBufferNum_LE();
}
/**
* @brief This function is used to query the number of available buffers for the current connection.
* When you need to query the current available buffer number, it is recommended to use this API.
* @param[in] conn_id: current connection id.
*
* @return
* Number of available buffers for the current connection
*
*/
extern UINT16 L2CA_GetCurFreePktBufferNum_LE(UINT16 conn_id);
uint16_t esp_ble_get_cur_sendable_packets_num (uint16_t connid)
{
return L2CA_GetCurFreePktBufferNum_LE(connid);
}
#endif
+59 -19
View File
@@ -38,7 +38,7 @@ esp_err_t esp_ble_gattc_register_callback(esp_gattc_cb_t callback)
esp_err_t esp_ble_gattc_app_register(uint16_t app_id)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -57,7 +57,7 @@ esp_err_t esp_ble_gattc_app_register(uint16_t app_id)
esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -72,7 +72,7 @@ esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if)
esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -90,7 +90,7 @@ esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, e
esp_err_t esp_ble_gattc_close (esp_gatt_if_t gattc_if, uint16_t conn_id)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -105,7 +105,7 @@ esp_err_t esp_ble_gattc_close (esp_gatt_if_t gattc_if, uint16_t conn_id)
esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -120,7 +120,7 @@ esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id)
esp_err_t esp_ble_gattc_search_service(esp_gatt_if_t gattc_if, uint16_t conn_id, esp_bt_uuid_t *filter_uuid)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -330,7 +330,7 @@ esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if,
uint16_t conn_id, uint16_t handle,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -350,11 +350,44 @@ esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if,
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_read_by_type (esp_gatt_if_t gattc_if,
uint16_t conn_id,
uint16_t start_handle,
uint16_t end_handle,
esp_bt_uuid_t *uuid,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (uuid == NULL) {
return ESP_GATT_ILLEGAL_PARAMETER;
}
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, conn_id)) {
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
return ESP_FAIL;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_READ_BY_TYPE;
arg.read_by_type.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
arg.read_by_type.s_handle = start_handle;
arg.read_by_type.e_handle = end_handle;
arg.read_by_type.auth_req = auth_req;
memcpy(&(arg.read_by_type.uuid), uuid, sizeof(esp_bt_uuid_t));
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_read_multiple(esp_gatt_if_t gattc_if,
uint16_t conn_id, esp_gattc_multi_t *read_multi,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -385,7 +418,7 @@ esp_err_t esp_ble_gattc_read_char_descr (esp_gatt_if_t gattc_if,
uint16_t conn_id, uint16_t handle,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -412,7 +445,7 @@ esp_err_t esp_ble_gattc_write_char(esp_gatt_if_t gattc_if,
esp_gatt_write_type_t write_type,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -431,6 +464,9 @@ esp_err_t esp_ble_gattc_write_char(esp_gatt_if_t gattc_if,
arg.write_char.value = value;
arg.write_char.write_type = write_type;
arg.write_char.auth_req = auth_req;
if(write_type == ESP_GATT_WRITE_TYPE_NO_RSP){
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL);
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
@@ -442,7 +478,7 @@ esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if,
esp_gatt_write_type_t write_type,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -462,6 +498,10 @@ esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if,
arg.write_descr.write_type = write_type;
arg.write_descr.auth_req = auth_req;
if(write_type == ESP_GATT_WRITE_TYPE_NO_RSP){
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL);
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
@@ -472,7 +512,7 @@ esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if,
uint8_t *value,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -502,7 +542,7 @@ esp_err_t esp_ble_gattc_prepare_write_char_descr(esp_gatt_if_t gattc_if,
uint8_t *value,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -527,7 +567,7 @@ esp_err_t esp_ble_gattc_prepare_write_char_descr(esp_gatt_if_t gattc_if,
esp_err_t esp_ble_gattc_execute_write (esp_gatt_if_t gattc_if, uint16_t conn_id, bool is_execute)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -544,7 +584,7 @@ esp_err_t esp_ble_gattc_execute_write (esp_gatt_if_t gattc_if, uint16_t conn_id,
esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
esp_bd_addr_t server_bda, uint16_t handle)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -562,7 +602,7 @@ esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
esp_bd_addr_t server_bda, uint16_t handle)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -578,7 +618,7 @@ esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -593,7 +633,7 @@ esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda)
esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_addr, esp_bd_addr_t assoc_addr, bool is_assoc)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -611,7 +651,7 @@ esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_ad
esp_err_t esp_ble_gattc_cache_get_addr_list(esp_gatt_if_t gattc_if)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
+19 -16
View File
@@ -38,7 +38,7 @@ esp_err_t esp_ble_gatts_register_callback(esp_gatts_cb_t callback)
esp_err_t esp_ble_gatts_app_register(uint16_t app_id)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -59,7 +59,7 @@ esp_err_t esp_ble_gatts_app_register(uint16_t app_id)
esp_err_t esp_ble_gatts_app_unregister(esp_gatt_if_t gatts_if)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -75,7 +75,7 @@ esp_err_t esp_ble_gatts_app_unregister(esp_gatt_if_t gatts_if)
esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatts_if,
esp_gatt_srvc_id_t *service_id, uint16_t num_handle)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -95,7 +95,7 @@ esp_err_t esp_ble_gatts_create_attr_tab(const esp_gatts_attr_db_t *gatts_attr_db
uint8_t max_nb_attr,
uint8_t srvc_inst_id)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -115,7 +115,7 @@ esp_err_t esp_ble_gatts_create_attr_tab(const esp_gatts_attr_db_t *gatts_attr_db
esp_err_t esp_ble_gatts_add_included_service(uint16_t service_handle, uint16_t included_service_handle)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -134,7 +134,7 @@ esp_err_t esp_ble_gatts_add_char(uint16_t service_handle, esp_bt_uuid_t *char_
esp_gatt_perm_t perm, esp_gatt_char_prop_t property, esp_attr_value_t *char_val,
esp_attr_control_t *control)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
esp_err_t status;
@@ -173,7 +173,7 @@ esp_err_t esp_ble_gatts_add_char_descr (uint16_t service_handle,
esp_gatt_perm_t perm, esp_attr_value_t *char_descr_val,
esp_attr_control_t *control)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
esp_err_t status;
@@ -208,7 +208,7 @@ esp_err_t esp_ble_gatts_add_char_descr (uint16_t service_handle,
esp_err_t esp_ble_gatts_delete_service(uint16_t service_handle)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -223,7 +223,7 @@ esp_err_t esp_ble_gatts_delete_service(uint16_t service_handle)
esp_err_t esp_ble_gatts_start_service(uint16_t service_handle)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -238,7 +238,7 @@ esp_err_t esp_ble_gatts_start_service(uint16_t service_handle)
esp_err_t esp_ble_gatts_stop_service(uint16_t service_handle)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -255,7 +255,7 @@ esp_err_t esp_ble_gatts_stop_service(uint16_t service_handle)
esp_err_t esp_ble_gatts_send_indicate(esp_gatt_if_t gatts_if, uint16_t conn_id, uint16_t attr_handle,
uint16_t value_len, uint8_t *value, bool need_confirm)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -274,6 +274,9 @@ esp_err_t esp_ble_gatts_send_indicate(esp_gatt_if_t gatts_if, uint16_t conn_id,
arg.send_ind.value_len = value_len;
arg.send_ind.value = value;
if(need_confirm == false){
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL);
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t),
btc_gatts_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
@@ -281,7 +284,7 @@ esp_err_t esp_ble_gatts_send_indicate(esp_gatt_if_t gatts_if, uint16_t conn_id,
esp_err_t esp_ble_gatts_send_response(esp_gatt_if_t gatts_if, uint16_t conn_id, uint32_t trans_id,
esp_gatt_status_t status, esp_gatt_rsp_t *rsp)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -300,7 +303,7 @@ esp_err_t esp_ble_gatts_send_response(esp_gatt_if_t gatts_if, uint16_t conn_id,
esp_err_t esp_ble_gatts_set_attr_value(uint16_t attr_handle, uint16_t length, const uint8_t *value)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -330,7 +333,7 @@ esp_gatt_status_t esp_ble_gatts_get_attr_value(uint16_t attr_handle, uint16_t *l
esp_err_t esp_ble_gatts_open(esp_gatt_if_t gatts_if, esp_bd_addr_t remote_bda, bool is_direct)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -348,7 +351,7 @@ esp_err_t esp_ble_gatts_open(esp_gatt_if_t gatts_if, esp_bd_addr_t remote_bda, b
esp_err_t esp_ble_gatts_close(esp_gatt_if_t gatts_if, uint16_t conn_id)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
@@ -364,7 +367,7 @@ esp_err_t esp_ble_gatts_close(esp_gatt_if_t gatts_if, uint16_t conn_id)
esp_err_t esp_ble_gatts_send_service_change_indication(esp_gatt_if_t gatts_if, esp_bd_addr_t remote_bda)
{
btc_msg_t msg;
btc_msg_t msg = {0};
btc_ble_gatts_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
+34 -1
View File
@@ -133,7 +133,8 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
btc_spp_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (strlen(name) > ESP_SPP_SERVER_NAME_MAX) {
if (name == NULL || strlen(name) > ESP_SPP_SERVER_NAME_MAX) {
LOG_ERROR("Invalid server name!\n");
return ESP_ERR_INVALID_ARG;
}
@@ -154,6 +155,38 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_spp_stop_srv(void)
{
btc_msg_t msg;
btc_spp_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_SPP;
msg.act = BTC_SPP_ACT_STOP_SRV;
arg.stop_srv.scn = BTC_SPP_INVALID_SCN;
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_spp_stop_srv_scn(uint8_t scn)
{
btc_msg_t msg;
btc_spp_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if ((scn == 0) || (scn >= PORT_MAX_RFC_PORTS)) {
LOG_ERROR("Invalid SCN!\n");
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_SPP;
msg.act = BTC_SPP_ACT_STOP_SRV;
arg.stop_srv.scn = scn;
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_spp_write(uint32_t handle, int len, uint8_t *p_data)
{
@@ -46,6 +46,12 @@ typedef struct {
} cie; /*!< A2DP codec information element */
} __attribute__((packed)) esp_a2d_mcc_t;
/// Bluetooth A2DP Initiation states
typedef enum {
ESP_A2D_DEINIT_SUCCESS = 0, /*!< A2DP profile deinit successful event */
ESP_A2D_INIT_SUCCESS /*!< A2DP profile init successful event */
} esp_a2d_init_state_t;
/// Bluetooth A2DP connection states
typedef enum {
ESP_A2D_CONNECTION_STATE_DISCONNECTED = 0, /*!< connection released */
@@ -76,7 +82,7 @@ typedef enum {
/// A2DP media control commands
typedef enum {
ESP_A2D_MEDIA_CTRL_NONE = 0, /*!< dummy command */
ESP_A2D_MEDIA_CTRL_NONE = 0, /*!< Not for application use, use inside stack only. */
ESP_A2D_MEDIA_CTRL_CHECK_SRC_RDY, /*!< check whether AVDTP is connected, only used in A2DP source */
ESP_A2D_MEDIA_CTRL_START, /*!< command to set up media transmission channel */
ESP_A2D_MEDIA_CTRL_STOP, /*!< command to stop media transmission */
@@ -89,6 +95,7 @@ typedef enum {
ESP_A2D_AUDIO_STATE_EVT, /*!< audio stream transmission state changed event */
ESP_A2D_AUDIO_CFG_EVT, /*!< audio codec is configured, only used for A2DP SINK */
ESP_A2D_MEDIA_CTRL_ACK_EVT, /*!< acknowledge event in response to media control commands */
ESP_A2D_PROF_STATE_EVT, /*!< indicate a2dp deinit complete */
} esp_a2d_cb_event_t;
/// A2DP state callback parameters
@@ -125,6 +132,13 @@ typedef union {
esp_a2d_media_ctrl_t cmd; /*!< media control commands to acknowledge */
esp_a2d_media_ctrl_ack_t status; /*!< acknowledgement to media control commands */
} media_ctrl_stat; /*!< status in acknowledgement to media control commands */
/**
* @brief ESP_A2D_PROF_STATE_EVT
*/
struct a2d_prof_stat_param {
esp_a2d_init_state_t init_state; /*!< a2dp profile state param */
} a2d_prof_stat; /*!< status to indicate a2d prof init or deinit */
} esp_a2d_cb_param_t;
/**
@@ -193,7 +207,8 @@ esp_err_t esp_a2d_sink_register_data_callback(esp_a2d_sink_data_cb_t callback);
/**
*
* @brief Initialize the bluetooth A2DP sink module. This function should be called
* after esp_bluedroid_enable() completes successfully
* after esp_bluedroid_enable() completes successfully, and ESP_A2D_PROF_STATE_EVT
* with ESP_A2D_INIT_SUCCESS will reported to the APP layer
*
* @return
* - ESP_OK: if the initialization request is sent successfully
@@ -207,7 +222,8 @@ esp_err_t esp_a2d_sink_init(void);
/**
*
* @brief De-initialize for A2DP sink module. This function
* should be called only after esp_bluedroid_enable() completes successfully
* should be called only after esp_bluedroid_enable() completes successfully,
* and ESP_A2D_PROF_STATE_EVT with ESP_A2D_DEINIT_SUCCESS will reported to APP layer.
*
* @return
* - ESP_OK: success
@@ -264,7 +280,8 @@ esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl);
/**
*
* @brief Initialize the bluetooth A2DP source module. This function should be called
* after esp_bluedroid_enable() completes successfully
* after esp_bluedroid_enable() completes successfully, and ESP_A2D_PROF_STATE_EVT
* with ESP_A2D_INIT_SUCCESS will reported to the APP layer
*
* @return
* - ESP_OK: if the initialization request is sent successfully
@@ -278,7 +295,8 @@ esp_err_t esp_a2d_source_init(void);
/**
*
* @brief De-initialize for A2DP source module. This function
* should be called only after esp_bluedroid_enable() completes successfully
* should be called only after esp_bluedroid_enable() completes successfully,
* and ESP_A2D_PROF_STATE_EVT with ESP_A2D_DEINIT_SUCCESS will reported to APP layer.
*
* @return
* - ESP_OK: success
@@ -301,6 +301,7 @@ typedef void (* esp_blufi_event_cb_t)(esp_blufi_cb_event_t event, esp_blufi_cb_p
* @param len : length of data from phone
* @param output_data : data want to send to phone
* @param output_len : length of data want to send to phone
* @param need_free : output reporting if memory needs to be freed or not *
*/
typedef void (*esp_blufi_negotiate_data_handler_t)(uint8_t *data, int len, uint8_t **output_data, int *output_len, bool *need_free);
@@ -311,7 +312,7 @@ typedef void (*esp_blufi_negotiate_data_handler_t)(uint8_t *data, int len, uint8
* @param crypt_len : length of plain text
* @return Nonnegative number is encrypted length, if error, return negative number;
*/
typedef int (* esp_blufi_encrypt_func_t)(uint8_t iv8, uint8_t *crypt_data, int cyprt_len);
typedef int (* esp_blufi_encrypt_func_t)(uint8_t iv8, uint8_t *crypt_data, int crypt_len);
/**
* @brief BLUFI decrypt the data after negotiate a share key
@@ -69,7 +69,7 @@ typedef uint8_t esp_link_key[ESP_BT_OCTET16_LEN]; /* Link Key */
#define ESP_BLE_CONN_INT_MIN 0x0006 /*!< relate to BTM_BLE_CONN_INT_MIN in stack/btm_ble_api.h */
#define ESP_BLE_CONN_INT_MAX 0x0C80 /*!< relate to BTM_BLE_CONN_INT_MAX in stack/btm_ble_api.h */
#define ESP_BLE_CONN_LATENCY_MAX 500 /*!< relate to ESP_BLE_CONN_LATENCY_MAX in stack/btm_ble_api.h */
#define ESP_BLE_CONN_LATENCY_MAX 499 /*!< relate to ESP_BLE_CONN_LATENCY_MAX in stack/btm_ble_api.h */
#define ESP_BLE_CONN_SUP_TOUT_MIN 0x000A /*!< relate to BTM_BLE_CONN_SUP_TOUT_MIN in stack/btm_ble_api.h */
#define ESP_BLE_CONN_SUP_TOUT_MAX 0x0C80 /*!< relate to ESP_BLE_CONN_SUP_TOUT_MAX in stack/btm_ble_api.h */
#define ESP_BLE_CONN_PARAM_UNDEF 0xffff /* use this value when a specific value not to be overwritten */ /* relate to ESP_BLE_CONN_PARAM_UNDEF in stack/btm_ble_api.h */
@@ -287,6 +287,8 @@ typedef enum {
ESP_BLE_SM_ONLY_ACCEPT_SPECIFIED_SEC_AUTH,
/* Enable/Disable OOB support */
ESP_BLE_SM_OOB_SUPPORT,
/* Appl encryption key size */
ESP_BLE_APP_ENC_KEY_SIZE,
ESP_BLE_SM_MAX_PARAM,
} esp_ble_sm_param_t;
@@ -388,6 +390,15 @@ typedef struct {
advertising reports for each packet received */
} esp_ble_scan_params_t;
/// connection parameters information
typedef struct {
uint16_t interval; /*!< connection interval */
uint16_t latency; /*!< Slave latency for the connection in number of connection events. Range: 0x0000 to 0x01F3 */
uint16_t timeout; /*!< Supervision timeout for the LE Link. Range: 0x000A to 0x0C80.
Mandatory Range: 0x000A to 0x0C80 Time = N * 10 msec
Time Range: 100 msec to 32 seconds */
} esp_gap_conn_params_t;
/// Connection update parameters
typedef struct {
esp_bd_addr_t bda; /*!< Bluetooth device address */
@@ -895,7 +906,7 @@ esp_err_t esp_ble_gap_update_conn_params(esp_ble_conn_update_params_t *params);
esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_data_length);
/**
* @brief This function sets the random address for the application
* @brief This function sets the static Random Address and Non-Resolvable Private Address for the application
*
* @param[in] rand_addr: the random address which should be setting
*
@@ -1243,6 +1254,32 @@ esp_err_t esp_ble_oob_req_reply(esp_bd_addr_t bd_addr, uint8_t *TK, uint8_t len)
*/
esp_err_t esp_ble_gap_disconnect(esp_bd_addr_t remote_device);
/**
* @brief This function is called to authorized a link after Authentication(MITM protection)
*
* @param[in] bd_addr: BD address of the peer device.
* @param[out] authorize: Authorized the link or not.
*
* @return - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_gap_ble_set_authorization(esp_bd_addr_t bd_addr, bool authorize);
/**
* @brief This function is called to read the connection
* parameters information of the device
*
* @param[in] bd_addr: BD address of the peer device.
* @param[out] conn_params: the connection parameters information
*
* @return - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_get_current_conn_params(esp_bd_addr_t bd_addr, esp_gap_conn_params_t *conn_params);
#ifdef __cplusplus
}
#endif
@@ -174,6 +174,7 @@ typedef enum {
ESP_BT_GAP_KEY_NOTIF_EVT, /*!< Simple Pairing Passkey Notification */
ESP_BT_GAP_KEY_REQ_EVT, /*!< Simple Pairing Passkey request */
ESP_BT_GAP_READ_RSSI_DELTA_EVT, /*!< read rssi event */
ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT, /*!< remove bond device complete event */
ESP_BT_GAP_EVT_MAX,
} esp_bt_gap_cb_event_t;
@@ -271,6 +272,14 @@ typedef union {
struct key_req_param {
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
} key_req; /*!< passkey request parameter struct */
/**
* @brief ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT
*/
struct bt_remove_bond_dev_cmpl_evt_param {
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
esp_bt_status_t status; /*!< Indicate the remove bond device operation success status */
}remove_bond_dev_cmpl; /*!< Event parameter of ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT */
} esp_bt_gap_cb_param_t;
/**
@@ -46,6 +46,7 @@ extern esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu);
#if (BLE_INCLUDED == TRUE)
extern uint16_t esp_ble_get_sendable_packets_num (void);
extern uint16_t esp_ble_get_cur_sendable_packets_num (uint16_t connid);
#endif
#ifdef __cplusplus
@@ -278,6 +278,8 @@ typedef enum {
#define ESP_GATT_PERM_WRITE_ENC_MITM (1 << 6) /* bit 6 - 0x0040 */ /* relate to BTA_GATT_PERM_WRITE_ENC_MITM in bta/bta_gatt_api.h */
#define ESP_GATT_PERM_WRITE_SIGNED (1 << 7) /* bit 7 - 0x0080 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED in bta/bta_gatt_api.h */
#define ESP_GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 - 0x0100 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED_MITM in bta/bta_gatt_api.h */
#define ESP_GATT_PERM_READ_AUTHORIZATION (1 << 9) /* bit 9 - 0x0200 */
#define ESP_GATT_PERM_WRITE_AUTHORIZATION (1 << 10) /* bit 10 - 0x0400 */
typedef uint16_t esp_gatt_perm_t;
/* relate to BTA_GATT_CHAR_PROP_BIT_xxx in bta/bta_gatt_api.h */
@@ -393,6 +395,17 @@ typedef enum {
ESP_GATT_WRITE_TYPE_RSP, /*!< Gatt write attribute need remote response */
} esp_gatt_write_type_t;
/**
* @brief Connection parameters information
*/
typedef struct {
uint16_t interval; /*!< connection interval */
uint16_t latency; /*!< Slave latency for the connection in number of connection events. Range: 0x0000 to 0x01F3 */
uint16_t timeout; /*!< Supervision timeout for the LE Link. Range: 0x000A to 0x0C80.
Mandatory Range: 0x000A to 0x0C80 Time = N * 10 msec
Time Range: 100 msec to 32 seconds */
} esp_gatt_conn_params_t;
#define ESP_GATT_IF_NONE 0xff /*!< If callback report gattc_if/gatts_if as this macro, means this event is not correspond to any app */
typedef uint8_t esp_gatt_if_t; /*!< Gatt interface type, different application on GATT client use different gatt_if */
@@ -209,6 +209,7 @@ typedef union {
struct gattc_connect_evt_param {
uint16_t conn_id; /*!< Connection id */
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
esp_gatt_conn_params_t conn_params; /*!< current connection parameters */
} connect; /*!< Gatt client callback param of ESP_GATTC_CONNECT_EVT */
/**
@@ -248,7 +249,7 @@ typedef union {
/**
* @brief GATT Client callback function type
* @param event : Event type
* @param gatts_if : GATT client access interface, normally
* @param gattc_if : GATT client access interface, normally
* different gattc_if correspond to different profile
* @param param : Point to callback parameter, currently is union type
*/
@@ -603,6 +604,29 @@ esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if,
uint16_t conn_id,
uint16_t handle,
esp_gatt_auth_req_t auth_req);
/**
* @brief This function is called to read a service's characteristics of
* the given characteristic UUID
*
* @param[in] gattc_if: Gatt client access interface.
* @param[in] conn_id : connection ID.
* @param[in] start_handle : the attribute start handle.
* @param[in] end_handle : the attribute end handle
* @param[in] uuid : The UUID of attribute which will be read.
* @param[in] auth_req : authenticate request type
*
* @return
* - ESP_OK: success
* - other: failed
*
*/
esp_err_t esp_ble_gattc_read_by_type (esp_gatt_if_t gattc_if,
uint16_t conn_id,
uint16_t start_handle,
uint16_t end_handle,
esp_bt_uuid_t *uuid,
esp_gatt_auth_req_t auth_req);
/**
* @brief This function is called to read multiple characteristic or
@@ -197,6 +197,7 @@ typedef union {
struct gatts_connect_evt_param {
uint16_t conn_id; /*!< Connection id */
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
esp_gatt_conn_params_t conn_params; /*!< current Connection parameters */
} connect; /*!< Gatt server callback param of ESP_GATTS_CONNECT_EVT */
/**
@@ -271,7 +271,7 @@ typedef void (* esp_hf_client_incoming_data_cb_t)(const uint8_t *buf, uint32_t l
* buffer is allocated inside bluetooth protocol stack and will be released after
* invoke of the callback is finished.
* @param[in] len : size(in bytes) in buf
* @param[out] length of data successfully read
* @return length of data successfully read
*/
typedef uint32_t (* esp_hf_client_outgoing_data_cb_t)(uint8_t *buf, uint32_t len);
@@ -26,8 +26,12 @@ typedef enum {
ESP_SPP_SUCCESS = 0, /*!< Successful operation. */
ESP_SPP_FAILURE, /*!< Generic failure. */
ESP_SPP_BUSY, /*!< Temporarily can not handle this request. */
ESP_SPP_NO_DATA, /*!< no data. */
ESP_SPP_NO_RESOURCE /*!< No more set pm control block */
ESP_SPP_NO_DATA, /*!< No data. */
ESP_SPP_NO_RESOURCE, /*!< No more resource */
ESP_SPP_NEED_INIT, /*!< SPP module shall init first */
ESP_SPP_NEED_DEINIT, /*!< SPP module shall deinit first */
ESP_SPP_NO_CONNECTION, /*!< Connection may have been closed */
ESP_SPP_NO_SERVER, /*!< No SPP server */
} esp_spp_status_t;
/* Security Setting Mask, Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only.*/
@@ -57,6 +61,7 @@ typedef enum {
*/
typedef enum {
ESP_SPP_INIT_EVT = 0, /*!< When SPP is inited, the event comes */
ESP_SPP_UNINIT_EVT = 1, /*!< When SPP is uninited, the event comes */
ESP_SPP_DISCOVERY_COMP_EVT = 8, /*!< When SDP discovery complete, the event comes */
ESP_SPP_OPEN_EVT = 26, /*!< When SPP Client connection open, the event comes */
ESP_SPP_CLOSE_EVT = 27, /*!< When SPP connection closed, the event comes */
@@ -66,6 +71,7 @@ typedef enum {
ESP_SPP_CONG_EVT = 31, /*!< When SPP connection congestion status changed, the event comes, only for ESP_SPP_MODE_CB */
ESP_SPP_WRITE_EVT = 33, /*!< When SPP write operation completes, the event comes, only for ESP_SPP_MODE_CB */
ESP_SPP_SRV_OPEN_EVT = 34, /*!< When SPP Server connection open, the event comes */
ESP_SPP_SRV_STOP_EVT = 35, /*!< When SPP server stopped, the event comes */
} esp_spp_cb_event_t;
@@ -80,13 +86,22 @@ typedef union {
esp_spp_status_t status; /*!< status */
} init; /*!< SPP callback param of SPP_INIT_EVT */
/**
* @brief SPP_UNINIT_EVT
*/
struct spp_uninit_evt_param {
esp_spp_status_t status; /*!< status */
} uninit; /*!< SPP callback param of SPP_UNINIT_EVT */
/**
* @brief SPP_DISCOVERY_COMP_EVT
*/
struct spp_discovery_comp_evt_param {
esp_spp_status_t status; /*!< status */
uint8_t scn_num; /*!< The num of scn_num */
uint8_t scn[ESP_SPP_MAX_SCN]; /*!< channel # */
esp_spp_status_t status; /*!< status */
uint8_t scn_num; /*!< The num of scn_num */
uint8_t scn[ESP_SPP_MAX_SCN]; /*!< channel # */
const char *service_name[ESP_SPP_MAX_SCN]; /*!< service_name */
} disc_comp; /*!< SPP callback param of SPP_DISCOVERY_COMP_EVT */
/**
@@ -126,8 +141,18 @@ typedef union {
esp_spp_status_t status; /*!< status */
uint32_t handle; /*!< The connection handle */
uint8_t sec_id; /*!< security ID used by this server */
uint8_t scn; /*!< Server channel number */
bool use_co; /*!< TRUE to use co_rfc_data */
} start; /*!< SPP callback param of ESP_SPP_START_EVT */
/**
* @brief ESP_SPP_SRV_STOP_EVT
*/
struct spp_srv_stop_evt_param {
esp_spp_status_t status; /*!< status */
uint8_t scn; /*!< Server channel number */
} srv_stop; /*!< SPP callback param of ESP_SPP_SRV_STOP_EVT */
/**
* @brief ESP_SPP_CL_INIT_EVT
*/
@@ -273,6 +298,34 @@ esp_err_t esp_spp_disconnect(uint32_t handle);
esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
esp_spp_role_t role, uint8_t local_scn, const char *name);
/**
* @brief This function stops all SPP servers.
* The operation will close all active SPP connection first, then the callback function will be called
* with ESP_SPP_CLOSE_EVT, and the number of ESP_SPP_CLOSE_EVT is equal to the number of connection.
* When the operation is completed, the callback is called with ESP_SPP_SRV_STOP_EVT.
* This funciton must be called after esp_spp_init() successful and before esp_spp_deinit().
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_spp_stop_srv(void);
/**
* @brief This function stops a specific SPP server.
* The operation will close all active SPP connection first on the specific SPP server, then the callback function will be called
* with ESP_SPP_CLOSE_EVT, and the number of ESP_SPP_CLOSE_EVT is equal to the number of connection.
* When the operation is completed, the callback is called with ESP_SPP_SRV_STOP_EVT.
* This funciton must be called after esp_spp_init() successful and before esp_spp_deinit().
*
* @param[in] scn: Server channel number.
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_spp_stop_srv_scn(uint8_t scn);
/**
* @brief This function is used to write data, only for ESP_SPP_MODE_CB.
+2 -5
View File
@@ -208,11 +208,8 @@ static void bta_av_rc_ctrl_cback(UINT8 handle, UINT8 event, UINT16 result, BD_AD
UINT16 msg_event = 0;
UNUSED(result);
#if (defined(BTA_AV_MIN_DEBUG_TRACES) && BTA_AV_MIN_DEBUG_TRACES == TRUE)
APPL_TRACE_EVENT("rc_ctrl handle: %d event=0x%x", handle, event);
#else
APPL_TRACE_EVENT("bta_av_rc_ctrl_cback handle: %d event=0x%x", handle, event);
#endif
APPL_TRACE_EVENT("%s handle: %d event: 0x%x",__func__, handle, event);
if (event == AVRC_OPEN_IND_EVT) {
/* save handle of opened connection
bta_av_cb.rc_handle = handle;*/
@@ -563,13 +563,8 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
if (bta_av_cb.features & (BTA_AV_FEAT_RCTG)) {
/* register with no authorization; let AVDTP use authorization instead */
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
#if (BTA_AV_WITH_AVCTP_AUTHORIZATION == TRUE)
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
bta_av_cb.sec_mask, BTA_ID_AV);
#else
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
(UINT8)(bta_av_cb.sec_mask & (~BTA_SEC_AUTHORIZE)), BTA_ID_AV);
#endif
if (p_data->api_reg.tsep == AVDT_TSEP_SRC) {
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REM_CTRL_TARGET, "AV Remote Control Target\n", NULL,
p_bta_av_cfg->avrc_src_tg_cat, BTA_ID_AV);
@@ -699,13 +694,8 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
/* if TG is not supported, we need to register to AVCT now */
if ((bta_av_cb.features & (BTA_AV_FEAT_RCTG)) == 0) {
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
#if (BTA_AV_WITH_AVCTP_AUTHORIZATION == TRUE)
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
bta_av_cb.sec_mask, BTA_ID_AV);
#else
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
(UINT8)(bta_av_cb.sec_mask & (~BTA_SEC_AUTHORIZE)), BTA_ID_AV);
#endif
#endif
}
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
+12 -7
View File
@@ -610,7 +610,7 @@ void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data)
}
}
void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data)
void bta_dm_read_rssi(tBTA_DM_MSG *p_data)
{
if (p_data->rssi.read_rssi_cb != NULL) {
BTM_ReadRSSI(p_data->rssi.remote_addr, p_data->rssi.transport, p_data->rssi.read_rssi_cb);
@@ -756,11 +756,13 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
/* Take the link down first, and mark the device for removal when disconnected */
for (int i = 0; i < bta_dm_cb.device_list.count; i++) {
if (!bdcmp(bta_dm_cb.device_list.peer_device[i].peer_bdaddr, p_dev->bd_addr)
&& bta_dm_cb.device_list.peer_device[i].transport == transport) {
#if BLE_INCLUDED == TRUE
&& bta_dm_cb.device_list.peer_device[i].transport == transport
#endif
) {
bta_dm_cb.device_list.peer_device[i].conn_state = BTA_DM_UNPAIRING;
btm_remove_acl( p_dev->bd_addr, bta_dm_cb.device_list.peer_device[i].transport);
APPL_TRACE_DEBUG("%s:transport = %d", __func__,
bta_dm_cb.device_list.peer_device[i].transport);
btm_remove_acl( p_dev->bd_addr, transport);
APPL_TRACE_DEBUG("%s:transport = %d", __func__, transport);
break;
}
}
@@ -3622,9 +3624,12 @@ static void bta_dm_adjust_roles(BOOLEAN delay_role_switch)
BTM_SwitchRole (bta_dm_cb.device_list.peer_device[i].peer_bdaddr,
HCI_ROLE_MASTER, NULL);
} else {
bta_dm_cb.switch_delay_timer.p_cback =
bta_dm_cb.switch_delay_timer[i].p_cback =
(TIMER_CBACK *)&bta_dm_delay_role_switch_cback;
bta_sys_start_timer(&bta_dm_cb.switch_delay_timer, 0, 500);
/* Start the timer if not active */
if (!bta_sys_timer_is_active(&bta_dm_cb.switch_delay_timer[i])) {
bta_sys_start_timer(&bta_dm_cb.switch_delay_timer[i], 0, 500);
}
}
}
+2 -2
View File
@@ -206,11 +206,11 @@ void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb)
}
}
void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb)
void BTA_DmReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb)
{
tBTA_DM_API_READ_RSSI *p_msg;
if ((p_msg = (tBTA_DM_API_READ_RSSI *)osi_malloc(sizeof(tBTA_DM_API_READ_RSSI))) != NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_READ_RSSI_EVT;
p_msg->hdr.event = BTA_DM_API_READ_RSSI_EVT;
memcpy(p_msg->remote_addr, remote_addr, sizeof(BD_ADDR));
p_msg->transport = transport;
p_msg->read_rssi_cb = cmpl_cb;
+14 -2
View File
@@ -51,6 +51,7 @@ tBTE_APPL_CFG bte_appl_cfg = {
BTM_BLE_MIN_KEY_SIZE,
BTM_BLE_ONLY_ACCEPT_SPECIFIED_SEC_AUTH_DISABLE,
BTM_BLE_OOB_DISABLE,
BTM_BLE_APPL_ENC_KEY_SIZE,
};
#endif
@@ -232,8 +233,8 @@ void bta_dm_co_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r)
*******************************************************************************/
void bta_dm_co_rmt_oob(BD_ADDR bd_addr)
{
BT_OCTET16 p_c;
BT_OCTET16 p_r;
BT_OCTET16 p_c = {0};
BT_OCTET16 p_r = {0};
BOOLEAN result = FALSE;
#ifdef BTIF_DM_OOB_TEST
@@ -427,6 +428,17 @@ void bta_dm_co_ble_set_min_key_size(UINT8 ble_key_size)
#endif ///SMP_INCLUDED == TRUE
}
void bta_dm_co_ble_set_appl_enc_key_size(UINT8 ble_key_size)
{
#if (SMP_INCLUDED == TRUE)
if(ble_key_size >= bte_appl_cfg.ble_min_key_size && ble_key_size <= bte_appl_cfg.ble_max_key_size) {
bte_appl_cfg.ble_appl_enc_key_size = ble_key_size;
} else {
APPL_TRACE_ERROR("%s error:Invalid key size value, key_size =%d",__func__, ble_key_size);
}
#endif ///SMP_INCLUDED == TRUE
}
void bta_dm_co_ble_set_accept_auth_enable(UINT8 enable)
{
#if (SMP_INCLUDED == TRUE)
+1 -1
View File
@@ -159,7 +159,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
bta_dm_remove_device, /* BTA_DM_API_REMOVE_DEVICE_EVT */
bta_dm_update_white_list, /* BTA_DM_API_UPDATE_WHITE_LIST_EVT */
bta_dm_ble_read_adv_tx_power, /* BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT */
bta_dm_ble_read_rssi, /* BTA_DM_API_BLE_READ_RSSI_EVT */
bta_dm_read_rssi, /* BTA_DM_API_READ_RSSI_EVT */
bta_dm_ble_update_duplicate_exceptional_list,/* BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT */
};
@@ -155,7 +155,7 @@ enum {
BTA_DM_API_REMOVE_DEVICE_EVT,
BTA_DM_API_UPDATE_WHITE_LIST_EVT,
BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT,
BTA_DM_API_BLE_READ_RSSI_EVT,
BTA_DM_API_READ_RSSI_EVT,
BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT,
BTA_DM_MAX_EVT
};
@@ -1040,7 +1040,7 @@ typedef struct {
tBTA_DM_ENCRYPT_CBACK *p_encrypt_cback;
TIMER_LIST_ENT switch_delay_timer;
TIMER_LIST_ENT switch_delay_timer[BTA_DM_NUM_PEER_DEVICE];
} tBTA_DM_CB;
@@ -1226,7 +1226,7 @@ extern void bta_dm_disable (tBTA_DM_MSG *p_data);
extern void bta_dm_set_dev_name (tBTA_DM_MSG *p_data);
extern void bta_dm_update_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_ble_read_rssi(tBTA_DM_MSG *p_data);
extern void bta_dm_read_rssi(tBTA_DM_MSG *p_data);
extern void bta_dm_set_visibility (tBTA_DM_MSG *p_data);
extern void bta_dm_set_scan_config(tBTA_DM_MSG *p_data);
@@ -488,9 +488,14 @@ void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
{
tBTA_GATTC_DATA gattc_data;
BOOLEAN found_app = FALSE;
tGATT_TCB *p_tcb;
tGATT_TCB *p_tcb = gatt_find_tcb_by_addr(p_data->api_conn.remote_bda, BT_TRANSPORT_LE);
if(p_tcb && p_clcb && p_data) {
if (!p_clcb || !p_data) {
return;
}
p_tcb = gatt_find_tcb_by_addr(p_data->api_conn.remote_bda, BT_TRANSPORT_LE);
if(p_tcb) {
found_app = gatt_find_specific_app_in_hold_link(p_tcb, p_clcb->p_rcb->client_if);
}
/* open/hold a connection */
@@ -729,7 +734,7 @@ void bta_gattc_conncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data)
if (p_rcb) {
bta_gattc_send_connect_cback(p_rcb,
p_data->int_conn.remote_bda,
p_data->int_conn.hdr.layer_specific);
p_data->int_conn.hdr.layer_specific, p_data->int_conn.conn_params);
}
}
@@ -1099,6 +1104,41 @@ void bta_gattc_read(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
}
/*******************************************************************************
**
** Function bta_gattc_read_by_type
**
** Description Read an attribute
**
** Returns None.
**
*******************************************************************************/
void bta_gattc_read_by_type(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
{
if (!bta_gattc_enqueue(p_clcb, p_data)) {
return;
}
tGATT_READ_PARAM read_param;
memset (&read_param, 0 ,sizeof(tGATT_READ_PARAM));
read_param.service.auth_req = p_data->api_read.auth_req;
read_param.service.s_handle = p_data->api_read.s_handle;
read_param.service.e_handle = p_data->api_read.e_handle;
memcpy(&(read_param.service.uuid), &(p_data->api_read.uuid), sizeof(tBT_UUID));
tBTA_GATT_STATUS status = GATTC_Read(p_clcb->bta_conn_id, GATT_READ_BY_TYPE, &read_param);
/* read fail */
if (status != BTA_GATT_OK) {
/* Dequeue the data, if it was enqueued */
if (p_clcb->p_q_cmd == p_data) {
p_clcb->p_q_cmd = NULL;
bta_gattc_pop_command_to_send(p_clcb);
}
bta_gattc_cmpl_sendmsg(p_clcb->bta_conn_id, GATTC_OPTYPE_READ, status, NULL);
}
}
/*******************************************************************************
**
** Function bta_gattc_read_multi
**
** Description read multiple
@@ -1117,7 +1157,7 @@ void bta_gattc_read_multi(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
read_param.read_multiple.num_handles = p_data->api_read_multi.num_attr;
read_param.read_multiple.auth_req = p_data->api_read_multi.auth_req;
memcpy(&read_param.read_multiple.handles, p_data->api_read_multi.handles,
sizeof(UINT16) * p_data->api_read_multi.num_attr);
sizeof(UINT16) * p_data->api_read_multi.num_attr);
status = GATTC_Read(p_clcb->bta_conn_id, GATT_READ_MULTIPLE, &read_param);
}
@@ -1392,7 +1432,7 @@ void bta_gattc_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
return;
}
if (p_clcb->p_q_cmd->hdr.event != bta_gattc_opcode_to_int_evt[op - GATTC_OPTYPE_READ]) {
if (p_clcb->p_q_cmd->hdr.event != BTA_GATTC_API_READ_MULTI_EVT) {
if ((p_clcb->p_q_cmd->hdr.event != BTA_GATTC_API_READ_MULTI_EVT)&&(p_clcb->p_q_cmd->hdr.event != BTA_GATTC_API_READ_BY_TYPE_EVT)) {
mapped_op = p_clcb->p_q_cmd->hdr.event - BTA_GATTC_API_READ_EVT + GATTC_OPTYPE_READ;
if ( mapped_op > GATTC_OPTYPE_INDICATION) {
mapped_op = 0;
@@ -1651,6 +1691,16 @@ static void bta_gattc_conn_cback(tGATT_IF gattc_if, BD_ADDR bda, UINT16 conn_id,
p_buf->int_conn.hdr.event = connected ? BTA_GATTC_INT_CONN_EVT :
BTA_GATTC_INT_DISCONN_EVT;
if(p_buf->int_conn.hdr.event == BTA_GATTC_INT_CONN_EVT) {
tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(bda, BT_TRANSPORT_LE);
if(p_lcb != NULL) {
p_buf->int_conn.conn_params.interval = p_lcb->current_used_conn_interval;
p_buf->int_conn.conn_params.latency = p_lcb->current_used_conn_latency;
p_buf->int_conn.conn_params.timeout = p_lcb->current_used_conn_timeout;
} else {
APPL_TRACE_WARNING("%s not found connection parameters of the device ", __func__);
}
}
p_buf->int_conn.hdr.layer_specific = conn_id;
p_buf->int_conn.client_if = gattc_if;
p_buf->int_conn.role = L2CA_GetBleConnRole(bda);
@@ -31,7 +31,7 @@
#include "bta/bta_sys.h"
#include "bta/bta_gatt_api.h"
#include "bta_gattc_int.h"
#include "stack/l2c_api.h"
/*****************************************************************************
** Constants
*****************************************************************************/
@@ -298,7 +298,7 @@ void BTA_GATTC_ServiceSearchRequest (UINT16 conn_id, tBT_UUID *p_srvc_uuid)
** Returns returns list_t of tBTA_GATTC_SERVICE or NULL.
**
*******************************************************************************/
const list_t* BTA_GATTC_GetServices(UINT16 conn_id)
const list_t* BTA_GATTC_GetServices(UINT16 conn_id)
{
return bta_gattc_get_services(conn_id);
}
@@ -315,7 +315,7 @@ const list_t* BTA_GATTC_GetServices(UINT16 conn_id)
** Returns returns pointer to tBTA_GATTC_CHARACTERISTIC or NULL.
**
*******************************************************************************/
const tBTA_GATTC_CHARACTERISTIC* BTA_GATTC_GetCharacteristic(UINT16 conn_id, UINT16 handle)
const tBTA_GATTC_CHARACTERISTIC* BTA_GATTC_GetCharacteristic(UINT16 conn_id, UINT16 handle)
{
return bta_gattc_get_characteristic(conn_id, handle);
}
@@ -562,6 +562,39 @@ void BTA_GATTC_ReadMultiple(UINT16 conn_id, tBTA_GATTC_MULTI *p_read_multi,
return;
}
/*******************************************************************************
**
** Function BTA_GATTC_Read_by_type
**
** Description This function is called to read a attribute value by uuid
**
** Parameters conn_id - connection ID.
** s_handle - start handle.
** e_handle - end hanle
** uuid - The attribute UUID.
**
** Returns None
**
*******************************************************************************/
void BTA_GATTC_Read_by_type(UINT16 conn_id, UINT16 s_handle,UINT16 e_handle, tBT_UUID *uuid, tBTA_GATT_AUTH_REQ auth_req)
{
tBTA_GATTC_API_READ *p_buf;
if ((p_buf = (tBTA_GATTC_API_READ *) osi_malloc(sizeof(tBTA_GATTC_API_READ))) != NULL) {
memset(p_buf, 0, sizeof(tBTA_GATTC_API_READ));
p_buf->hdr.event = BTA_GATTC_API_READ_BY_TYPE_EVT;
p_buf->hdr.layer_specific = conn_id;
p_buf->auth_req = auth_req;
p_buf->s_handle = s_handle;
p_buf->e_handle = e_handle;
memcpy(&(p_buf->uuid), uuid, sizeof(tBT_UUID));
p_buf->cmpl_evt = BTA_GATTC_READ_CHAR_EVT;
bta_sys_sendmsg(p_buf);
}
return;
}
/*******************************************************************************
**
@@ -603,6 +636,10 @@ void BTA_GATTC_WriteCharValue ( UINT16 conn_id,
memcpy(p_buf->p_value, p_value, len);
}
if(write_type == BTA_GATTC_TYPE_WRITE_NO_RSP){
l2ble_update_att_acl_pkt_num(L2CA_DECREASE_BTC_NUM, NULL);
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTU_NUM, NULL);
}
bta_sys_sendmsg(p_buf);
}
return;
@@ -650,6 +687,10 @@ void BTA_GATTC_WriteCharDescr (UINT16 conn_id,
memcpy(p_buf->p_value, p_data->p_value, p_data->len);
}
if(write_type == BTA_GATTC_TYPE_WRITE_NO_RSP){
l2ble_update_att_acl_pkt_num(L2CA_DECREASE_BTC_NUM, NULL);
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTU_NUM, NULL);
}
bta_sys_sendmsg(p_buf);
}
return;
@@ -718,7 +759,7 @@ void BTA_GATTC_PrepareWriteCharDescr (UINT16 conn_id, UINT16 handle,
tBTA_GATT_AUTH_REQ auth_req)
{
tBTA_GATTC_API_WRITE *p_buf;
UINT16 len = sizeof(tBTA_GATTC_API_WRITE) + p_data->len;
UINT16 len = sizeof(tBTA_GATTC_API_WRITE);
if (p_data != NULL) {
len += p_data->len;
@@ -957,7 +998,7 @@ void BTA_GATTC_CacheAssoc(tBTA_GATTC_IF client_if, BD_ADDR src_addr, BD_ADDR ass
memcpy(p_buf->assoc_addr, assoc_addr, sizeof(BD_ADDR));
bta_sys_sendmsg(p_buf);
}
return;
}
@@ -154,6 +154,10 @@ static void cacheReset(BD_ADDR bda)
cache_env.cache_addr[index].is_open = FALSE;
} else {
cacheOpen(bda, false, &index);
if (index == INVALID_ADDR_NUM) {
APPL_TRACE_ERROR("%s INVALID ADDR NUM", __func__);
return;
}
if (cache_env.cache_addr[index].is_open) {
nvs_erase_all(cache_env.cache_addr[index].cache_fp);
nvs_close(cache_env.cache_addr[index].cache_fp);
@@ -65,6 +65,7 @@ enum {
BTA_GATTC_DISC_CLOSE,
BTA_GATTC_RESTART_DISCOVER,
BTA_GATTC_CFG_MTU,
BTA_GATTC_READ_BY_TYPE,
BTA_GATTC_IGNORE
};
@@ -98,7 +99,8 @@ const tBTA_GATTC_ACTION bta_gattc_action[] = {
bta_gattc_ignore_op_cmpl,
bta_gattc_disc_close,
bta_gattc_restart_discover,
bta_gattc_cfg_mtu
bta_gattc_cfg_mtu,
bta_gattc_read_by_type
};
@@ -133,6 +135,7 @@ static const UINT8 bta_gattc_st_idle[][BTA_GATTC_NUM_COLS] = {
/* BTA_GATTC_OP_CMPL_EVT */ {BTA_GATTC_IGNORE, BTA_GATTC_IDLE_ST},
/* BTA_GATTC_INT_DISCONN_EVT */ {BTA_GATTC_IGNORE, BTA_GATTC_IDLE_ST},
/* BTA_GATTC_API_READ_BY_TYPE_EVT */ {BTA_GATTC_FAIL, BTA_GATTC_IDLE_ST},
};
/* state table for wait for open state */
@@ -161,6 +164,7 @@ static const UINT8 bta_gattc_st_w4_conn[][BTA_GATTC_NUM_COLS] = {
/* BTA_GATTC_OP_CMPL_EVT */ {BTA_GATTC_IGNORE, BTA_GATTC_W4_CONN_ST},
/* BTA_GATTC_INT_DISCONN_EVT */ {BTA_GATTC_OPEN_FAIL, BTA_GATTC_IDLE_ST},
/* BTA_GATTC_API_READ_BY_TYPE_EVT */ {BTA_GATTC_FAIL, BTA_GATTC_W4_CONN_ST},
};
/* state table for open state */
@@ -190,6 +194,7 @@ static const UINT8 bta_gattc_st_connected[][BTA_GATTC_NUM_COLS] = {
/* BTA_GATTC_INT_DISCONN_EVT */ {BTA_GATTC_CLOSE, BTA_GATTC_IDLE_ST},
/* BTA_GATTC_API_READ_BY_TYPE_EVT */ {BTA_GATTC_READ_BY_TYPE, BTA_GATTC_CONN_ST},
};
/* state table for discover state */
@@ -218,6 +223,7 @@ static const UINT8 bta_gattc_st_discover[][BTA_GATTC_NUM_COLS] = {
/* BTA_GATTC_OP_CMPL_EVT */ {BTA_GATTC_IGNORE_OP_CMPL, BTA_GATTC_DISCOVER_ST},
/* BTA_GATTC_INT_DISCONN_EVT */ {BTA_GATTC_CLOSE, BTA_GATTC_IDLE_ST},
/* BTA_GATTC_API_READ_BY_TYPE_EVT */ {BTA_GATTC_Q_CMD, BTA_GATTC_DISCOVER_ST},
};
/* type for state table */
@@ -470,6 +476,8 @@ static char *gattc_evt_code(tBTA_GATTC_INT_EVT evt_code)
return "BTA_GATTC_API_DISABLE_EVT";
case BTA_GATTC_API_CFG_MTU_EVT:
return "BTA_GATTC_API_CFG_MTU_EVT";
case BTA_GATTC_API_READ_BY_TYPE_EVT:
return "BTA_GATTC_API_READ_BY_TYPE_EVT";
default:
return "unknown GATTC event code";
}
@@ -306,8 +306,11 @@ void bta_gattc_clcb_dealloc(tBTA_GATTC_CLCB *p_clcb)
p_srcb->p_srvc_cache = NULL;
}
}
osi_free(p_clcb->p_q_cmd);
p_clcb->p_q_cmd = NULL;
if ( p_clcb->p_q_cmd != NULL && !list_contains(p_clcb->p_cmd_list, p_clcb->p_q_cmd)){
osi_free(p_clcb->p_q_cmd);
p_clcb->p_q_cmd = NULL;
}
// don't forget to clear the command queue before dealloc the clcb.
list_clear(p_clcb->p_cmd_list);
osi_free((void *)p_clcb->p_cmd_list);
@@ -762,7 +765,7 @@ void bta_gattc_send_open_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status
** Returns
**
*******************************************************************************/
void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id)
void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id, tBTA_GATT_CONN_PARAMS conn_params)
{
tBTA_GATTC cb_data;
@@ -771,6 +774,9 @@ void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda,
cb_data.connect.client_if = p_clreg->client_if;
cb_data.connect.conn_id = conn_id;
cb_data.connect.conn_params.interval = conn_params.interval;
cb_data.connect.conn_params.latency = conn_params.latency;
cb_data.connect.conn_params.timeout = conn_params.timeout;
bdcpy(cb_data.connect.remote_bda, remote_bda);
(*p_clreg->p_cback)(BTA_GATTC_CONNECT_EVT, &cb_data);
@@ -35,6 +35,8 @@
#include "stack/btm_ble_api.h"
#include <string.h>
#include "osi/allocator.h"
#include "stack/l2c_api.h"
#include "l2c_int.h"
static void bta_gatts_nv_save_cback(BOOLEAN is_saved, tGATTS_HNDL_RANGE *p_hndl_range);
static BOOLEAN bta_gatts_nv_srv_chg_cback(tGATTS_SRV_CHG_CMD cmd, tGATTS_SRV_CHG_REQ *p_req,
@@ -672,6 +674,7 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
p_msg->api_indicate.len,
p_msg->api_indicate.value);
} else {
l2ble_update_att_acl_pkt_num(L2CA_DECREASE_BTU_NUM, NULL);
status = GATTS_HandleValueNotification (p_msg->api_indicate.hdr.layer_specific,
p_msg->api_indicate.attr_id,
p_msg->api_indicate.len,
@@ -965,7 +968,7 @@ static void bta_gatts_conn_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
BOOLEAN connected, tGATT_DISCONN_REASON reason,
tGATT_TRANSPORT transport)
{
tBTA_GATTS cb_data;
tBTA_GATTS cb_data = {0};
UINT8 evt = connected ? BTA_GATTS_CONNECT_EVT : BTA_GATTS_DISCONNECT_EVT;
tBTA_GATTS_RCB *p_reg;
@@ -993,7 +996,16 @@ static void bta_gatts_conn_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
bta_sys_conn_close( BTA_ID_GATTS , BTA_ALL_APP_ID, bda);
}
}
if(evt == BTA_GATTS_CONNECT_EVT) {
tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(bda, BT_TRANSPORT_LE);
if(p_lcb != NULL) {
cb_data.conn.conn_params.interval = p_lcb->current_used_conn_interval;
cb_data.conn.conn_params.latency = p_lcb->current_used_conn_latency;
cb_data.conn.conn_params.timeout = p_lcb->current_used_conn_timeout;
}else {
APPL_TRACE_WARNING("%s not found connection parameters of the device ", __func__);
}
}
cb_data.conn.conn_id = conn_id;
cb_data.conn.server_if = gatt_if;
cb_data.conn.reason = reason;
@@ -31,7 +31,7 @@
#include "bta/bta_gatt_api.h"
#include "bta_gatts_int.h"
#include "osi/allocator.h"
#include "stack/l2c_api.h"
/*****************************************************************************
** Constants
*****************************************************************************/
@@ -426,6 +426,11 @@ void BTA_GATTS_HandleValueIndication (UINT16 conn_id, UINT16 attr_id, UINT16 dat
memcpy(p_buf->value, p_data, data_len);
}
if(need_confirm == false){
l2ble_update_att_acl_pkt_num(L2CA_DECREASE_BTC_NUM, NULL);
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTU_NUM, NULL);
}
bta_sys_sendmsg(p_buf);
}
return;
@@ -59,6 +59,8 @@ enum {
BTA_GATTC_OP_CMPL_EVT,
BTA_GATTC_INT_DISCONN_EVT,
BTA_GATTC_API_READ_BY_TYPE_EVT,
BTA_GATTC_INT_START_IF_EVT,
BTA_GATTC_API_REG_EVT,
BTA_GATTC_API_DEREG_EVT,
@@ -136,6 +138,9 @@ typedef struct {
BT_HDR hdr;
tBTA_GATT_AUTH_REQ auth_req;
UINT16 handle;
UINT16 s_handle;
UINT16 e_handle;
tBT_UUID uuid;
tBTA_GATTC_EVT cmpl_evt;
} tBTA_GATTC_API_READ;
@@ -215,6 +220,7 @@ typedef struct {
tBT_TRANSPORT transport;
tGATT_DISCONN_REASON reason;
BOOLEAN already_connect;
tBTA_GATT_CONN_PARAMS conn_params;
} tBTA_GATTC_INT_CONN;
typedef struct {
@@ -449,6 +455,7 @@ extern void bta_gattc_disc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_dat
extern void bta_gattc_start_discover(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_read(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_read_by_type(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_write(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_q_cmd(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
@@ -466,7 +473,7 @@ extern void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *
extern void bta_gattc_cancel_bk_conn(tBTA_GATTC_API_CANCEL_OPEN *p_data);
extern void bta_gattc_send_open_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status,
BD_ADDR remote_bda, UINT16 conn_id, tBTA_TRANSPORT transport, UINT16 mtu);
extern void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id);
extern void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id, tBTA_GATT_CONN_PARAMS conn_params);
extern void bta_gattc_send_disconnect_cback( tBTA_GATTC_RCB *p_clreg, tGATT_DISCONN_REASON reason,
BD_ADDR remote_bda, UINT16 conn_id);
extern void bta_gattc_process_api_refresh(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
@@ -214,7 +214,7 @@ const UINT8 bta_hf_client_st_closing[][BTA_HF_CLIENT_NUM_COLS] = {
/* DISC_OK_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
/* DISC_FAIL_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
/* SCO_OPEN_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
/* SCO_CLOSE_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
/* SCO_CLOSE_EVT */ {BTA_HF_CLIENT_SCO_CONN_CLOSE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
/* SEND_AT_CMD_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
#if (BTM_SCO_HCI_INCLUDED == TRUE )
/* CI_SCO_DATA_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
@@ -926,7 +926,7 @@ typedef union {
tBTA_DM_PIN_REQ pin_req; /* PIN request. */
tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication. */
tBTA_DM_AUTHORIZE authorize; /* Authorization request. */
tBTA_DM_LINK_UP link_up; /* ACL connection down event */
tBTA_DM_LINK_UP link_up; /* ACL connection up event */
tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */
tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */
tBTA_DM_SP_CFM_REQ cfm_req; /* user confirm request */
@@ -1457,7 +1457,7 @@ extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBTA
extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb);
extern void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb);
extern void BTA_DmReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb);
/*******************************************************************************
**
@@ -2296,8 +2296,8 @@ extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_l
** Returns None
**
*******************************************************************************/
extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
BD_ADDR device_info,
extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
BD_ADDR device_info,
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback);
/*******************************************************************************
@@ -36,12 +36,6 @@
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/* Set to TRUE if seperate authorization prompt desired for AVCTP besides A2DP authorization */
/* Typically FALSE when AVRCP is used in conjunction with A2DP */
#ifndef BTA_AV_WITH_AVCTP_AUTHORIZATION
#define BTA_AV_WITH_AVCTP_AUTHORIZATION FALSE
#endif
/* AV status values */
#define BTA_AV_SUCCESS 0 /* successful operation */
#define BTA_AV_FAIL 1 /* generic failure */
@@ -581,8 +575,7 @@ void BTA_AvDisable(void);
** Returns void
**
*******************************************************************************/
void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name,
UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback, tBTA_AV_CO_FUNCTS *bta_av_cos, UINT8 tsep);
void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name, UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback, tBTA_AV_CO_FUNCTS *bta_av_cos, UINT8 tsep);
/*******************************************************************************
**
@@ -214,4 +214,6 @@ extern UINT8 bta_dm_co_ble_get_accept_auth_enable(void);
extern UINT8 bta_dm_co_ble_get_auth_req(void);
extern void bta_dm_co_ble_oob_support(UINT8 enable);
extern void bta_dm_co_ble_set_appl_enc_key_size(UINT8 ble_key_size);
#endif
@@ -200,6 +200,12 @@ typedef struct {
UINT8 name_spc; /* The name space of the description */
} tBTA_GATT_CHAR_PRES;
typedef struct {
UINT16 interval;
UINT16 latency;
UINT16 timeout;
} tBTA_GATT_CONN_PARAMS;
#define BTA_GATT_CLT_CONFIG_NONE GATT_CLT_CONFIG_NONE /* 0x0000 */
#define BTA_GATT_CLT_CONFIG_NOTIFICATION GATT_CLT_CONFIG_NOTIFICATION /* 0x0001 */
#define BTA_GATT_CLT_CONFIG_INDICATION GATT_CLT_CONFIG_INDICATION /* 0x0002 */
@@ -397,6 +403,7 @@ typedef struct {
UINT16 conn_id;
tBTA_GATTC_IF client_if;
BD_ADDR remote_bda;
tBTA_GATT_CONN_PARAMS conn_params;
} tBTA_GATTC_CONNECT;
typedef struct {
@@ -479,6 +486,8 @@ typedef tGATT_IF tBTA_GATTS_IF;
#define BTA_GATT_PERM_WRITE_ENC_MITM GATT_PERM_WRITE_ENC_MITM /* bit 6 - 0x0040 */
#define BTA_GATT_PERM_WRITE_SIGNED GATT_PERM_WRITE_SIGNED /* bit 7 - 0x0080 */
#define BTA_GATT_PERM_WRITE_SIGNED_MITM GATT_PERM_WRITE_SIGNED_MITM /* bit 8 - 0x0100 */
#define BTA_GATT_PERM_READ_AUTHORIZATION GATT_PERM_READ_AUTHORIZATION /* bit 9 - 0x0200 */
#define BTA_GATT_PERM_WRITE_AUTHORIZATION GATT_PERM_WRITE_AUTHORIZATION /* bit 10 - 0x0400 */
typedef UINT16 tBTA_GATT_PERM;
typedef tGATT_ATTR_VAL tBTA_GATT_ATTR_VAL;
typedef tGATTS_ATTR_CONTROL tBTA_GATTS_ATTR_CONTROL;
@@ -604,6 +613,7 @@ typedef struct {
UINT16 conn_id;
tBTA_GATT_REASON reason; /* report disconnect reason */
tBTA_GATT_TRANSPORT transport;
tBTA_GATT_CONN_PARAMS conn_params;
} tBTA_GATTS_CONN;
typedef struct {
@@ -937,6 +947,22 @@ void BTA_GATTC_ReadCharacteristic(UINT16 conn_id, UINT16 handle, tBTA_GATT_AUTH_
*******************************************************************************/
void BTA_GATTC_ReadCharDescr (UINT16 conn_id, UINT16 handle, tBTA_GATT_AUTH_REQ auth_req);
/*******************************************************************************
**
** Function BTA_GATTC_Read_by_type
**
** Description This function is called to read a attribute value by uuid
**
** Parameters conn_id - connection ID.
** s_handle - start handle.
** e_handle - end hanle
** uuid - The attribute UUID.
**
** Returns None
**
*******************************************************************************/
void BTA_GATTC_Read_by_type(UINT16 conn_id, UINT16 s_handle,UINT16 e_handle, tBT_UUID *uuid, tBTA_GATT_AUTH_REQ auth_req);
/*******************************************************************************
**
** Function BTA_GATTC_WriteCharValue
@@ -129,11 +129,13 @@ typedef UINT8 tBTA_JV_CONN_STATE;
/* Java I/F callback events */
/* events received by tBTA_JV_DM_CBACK */
#define BTA_JV_ENABLE_EVT 0 /* JV enabled */
#define BTA_JV_DISABLE_EVT 1 /* JV disabled */
#define BTA_JV_GET_SCN_EVT 6 /* Reserved an SCN */
#define BTA_JV_GET_PSM_EVT 7 /* Reserved a PSM */
#define BTA_JV_DISCOVERY_COMP_EVT 8 /* SDP discovery complete */
#define BTA_JV_CREATE_RECORD_EVT 11 /* the result for BTA_JvCreateRecord */
/* events received by tBTA_JV_L2CAP_CBACK */
#if BTA_JV_L2CAP_INCLUDED
#define BTA_JV_L2CAP_OPEN_EVT 16 /* open status of L2CAP connection */
#define BTA_JV_L2CAP_CLOSE_EVT 17 /* L2CAP connection closed */
#define BTA_JV_L2CAP_START_EVT 18 /* L2CAP server started */
@@ -144,6 +146,7 @@ typedef UINT8 tBTA_JV_CONN_STATE;
#define BTA_JV_L2CAP_RECEIVE_EVT 23 /* the result for BTA_JvL2capReceive*/
#define BTA_JV_L2CAP_WRITE_EVT 24 /* the result for BTA_JvL2capWrite*/
#define BTA_JV_L2CAP_WRITE_FIXED_EVT 25 /* the result for BTA_JvL2capWriteFixed */
#endif /* BTA_JV_L2CAP_INCLUDED */
/* events received by tBTA_JV_RFCOMM_CBACK */
#define BTA_JV_RFCOMM_OPEN_EVT 26 /* open status of RFCOMM Client connection */
@@ -155,7 +158,8 @@ typedef UINT8 tBTA_JV_CONN_STATE;
#define BTA_JV_RFCOMM_READ_EVT 32 /* the result for BTA_JvRfcommRead */
#define BTA_JV_RFCOMM_WRITE_EVT 33 /* the result for BTA_JvRfcommWrite*/
#define BTA_JV_RFCOMM_SRV_OPEN_EVT 34 /* open status of Server RFCOMM connection */
#define BTA_JV_MAX_EVT 35 /* max number of JV events */
#define BTA_JV_FREE_SCN_EVT 35 /* FREE an SCN */
#define BTA_JV_MAX_EVT 36 /* max number of JV events */
typedef UINT16 tBTA_JV_EVT;
@@ -167,9 +171,10 @@ typedef struct {
/* data associated with BTA_JV_DISCOVERY_COMP_EVT_ */
typedef struct {
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
UINT8 scn_num; /* num of channel */
UINT8 scn[BTA_JV_MAX_SCN]; /* channel # */
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
UINT8 scn_num; /* num of channel */
UINT8 scn[BTA_JV_MAX_SCN]; /* channel # */
const char *service_name[BTA_JV_MAX_SCN]; /* service_name */
} tBTA_JV_DISCOVERY_COMP;
/* data associated with BTA_JV_CREATE_RECORD_EVT */
@@ -178,6 +183,7 @@ typedef struct {
UINT32 handle; /* The SDP handle */
} tBTA_JV_CREATE_RECORD;
#if BTA_JV_L2CAP_INCLUDED
/* data associated with BTA_JV_L2CAP_OPEN_EVT */
typedef struct {
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
@@ -186,18 +192,6 @@ typedef struct {
INT32 tx_mtu; /* The transmit MTU */
} tBTA_JV_L2CAP_OPEN;
/* data associated with BTA_JV_L2CAP_OPEN_EVT for LE sockets */
typedef struct {
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
UINT32 handle; /* The connection handle */
BD_ADDR rem_bda; /* The peer address */
INT32 tx_mtu; /* The transmit MTU */
void **p_p_cback; /* set them for new socket */
void **p_user_data;/* set them for new socket */
} tBTA_JV_L2CAP_LE_OPEN;
/* data associated with BTA_JV_L2CAP_CLOSE_EVT */
typedef struct {
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
@@ -255,6 +249,22 @@ typedef struct {
BOOLEAN cong; /* congestion status */
} tBTA_JV_L2CAP_WRITE;
/* data associated with BTA_JV_L2CAP_OPEN_EVT for LE sockets */
typedef struct {
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
UINT32 handle; /* The connection handle */
BD_ADDR rem_bda; /* The peer address */
INT32 tx_mtu; /* The transmit MTU */
void **p_p_cback; /* set them for new socket */
void **p_user_data;/* set them for new socket */
} tBTA_JV_L2CAP_LE_OPEN;
/*data associated with BTA_JV_L2CAP_DATA_IND_EVT if used for LE */
typedef struct {
UINT32 handle; /* The connection handle */
BT_HDR *p_buf; /* The incoming data */
} tBTA_JV_LE_DATA_IND;
/* data associated with BTA_JV_L2CAP_WRITE_FIXED_EVT */
typedef struct {
@@ -265,6 +275,7 @@ typedef struct {
UINT16 len; /* The length of the data written. */
BOOLEAN cong; /* congestion status */
} tBTA_JV_L2CAP_WRITE_FIXED;
#endif /* BTA_JV_L2CAP_INCLUDED */
/* data associated with BTA_JV_RFCOMM_OPEN_EVT */
typedef struct {
@@ -272,6 +283,7 @@ typedef struct {
UINT32 handle; /* The connection handle */
BD_ADDR rem_bda; /* The peer address */
} tBTA_JV_RFCOMM_OPEN;
/* data associated with BTA_JV_RFCOMM_SRV_OPEN_EVT */
typedef struct {
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
@@ -280,7 +292,6 @@ typedef struct {
BD_ADDR rem_bda; /* The peer address */
} tBTA_JV_RFCOMM_SRV_OPEN;
/* data associated with BTA_JV_RFCOMM_CLOSE_EVT */
typedef struct {
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
@@ -294,6 +305,7 @@ typedef struct {
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
UINT32 handle; /* The connection handle */
UINT8 sec_id; /* security ID used by this server */
UINT8 scn; /* Server channe number */
BOOLEAN use_co; /* TRUE to use co_rfc_data */
} tBTA_JV_RFCOMM_START;
@@ -304,19 +316,13 @@ typedef struct {
UINT8 sec_id; /* security ID used by this client */
BOOLEAN use_co; /* TRUE to use co_rfc_data */
} tBTA_JV_RFCOMM_CL_INIT;
/*data associated with BTA_JV_L2CAP_DATA_IND_EVT & BTA_JV_RFCOMM_DATA_IND_EVT */
typedef struct {
UINT32 handle; /* The connection handle */
BT_HDR *p_buf; /* The incoming data */
} tBTA_JV_DATA_IND;
/*data associated with BTA_JV_L2CAP_DATA_IND_EVT if used for LE */
typedef struct {
UINT32 handle; /* The connection handle */
BT_HDR *p_buf; /* The incoming data */
} tBTA_JV_LE_DATA_IND;
/* data associated with BTA_JV_RFCOMM_CONG_EVT */
typedef struct {
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
@@ -341,6 +347,7 @@ typedef struct {
UINT32 req_id; /* The req_id in the associated BTA_JvRfcommWrite() */
int len; /* The length of the data written. */
BOOLEAN cong; /* congestion status */
BOOLEAN old_cong; /* congestion status */
} tBTA_JV_RFCOMM_WRITE;
/* data associated with BTA_JV_API_SET_PM_PROFILE_EVT */
@@ -356,6 +363,24 @@ typedef struct {
tBTA_JV_CONN_STATE state; /* JV connection stata */
} tBTA_JV_NOTIFY_PM_STATE_CHANGE;
/* indicate server at which status */
typedef enum {
BTA_JV_SERVER_START_FAILED,
BTA_JV_SERVER_RUNNING,
BTA_JV_SERVER_STATUS_MAX,
} tBTA_JV_SERVER_STATUS;
typedef struct {
tBTA_JV_SERVER_STATUS server_status;
UINT32 slot_id;
}tBTA_JV_FREE_SCN_USER_DATA;
/* data associated with BTA_JV_FREE_SCN_EVT */
typedef struct {
tBTA_JV_STATUS status; /* Status of the operation */
tBTA_JV_SERVER_STATUS server_status; /* Server status */
UINT8 scn; /* Server channe number */
} tBTA_JV_FREE_SCN;
/* union of data associated with JV callback */
typedef union {
@@ -365,6 +390,7 @@ typedef union {
UINT8 scn; /* BTA_JV_GET_SCN_EVT */
UINT16 psm; /* BTA_JV_GET_PSM_EVT */
tBTA_JV_CREATE_RECORD create_rec; /* BTA_JV_CREATE_RECORD_EVT */
#if BTA_JV_L2CAP_INCLUDED
tBTA_JV_L2CAP_OPEN l2c_open; /* BTA_JV_L2CAP_OPEN_EVT */
tBTA_JV_L2CAP_CLOSE l2c_close; /* BTA_JV_L2CAP_CLOSE_EVT */
tBTA_JV_L2CAP_START l2c_start; /* BTA_JV_L2CAP_START_EVT */
@@ -372,6 +398,7 @@ typedef union {
tBTA_JV_L2CAP_CONG l2c_cong; /* BTA_JV_L2CAP_CONG_EVT */
tBTA_JV_L2CAP_READ l2c_read; /* BTA_JV_L2CAP_READ_EVT */
tBTA_JV_L2CAP_WRITE l2c_write; /* BTA_JV_L2CAP_WRITE_EVT */
#endif /* BTA_JV_L2CAP_INCLUDED */
tBTA_JV_RFCOMM_OPEN rfc_open; /* BTA_JV_RFCOMM_OPEN_EVT */
tBTA_JV_RFCOMM_SRV_OPEN rfc_srv_open; /* BTA_JV_RFCOMM_SRV_OPEN_EVT */
tBTA_JV_RFCOMM_CLOSE rfc_close; /* BTA_JV_RFCOMM_CLOSE_EVT */
@@ -382,9 +409,12 @@ typedef union {
tBTA_JV_RFCOMM_WRITE rfc_write; /* BTA_JV_RFCOMM_WRITE_EVT */
tBTA_JV_DATA_IND data_ind; /* BTA_JV_L2CAP_DATA_IND_EVT
BTA_JV_RFCOMM_DATA_IND_EVT */
tBTA_JV_LE_DATA_IND le_data_ind; /* BTA_JV_L2CAP_LE_DATA_IND_EVT */
tBTA_JV_FREE_SCN free_scn; /* BTA_JV_FREE_SCN_EVT */
#if BTA_JV_L2CAP_INCLUDED
tBTA_JV_L2CAP_LE_OPEN l2c_le_open; /* BTA_JV_L2CAP_OPEN_EVT */
tBTA_JV_LE_DATA_IND le_data_ind; /* BTA_JV_L2CAP_LE_DATA_IND_EVT */
tBTA_JV_L2CAP_WRITE_FIXED l2c_write_fixed; /* BTA_JV_L2CAP_WRITE_FIXED_EVT */
#endif
} tBTA_JV;
/* JAVA DM Interface callback */
@@ -393,8 +423,10 @@ typedef void (tBTA_JV_DM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_d
/* JAVA RFCOMM interface callback */
typedef void *(tBTA_JV_RFCOMM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data);
#if BTA_JV_L2CAP_INCLUDED
/* JAVA L2CAP interface callback */
typedef void (tBTA_JV_L2CAP_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_Data);
#endif /* BTA_JV_L2CAP_INCLUDED */
/* JV configuration structure */
typedef struct {
@@ -424,12 +456,25 @@ extern tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback);
**
** Function BTA_JvDisable
**
** Description Disable the Java I/F
** Description Disable the Java I/F. When the enable
** operation is complete the callback function will be
** called with a BTA_JV_DISABLE_EVT.
**
** Returns void
**
*******************************************************************************/
extern void BTA_JvDisable(void);
extern void BTA_JvDisable(tBTA_JV_RFCOMM_CBACK *p_cback);
/*******************************************************************************
**
** Function BTA_JvFree
**
** Description Free JV configuration
**
** Returns void
**
*******************************************************************************/
extern void BTA_JvFree(void);
/*******************************************************************************
**
@@ -484,12 +529,17 @@ extern tBTA_JV_STATUS BTA_JvGetChannelId(int conn_type, void *user_data,
**
** Description This function frees a SCN/PSM that was used
** by an application running over RFCOMM or L2CAP.
** Parameters
** channel The channel to free
** conn_type one of BTA_JV_CONN_TYPE_
** p_cback tBTA_JV_RFCOMM_CBACK is called with BTA_JV_FREE_SCN_EVT when server frees a SCN/PSM
** user_data indicate the RFCOMM server status
**
** Returns BTA_JV_SUCCESS, if the request is being processed.
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type);
extern tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
/*******************************************************************************
**
@@ -532,6 +582,7 @@ extern tBTA_JV_STATUS BTA_JvCreateRecordByUser(const char *name, UINT32 channel,
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvDeleteRecord(UINT32 handle);
#if BTA_JV_L2CAP_INCLUDED
/*******************************************************************************
**
** Function BTA_JvL2capConnectLE
@@ -739,6 +790,7 @@ extern tBTA_JV_STATUS BTA_JvL2capWrite(UINT32 handle, UINT32 req_id,
extern tBTA_JV_STATUS BTA_JvL2capWriteFixed(UINT16 channel, BD_ADDR *addr, UINT32 req_id,
tBTA_JV_L2CAP_CBACK *p_cback,
UINT8 *p_data, UINT16 len, void *user_data);
#endif /* BTA_JV_L2CAP_INCLUDED */
/*******************************************************************************
**
@@ -769,7 +821,7 @@ extern tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data);
extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
/*******************************************************************************
**
@@ -786,9 +838,9 @@ extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data);
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask,
tBTA_JV_ROLE role, UINT8 local_scn, UINT8 max_session,
tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
extern tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
UINT8 local_scn, UINT8 max_session,
tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
/*******************************************************************************
**
@@ -815,8 +867,7 @@ extern tBTA_JV_STATUS BTA_JvRfcommStopServer(UINT32 handle, void *user_data);
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvRfcommRead(UINT32 handle, UINT32 req_id,
UINT8 *p_data, UINT16 len);
extern tBTA_JV_STATUS BTA_JvRfcommRead(UINT32 handle, UINT32 req_id, UINT8 *p_data, UINT16 len);
/*******************************************************************************
**
@@ -843,9 +894,20 @@ extern tBTA_JV_STATUS BTA_JvRfcommReady(UINT32 handle, UINT32 *p_data_size);
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
// extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id);
extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id, int len, UINT8 *p_data);
/*******************************************************************************
**
** Function BTA_JvRfcommFlowControl
**
** Description This function gives the credit to the peer
**
** Returns BTA_JV_SUCCESS, if the request is being processed.
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvRfcommFlowControl(UINT32 handle, UINT16 credits_given);
/*******************************************************************************
**
** Function BTA_JVSetPmProfile
@@ -865,8 +927,7 @@ extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id, int len, U
** BTA_JV_CONN_CLOSE to remove in case of connection close!
**
*******************************************************************************/
extern tBTA_JV_STATUS BTA_JvSetPmProfile(UINT32 handle, tBTA_JV_PM_ID app_id,
tBTA_JV_CONN_STATE init_st);
extern tBTA_JV_STATUS BTA_JvSetPmProfile(UINT32 handle, tBTA_JV_PM_ID app_id, tBTA_JV_CONN_STATE init_st);
/*******************************************************************************
**
@@ -225,6 +225,7 @@ extern void 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);
extern BOOLEAN bta_sys_timer_is_active(TIMER_LIST_ENT *p_tle);
extern void bta_sys_disable(tBTA_SYS_HW_MODULE module);
extern UINT32 bta_sys_get_remaining_ticks(TIMER_LIST_ENT *p_target_tle);
+164 -25
View File
@@ -48,6 +48,7 @@
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
#if BTA_JV_L2CAP_INCLUDED
/* one of these exists for each client */
struct fc_client {
struct fc_client *next_all_list;
@@ -92,11 +93,10 @@ static void __attribute__((unused)) fc_init(void)
pthread_once(&fc_init_once, fc_init_work);
}
static void fcchan_conn_chng_cbk(UINT16 chan, BD_ADDR bd_addr, BOOLEAN connected,
UINT16 reason, tBT_TRANSPORT );
static void fcchan_data_cbk(UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf);
#endif /* BTA_JV_L2CAP_INCLUDED */
extern void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str);
static inline void logu(const char *title, const uint8_t *p_uuid)
@@ -114,6 +114,10 @@ static void bta_jv_pm_conn_idle(tBTA_JV_PM_CB *p_cb);
static void bta_jv_pm_state_change(tBTA_JV_PM_CB *p_cb, const tBTA_JV_CONN_STATE state);
tBTA_JV_STATUS bta_jv_set_pm_conn_state(tBTA_JV_PM_CB *p_cb, const tBTA_JV_CONN_STATE
new_st);
static int find_rfc_pcb(void *user_data, tBTA_JV_RFC_CB **cb, tBTA_JV_PCB **pcb);
static void bta_jv_port_mgmt_sr_cback(UINT32 code, UINT16 port_handle);
static void bta_jv_port_event_sr_cback(UINT32 code, UINT16 port_handle);
static int bta_jv_port_data_co_cback(UINT16 port_handle, UINT8 *buf, UINT16 len, int type);
/*******************************************************************************
**
@@ -288,6 +292,12 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pc
BOOLEAN remove_server = FALSE;
int close_pending = 0;
UINT8 used = 0, i, listen = 0;
tPORT_STATE port_state;
UINT32 event_mask = BTA_JV_RFC_EV_MASK;
UINT32 scn_num = (UINT32)p_cb->scn;
tBTA_JV evt_data;
if (!p_cb || !p_pcb) {
APPL_TRACE_ERROR("bta_jv_free_sr_rfc_cb, p_cb or p_pcb cannot be null");
return BTA_JV_FAILURE;
@@ -363,6 +373,57 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pc
}
p_pcb->handle = 0;
p_cb->curr_sess--;
if ((p_cb->max_sess > 1) &&
(p_cb->scn != 0) &&
(p_cb->curr_sess == p_cb->max_sess - 1)) {
for (i = 0; i < p_cb->max_sess; i++) {
if (p_cb->rfc_hdl[i] != 0) {
p_pcb = &bta_jv_cb.port_cb[p_cb->rfc_hdl[i] - 1];
if (p_pcb->state == BTA_JV_ST_SR_LISTEN) {
listen++;
}
used++;
}
}
APPL_TRACE_DEBUG("%s max_sess=%d used:%d curr_sess:%d, listen:%d si:%d",
__func__, p_cb->max_sess, used, p_cb->curr_sess, listen, si);
if (used < p_cb->max_sess &&
listen == 0 &&
0 <= si &&
si < BTA_JV_MAX_RFC_SR_SESSION) {
/* make sure the server has a listen port */
if ((RFCOMM_CreateConnection(p_cb->sec_id, p_cb->scn, TRUE,
BTA_JV_DEF_RFC_MTU, (UINT8 *)bd_addr_any, &(p_cb->rfc_hdl[si]), bta_jv_port_mgmt_sr_cback) == PORT_SUCCESS) &&
(p_cb->rfc_hdl[si] != 0)) {
p_cb->curr_sess++;
p_pcb = &bta_jv_cb.port_cb[p_cb->rfc_hdl[si] - 1];
p_pcb->state = BTA_JV_ST_SR_LISTEN;
p_pcb->port_handle = p_cb->rfc_hdl[si];
// p_pcb->user_data = p_pcb_open->user_data;
PORT_ClearKeepHandleFlag(p_pcb->port_handle);
PORT_SetEventCallback(p_pcb->port_handle, bta_jv_port_event_sr_cback);
PORT_SetDataCOCallback(p_pcb->port_handle, bta_jv_port_data_co_cback);
PORT_SetEventMask(p_pcb->port_handle, event_mask);
PORT_GetState(p_pcb->port_handle, &port_state);
port_state.fc_type = (PORT_FC_CTS_ON_INPUT | PORT_FC_CTS_ON_OUTPUT);
PORT_SetState(p_pcb->port_handle, &port_state);
p_pcb->handle = BTA_JV_RFC_H_S_TO_HDL(p_cb->handle, si);
APPL_TRACE_DEBUG("%s: p_pcb->handle:0x%x, curr_sess:%d", __func__,
p_pcb->handle, p_cb->curr_sess);
evt_data.rfc_srv_open.handle = 0;
evt_data.rfc_srv_open.new_listen_handle = p_pcb->handle;
evt_data.rfc_srv_open.status = BTA_JV_SUCCESS;
p_pcb->user_data = p_cb->p_cback(BTA_JV_RFCOMM_SRV_OPEN_EVT, &evt_data, (void *)scn_num);
}
}
}
if (p_cb->curr_sess == 0) {
p_cb->scn = 0;
bta_jv_free_sec_id(&p_cb->sec_id);
@@ -377,6 +438,7 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pc
return status;
}
#if BTA_JV_L2CAP_INCLUDED
/*******************************************************************************
**
** Function bta_jv_free_l2c_cb
@@ -402,6 +464,7 @@ tBTA_JV_STATUS bta_jv_free_l2c_cb(tBTA_JV_L2C_CB *p_cb)
p_cb->p_cback = NULL;
return status;
}
#endif /* BTA_JV_L2CAP_INCLUDED */
/*******************************************************************************
**
@@ -456,10 +519,9 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
}
}
APPL_TRACE_API("%s(jv_handle: 0x%2x), idx: %d, "
"app_id: 0x%x", __func__, jv_handle, i, bta_jv_cb.pm_cb[i].app_id);
APPL_TRACE_API("%s, bd_counter = %d, "
"appid_counter = %d", __func__, bd_counter, appid_counter);
APPL_TRACE_API("%s(jv_handle: 0x%2x), idx: %d, app_id: 0x%x", __func__, jv_handle, i, bta_jv_cb.pm_cb[i].app_id);
APPL_TRACE_API("%s, bd_counter = %d, appid_counter = %d", __func__, bd_counter, appid_counter);
if (bd_counter > 1) {
bta_jv_pm_conn_idle(&bta_jv_cb.pm_cb[i]);
}
@@ -478,14 +540,15 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(bta_jv_cb.rfc_cb[hi].rfc_hdl[si]);
if (p_pcb) {
if (NULL == p_pcb->p_pm_cb) {
APPL_TRACE_WARNING("%s(jv_handle:"
" 0x%x):port_handle: 0x%x, p_pm_cb: %d: no link to "
"pm_cb?", __func__, jv_handle, p_pcb->port_handle, i);
APPL_TRACE_WARNING("%s(jv_handle: 0x%x):port_handle: 0x%x, p_pm_cb: %d: no link to pm_cb?",
__func__, jv_handle, p_pcb->port_handle, i);
}
p_cb = &p_pcb->p_pm_cb;
}
}
} else {
}
#if BTA_JV_L2CAP_INCLUDED
else {
if (jv_handle < BTA_JV_MAX_L2C_CONN) {
tBTA_JV_L2C_CB *p_l2c_cb = &bta_jv_cb.l2c_cb[jv_handle];
if (NULL == p_l2c_cb->p_pm_cb) {
@@ -495,6 +558,8 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
p_cb = &p_l2c_cb->p_pm_cb;
}
}
#endif /* BTA_JV_L2CAP_INCLUDED */
if (p_cb) {
*p_cb = NULL;
status = BTA_JV_SUCCESS;
@@ -537,7 +602,9 @@ static tBTA_JV_PM_CB *bta_jv_alloc_set_pm_profile_cb(UINT32 jv_handle, tBTA_JV_P
break;
}
}
} else {
}
#if BTA_JV_L2CAP_INCLUDED
else {
/* use jv handle for l2cap bd address retrieval */
for (j = 0; j < BTA_JV_MAX_L2C_CONN; j++) {
if (jv_handle == bta_jv_cb.l2c_cb[j].handle) {
@@ -552,6 +619,7 @@ static tBTA_JV_PM_CB *bta_jv_alloc_set_pm_profile_cb(UINT32 jv_handle, tBTA_JV_P
}
}
}
#endif /* BTA_JV_L2CAP_INCLUDED */
APPL_TRACE_API("bta_jv_alloc_set_pm_profile_cb(handle 0x%2x, app_id %d): "
"idx: %d, (BTA_JV_PM_MAX_NUM: %d), pp_cb: %p", jv_handle, app_id,
i, BTA_JV_PM_MAX_NUM, (void *)pp_cb);
@@ -634,7 +702,6 @@ BOOLEAN bta_jv_check_psm(UINT16 psm)
}
}
return ret;
}
/*******************************************************************************
@@ -673,7 +740,12 @@ void bta_jv_enable(tBTA_JV_MSG *p_data)
*******************************************************************************/
void bta_jv_disable (tBTA_JV_MSG *p_data)
{
UNUSED(p_data);
tBTA_JV_STATUS evt_data;
evt_data = BTA_JV_SUCCESS;
// UNUSED(p_data);
if (p_data->disable.p_cback) {
p_data->disable.p_cback(BTA_JV_DISABLE_EVT, (tBTA_JV *)&evt_data, NULL);
}
}
@@ -782,7 +854,17 @@ void bta_jv_get_channel_id(tBTA_JV_MSG *p_data)
*******************************************************************************/
void bta_jv_free_scn(tBTA_JV_MSG *p_data)
{
UINT16 scn = p_data->free_channel.scn;
tBTA_JV_API_FREE_CHANNEL *fc = &(p_data->free_channel);
UINT16 scn = fc->scn;
tBTA_JV_FREE_SCN evt_data = {
.status = BTA_JV_SUCCESS,
.server_status = BTA_JV_SERVER_STATUS_MAX,
.scn = scn
};
tBTA_JV_FREE_SCN_USER_DATA *user_data = NULL;
tBTA_JV_RFC_CB *p_cb = NULL;
tBTA_JV_PCB *p_pcb = NULL;
switch (p_data->free_channel.type) {
case BTA_JV_CONN_TYPE_RFCOMM: {
@@ -802,6 +884,19 @@ void bta_jv_free_scn(tBTA_JV_MSG *p_data)
default:
break;
}
if (fc->user_data) {
user_data = (tBTA_JV_FREE_SCN_USER_DATA *)fc->user_data;
evt_data.server_status = user_data->server_status;
if (user_data->server_status == BTA_JV_SERVER_RUNNING && find_rfc_pcb((void *)user_data->slot_id, &p_cb, &p_pcb)) {
/* if call bta_jv_rfcomm_stop_server successfully, find_rfc_pcb shall return false */
evt_data.status = BTA_JV_FAILURE;
}
if (fc->p_cback) {
fc->p_cback(BTA_JV_FREE_SCN_EVT, (tBTA_JV *)&evt_data, (void *)user_data);
}
}
}
static inline tBT_UUID shorten_sdp_uuid(const tBT_UUID *u)
{
@@ -857,6 +952,7 @@ static void bta_jv_start_discovery_cback(UINT16 result, void *user_data)
status = BTA_JV_FAILURE;
if (result == SDP_SUCCESS || result == SDP_DB_FULL) {
tSDP_DISC_REC *p_sdp_rec = NULL;
tSDP_DISC_ATTR *p_attr = NULL;
tSDP_PROTOCOL_ELEM pe;
logu("bta_jv_cb.uuid", bta_jv_cb.uuid.uu.uuid128);
tBT_UUID su = shorten_sdp_uuid(&bta_jv_cb.uuid);
@@ -865,7 +961,13 @@ static void bta_jv_start_discovery_cback(UINT16 result, void *user_data)
p_sdp_rec = SDP_FindServiceUUIDInDb(p_bta_jv_cfg->p_sdp_db, &su, p_sdp_rec);
APPL_TRACE_DEBUG("p_sdp_rec:%p", p_sdp_rec);
if (p_sdp_rec && SDP_FindProtocolListElemInRec(p_sdp_rec, UUID_PROTOCOL_RFCOMM, &pe)){
dcomp.scn[dcomp.scn_num++] = (UINT8) pe.params[0];
dcomp.scn[dcomp.scn_num] = (UINT8) pe.params[0];
if ((p_attr = SDP_FindAttributeInRec(p_sdp_rec, ATTR_ID_SERVICE_NAME)) != NULL) {
dcomp.service_name[dcomp.scn_num] = (char *)p_attr->attr_value.v.array;
} else {
dcomp.service_name[dcomp.scn_num] = NULL;
}
dcomp.scn_num++;
status = BTA_JV_SUCCESS;
}
} while (p_sdp_rec);
@@ -1092,6 +1194,7 @@ void bta_jv_delete_record(tBTA_JV_MSG *p_data)
}
}
#if BTA_JV_L2CAP_INCLUDED
/*******************************************************************************
**
** Function bta_jv_l2cap_client_cback
@@ -1517,6 +1620,7 @@ void bta_jv_l2cap_write_fixed(tBTA_JV_MSG *p_data)
ls->p_cback(BTA_JV_L2CAP_WRITE_FIXED_EVT, (tBTA_JV *)&evt_data, ls->user_data);
}
#endif /* BTA_JV_L2CAP_INCLUDED */
/*******************************************************************************
**
@@ -1596,6 +1700,7 @@ static void bta_jv_port_mgmt_cl_cback(UINT32 code, UINT16 port_handle)
evt_data.rfc_close.async = TRUE;
if (p_pcb->state == BTA_JV_ST_CL_CLOSING) {
evt_data.rfc_close.async = FALSE;
evt_data.rfc_close.status = BTA_JV_SUCCESS;
}
//p_pcb->state = BTA_JV_ST_NONE;
//p_pcb->cong = FALSE;
@@ -1760,9 +1865,10 @@ void bta_jv_rfcomm_close(tBTA_JV_MSG *p_data)
tBTA_JV_API_RFCOMM_CLOSE *cc = &(p_data->rfcomm_close);
tBTA_JV_RFC_CB *p_cb = NULL;
tBTA_JV_PCB *p_pcb = NULL;
APPL_TRACE_DEBUG("bta_jv_rfcomm_close, rfc handle:%d", cc->handle);
tBTA_JV evt_data;
APPL_TRACE_DEBUG("%s, rfc handle:%d",__func__, cc->handle);
if (!cc->handle) {
APPL_TRACE_ERROR("bta_jv_rfcomm_close, rfc handle is null");
APPL_TRACE_ERROR("%s, rfc handle is null", __func__);
return;
}
@@ -1770,9 +1876,21 @@ void bta_jv_rfcomm_close(tBTA_JV_MSG *p_data)
if (!find_rfc_pcb(user_data, &p_cb, &p_pcb)) {
return;
}
if(cc->p_cback) {
evt_data.rfc_close.status = BTA_JV_SUCCESS;
evt_data.rfc_close.port_status = PORT_LOCAL_CLOSED;
evt_data.rfc_close.handle = cc->handle;
evt_data.rfc_close.async = TRUE;
if (p_pcb && (p_pcb->state == BTA_JV_ST_SR_LISTEN ||
p_pcb->state == BTA_JV_ST_SR_OPEN ||
p_pcb->state == BTA_JV_ST_CL_OPEN ||
p_pcb->state == BTA_JV_ST_CL_OPENING)) {
evt_data.rfc_close.async = FALSE;
}
cc->p_cback(BTA_JV_RFCOMM_CLOSE_EVT, (tBTA_JV *)&evt_data, user_data);
}
bta_jv_free_rfc_cb(p_cb, p_pcb);
APPL_TRACE_DEBUG("bta_jv_rfcomm_close: sec id in use:%d, rfc_cb in use:%d",
get_sec_id_used(), get_rfc_cb_used());
APPL_TRACE_DEBUG("%s: sec id in use:%d, rfc_cb in use:%d", __func__, get_sec_id_used(), get_rfc_cb_used());
}
/*******************************************************************************
@@ -1976,6 +2094,8 @@ static tBTA_JV_PCB *bta_jv_add_rfc_port(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pcb
p_pcb->handle, p_cb->curr_sess);
}
} else {
/* avoid p_pcb always points to the last element of rfc_hdl */
p_pcb = p_pcb_open;
APPL_TRACE_ERROR("bta_jv_add_rfc_port, cannot create new rfc listen port");
}
}
@@ -2043,6 +2163,7 @@ void bta_jv_rfcomm_start_server(tBTA_JV_MSG *p_data)
evt_data.status = BTA_JV_SUCCESS;
evt_data.handle = p_pcb->handle;
evt_data.sec_id = sec_id;
evt_data.scn = rs->local_scn;
evt_data.use_co = TRUE;
PORT_ClearKeepHandleFlag(handle);
@@ -2146,16 +2267,16 @@ void bta_jv_rfcomm_write(tBTA_JV_MSG *p_data)
evt_data.status = BTA_JV_FAILURE;
evt_data.handle = p_pcb->handle;
evt_data.req_id = wc->req_id;
evt_data.cong = p_pcb->cong;
evt_data.old_cong = p_pcb->cong;
bta_jv_pm_conn_busy(p_pcb->p_pm_cb);
evt_data.len = wc->len;
if (!evt_data.cong &&
evt_data.len = -1;
if (!evt_data.old_cong &&
PORT_WriteDataCO(p_pcb->port_handle, &evt_data.len, wc->len, wc->p_data) ==
PORT_SUCCESS) {
evt_data.status = BTA_JV_SUCCESS;
}
// update congestion flag
evt_data.cong = p_pcb->cong;
evt_data.cong = p_pcb->cong;
if (p_cb->p_cback) {
p_cb->p_cback(BTA_JV_RFCOMM_WRITE_EVT, (tBTA_JV *)&evt_data, p_pcb->user_data);
} else {
@@ -2164,6 +2285,24 @@ void bta_jv_rfcomm_write(tBTA_JV_MSG *p_data)
}
/*******************************************************************************
**
** Function bta_jv_rfcomm_flow_control
**
** Description give credits to the peer
**
** Returns void
**
*******************************************************************************/
void bta_jv_rfcomm_flow_control(tBTA_JV_MSG *p_data)
{
tBTA_JV_API_RFCOMM_FLOW_CONTROL *fc = &(p_data->rfcomm_fc);
tBTA_JV_PCB *p_pcb = fc->p_pcb;
PORT_FlowControl_GiveCredit(p_pcb->port_handle, TRUE, fc->credits_given);
}
/*******************************************************************************
**
** Function bta_jv_set_pm_profile
@@ -2351,7 +2490,7 @@ static void bta_jv_pm_state_change(tBTA_JV_PM_CB *p_cb, const tBTA_JV_CONN_STATE
}
/**********************************************************************************************/
#if BTA_JV_L2CAP_INCLUDED
static struct fc_channel *fcchan_get(uint16_t chan, char create)
{
struct fc_channel *t = fc_channels;
@@ -2791,6 +2930,6 @@ extern void bta_jv_l2cap_close_fixed (tBTA_JV_MSG *p_data)
fcclient_free(t);
}
}
#endif /* BTA_JV_L2CAP_INCLUDED */
#endif ///defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE
+83 -9
View File
@@ -69,6 +69,16 @@ tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback)
int i;
APPL_TRACE_API( "BTA_JvEnable");
#if BTA_DYNAMIC_MEMORY == TRUE
/* Malloc buffer for JV configuration structure */
p_bta_jv_cfg->p_sdp_raw_data = (UINT8 *)osi_malloc(p_bta_jv_cfg->sdp_raw_size);
p_bta_jv_cfg->p_sdp_db = (tSDP_DISCOVERY_DB *)osi_malloc(p_bta_jv_cfg->sdp_db_size);
if (p_bta_jv_cfg->p_sdp_raw_data == NULL || p_bta_jv_cfg->p_sdp_db == NULL) {
return BTA_JV_NO_DATA;
}
#endif
if (p_cback && FALSE == bta_sys_is_register(BTA_ID_JV)) {
memset(&bta_jv_cb, 0, sizeof(tBTA_JV_CB));
/* set handle to invalid value by default */
@@ -85,8 +95,11 @@ tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback)
bta_sys_sendmsg(p_buf);
status = BTA_JV_SUCCESS;
}
} else if (p_cback == NULL) {
APPL_TRACE_ERROR("No p_cback.");
} else {
APPL_TRACE_ERROR("JVenable fails");
APPL_TRACE_WARNING("No need to Init again.");
// status = BTA_JV_SUCCESS;
}
return (status);
}
@@ -100,18 +113,39 @@ tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback)
** Returns void
**
*******************************************************************************/
void BTA_JvDisable(void)
void BTA_JvDisable(tBTA_JV_RFCOMM_CBACK *p_cback)
{
BT_HDR *p_buf;
tBTA_JV_API_DISABLE *p_buf;
APPL_TRACE_API( "BTA_JvDisable");
bta_sys_deregister(BTA_ID_JV);
if ((p_buf = (BT_HDR *) osi_malloc(sizeof(BT_HDR))) != NULL) {
p_buf->event = BTA_JV_API_DISABLE_EVT;
if ((p_buf = (tBTA_JV_API_DISABLE *) osi_malloc(sizeof(tBTA_JV_API_DISABLE))) != NULL) {
p_buf->hdr.event = BTA_JV_API_DISABLE_EVT;
p_buf->p_cback = p_cback;
bta_sys_sendmsg(p_buf);
}
}
/*******************************************************************************
**
** Function BTA_JvFree
**
** Description Free JV configuration
**
** Returns void
**
*******************************************************************************/
void BTA_JvFree(void)
{
#if BTA_DYNAMIC_MEMORY == TRUE
/* Free buffer for JV configuration structure */
osi_free(p_bta_jv_cfg->p_sdp_raw_data);
osi_free(p_bta_jv_cfg->p_sdp_db);
p_bta_jv_cfg->p_sdp_raw_data = NULL;
p_bta_jv_cfg->p_sdp_db = NULL;
#endif
}
/*******************************************************************************
**
** Function BTA_JvIsEnable
@@ -199,12 +233,14 @@ tBTA_JV_STATUS BTA_JvGetChannelId(int conn_type, void *user_data, INT32 channel)
** Parameters
** channel The channel to free
** conn_type one of BTA_JV_CONN_TYPE_
** p_cback tBTA_JV_RFCOMM_CBACK is called with when server
** user_data indicate the RFCOMM server status
**
** Returns BTA_JV_SUCCESS, if the request is being processed.
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type)
tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data)
{
tBTA_JV_STATUS status = BTA_JV_FAILURE;
tBTA_JV_API_FREE_CHANNEL *p_msg;
@@ -214,6 +250,8 @@ tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type)
p_msg->hdr.event = BTA_JV_API_FREE_SCN_EVT;
p_msg->scn = channel;
p_msg->type = conn_type;
p_msg->p_cback = p_cback;
p_msg->user_data = user_data;
bta_sys_sendmsg(p_msg);
status = BTA_JV_SUCCESS;
}
@@ -310,6 +348,7 @@ tBTA_JV_STATUS BTA_JvDeleteRecord(UINT32 handle)
return (status);
}
#if BTA_JV_L2CAP_INCLUDED
/*******************************************************************************
**
** Function BTA_JvL2capConnectLE
@@ -823,6 +862,7 @@ tBTA_JV_STATUS BTA_JvL2capWriteFixed(UINT16 channel, BD_ADDR *addr, UINT32 req_i
return (status);
}
#endif /* BTA_JV_L2CAP_INCLUDED */
/*******************************************************************************
**
@@ -868,19 +908,20 @@ tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
** Function BTA_JvRfcommClose
**
** Description This function closes an RFCOMM connection
**
** When the connection is established or failed,
** tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_CLOSE_EVT
** Returns BTA_JV_SUCCESS, if the request is being processed.
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data)
tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data)
{
tBTA_JV_STATUS status = BTA_JV_FAILURE;
tBTA_JV_API_RFCOMM_CLOSE *p_msg;
UINT32 hi = ((handle & BTA_JV_RFC_HDL_MASK) & ~BTA_JV_RFCOMM_MASK) - 1;
UINT32 si = BTA_JV_RFC_HDL_TO_SIDX(handle);
APPL_TRACE_API( "BTA_JvRfcommClose");
APPL_TRACE_API( "%s", __func__);
if (hi < BTA_JV_MAX_RFC_CONN && bta_jv_cb.rfc_cb[hi].p_cback &&
si < BTA_JV_MAX_RFC_SR_SESSION && bta_jv_cb.rfc_cb[hi].rfc_hdl[si] &&
(p_msg = (tBTA_JV_API_RFCOMM_CLOSE *)osi_malloc(sizeof(tBTA_JV_API_RFCOMM_CLOSE))) != NULL) {
@@ -888,6 +929,7 @@ tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data)
p_msg->handle = handle;
p_msg->p_cb = &bta_jv_cb.rfc_cb[hi];
p_msg->p_pcb = &bta_jv_cb.port_cb[p_msg->p_cb->rfc_hdl[si] - 1];
p_msg->p_cback = p_cback;
p_msg->user_data = user_data;
bta_sys_sendmsg(p_msg);
status = BTA_JV_SUCCESS;
@@ -1095,6 +1137,38 @@ tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id, int len, UINT8 *p
return (status);
}
/*******************************************************************************
**
** Function BTA_JvRfcommFlowControl
**
** Description This function gives credits to the peer
**
** Returns BTA_JV_SUCCESS, if the request is being processed.
** BTA_JV_FAILURE, otherwise.
**
*******************************************************************************/
tBTA_JV_STATUS BTA_JvRfcommFlowControl(UINT32 handle, UINT16 credits_given)
{
tBTA_JV_STATUS status = BTA_JV_FAILURE;
tBTA_JV_API_RFCOMM_FLOW_CONTROL *p_msg;
UINT32 hi = ((handle & BTA_JV_RFC_HDL_MASK) & ~BTA_JV_RFCOMM_MASK) - 1;
UINT32 si = BTA_JV_RFC_HDL_TO_SIDX(handle);
APPL_TRACE_API( "BTA_JvRfcommFlowControl");
APPL_TRACE_DEBUG( "handle:0x%x, hi:%d, si:%d", handle, hi, si);
if (hi < BTA_JV_MAX_RFC_CONN && bta_jv_cb.rfc_cb[hi].p_cback &&
si < BTA_JV_MAX_RFC_SR_SESSION && bta_jv_cb.rfc_cb[hi].rfc_hdl[si] &&
(p_msg = (tBTA_JV_API_RFCOMM_FLOW_CONTROL *)osi_malloc(sizeof(tBTA_JV_API_RFCOMM_FLOW_CONTROL))) != NULL) {
p_msg->hdr.event = BTA_JV_API_RFCOMM_FLOW_CONTROL_EVT;
p_msg->p_cb = &bta_jv_cb.rfc_cb[hi];
p_msg->p_pcb = &bta_jv_cb.port_cb[p_msg->p_cb->rfc_hdl[si] - 1];
p_msg->credits_given = credits_given;
APPL_TRACE_API( "credits given %d", credits_given);
bta_sys_sendmsg(p_msg);
status = BTA_JV_SUCCESS;
}
return (status);
}
/*******************************************************************************
**
+11 -4
View File
@@ -43,15 +43,22 @@
* between BTA_JvEnable and BTA_JvDisable
* p_bta_jv_cfg->p_sdp_raw_data can be allocated before calling BTA_JvStartDiscovery
* it can be de-allocated after the last call to access the database */
#if BTA_DYNAMIC_MEMORY == FALSE
static UINT8 bta_jv_sdp_raw_data[BTA_JV_SDP_RAW_DATA_SIZE];
static UINT8 __attribute__ ((aligned(4))) bta_jv_sdp_db_data[BTA_JV_SDP_DB_SIZE];
#endif
/* JV configuration structure */
const tBTA_JV_CFG bta_jv_cfg = {
BTA_JV_SDP_RAW_DATA_SIZE, /* The size of p_sdp_raw_data */
BTA_JV_SDP_DB_SIZE, /* The size of p_sdp_db_data */
bta_jv_sdp_raw_data, /* The data buffer to keep raw data */
/* const */ tBTA_JV_CFG bta_jv_cfg = {
BTA_JV_SDP_RAW_DATA_SIZE, /* The size of p_sdp_raw_data */
BTA_JV_SDP_DB_SIZE, /* The size of p_sdp_db_data */
#if BTA_DYNAMIC_MEMORY == FALSE
bta_jv_sdp_raw_data, /* The data buffer to keep raw data */
(tSDP_DISCOVERY_DB *)bta_jv_sdp_db_data /* The data buffer to keep SDP database */
#else
NULL,
NULL
#endif
};
tBTA_JV_CFG *p_bta_jv_cfg = (tBTA_JV_CFG *) &bta_jv_cfg;
@@ -35,6 +35,8 @@
#if BTA_DYNAMIC_MEMORY == FALSE
tBTA_JV_CB bta_jv_cb;
#else
tBTA_JV_CB *bta_jv_cb_ptr;
#endif
/* state machine action enumeration list */
@@ -52,25 +54,30 @@ const tBTA_JV_ACTION bta_jv_action[] = {
bta_jv_start_discovery, /* BTA_JV_API_START_DISCOVERY_EVT */
bta_jv_create_record, /* BTA_JV_API_CREATE_RECORD_EVT */
bta_jv_delete_record, /* BTA_JV_API_DELETE_RECORD_EVT */
#if BTA_JV_L2CAP_INCLUDED
bta_jv_l2cap_connect, /* BTA_JV_API_L2CAP_CONNECT_EVT */
bta_jv_l2cap_close, /* BTA_JV_API_L2CAP_CLOSE_EVT */
bta_jv_l2cap_start_server, /* BTA_JV_API_L2CAP_START_SERVER_EVT */
bta_jv_l2cap_stop_server, /* BTA_JV_API_L2CAP_STOP_SERVER_EVT */
bta_jv_l2cap_read, /* BTA_JV_API_L2CAP_READ_EVT */
bta_jv_l2cap_write, /* BTA_JV_API_L2CAP_WRITE_EVT */
#endif /* BTA_JV_L2CAP_INCLUDED */
bta_jv_rfcomm_connect, /* BTA_JV_API_RFCOMM_CONNECT_EVT */
bta_jv_rfcomm_close, /* BTA_JV_API_RFCOMM_CLOSE_EVT */
bta_jv_rfcomm_start_server, /* BTA_JV_API_RFCOMM_START_SERVER_EVT */
bta_jv_rfcomm_stop_server, /* BTA_JV_API_RFCOMM_STOP_SERVER_EVT */
bta_jv_rfcomm_read, /* BTA_JV_API_RFCOMM_READ_EVT */
bta_jv_rfcomm_write, /* BTA_JV_API_RFCOMM_WRITE_EVT */
bta_jv_rfcomm_flow_control, /* BTA_JV_API_RFCOMM_FLOW_CONTROL_EVT */
bta_jv_set_pm_profile, /* BTA_JV_API_SET_PM_PROFILE_EVT */
bta_jv_change_pm_state, /* BTA_JV_API_PM_STATE_CHANGE_EVT */
#if BTA_JV_L2CAP_INCLUDED
bta_jv_l2cap_connect_le, /* BTA_JV_API_L2CAP_CONNECT_LE_EVT */
bta_jv_l2cap_start_server_le, /* BTA_JV_API_L2CAP_START_SERVER_LE_EVT */
bta_jv_l2cap_stop_server_le, /* BTA_JV_API_L2CAP_STOP_SERVER_LE_EVT */
bta_jv_l2cap_write_fixed, /* BTA_JV_API_L2CAP_WRITE_FIXED_EVT */
bta_jv_l2cap_close_fixed, /* BTA_JV_API_L2CAP_CLOSE_FIXED_EVT */
#endif /* BTA_JV_L2CAP_INCLUDED */
};
/*******************************************************************************
@@ -48,25 +48,30 @@ enum {
BTA_JV_API_START_DISCOVERY_EVT,
BTA_JV_API_CREATE_RECORD_EVT,
BTA_JV_API_DELETE_RECORD_EVT,
#if BTA_JV_L2CAP_INCLUDED
BTA_JV_API_L2CAP_CONNECT_EVT,
BTA_JV_API_L2CAP_CLOSE_EVT,
BTA_JV_API_L2CAP_START_SERVER_EVT,
BTA_JV_API_L2CAP_STOP_SERVER_EVT,
BTA_JV_API_L2CAP_READ_EVT,
BTA_JV_API_L2CAP_WRITE_EVT,
#endif /* BTA_JV_L2CAP_INCLUDED */
BTA_JV_API_RFCOMM_CONNECT_EVT,
BTA_JV_API_RFCOMM_CLOSE_EVT,
BTA_JV_API_RFCOMM_START_SERVER_EVT,
BTA_JV_API_RFCOMM_STOP_SERVER_EVT,
BTA_JV_API_RFCOMM_READ_EVT,
BTA_JV_API_RFCOMM_WRITE_EVT,
BTA_JV_API_RFCOMM_FLOW_CONTROL_EVT,
BTA_JV_API_SET_PM_PROFILE_EVT,
BTA_JV_API_PM_STATE_CHANGE_EVT,
#if BTA_JV_L2CAP_INCLUDED
BTA_JV_API_L2CAP_CONNECT_LE_EVT,
BTA_JV_API_L2CAP_START_SERVER_LE_EVT,
BTA_JV_API_L2CAP_STOP_SERVER_LE_EVT,
BTA_JV_API_L2CAP_WRITE_FIXED_EVT,
BTA_JV_API_L2CAP_CLOSE_FIXED_EVT,
#endif /* BTA_JV_L2CAP_INCLUDED */
BTA_JV_MAX_INT_EVT
};
@@ -80,6 +85,12 @@ typedef struct {
tBTA_JV_DM_CBACK *p_cback;
} tBTA_JV_API_ENABLE;
/* data type for BTA_JV_API_DISABLE_EVT */
typedef struct {
BT_HDR hdr;
tBTA_JV_RFCOMM_CBACK *p_cback;
} tBTA_JV_API_DISABLE;
/* data type for BTA_JV_API_START_DISCOVERY_EVT */
typedef struct {
BT_HDR hdr;
@@ -115,6 +126,8 @@ enum {
BTA_JV_ST_SR_CLOSING
} ;
typedef UINT8 tBTA_JV_STATE;
#if BTA_JV_L2CAP_INCLUDED
#define BTA_JV_ST_CL_MAX BTA_JV_ST_CL_CLOSING
/* JV L2CAP control block */
typedef struct {
@@ -127,6 +140,7 @@ typedef struct {
tBTA_JV_PM_CB *p_pm_cb; /* ptr to pm control block, NULL: unused */
void *user_data; /* user data for callback from higher layers */
} tBTA_JV_L2C_CB;
#endif /* BTA_JV_L2CAP_INCLUDED */
#define BTA_JV_RFC_HDL_MASK 0xFF
#define BTA_JV_RFCOMM_MASK 0x80
@@ -156,6 +170,7 @@ typedef struct {
int curr_sess; /* current sessions count*/
} tBTA_JV_RFC_CB;
#if BTA_JV_L2CAP_INCLUDED
/* data type for BTA_JV_API_L2CAP_CONNECT_EVT & BTA_JV_API_L2CAP_CONNECT_LE_EVT */
typedef struct {
BT_HDR hdr;
@@ -233,6 +248,7 @@ typedef struct {
UINT16 len;
void *user_data;
} tBTA_JV_API_L2CAP_WRITE_FIXED;
#endif /* BTA_JV_L2CAP_INCLUDED */
/* data type for BTA_JV_API_RFCOMM_CONNECT_EVT */
typedef struct {
@@ -294,12 +310,21 @@ typedef struct {
tBTA_JV_PCB *p_pcb;
} tBTA_JV_API_RFCOMM_WRITE;
/* data type for BTA_JV_API_RFCOMM_FLOW_CONTROL_EVT */
typedef struct {
BT_HDR hdr;
tBTA_JV_RFC_CB *p_cb;
tBTA_JV_PCB *p_pcb;
UINT16 credits_given;
} tBTA_JV_API_RFCOMM_FLOW_CONTROL;
/* data type for BTA_JV_API_RFCOMM_CLOSE_EVT */
typedef struct {
BT_HDR hdr;
UINT32 handle;
tBTA_JV_RFC_CB *p_cb;
tBTA_JV_PCB *p_pcb;
tBTA_JV_RFCOMM_CBACK *p_cback;
void *user_data;
} tBTA_JV_API_RFCOMM_CLOSE;
@@ -326,6 +351,8 @@ typedef struct {
BT_HDR hdr;
INT32 type; /* One of BTA_JV_CONN_TYPE_ */
UINT16 scn;
tBTA_JV_RFCOMM_CBACK *p_cback;
void *user_data;
} tBTA_JV_API_FREE_CHANNEL;
/* data type for BTA_JV_API_ALLOC_CHANNEL_EVT */
@@ -340,24 +367,28 @@ typedef union {
/* GKI event buffer header */
BT_HDR hdr;
tBTA_JV_API_ENABLE enable;
tBTA_JV_API_DISABLE disable;
tBTA_JV_API_START_DISCOVERY start_discovery;
tBTA_JV_API_ALLOC_CHANNEL alloc_channel;
tBTA_JV_API_FREE_CHANNEL free_channel;
tBTA_JV_API_CREATE_RECORD create_record;
tBTA_JV_API_ADD_ATTRIBUTE add_attr;
#if BTA_JV_L2CAP_INCLUDED
tBTA_JV_API_L2CAP_CONNECT l2cap_connect;
tBTA_JV_API_L2CAP_READ l2cap_read;
tBTA_JV_API_L2CAP_WRITE l2cap_write;
tBTA_JV_API_L2CAP_CLOSE l2cap_close;
tBTA_JV_API_L2CAP_SERVER l2cap_server;
tBTA_JV_API_L2CAP_WRITE_FIXED l2cap_write_fixed;
#endif /* BTA_JV_L2CAP_INCLUDED */
tBTA_JV_API_RFCOMM_CONNECT rfcomm_connect;
tBTA_JV_API_RFCOMM_READ rfcomm_read;
tBTA_JV_API_RFCOMM_WRITE rfcomm_write;
tBTA_JV_API_RFCOMM_FLOW_CONTROL rfcomm_fc;
tBTA_JV_API_SET_PM_PROFILE set_pm;
tBTA_JV_API_PM_STATE_CHANGE change_pm_state;
tBTA_JV_API_RFCOMM_CLOSE rfcomm_close;
tBTA_JV_API_RFCOMM_SERVER rfcomm_server;
tBTA_JV_API_L2CAP_WRITE_FIXED l2cap_write_fixed;
} tBTA_JV_MSG;
/* JV control block */
@@ -368,7 +399,9 @@ typedef struct {
UINT32 sdp_handle[BTA_JV_MAX_SDP_REC]; /* SDP records created */
UINT8 *p_sel_raw_data;/* the raw data of last service select */
tBTA_JV_DM_CBACK *p_dm_cback;
#if BTA_JV_L2CAP_INCLUDED
tBTA_JV_L2C_CB l2c_cb[BTA_JV_MAX_L2C_CONN]; /* index is GAP handle (index) */
#endif /* BTA_JV_L2CAP_INCLUDED */
tBTA_JV_RFC_CB rfc_cb[BTA_JV_MAX_RFC_CONN];
tBTA_JV_PCB port_cb[MAX_RFC_PORTS]; /* index of this array is
the port_handle, */
@@ -407,25 +440,29 @@ extern void bta_jv_free_scn (tBTA_JV_MSG *p_data);
extern void bta_jv_start_discovery (tBTA_JV_MSG *p_data);
extern void bta_jv_create_record (tBTA_JV_MSG *p_data);
extern void bta_jv_delete_record (tBTA_JV_MSG *p_data);
#if BTA_JV_L2CAP_INCLUDED
extern void bta_jv_l2cap_connect (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_close (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_start_server (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_stop_server (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_read (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_write (tBTA_JV_MSG *p_data);
#endif /* BTA_JV_L2CAP_INCLUDED */
extern void bta_jv_rfcomm_connect (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_close (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_start_server (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_stop_server (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_read (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_write (tBTA_JV_MSG *p_data);
extern void bta_jv_rfcomm_flow_control(tBTA_JV_MSG *p_data);
extern void bta_jv_set_pm_profile (tBTA_JV_MSG *p_data);
extern void bta_jv_change_pm_state(tBTA_JV_MSG *p_data);
#if BTA_JV_L2CAP_INCLUDED
extern void bta_jv_l2cap_connect_le (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_start_server_le (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_stop_server_le (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_write_fixed (tBTA_JV_MSG *p_data);
extern void bta_jv_l2cap_close_fixed (tBTA_JV_MSG *p_data);
#endif /* BTA_JV_L2CAP_INCLUDED */
#endif ///defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE
#endif /* BTA_JV_INT_H */
+20 -1
View File
@@ -501,7 +501,6 @@ void bta_sys_event(BT_HDR *p_msg)
if (freebuf) {
osi_free(p_msg);
}
}
/*******************************************************************************
@@ -635,6 +634,26 @@ UINT32 bta_sys_get_remaining_ticks(TIMER_LIST_ENT *p_target_tle)
return remaining_ms;
}
/*******************************************************************************
**
** Function bta_sys_timer_is_active
**
** Description Get info of one-shot timer is active or not.
**
** Returns true if timer is exist and active, false otherwise.
**
*******************************************************************************/
BOOLEAN bta_sys_timer_is_active(TIMER_LIST_ENT *p_tle)
{
assert(p_tle != NULL);
osi_alarm_t *alarm = hash_map_get(bta_alarm_hash_map, p_tle);
if (alarm != NULL && osi_alarm_is_active(alarm)) {
return TRUE;
}
return FALSE;
}
/*******************************************************************************
**
+50 -35
View File
@@ -22,7 +22,7 @@
#include "common/bt_target.h"
#include "btc/btc_storage.h"
#include "btc/btc_ble_storage.h"
#include "esp_gap_ble_api.h"
#include "btc_gap_ble.h"
#include "btm_int.h"
#include "bta/bta_api.h"
#include "bta/bta_gatt_api.h"
@@ -103,7 +103,7 @@ void btc_dm_sec_arg_deep_copy(btc_msg_t *msg, void *dst, void *src)
void btc_dm_sec_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *data)
{
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_DM_SEC;
@@ -304,11 +304,11 @@ static void btc_dm_link_up_evt(tBTA_DM_LINK_UP *p_link_up)
BD_ADDR bd_addr;
bt_bdaddr_t bt_bdaddr;
memcpy(bd_addr, p_link_up->bd_addr, sizeof(BD_ADDR));
memcpy(bt_bdaddr.address, p_link_up->bd_addr, sizeof(BD_ADDR));
if (p_link_up->sc_downgrade == 1) {
memcpy(bt_bdaddr.address, p_link_up->bd_addr, sizeof(BD_ADDR));
if (btc_storage_remove_bonded_device(&bt_bdaddr) == BT_STATUS_SUCCESS) {
memcpy(bd_addr, p_link_up->bd_addr, sizeof(BD_ADDR));
if (BTA_DmRemoveDevice(bd_addr, BT_TRANSPORT_BR_EDR) == BTA_SUCCESS) {
BTC_TRACE_EVENT(" %s() Bonding information removed.", __FUNCTION__);
} else {
@@ -391,6 +391,7 @@ static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
break;
default:
status = BT_STATUS_FAIL;
break;
}
}
#if (BTC_GAP_BT_INCLUDED == TRUE)
@@ -404,11 +405,10 @@ static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
memcpy(param.auth_cmpl.bda, p_auth_cmpl->bd_addr, ESP_BD_ADDR_LEN);
memcpy(param.auth_cmpl.device_name, p_auth_cmpl->bd_name, ESP_BT_GAP_MAX_BDNAME_LEN + 1);
ret = btc_transfer_context(&msg, &param,
sizeof(esp_bt_gap_cb_param_t), NULL);
ret = btc_inter_profile_call(&msg, &param);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
}
#endif /// BTC_GAP_BT_INCLUDED == TRUE
@@ -427,11 +427,10 @@ static void btc_dm_pin_req_evt(tBTA_DM_PIN_REQ *p_pin_req)
param.pin_req.min_16_digit = p_pin_req->min_16_digit;
memcpy(param.pin_req.bda, p_pin_req->bd_addr, ESP_BD_ADDR_LEN);
ret = btc_transfer_context(&msg, &param,
sizeof(esp_bt_gap_cb_param_t), NULL);
ret = btc_inter_profile_call(&msg, &param);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
}
#endif /// BTC_GAP_BT_INCLUDED == TRUE
}
@@ -455,11 +454,10 @@ static void btc_dm_sp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_cfm_req)
param.cfm_req.num_val = p_cfm_req->num_val;
memcpy(param.cfm_req.bda, p_cfm_req->bd_addr, ESP_BD_ADDR_LEN);
ret = btc_transfer_context(&msg, &param,
sizeof(esp_bt_gap_cb_param_t), NULL);
ret = btc_inter_profile_call(&msg, &param);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
}
#endif /// BTC_GAP_BT_INCLUDED == TRUE
}
@@ -476,11 +474,10 @@ static void btc_dm_sp_key_notif_evt(tBTA_DM_SP_KEY_NOTIF *p_key_notif)
param.key_notif.passkey = p_key_notif->passkey;
memcpy(param.key_notif.bda, p_key_notif->bd_addr, ESP_BD_ADDR_LEN);
ret = btc_transfer_context(&msg, &param,
sizeof(esp_bt_gap_cb_param_t), NULL);
ret = btc_inter_profile_call(&msg, &param);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
}
#endif /// BTC_GAP_BT_INCLUDED == TRUE
}
@@ -496,16 +493,43 @@ static void btc_dm_sp_key_req_evt(tBTA_DM_SP_KEY_REQ *p_key_req)
msg.act = BTC_GAP_BT_KEY_REQ_EVT;
memcpy(param.key_req.bda, p_key_req->bd_addr, ESP_BD_ADDR_LEN);
ret = btc_transfer_context(&msg, &param,
sizeof(esp_bt_gap_cb_param_t), NULL);
ret = btc_inter_profile_call(&msg, &param);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
}
#endif /// BTC_GAP_BT_INCLUDED == TRUE
}
#endif /// BT_SSP_INCLUDED == TRUE
static void btc_dm_dev_unpaired_evt(tBTA_DM_LINK_DOWN *p_link_down)
{
esp_bt_gap_cb_param_t param;
BTC_TRACE_DEBUG("%s",__func__);
memcpy(param.remove_bond_dev_cmpl.bda, p_link_down->bd_addr, ESP_BD_ADDR_LEN);
btm_set_bond_type_dev(p_link_down->bd_addr, BOND_TYPE_UNKNOWN);
if (p_link_down->status == HCI_SUCCESS) {
//remove the bonded key in the config and nvs flash.
param.remove_bond_dev_cmpl.status = btc_storage_remove_bonded_device((bt_bdaddr_t *)param.remove_bond_dev_cmpl.bda);
} else {
param.remove_bond_dev_cmpl.status = ESP_BT_STATUS_FAIL;
}
#if (BTC_GAP_BT_INCLUDED == TRUE)
bt_status_t ret;
btc_msg_t msg;
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BT;
msg.act = BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT;
ret = btc_inter_profile_call(&msg, &param);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
}
#endif /// BTC_GAP_BT_INCLUDED == TRUE
}
tBTA_SERVICE_MASK btc_get_enabled_services_mask(void)
{
return btc_enabled_services;
@@ -643,16 +667,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
#endif ///BT_SSP_INCLUDED == TRUE
case BTA_DM_DEV_UNPAIRED_EVT: {
#if (SMP_INCLUDED == TRUE)
bt_bdaddr_t bd_addr;
BTC_TRACE_DEBUG("BTA_DM_DEV_UNPAIRED_EVT");
memcpy(bd_addr.address, p_data->link_down.bd_addr, sizeof(BD_ADDR));
btm_set_bond_type_dev(p_data->link_down.bd_addr, BOND_TYPE_UNKNOWN);
if (p_data->link_down.status == HCI_SUCCESS) {
//remove the bonded key in the config and nvs flash.
btc_storage_remove_bonded_device(&bd_addr);
}
#endif /* #if (SMP_INCLUDED == TRUE) */
btc_dm_dev_unpaired_evt(&p_data->link_down);
break;
}
case BTA_DM_BLE_DEV_UNPAIRED_EVT: {
@@ -685,13 +700,14 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
break;
}
#endif /* BTC_GAP_BT_INCLUDED == TRUE */
case BTA_DM_LINK_UP_EVT:
btc_dm_link_up_evt(&p_data->link_up);
case BTA_DM_LINK_DOWN_EVT:
case BTA_DM_HW_ERROR_EVT:
BTC_TRACE_DEBUG( "btc_dm_sec_cback : unhandled event (%d)\n", msg->act );
break;
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE))
case BTA_DM_LINK_UP_EVT:
btc_dm_link_up_evt(&p_data->link_up);
break;
#if ((BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE))
case BTA_DM_BLE_AUTH_CMPL_EVT: {
rsp_app = true;
ble_msg.act = ESP_GAP_BLE_AUTH_CMPL_EVT;
@@ -854,11 +870,10 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
}
if (rsp_app) {
ret = btc_transfer_context(&ble_msg, &param,
sizeof(esp_ble_gap_cb_param_t), NULL);
ret = btc_inter_profile_call(&ble_msg, &param);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
}
}
btc_dm_sec_arg_deep_free(msg);
@@ -201,7 +201,6 @@ int btc_storage_get_num_bt_bond_devices(void)
}
}
btc_config_unlock();
return num_dev;
}
@@ -215,15 +214,17 @@ int btc_storage_get_num_bt_bond_devices(void)
** BT_STATUS_FAIL otherwise
**
*******************************************************************************/
bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int dev_num)
bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int *dev_num)
{
bt_bdaddr_t bd_addr;
int in_dev_num = *dev_num; /* buffer size */
int out_dev_num = 0; /* bond_dev size */
btc_config_lock();
for (const btc_config_section_iter_t *iter = btc_config_section_begin(); iter != btc_config_section_end();
iter = btc_config_section_next(iter)) {
if (dev_num-- <= 0) {
if (in_dev_num <= 0) {
break;
}
@@ -236,9 +237,12 @@ bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int de
btc_config_exist(name, BTC_STORAGE_LINK_KEY_STR)) {
string_to_bdaddr(name, &bd_addr);
memcpy(bond_dev, &bd_addr, sizeof(bt_bdaddr_t));
in_dev_num--;
out_dev_num++;
bond_dev++;
}
}
*dev_num = out_dev_num; /* out_dev_num <= in_dev_num */
btc_config_unlock();
return BT_STATUS_SUCCESS;
@@ -89,6 +89,6 @@ int btc_storage_get_num_bt_bond_devices(void);
** BT_STATUS_FAIL otherwise
**
*******************************************************************************/
bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int dev_num);
bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int *dev_num);
#endif /* BTC_STORAGE_H */
@@ -36,8 +36,9 @@
#include "blufi_int.h"
#include "esp_blufi_api.h"
#include "esp_gatt_common_api.h"
#if (GATTS_INCLUDED == TRUE)
#if (BLUFI_INCLUDED == TRUE)
#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
@@ -283,6 +284,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
memcpy(blufi_env.remote_bda, p_data->conn.remote_bda, sizeof(esp_bd_addr_t));
blufi_env.conn_id = p_data->conn.conn_id;
blufi_env.is_connected = true;
blufi_env.recv_seq = blufi_env.send_seq = 0;
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_BLUFI;
@@ -305,7 +307,6 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
memcpy(blufi_env.remote_bda, p_data->conn.remote_bda, sizeof(esp_bd_addr_t));
blufi_env.conn_id = p_data->conn.conn_id;
blufi_env.is_connected = false;
blufi_env.recv_seq = blufi_env.send_seq = 0;
blufi_env.sec_mode = 0x0;
@@ -456,6 +457,7 @@ static void btc_blufi_recv_handler(uint8_t *data, int len)
}
}
}
void btc_blufi_send_encap(uint8_t type, uint8_t *data, int total_data_len)
{
struct blufi_hdr *hdr = NULL;
@@ -463,6 +465,11 @@ void btc_blufi_send_encap(uint8_t type, uint8_t *data, int total_data_len)
uint16_t checksum;
int ret;
if (blufi_env.is_connected == false) {
BTC_TRACE_ERROR("blufi connection has been disconnected \n");
return;
}
while (remain_len > 0) {
if (remain_len > blufi_env.frag_size) {
hdr = osi_malloc(sizeof(struct blufi_hdr) + 2 + blufi_env.frag_size + 2);
@@ -526,10 +533,21 @@ void btc_blufi_send_encap(uint8_t type, uint8_t *data, int total_data_len)
remain_len -= hdr->data_len;
}
btc_blufi_send_notify((uint8_t *)hdr,
retry:
if (blufi_env.is_connected == false) {
return;
}
if (esp_ble_get_cur_sendable_packets_num(BTC_GATT_GET_CONN_ID(blufi_env.conn_id)) > 0) {
btc_blufi_send_notify((uint8_t *)hdr,
((hdr->fc & BLUFI_FC_CHECK) ?
hdr->data_len + sizeof(struct blufi_hdr) + 2 :
hdr->data_len + sizeof(struct blufi_hdr)));
} else {
BTC_TRACE_WARNING("%s wait to send blufi custom data\n", __func__);
vTaskDelay(pdMS_TO_TICKS(10));
goto retry;
}
osi_free(hdr);
hdr = NULL;
@@ -1117,4 +1135,4 @@ uint16_t btc_blufi_get_version(void)
return BTC_BLUFI_VERSION;
}
#endif ///GATTS_INCLUDED == TRUE
#endif ///BLUFI_INCLUDED == TRUE
@@ -35,7 +35,7 @@
//#include "esp_wifi.h"
#if (GATTS_INCLUDED == TRUE)
#if (BLUFI_INCLUDED == TRUE)
extern tBLUFI_ENV blufi_env;
void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len)
@@ -269,4 +269,5 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len)
}
}
#endif ///(GATTS_INCLUDED == TRUE)
#endif ///BLUFI_INCLUDED == TRUE
@@ -15,6 +15,7 @@
#ifndef __BLUFI_INT_H__
#define __BLUFI_INT_H__
#if (BLUFI_INCLUDED == TRUE)
#define BTC_BLUFI_GREAT_VER 0x01 //Version + Subversion
#define BTC_BLUFI_SUB_VER 0x02 //Version + Subversion
#define BTC_BLUFI_VERSION ((BTC_BLUFI_GREAT_VER<<8)|BTC_BLUFI_SUB_VER) //Version + Subversion
@@ -184,3 +185,4 @@ void btc_blufi_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_blufi_cb_deep_free(btc_msg_t *msg);
#endif /* __BLUFI_INT_H__ */
#endif ///BLUFI_INCLUDED == TRUE
@@ -38,7 +38,7 @@
*******************************************************************************/
void btc_a2dp_on_init(void)
{
//tput_mon(1, 0, 1);
BTC_TRACE_EVENT("A2DP Initialized.");
}
/*****************************************************************************
@@ -127,12 +127,16 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
switch (ctrl) {
case ESP_A2D_MEDIA_CTRL_CHECK_SRC_RDY:
#if BTC_AV_SRC_INCLUDED
if (btc_a2dp_source_is_task_shutting_down()) {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
} else if ((btc_av_stream_ready() == TRUE) ||
(btc_av_stream_started_ready() == TRUE)) {
/* check whether av is ready to setup a2dp datapath */
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
if (btc_av_get_service_id() == BTA_A2DP_SOURCE_SERVICE_ID) {
if (btc_a2dp_source_is_task_shutting_down()) {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
} else if ((btc_av_stream_ready() == TRUE) ||
(btc_av_stream_started_ready() == TRUE)) {
/* check whether av is ready to setup a2dp datapath */
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
} else {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
}
} else {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
}
@@ -159,6 +163,10 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
}
break;
case ESP_A2D_MEDIA_CTRL_STOP:
if (btc_av_is_connected() == FALSE) {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
break;
}
#if BTC_AV_SRC_INCLUDED
if (btc_av_get_peer_sep() == AVDT_TSEP_SNK && !btc_a2dp_source_is_streaming() &&
btc_av_get_service_id() == BTA_A2DP_SOURCE_SERVICE_ID) {
@@ -174,7 +182,6 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
}
#endif
break;
case ESP_A2D_MEDIA_CTRL_SUSPEND:
/* local suspend */
if (btc_av_stream_started_ready()) {
@@ -184,14 +191,15 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
}
#endif
} else {
} else if (btc_av_is_connected() == TRUE) {
/* we are not in started state; just ack back ok. This can happen if we are
remotely suspended; clear REMOTE SUSPEND Flag */
btc_av_clear_remote_suspend_flag();
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
} else {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
}
break;
default :
APPL_TRACE_ERROR("### A2DP-MEDIA EVENT %u NOT HANDLED ###", ctrl);
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
@@ -88,7 +88,8 @@ enum {
layers we might need to temporarily buffer up data */
/* 18 frames is equivalent to 6.89*18*2.9 ~= 360 ms @ 44.1 khz, 20 ms mediatick */
#define MAX_OUTPUT_A2DP_SNK_FRAME_QUEUE_SZ (18)
#define JITTER_BUFFER_WATER_LEVEL (15)
#define MAX_OUTPUT_A2DP_SNK_FRAME_QUEUE_SZ (18 + JITTER_BUFFER_WATER_LEVEL)
typedef struct {
UINT16 num_frames_to_be_processed;
@@ -458,7 +459,7 @@ static void btc_a2dp_sink_data_ready(UNUSED_ATTR void *context)
tBT_SBC_HDR *p_msg;
if (fixed_queue_is_empty(btc_aa_snk_cb.RxSbcQ)) {
APPL_TRACE_DEBUG(" QUE EMPTY ");
APPL_TRACE_ERROR(" QUE EMPTY ");
} else {
if (btc_aa_snk_cb.rx_flush == TRUE) {
btc_a2dp_sink_flush_q(btc_aa_snk_cb.RxSbcQ);
@@ -775,8 +776,13 @@ UINT8 btc_a2dp_sink_enque_buf(BT_HDR *p_pkt)
p_pkt->offset + p_pkt->len)) != NULL) {
memcpy(p_msg, p_pkt, (sizeof(BT_HDR) + p_pkt->offset + p_pkt->len));
p_msg->num_frames_to_be_processed = (*((UINT8 *)(p_msg + 1) + p_msg->offset)) & 0x0f;
APPL_TRACE_VERBOSE("btc_a2dp_sink_enque_buf %d + \n", p_msg->num_frames_to_be_processed);
APPL_TRACE_DEBUG("btc_a2dp_sink_enque_buf %d + \n", p_msg->num_frames_to_be_processed);
fixed_queue_enqueue(btc_aa_snk_cb.RxSbcQ, p_msg);
if (fixed_queue_length(btc_aa_snk_cb.RxSbcQ) < JITTER_BUFFER_WATER_LEVEL) {
return fixed_queue_length(btc_aa_snk_cb.RxSbcQ);
}
btc_a2dp_sink_data_post(BTC_A2DP_SINK_DATA_EVT);
} else {
/* let caller deal with a failed allocation */
@@ -1290,8 +1290,6 @@ BOOLEAN btc_media_aa_read_feeding(void)
/* Read Data from data channel */
nb_byte_read = btc_aa_src_data_read((uint8_t *)read_buffer, read_size);
//tput_mon(TRUE, nb_byte_read, FALSE);
if (nb_byte_read < read_size) {
APPL_TRACE_WARNING("### UNDERRUN :: ONLY READ %d BYTES OUT OF %d ###",
nb_byte_read, read_size);
@@ -1503,7 +1501,7 @@ static void btc_a2dp_source_handle_timer(UNUSED_ATTR void *context)
log_tstamps_us("media task tx timer");
#if (BTA_AV_INCLUDED == TRUE)
if (btc_a2dp_source_state != BTC_A2DP_SOURCE_STATE_ON){
if (btc_a2dp_source_state != BTC_A2DP_SOURCE_STATE_ON || g_a2dp_source_ongoing_deinit){
return;
}
@@ -42,6 +42,18 @@
#if BTC_AV_INCLUDED
// global variable to inidcate avrc is initialized with a2dp
bool g_av_with_rc;
// global variable to indicate a2dp is initialized
bool g_a2dp_on_init;
// global variable to indicate a2dp is deinitialized
bool g_a2dp_on_deinit;
// global variable to indicate a2dp source deinitialization is ongoing
bool g_a2dp_source_ongoing_deinit;
// global variable to indicate a2dp sink deinitialization is ongoing
bool g_a2dp_sink_ongoing_deinit;
/*****************************************************************************
** Constants & Macros
******************************************************************************/
@@ -86,6 +98,10 @@ typedef struct {
uint16_t uuid;
} btc_av_connect_req_t;
typedef struct {
bt_bdaddr_t target_bda;
} btc_av_disconn_req_t;
/*****************************************************************************
** Static variables
******************************************************************************/
@@ -120,6 +136,7 @@ static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *data);
static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *data);
static BOOLEAN btc_av_state_started_handler(btc_sm_event_t event, void *data);
static BOOLEAN btc_av_state_closing_handler(btc_sm_event_t event, void *data);
static void clean_up(int service_id);
#if BTC_AV_SRC_INCLUDED
static bt_status_t btc_a2d_src_init(void);
@@ -284,7 +301,7 @@ static void btc_report_audio_state(esp_a2d_audio_state_t state, bt_bdaddr_t *bd_
static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
{
BTC_TRACE_DEBUG("%s event:%s flags %x\n", __FUNCTION__,
BTC_TRACE_DEBUG("%s event: %s flags %x\n", __FUNCTION__,
dump_av_sm_event_name(event), btc_av_cb.flags);
switch (event) {
@@ -309,20 +326,34 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
case BTA_AV_PENDING_EVT:
case BTC_AV_CONNECT_REQ_EVT: {
if (event == BTC_AV_CONNECT_REQ_EVT) {
memcpy(&btc_av_cb.peer_bda, &((btc_av_connect_req_t *)p_data)->target_bda,
sizeof(bt_bdaddr_t));
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
TRUE, BTA_SEC_AUTHENTICATE, ((btc_av_connect_req_t *)p_data)->uuid);
memcpy(&btc_av_cb.peer_bda, &((btc_av_connect_req_t *)p_data)->target_bda, sizeof(bt_bdaddr_t));
if (g_av_with_rc) {
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
TRUE, BTA_SEC_AUTHENTICATE, ((btc_av_connect_req_t *)p_data)->uuid);
} else {
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
FALSE, BTA_SEC_AUTHENTICATE, ((btc_av_connect_req_t *)p_data)->uuid);
}
} else if (event == BTA_AV_PENDING_EVT) {
bdcpy(btc_av_cb.peer_bda.address, ((tBTA_AV *)p_data)->pend.bd_addr);
UINT16 uuid = (btc_av_cb.service_id == BTA_A2DP_SOURCE_SERVICE_ID) ? UUID_SERVCLASS_AUDIO_SOURCE :
UUID_SERVCLASS_AUDIO_SINK;
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
TRUE, BTA_SEC_AUTHENTICATE, uuid);
UINT16 uuid = (btc_av_cb.service_id == BTA_A2DP_SOURCE_SERVICE_ID) ? UUID_SERVCLASS_AUDIO_SOURCE : UUID_SERVCLASS_AUDIO_SINK;
if (g_av_with_rc) {
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
TRUE, BTA_SEC_AUTHENTICATE, uuid);
} else {
BTA_AvOpen(btc_av_cb.peer_bda.address, btc_av_cb.bta_handle,
FALSE, BTA_SEC_AUTHENTICATE, uuid);
}
}
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_OPENING);
} break;
case BTC_AV_DISCONNECT_REQ_EVT:
BTC_TRACE_WARNING("No Link At All.");
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &((btc_av_disconn_req_t *)p_data)->target_bda, 0);
break;
case BTA_AV_RC_OPEN_EVT:
/* IOP_FIX: Jabra 620 only does RC open without AV open whenever it connects. So
* as per the AV WP, an AVRC connection cannot exist without an AV connection. Therefore,
@@ -333,7 +364,6 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
*
* TODO: We may need to do this only on an AVRCP Play. FixMe
*/
#if BTC_AV_SRC_INCLUDED
BTC_TRACE_DEBUG("BTA_AV_RC_OPEN_EVT received w/o AV");
tle_av_open_on_rc = osi_alarm_new("AVconn", btc_initiate_av_open_tmr_hdlr, NULL, BTC_TIMEOUT_AV_OPEN_ON_RC_SECS * 1000);
@@ -361,15 +391,13 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
break;
default:
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__,
dump_av_sm_event_name(event));
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__, dump_av_sm_event_name(event));
return FALSE;
}
return TRUE;
}
/*****************************************************************************
/*****************************************************************************
**
** Function btc_av_state_opening_handler
**
@@ -382,7 +410,7 @@ static BOOLEAN btc_av_state_idle_handler(btc_sm_event_t event, void *p_data)
static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data)
{
BTC_TRACE_DEBUG("%s event:%s flags %x\n", __FUNCTION__,
BTC_TRACE_DEBUG("%s event: %s flags %x\n", __FUNCTION__,
dump_av_sm_event_name(event), btc_av_cb.flags);
switch (event) {
@@ -395,35 +423,36 @@ static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data)
break;
case BTA_AV_REJECT_EVT:
BTC_TRACE_DEBUG(" Received BTA_AV_REJECT_EVT \n");
BTC_TRACE_WARNING(" Received BTA_AV_REJECT_EVT \n");
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda), 0);
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
break;
case BTA_AV_OPEN_EVT: {
tBTA_AV *p_bta_data = (tBTA_AV *)p_data;
esp_a2d_connection_state_t state;
esp_a2d_connection_state_t conn_stat;
btc_sm_state_t av_state;
BTC_TRACE_DEBUG("status:%d, edr 0x%x, peer sep %d\n", p_bta_data->open.status,
p_bta_data->open.edr, p_bta_data->open.sep);
if (p_bta_data->open.status == BTA_AV_SUCCESS) {
state = ESP_A2D_CONNECTION_STATE_CONNECTED;
av_state = BTC_AV_STATE_OPENED;
btc_av_cb.edr = p_bta_data->open.edr;
btc_av_cb.peer_sep = p_bta_data->open.sep;
conn_stat = ESP_A2D_CONNECTION_STATE_CONNECTED;
av_state = BTC_AV_STATE_OPENED;
} else {
BTC_TRACE_WARNING("BTA_AV_OPEN_EVT::FAILED status: %d\n",
p_bta_data->open.status );
state = ESP_A2D_CONNECTION_STATE_DISCONNECTED;
av_state = BTC_AV_STATE_IDLE;
BTC_TRACE_WARNING("BTA_AV_OPEN_EVT::FAILED status: %d\n", p_bta_data->open.status );
conn_stat = ESP_A2D_CONNECTION_STATE_DISCONNECTED;
av_state = BTC_AV_STATE_IDLE;
}
/* inform the application of the event */
btc_report_connection_state(state, &(btc_av_cb.peer_bda), 0);
btc_report_connection_state(conn_stat, &(btc_av_cb.peer_bda), 0);
/* change state to open/idle based on the status */
btc_sm_change_state(btc_av_cb.sm_handle, av_state);
if (btc_av_cb.peer_sep == AVDT_TSEP_SNK) {
/* if queued PLAY command, send it now */
/* necessary to add this?
@@ -432,8 +461,12 @@ static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data)
*/
} else if (btc_av_cb.peer_sep == AVDT_TSEP_SRC &&
(p_bta_data->open.status == BTA_AV_SUCCESS)) {
/* Bring up AVRCP connection too */
BTA_AvOpenRc(btc_av_cb.bta_handle);
/* Bring up AVRCP connection too if AVRC Initialized */
if(g_av_with_rc) {
BTA_AvOpenRc(btc_av_cb.bta_handle);
} else {
BTC_TRACE_WARNING("AVRC not Init, not using it.");
}
}
btc_queue_advance();
} break;
@@ -473,11 +506,10 @@ static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data)
break;
}
CHECK_RC_EVENT(event, p_data);
CHECK_RC_EVENT(event, p_data);
default:
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__,
dump_av_sm_event_name(event));
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__, dump_av_sm_event_name(event));
return FALSE;
}
@@ -498,7 +530,7 @@ static BOOLEAN btc_av_state_opening_handler(btc_sm_event_t event, void *p_data)
static BOOLEAN btc_av_state_closing_handler(btc_sm_event_t event, void *p_data)
{
BTC_TRACE_DEBUG("%s event:%s flags %x\n", __FUNCTION__,
BTC_TRACE_DEBUG("%s event: %s flags %x\n", __FUNCTION__,
dump_av_sm_event_name(event), btc_av_cb.flags);
switch (event) {
@@ -539,9 +571,7 @@ static BOOLEAN btc_av_state_closing_handler(btc_sm_event_t event, void *p_data)
case BTA_AV_CLOSE_EVT: {
tBTA_AV_CLOSE *close = (tBTA_AV_CLOSE *)p_data;
/* inform the application that we are disconnecting */
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda),
close->disc_rsn);
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda), close->disc_rsn);
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
break;
}
@@ -552,14 +582,12 @@ static BOOLEAN btc_av_state_closing_handler(btc_sm_event_t event, void *p_data)
break;
default:
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__,
dump_av_sm_event_name(event));
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__, dump_av_sm_event_name(event));
return FALSE;
}
return TRUE;
}
/*****************************************************************************
**
** Function btc_av_state_opened_handler
@@ -569,12 +597,11 @@ static BOOLEAN btc_av_state_closing_handler(btc_sm_event_t event, void *p_data)
** Returns TRUE if event was processed, FALSE otherwise
**
*******************************************************************************/
static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *p_data)
{
tBTA_AV *p_av = (tBTA_AV *)p_data;
BTC_TRACE_DEBUG("%s event:%s flags %x\n", __FUNCTION__,
BTC_TRACE_DEBUG("%s event: %s flags %x\n", __FUNCTION__,
dump_av_sm_event_name(event), btc_av_cb.flags);
if ( (event == BTA_AV_REMOTE_CMD_EVT) && (btc_av_cb.flags & BTC_AV_FLAG_REMOTE_SUSPEND) &&
@@ -654,10 +681,9 @@ static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *p_data)
case BTC_AV_DISCONNECT_REQ_EVT:
BTA_AvClose(btc_av_cb.bta_handle);
if (btc_av_cb.peer_sep == AVDT_TSEP_SRC) {
if (btc_av_cb.peer_sep == AVDT_TSEP_SRC && g_av_with_rc == true) {
BTA_AvCloseRc(btc_av_cb.bta_handle);
}
/* inform the application that we are disconnecting */
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTING, &(btc_av_cb.peer_bda), 0);
break;
@@ -665,18 +691,22 @@ static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *p_data)
case BTA_AV_CLOSE_EVT: {
/* avdtp link is closed */
btc_a2dp_on_stopped(NULL);
tBTA_AV_CLOSE *close = (tBTA_AV_CLOSE *)p_data;
/* inform the application that we are disconnected */
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda),
close->disc_rsn);
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda), close->disc_rsn);
/* change state to idle, send acknowledgement if start is pending */
if (btc_av_cb.flags & BTC_AV_FLAG_PENDING_START) {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
/* pending start flag will be cleared when exit current state */
}
/* change state to idle, send acknowledgement if start is pending */
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
if (g_a2dp_source_ongoing_deinit) {
clean_up(BTA_A2DP_SOURCE_SERVICE_ID);
} else if (g_a2dp_sink_ongoing_deinit) {
clean_up(BTA_A2DP_SINK_SERVICE_ID);
}
break;
}
@@ -703,11 +733,10 @@ static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *p_data)
btc_queue_advance();
break;
CHECK_RC_EVENT(event, p_data);
CHECK_RC_EVENT(event, p_data);
default:
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__,
dump_av_sm_event_name(event));
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__, dump_av_sm_event_name(event));
return FALSE;
}
@@ -728,27 +757,22 @@ static BOOLEAN btc_av_state_started_handler(btc_sm_event_t event, void *p_data)
{
tBTA_AV *p_av = (tBTA_AV *)p_data;
BTC_TRACE_DEBUG("%s event:%s flags %x\n", __FUNCTION__,
BTC_TRACE_DEBUG("%s event: %s flags %x\n", __FUNCTION__,
dump_av_sm_event_name(event), btc_av_cb.flags);
switch (event) {
case BTC_SM_ENTER_EVT:
/* we are again in started state, clear any remote suspend flags */
btc_av_cb.flags &= ~BTC_AV_FLAG_REMOTE_SUSPEND;
btc_report_audio_state(ESP_A2D_AUDIO_STATE_STARTED, &(btc_av_cb.peer_bda));
/* increase the a2dp consumer task priority temporarily when start
** audio playing, to avoid overflow the audio packet queue. */
// adjust_priority_a2dp(TRUE);
break;
case BTC_SM_EXIT_EVT:
/* restore the a2dp consumer task priority when stop audio playing. */
// adjust_priority_a2dp(FALSE);
break;
case BTC_AV_START_STREAM_REQ_EVT:
@@ -763,11 +787,9 @@ static BOOLEAN btc_av_state_started_handler(btc_sm_event_t event, void *p_data)
/* fixme -- use suspend = true always to work around issue with BTA AV */
case BTC_AV_STOP_STREAM_REQ_EVT:
case BTC_AV_SUSPEND_STREAM_REQ_EVT:
/* set pending flag to ensure btc task is not trying to restart
stream while suspend is in progress */
btc_av_cb.flags |= BTC_AV_FLAG_LOCAL_SUSPEND_PENDING;
/* if we were remotely suspended but suspend locally, local suspend
always overrides */
btc_av_cb.flags &= ~BTC_AV_FLAG_REMOTE_SUSPEND;
@@ -787,25 +809,19 @@ static BOOLEAN btc_av_state_started_handler(btc_sm_event_t event, void *p_data)
break;
case BTC_AV_DISCONNECT_REQ_EVT:
/* request avdtp to close */
BTA_AvClose(btc_av_cb.bta_handle);
if (btc_av_cb.peer_sep == AVDT_TSEP_SRC) {
if (btc_av_cb.peer_sep == AVDT_TSEP_SRC && g_av_with_rc == true) {
BTA_AvCloseRc(btc_av_cb.bta_handle);
}
/* inform the application that we are disconnecting */
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTING, &(btc_av_cb.peer_bda), 0);
/* wait in closing state until fully closed */
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_CLOSING);
break;
case BTA_AV_SUSPEND_EVT:
BTC_TRACE_DEBUG("BTA_AV_SUSPEND_EVT status %d, init %d\n",
p_av->suspend.status, p_av->suspend.initiator);
BTC_TRACE_DEBUG("BTA_AV_SUSPEND_EVT status %d, init %d\n", p_av->suspend.status, p_av->suspend.initiator);
/* a2dp suspended, stop media task until resumed */
btc_a2dp_on_suspended(&p_av->suspend);
@@ -824,7 +840,6 @@ static BOOLEAN btc_av_state_started_handler(btc_sm_event_t event, void *p_data)
if (p_av->suspend.initiator != TRUE) {
/* remote suspend, notify HAL and await audioflinger to
suspend/stop stream */
/* set remote suspend flag to block media task from restarting
stream only if we did not already initiate a local suspend */
if ((btc_av_cb.flags & BTC_AV_FLAG_LOCAL_SUSPEND_PENDING) == 0) {
@@ -843,42 +858,39 @@ static BOOLEAN btc_av_state_started_handler(btc_sm_event_t event, void *p_data)
break;
case BTA_AV_STOP_EVT:
btc_av_cb.flags |= BTC_AV_FLAG_PENDING_STOP;
btc_a2dp_on_stopped(&p_av->suspend);
btc_report_audio_state(ESP_A2D_AUDIO_STATE_STOPPED, &(btc_av_cb.peer_bda));
/* if stop was successful, change state to open */
if (p_av->suspend.status == BTA_AV_SUCCESS) {
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_OPENED);
}
break;
case BTA_AV_CLOSE_EVT: {
btc_av_cb.flags |= BTC_AV_FLAG_PENDING_STOP;
/* avdtp link is closed */
btc_a2dp_on_stopped(NULL);
tBTA_AV_CLOSE *close = (tBTA_AV_CLOSE *)p_data;
/* inform the application that we are disconnected */
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda),
close->disc_rsn);
btc_report_connection_state(ESP_A2D_CONNECTION_STATE_DISCONNECTED, &(btc_av_cb.peer_bda), close->disc_rsn);
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_IDLE);
if (g_a2dp_source_ongoing_deinit) {
clean_up(BTA_A2DP_SOURCE_SERVICE_ID);
} else if (g_a2dp_sink_ongoing_deinit) {
clean_up(BTA_A2DP_SINK_SERVICE_ID);
}
break;
}
CHECK_RC_EVENT(event, p_data);
default:
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__,
dump_av_sm_event_name(event));
BTC_TRACE_WARNING("%s : unhandled event:%s\n", __FUNCTION__, dump_av_sm_event_name(event));
return FALSE;
}
return TRUE;
}
@@ -957,7 +969,6 @@ static void btc_av_event_free_data(btc_sm_event_t event, void *p_data)
** Returns bt_status_t
**
*******************************************************************************/
static bt_status_t btc_av_init(int service_id)
{
if (btc_av_cb.sm_handle == NULL) {
@@ -974,7 +985,11 @@ static bt_status_t btc_av_init(int service_id)
}
if (!stat) {
return BT_STATUS_FAIL;
g_a2dp_on_init = false;
g_a2dp_on_deinit = true;
g_a2dp_source_ongoing_deinit = false;
g_a2dp_sink_ongoing_deinit = false;
goto av_init_fail;
}
/* Also initialize the AV state machine */
@@ -986,12 +1001,20 @@ static bt_status_t btc_av_init(int service_id)
} else {
btc_dm_enable_service(BTA_A2DP_SOURCE_SERVICE_ID);
}
btc_a2dp_on_init();
g_a2dp_on_init = true;
g_a2dp_on_deinit = false;
g_a2dp_source_ongoing_deinit = false;
g_a2dp_sink_ongoing_deinit = false;
esp_a2d_cb_param_t param;
memset(&param, 0, sizeof(esp_a2d_cb_param_t));
param.a2d_prof_stat.init_state = ESP_A2D_INIT_SUCCESS;
btc_a2d_cb_to_app(ESP_A2D_PROF_STATE_EVT, &param);
return BT_STATUS_SUCCESS;
}
av_init_fail:
return BT_STATUS_FAIL;
}
@@ -1038,11 +1061,13 @@ static void clean_up(int service_id)
tle_av_open_on_rc = NULL;
}
#endif /* BTC_AV_SRC_INCLUDED */
btc_dm_disable_service(BTA_A2DP_SOURCE_SERVICE_ID);
}
btc_dm_disable_service(BTA_A2DP_SOURCE_SERVICE_ID);
if (service_id == BTA_A2DP_SINK_SERVICE_ID) {
#if BTC_AV_SINK_INCLUDED
btc_a2dp_sink_shutdown();
#endif /* BTC_AV_SINK_INCLUDED */
btc_dm_disable_service(BTA_A2DP_SINK_SERVICE_ID);
}
@@ -1050,11 +1075,15 @@ static void clean_up(int service_id)
btc_sm_shutdown(btc_av_cb.sm_handle);
btc_av_cb.sm_handle = NULL;
if (service_id == BTA_A2DP_SINK_SERVICE_ID) {
#if BTC_AV_SINK_INCLUDED
btc_a2dp_sink_shutdown();
#endif /* BTC_AV_SINK_INCLUDED */
}
esp_a2d_cb_param_t param;
memset(&param, 0, sizeof(esp_a2d_cb_param_t));
param.a2d_prof_stat.init_state = ESP_A2D_DEINIT_SUCCESS;
btc_a2d_cb_to_app(ESP_A2D_PROF_STATE_EVT, &param);
g_a2dp_on_init = false;
g_a2dp_on_deinit = true;
g_a2dp_source_ongoing_deinit = false;
g_a2dp_sink_ongoing_deinit = false;
}
/*******************************************************************************
@@ -1229,10 +1258,16 @@ bt_status_t btc_av_execute_service(BOOLEAN b_enable, UINT8 tsep)
/* Added BTA_AV_FEAT_NO_SCO_SSPD - this ensures that the BTA does not
* auto-suspend av streaming on AG events(SCO or Call). The suspend shall
* be initiated by the app/audioflinger layers */
BTA_AvEnable(BTA_SEC_AUTHENTICATE, (BTA_AV_FEAT_NO_SCO_SSPD)
| BTA_AV_FEAT_RCTG | BTA_AV_FEAT_METADATA | BTA_AV_FEAT_VENDOR
| BTA_AV_FEAT_RCCT | BTA_AV_FEAT_ADV_CTRL,
bte_av_callback);
if (g_av_with_rc) {
BTC_TRACE_WARNING("A2DP Enable with AVRC")
BTA_AvEnable(BTA_SEC_AUTHENTICATE, BTA_AV_FEAT_NO_SCO_SSPD |
BTA_AV_FEAT_RCTG | BTA_AV_FEAT_METADATA | BTA_AV_FEAT_VENDOR |
BTA_AV_FEAT_RCCT | BTA_AV_FEAT_ADV_CTRL,
bte_av_callback);
} else {
BTC_TRACE_WARNING("A2DP Enable without AVRC")
BTA_AvEnable(BTA_SEC_AUTHENTICATE, BTA_AV_FEAT_NO_SCO_SSPD, bte_av_callback);
}
BTA_AvRegister(BTA_AV_CHNL_AUDIO, BTC_AV_SERVICE_NAME, 0, bte_av_media_callback, &bta_av_a2d_cos, tsep);
} else {
BTA_AvDeregister(btc_av_cb.bta_handle);
@@ -1384,7 +1419,9 @@ void btc_a2dp_call_handler(btc_msg_t *msg)
}
case BTC_AV_SINK_API_DISCONNECT_EVT: {
CHECK_BTAV_INIT();
btc_sm_dispatch(btc_av_cb.sm_handle, BTC_AV_DISCONNECT_REQ_EVT, NULL);
btc_av_disconn_req_t disconn_req;
memcpy(&disconn_req.target_bda, &arg->disconn, sizeof(bt_bdaddr_t));
btc_sm_dispatch(btc_av_cb.sm_handle, BTC_AV_DISCONNECT_REQ_EVT, &disconn_req);
break;
}
case BTC_AV_SINK_API_REG_DATA_CB_EVT: {
@@ -1407,7 +1444,9 @@ void btc_a2dp_call_handler(btc_msg_t *msg)
}
case BTC_AV_SRC_API_DISCONNECT_EVT: {
CHECK_BTAV_INIT();
btc_sm_dispatch(btc_av_cb.sm_handle, BTC_AV_DISCONNECT_REQ_EVT, NULL);
btc_av_disconn_req_t disconn_req;
memcpy(&disconn_req.target_bda, &arg->src_disconn, sizeof(bt_bdaddr_t));
btc_sm_dispatch(btc_av_cb.sm_handle, BTC_AV_DISCONNECT_REQ_EVT, &disconn_req);
break;
}
case BTC_AV_SRC_API_REG_DATA_CB_EVT: {
@@ -1472,7 +1511,15 @@ static bt_status_t btc_a2d_sink_connect(bt_bdaddr_t *remote_bda)
static void btc_a2d_sink_deinit(void)
{
clean_up(BTA_A2DP_SINK_SERVICE_ID);
g_a2dp_sink_ongoing_deinit = true;
if (btc_av_is_connected()) {
BTA_AvClose(btc_av_cb.bta_handle);
if (btc_av_cb.peer_sep == AVDT_TSEP_SRC && g_av_with_rc == true) {
BTA_AvCloseRc(btc_av_cb.bta_handle);
}
} else {
clean_up(BTA_A2DP_SINK_SERVICE_ID);
}
}
#endif /* BTC_AV_SINK_INCLUDED */
@@ -1497,7 +1544,15 @@ static bt_status_t btc_a2d_src_init(void)
static void btc_a2d_src_deinit(void)
{
clean_up(BTA_A2DP_SOURCE_SERVICE_ID);
g_a2dp_source_ongoing_deinit = true;
if (btc_av_is_connected()) {
BTA_AvClose(btc_av_cb.bta_handle);
if (btc_av_cb.peer_sep == AVDT_TSEP_SNK && g_av_with_rc == true) {
BTA_AvCloseRc(btc_av_cb.bta_handle);
}
} else {
clean_up(BTA_A2DP_SOURCE_SERVICE_ID);
}
}
static bt_status_t btc_a2d_src_connect(bt_bdaddr_t *remote_bda)
@@ -424,6 +424,14 @@ static void btc_avrc_ct_init(void)
BTC_TRACE_DEBUG("## %s ##", __FUNCTION__);
memset (&btc_rc_vb, 0, sizeof(btc_rc_vb));
if (!g_av_with_rc) {
g_av_with_rc = true;
}
if (g_a2dp_on_init) {
BTC_TRACE_WARNING("AVRC Controller is expected to be initialized in advance of A2DP !!!");
}
btc_rc_vb.rc_vol_label = MAX_LABEL;
btc_rc_vb.rc_volume = MAX_VOLUME;
}
@@ -442,6 +450,13 @@ static void btc_avrc_ct_deinit(void)
{
BTC_TRACE_API("## %s ##", __FUNCTION__);
if (g_a2dp_on_deinit) {
BTC_TRACE_WARNING("A2DP already deinit, AVRC CT shuold deinit in advance of A2DP !!!");
}
if (g_av_with_rc) {
g_av_with_rc = false;
}
memset(&btc_rc_vb, 0, sizeof(btc_rc_cb_t));
BTC_TRACE_API("## %s ## completed", __FUNCTION__);
}
@@ -204,8 +204,8 @@ static void btc_to_bta_adv_data(esp_ble_adv_data_t *p_adv_data, tBTA_BLE_ADV_DAT
if (NULL != p_elem) {
memcpy(p_elem++, p_elem_service_data, sizeof(tBTA_BLE_PROP_ELEM));
}
osi_free(p_elem_service_data);
}
osi_free(p_elem_service_data);
}
if (p_adv_data->service_uuid_len && p_adv_data->p_service_uuid) {
@@ -290,7 +290,7 @@ static void btc_adv_data_callback(tBTA_STATUS status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -309,7 +309,7 @@ static void btc_scan_rsp_data_callback(tBTA_STATUS status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -328,7 +328,7 @@ static void btc_adv_data_raw_callback(tBTA_STATUS status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -347,7 +347,7 @@ static void btc_scan_rsp_data_raw_callback(tBTA_STATUS status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -392,7 +392,7 @@ static void btc_start_adv_callback(uint8_t status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -411,7 +411,7 @@ static void btc_stop_adv_callback(uint8_t status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -430,7 +430,7 @@ void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -511,7 +511,7 @@ static void btc_scan_params_callback(tGATT_IF gatt_if, tBTM_STATUS status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -550,7 +550,7 @@ static void btc_ble_set_scan_params(esp_ble_scan_params_t *scan_params, tBLE_SCA
static void btc_search_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data)
{
esp_ble_gap_cb_param_t param;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -618,7 +618,7 @@ static void btc_start_scan_callback(uint8_t status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -637,7 +637,7 @@ static void btc_stop_scan_callback(tBTA_STATUS status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -659,7 +659,7 @@ void btc_update_conn_param_callback (UINT8 status, BD_ADDR bd_addr, tBTM_LE_UPDA
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT;
@@ -682,7 +682,7 @@ static void btc_set_pkt_length_callback(UINT8 status, tBTM_LE_SET_PKT_DATA_LENGT
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT;
@@ -701,7 +701,7 @@ static void btc_add_whitelist_complete_callback(UINT8 status, tBTM_WL_OPERATION
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT;
@@ -719,7 +719,7 @@ static void btc_set_rand_addr_callback(UINT8 status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
param.set_rand_addr_cmpl.status = btc_btm_status_to_esp_status(status); //todo status
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
@@ -737,7 +737,7 @@ static void btc_set_local_privacy_callback(UINT8 status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT;
@@ -766,7 +766,7 @@ static void btc_read_ble_rssi_cmpl_callback(void *p_data)
tBTA_RSSI_RESULTS *result = (tBTA_RSSI_RESULTS *)p_data;
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT;
@@ -856,22 +856,38 @@ static void btc_ble_set_rand_addr (BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *
The two most significant bits of the address shall be equal to 1
All bits of the random part of the address shall not be equal to 1
All bits of the random part of the address shall not be equal to 0
A non-resolvable private address is a 48-bit randomly generated address and shall meet the following requirements:
The two most significant bits of the address shall be equal to 0
All bits of the random part of the address shall not be equal to 1
All bits of the random part of the address shall not be equal to 0
*/
BD_ADDR invalid_rand_addr_a, invalid_rand_addr_b;
memset(invalid_rand_addr_a, 0xff, sizeof(BD_ADDR));
memset(invalid_rand_addr_b, 0x00, sizeof(BD_ADDR));
invalid_rand_addr_b[0] = invalid_rand_addr_b[0] | BT_STATIC_RAND_ADDR_MASK;
if((rand_addr[0] & BT_STATIC_RAND_ADDR_MASK) == BT_STATIC_RAND_ADDR_MASK
&& memcmp(invalid_rand_addr_a, rand_addr, BD_ADDR_LEN) != 0
&& memcmp(invalid_rand_addr_b, rand_addr, BD_ADDR_LEN) != 0){
BTA_DmSetRandAddress(rand_addr, btc_set_rand_addr_callback);
} else {
if((rand_addr[0] & BT_STATIC_RAND_ADDR_MASK) == BT_STATIC_RAND_ADDR_MASK) {
invalid_rand_addr_b[0] = invalid_rand_addr_b[0] | BT_STATIC_RAND_ADDR_MASK;
if (memcmp(invalid_rand_addr_a, rand_addr, BD_ADDR_LEN) != 0 && memcmp(invalid_rand_addr_b, rand_addr, BD_ADDR_LEN) != 0) {
BTA_DmSetRandAddress(rand_addr, btc_set_rand_addr_callback);
} else {
btc_set_rand_addr_callback(BTM_INVALID_STATIC_RAND_ADDR);
BTC_TRACE_ERROR("Invalid static random address, the high bit should be 0b11, bits of the random part shall not be all 1 or 0");
}
} else if ((rand_addr[0] | BT_NON_RPA_MASK) == BT_NON_RPA_MASK) {
invalid_rand_addr_a[0] = invalid_rand_addr_a[0] & BT_NON_RPA_MASK;
if (memcmp(invalid_rand_addr_a, rand_addr, BD_ADDR_LEN) != 0 && memcmp(invalid_rand_addr_b, rand_addr, BD_ADDR_LEN) != 0) {
BTA_DmSetRandAddress(rand_addr, btc_set_rand_addr_callback);
} else {
btc_set_rand_addr_callback(BTM_INVALID_STATIC_RAND_ADDR);
BTC_TRACE_ERROR("Invalid non-resolvable private address, the high bit should be 0b00, bits of the random part shall not be all 1 or 0");
}
}else {
btc_set_rand_addr_callback(BTM_INVALID_STATIC_RAND_ADDR);
BTC_TRACE_ERROR("Invalid random address, the high bit should be 0b11, bits of the random part shall not be all 1 or 0");
BTC_TRACE_ERROR("Invalid random address type");
}
} else {
btc_set_rand_addr_callback(BTM_INVALID_STATIC_RAND_ADDR);
BTC_TRACE_ERROR("Invalid random addressm, the address value is NULL");
BTC_TRACE_ERROR("Invalid address, the address value is NULL");
}
}
@@ -1120,7 +1136,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
BTA_DmUpdateWhiteList(arg->update_white_list.add_remove, arg->update_white_list.remote_bda, btc_add_whitelist_complete_callback);
break;
case BTC_GAP_BLE_ACT_READ_RSSI:
BTA_DmBleReadRSSI(arg->read_rssi.remote_addr, BTA_TRANSPORT_LE, btc_read_ble_rssi_cmpl_callback);
BTA_DmReadRSSI(arg->read_rssi.remote_addr, BTA_TRANSPORT_LE, btc_read_ble_rssi_cmpl_callback);
break;
case BTC_GAP_BLE_ACT_SET_CONN_PARAMS:
BTA_DmSetBlePrefConnParams(arg->set_conn_params.bd_addr, arg->set_conn_params.min_conn_int,
@@ -1220,6 +1236,12 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
bta_dm_co_ble_oob_support(enable);
break;
}
case ESP_BLE_APP_ENC_KEY_SIZE: {
uint8_t key_size = 0;
STREAM_TO_UINT8(key_size, value);
bta_dm_co_ble_set_appl_enc_key_size(key_size);
break;
}
default:
break;
}
@@ -633,7 +633,7 @@ static void btc_gap_bt_read_rssi_delta_cmpl_callback(void *p_data)
static void btc_gap_bt_read_rssi_delta(btc_gap_bt_args_t *arg)
{
BTA_DmBleReadRSSI(arg->read_rssi_delta.bda.address, BTA_TRANSPORT_BR_EDR, btc_gap_bt_read_rssi_delta_cmpl_callback);
BTA_DmReadRSSI(arg->read_rssi_delta.bda.address, BTA_TRANSPORT_BR_EDR, btc_gap_bt_read_rssi_delta_cmpl_callback);
}
static esp_err_t btc_gap_bt_remove_bond_device(btc_gap_bt_args_t *arg)
@@ -852,6 +852,7 @@ void btc_gap_bt_cb_deep_free(btc_msg_t *msg)
case BTC_GAP_BT_READ_RSSI_DELTA_EVT:
case BTC_GAP_BT_AUTH_CMPL_EVT:
case BTC_GAP_BT_PIN_REQ_EVT:
case BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT:
#if (BT_SSP_INCLUDED == TRUE)
case BTC_GAP_BT_CFM_REQ_EVT:
case BTC_GAP_BT_KEY_NOTIF_EVT:
@@ -905,6 +906,10 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg)
break;
}
#endif ///BT_SSP_INCLUDED == TRUE
case BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT:{
btc_gap_bt_cb_to_app(ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT,(esp_bt_gap_cb_param_t *)msg->arg);
break;
}
default:
BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act);
break;
@@ -121,14 +121,14 @@ static void btc_gattc_copy_req_data(btc_msg_t *msg, void *p_dest, void *p_src)
tBTA_GATTC *p_dest_data = (tBTA_GATTC *) p_dest;
tBTA_GATTC *p_src_data = (tBTA_GATTC *) p_src;
if (!p_src_data || !p_dest_data) {
if (!p_src_data || !p_dest_data || !msg) {
return;
}
// Allocate buffer for request data if necessary
switch (msg->act) {
case BTA_GATTC_READ_DESCR_EVT:
case BTA_GATTC_READ_CHAR_EVT:
case BTA_GATTC_READ_CHAR_EVT:
case BTA_GATTC_READ_MULTIPLE_EVT: {
if (p_src_data->read.p_value && p_src_data->read.p_value->p_value) {
p_dest_data->read.p_value = (tBTA_GATT_UNFMT *)osi_malloc(sizeof(tBTA_GATT_UNFMT) + p_src_data->read.p_value->len);
@@ -164,7 +164,7 @@ static void btc_gattc_free_req_data(btc_msg_t *msg)
tBTA_GATTC *arg = (tBTA_GATTC *)(msg->arg);
switch (msg->act) {
case BTA_GATTC_READ_DESCR_EVT:
case BTA_GATTC_READ_CHAR_EVT:
case BTA_GATTC_READ_CHAR_EVT:
case BTA_GATTC_READ_MULTIPLE_EVT: {
if (arg->read.p_value) {
osi_free(arg->read.p_value);
@@ -186,7 +186,7 @@ static void btc_gattc_free_req_data(btc_msg_t *msg)
static void btc_gattc_cback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
{
bt_status_t ret;
btc_msg_t msg;
btc_msg_t msg= {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GATTC;
@@ -613,6 +613,14 @@ static void btc_gattc_read_char_descr(btc_ble_gattc_args_t *arg)
BTA_GATTC_ReadCharDescr(arg->read_descr.conn_id, arg->read_descr.handle, arg->read_descr.auth_req);
}
static void btc_gattc_read_by_type(btc_ble_gattc_args_t *arg)
{
tBT_UUID uuid;
btc_to_bta_uuid(&uuid, &(arg->read_by_type.uuid));
BTA_GATTC_Read_by_type(arg->read_by_type.conn_id, arg->read_by_type.s_handle, arg->read_by_type.e_handle, &uuid, arg->read_by_type.auth_req);
}
static void btc_gattc_write_char(btc_ble_gattc_args_t *arg)
{
BTA_GATTC_WriteCharValue(arg->write_char.conn_id,
@@ -724,6 +732,9 @@ void btc_gattc_call_handler(btc_msg_t *msg)
case BTC_GATTC_ACT_READ_CHAR_DESCR:
btc_gattc_read_char_descr(arg);
break;
case BTC_GATTC_ACT_READ_BY_TYPE:
btc_gattc_read_by_type(arg);
break;
case BTC_GATTC_ACT_WRITE_CHAR:
btc_gattc_write_char(arg);
break;
@@ -898,6 +909,9 @@ void btc_gattc_cb_handler(btc_msg_t *msg)
gattc_if = connect->client_if;
param.connect.conn_id = BTC_GATT_GET_CONN_ID(connect->conn_id);
memcpy(param.connect.remote_bda, connect->remote_bda, sizeof(esp_bd_addr_t));
param.connect.conn_params.interval = connect->conn_params.interval;
param.connect.conn_params.latency = connect->conn_params.latency;
param.connect.conn_params.timeout = connect->conn_params.timeout;
btc_gattc_cb_to_app(ESP_GATTC_CONNECT_EVT, gattc_if, &param);
break;
}
@@ -277,7 +277,7 @@ static void btc_gatts_act_create_attr_tab(esp_gatts_attr_db_t *gatts_attr_db,
switch(uuid)
{
case ESP_GATT_UUID_PRI_SERVICE:{
tBTA_GATT_SRVC_ID srvc_id;
tBTA_GATT_SRVC_ID srvc_id = {0};
esp_gatt_srvc_id_t esp_srvc_id;
esp_srvc_id.id.inst_id = srvc_inst_id;
@@ -571,7 +571,7 @@ static void btc_gatts_cb_param_copy_free(btc_msg_t *msg, tBTA_GATTS *p_data)
static void btc_gatts_inter_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
{
bt_status_t status;
btc_msg_t msg;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GATTS;
@@ -907,7 +907,9 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
gatts_if = p_data->conn.server_if;
param.connect.conn_id = BTC_GATT_GET_CONN_ID(p_data->conn.conn_id);
memcpy(param.connect.remote_bda, p_data->conn.remote_bda, ESP_BD_ADDR_LEN);
param.connect.conn_params.interval = p_data->conn.conn_params.interval;
param.connect.conn_params.latency = p_data->conn.conn_params.latency;
param.connect.conn_params.timeout = p_data->conn.conn_params.timeout;
btc_gatts_cb_to_app(ESP_GATTS_CONNECT_EVT, gatts_if, &param);
break;
case BTA_GATTS_DISCONNECT_EVT:
@@ -33,10 +33,21 @@
#include "bta/bta_av_api.h"
#if (BTC_AV_INCLUDED == TRUE)
// global variable to inidcate avrc is initialized with a2dp
extern bool g_av_with_rc;
// global variable to indicate a2dp is initialized
extern bool g_a2dp_on_init;
// global variable to indicate a2dp is deinitialized
extern bool g_a2dp_on_deinit;
// global variable to indicate a2dp source deinitialization is ongoing
extern bool g_a2dp_source_ongoing_deinit;
// global variable to indicate a2dp sink deinitialization is ongoing
extern bool g_a2dp_sink_ongoing_deinit;
/*******************************************************************************
** Type definitions for callback functions
********************************************************************************/
enum {
BTC_AV_DATAPATH_OPEN_EVT, // original UIPC_OPEN_EVT for data channel in bluedroid
BTC_AV_DATAPATH_MAX_EVT,
@@ -77,6 +88,8 @@ typedef union {
esp_a2d_mcc_t mcc;
// BTC_AV_SINK_API_CONNECT_EVT
bt_bdaddr_t connect;
// BTC_AV_SINK_API_DISCONNECT_EVT
bt_bdaddr_t disconn;
// BTC_AV_SINK_API_REG_DATA_CB_EVT
esp_a2d_sink_data_cb_t data_cb;
#endif /* BTC_AV_SINK_INCLUDED */
@@ -85,6 +98,8 @@ typedef union {
esp_a2d_source_data_cb_t src_data_cb;
// BTC_AV_SRC_API_CONNECT
bt_bdaddr_t src_connect;
// BTC_AV_SRC_API_DISCONNECT_EVT
bt_bdaddr_t src_disconn;
#endif /* BTC_AV_SRC_INCLUDED */
// BTC_AV_API_MEDIA_CTRL_EVT
esp_a2d_media_ctrl_t ctrl;
@@ -33,6 +33,7 @@ typedef enum {
BTC_GAP_BT_KEY_NOTIF_EVT,
BTC_GAP_BT_KEY_REQ_EVT,
BTC_GAP_BT_READ_RSSI_DELTA_EVT,
BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT,
}btc_gap_bt_evt_t;
typedef enum {
@@ -30,6 +30,7 @@ typedef enum {
BTC_GATTC_ACT_READ_CHAR,
BTC_GATTC_ACT_READ_MULTIPLE_CHAR,
BTC_GATTC_ACT_READ_CHAR_DESCR,
BTC_GATTC_ACT_READ_BY_TYPE,
BTC_GATTC_ACT_WRITE_CHAR,
BTC_GATTC_ACT_WRITE_CHAR_DESCR,
BTC_GATTC_ACT_PREPARE_WRITE,
@@ -112,6 +113,14 @@ typedef union {
uint16_t handle;
esp_gatt_auth_req_t auth_req;
} read_descr;
// BTC_GATTC_ACT_READ_BY_TYPE
struct read_by_type_arg {
uint16_t conn_id;
uint16_t s_handle;
uint16_t e_handle;
esp_bt_uuid_t uuid;
esp_gatt_auth_req_t auth_req;
} read_by_type;
//BTC_GATTC_ACT_WRITE_CHAR,
struct write_char_arg {
uint16_t conn_id;
@@ -28,6 +28,8 @@
#define ESP_SPP_RINGBUF_SIZE 1000
#define BTC_SPP_INVALID_SCN 0x00
typedef enum {
BTC_SPP_ACT_INIT = 0,
BTC_SPP_ACT_UNINIT,
@@ -35,6 +37,7 @@ typedef enum {
BTC_SPP_ACT_CONNECT,
BTC_SPP_ACT_DISCONNECT,
BTC_SPP_ACT_START_SRV,
BTC_SPP_ACT_STOP_SRV,
BTC_SPP_ACT_WRITE,
} btc_spp_act_t;
@@ -73,6 +76,10 @@ typedef union {
UINT8 max_session;
char name[ESP_SPP_SERVER_NAME_MAX + 1];
} start_srv;
//BTC_SPP_ACT_STOP_SRV
struct stop_srv_arg {
UINT8 scn;
} stop_srv;
//BTC_SPP_ACT_WRITE
struct write_arg {
UINT32 handle;
File diff suppressed because it is too large Load Diff
@@ -96,6 +96,12 @@
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
/* This is set to enable use of GAP L2CAP connections. */
#if (VND_BT_JV_BTA_L2CAP == TRUE)
#define BTA_JV_L2CAP_INCLUDED TRUE
#define GAP_CONN_INCLUDED TRUE
#endif /* VND_BT_JV_BTA_L2CAP */
#ifndef CLASSIC_BT_INCLUDED
#define CLASSIC_BT_INCLUDED FALSE
#endif /* CLASSIC_BT_INCLUDED */
@@ -125,6 +131,12 @@
#define GATTC_INCLUDED FALSE
#endif /* CONFIG_GATTC_ENABLE */
#if (CONFIG_GATTS_BLUFI_ENABLE)
#define BLUFI_INCLUDED TRUE
#else
#define BLUFI_INCLUDED FALSE
#endif /* UC_BT_BLUFI_ENABLE */
#if (CONFIG_GATTC_ENABLE && CONFIG_GATTC_CACHE_NVS_FLASH)
#define GATTC_CACHE_NVS TRUE
#else
@@ -293,6 +305,19 @@
#define BTA_SDP_INCLUDED FALSE
#endif
/* This is set to enable use of GAP L2CAP connections. */
#ifndef VND_BT_JV_BTA_L2CAP
#define VND_BT_JV_BTA_L2CAP FALSE
#endif
#ifndef BTA_JV_L2CAP_INCLUDED
#define BTA_JV_L2CAP_INCLUDED FALSE
#endif
#ifndef GAP_CONN_INCLUDED
#define GAP_CONN_INCLUDED FALSE
#endif
/******************************************************************************
**
** Stack-layer components
@@ -1341,7 +1366,7 @@
/* The maximum number of ports supported. */
#ifndef MAX_RFC_PORTS
#define MAX_RFC_PORTS 16 /*max is 30*/
#define MAX_RFC_PORTS 8 /*max is 30*/
#endif
/* The maximum simultaneous links to different devices. */
@@ -1710,15 +1735,6 @@ Range: 2 octets
#define GAP_INCLUDED TRUE
#endif
/* This is set to enable use of GAP L2CAP connections. */
#ifndef GAP_CONN_INCLUDED
#if (GAP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE)
#define GAP_CONN_INCLUDED TRUE
#else
#define GAP_CONN_INCLUDED FALSE
#endif
#endif
/* This is set to enable posting event for data write */
#ifndef GAP_CONN_POST_EVT_INCLUDED
#define GAP_CONN_POST_EVT_INCLUDED FALSE
@@ -34,6 +34,7 @@ typedef struct {
UINT8 ble_min_key_size;
UINT8 ble_accept_auth_enable;
UINT8 oob_support;
UINT8 ble_appl_enc_key_size;
#endif
} tBTE_APPL_CFG;
+6 -19
View File
@@ -197,30 +197,16 @@ task_post_status_t hci_hal_h4_task_post(task_post_t timeout)
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
static void hci_packet_complete(BT_HDR *packet){
uint8_t type, num_handle;
uint8_t type;
uint16_t handle;
uint16_t handles[MAX_L2CAP_LINKS + 4];
uint16_t num_packets[MAX_L2CAP_LINKS + 4];
uint16_t num_packets = 1;
uint8_t *stream = packet->data + packet->offset;
tL2C_LCB *p_lcb = NULL;
STREAM_TO_UINT8(type, stream);
if (type == DATA_TYPE_ACL/* || type == DATA_TYPE_SCO*/) {
STREAM_TO_UINT16(handle, stream);
handle = handle & HCI_DATA_HANDLE_MASK;
p_lcb = l2cu_find_lcb_by_handle(handle);
if (p_lcb) {
p_lcb->completed_packets++;
}
if (esp_vhci_host_check_send_available()){
num_handle = l2cu_find_completed_packets(handles, num_packets);
if (num_handle > 0){
btsnd_hcic_host_num_xmitted_pkts (num_handle, handles, num_packets);
}
} else {
//Send HCI_Host_Number_of_Completed_Packets next time.
}
btsnd_hcic_host_num_xmitted_pkts(1, &handle, &num_packets);
}
}
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
@@ -229,7 +215,7 @@ bool host_recv_adv_packet(BT_HDR *packet)
{
assert(packet);
if(packet->data[0] == DATA_TYPE_EVENT && packet->data[1] == HCI_BLE_EVENT) {
if(packet->data[3] == HCI_BLE_ADV_PKT_RPT_EVT
if(packet->data[3] == HCI_BLE_ADV_PKT_RPT_EVT
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|| packet->data[3] == HCI_BLE_ADV_DISCARD_REPORT_EVT
#endif
@@ -263,11 +249,12 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
{
uint8_t type, hdr_size;
uint16_t length;
uint8_t *stream = packet->data + packet->offset;
uint8_t *stream = NULL;
if (!packet) {
return;
}
stream = packet->data + packet->offset;
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
hci_packet_complete(packet);
+4 -3
View File
@@ -116,7 +116,6 @@
#if BTA_JV_INCLUDED==TRUE
#include "bta_jv_int.h"
tBTA_JV_CB *bta_jv_cb_ptr = NULL;
#endif
#if BTA_HL_INCLUDED == TRUE
@@ -332,8 +331,10 @@ void BTE_DeinitStack(void)
bta_sdp_cb_ptr = NULL;
#endif
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
osi_free(bta_jv_cb_ptr);
bta_jv_cb_ptr = NULL;
if (bta_jv_cb_ptr) {
osi_free(bta_jv_cb_ptr);
bta_jv_cb_ptr = NULL;
}
#endif //JV
#if (defined BTA_HF_INCLUDED && BTA_HF_INCLUDED == TRUE)
osi_free(bta_hf_client_cb_ptr);

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