Compare commits

...

1115 commits

Author SHA1 Message Date
Carsten Schmiemann 25d79ca572 Original project changes: mdns: task stack size configuration (MDNS_TASK_STACK_SIZE) 2022-11-18 23:19:24 +01:00
Michael Balzer 1ff5e24b1b
Merge pull request #6 from leres/master
Allow  pyparsing > 2.4.0
2021-03-07 19:46:50 +01:00
Craig Leres 844922539e Allow pyparsing > 2.4.0 2021-03-07 10:19:41 -08:00
Michael Balzer a5ee881789 pthread: copy priority inheritance fix from espressif
commit 202e6c8984255b551e29e3182e091cf7cd0153b0
2020-12-21 13:55:27 +01:00
Michael Balzer d59ed8bba0 log: fix timestamp output type 2020-11-08 11:24:40 +01:00
Michael Balzer 7124a32fed Merge branch 'release/v3.3' of https://github.com/espressif/esp-idf.git 2020-11-08 11:07:45 +01: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 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
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: 5e8950e681)
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: 40b06deb10)
Closes https://github.com/espressif/esp-mqtt/issues/161

Config: Add check for consistency between config settings
esp-mqtt commit: 8a412c147d)

Add IDF version check for secure element feature
esp-mqtt commit: db4bce01ab)

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

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

Cleanup expired messages when offline
esp-mqtt commit: bdadd77c6e
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: f7325bfa10
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
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 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 95c7b26cdd version: Update to v3.3.3 2020-08-27 18:21:03 +10: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
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
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
Michael Balzer 22d636b7b0 pthread: fix pthread_mutex_destroy() breaking priority inheritance 2020-07-24 14:45:48 +02:00
Michael Balzer 95e43fc2c4 FreeRTOS: add mutex hold count to task status info 2020-07-24 14:43:32 +02:00
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
Michael Balzer 0137aef471 Merge branch 'release/v3.3' of https://github.com/espressif/esp-idf.git into release/v3.3
# Conflicts:
#	components/bt/include/esp_bt.h
2020-07-15 12:08:17 +02: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
Angus Gratton a4fe300cc9 Merge branch 'bugfix/bootloader_efuse_clock_freq_v3.3' into 'release/v3.3'
bootloader: Fix regression burning efuses late in boot process

See merge request espressif/esp-idf!9489
2020-07-08 10:29:01 +08:00
Marius Vikhammer a3ef357b8d Docs: fix broken example README links 2020-07-07 18:22:55 +08:00
Angus Gratton 9d6c3632e8 bootloader: Fix regression burning efuses late in boot process
APB clock get functions not included in iram_loader_seg, meaning
could be overwritten by app depending on app IRAM size and linker
layout.

Regression in dd5190868a

Closes https://github.com/espressif/esp-idf/issues/5456
2020-07-06 16:42:46 +10:00
Jiang Jiang Jian 4891fcea78 Merge branch 'bugfix/beacon_security_downgrade_v3.3' into 'release/v3.3'
Avoid parsing RSN/WPA IE's after connection (Backport v3.3)

See merge request espressif/esp-idf!9268
2020-07-03 14:32:04 +08:00
Island bfb3690821 Merge branch 'bugfix/ble_mesh_fast_prov_misc_update_v3.3' into 'release/v3.3'
Bugfix/ble mesh fast prov misc update (v3.3)

See merge request espressif/esp-idf!9464
2020-07-03 11:13:39 +08:00
lly 8753fb359a ble_mesh: stack: Update some fast prov functions 2020-07-03 08:54:59 +08:00
lly bbf4ce8d18 ble_mesh: stack: Move fast prov functions to a single file 2020-07-03 08:54:51 +08:00
Island be526abc13 Merge branch 'bugfix/ble_mesh_split_tinycrypt_v3.3' into 'release/v3.3'
Bugfix/ble mesh split tinycrypt (v3.3)

See merge request espressif/esp-idf!9373
2020-07-02 22:45:50 +08:00
Nachiket Kukade 2edc576419 esp_wifi: Update wifi lib
1. Avoid parsing RSN/WPA IE's after connection
2. Remove AUTH_CHANGED reason code logic
2020-07-02 04:06:35 +00:00
lly d76a3a8372 ble_mesh: ci: Fix failing to compile when using make 2020-07-02 03:38:18 +00:00
lly e36105156c ble_mesh: Mark platform related default RNG as 0 2020-07-02 03:38:18 +00:00
lly 9060de827f ble_mesh: Remove the previously added redundant aes files 2020-07-02 03:38:18 +00:00
lly 8887bd5f3c ble_mesh: Update CMake and make files for tinycrypt 2020-07-02 03:38:18 +00:00
lly 0940f5b2c3 ble_mesh: Update tinycrypt header file include guards
Add BLE_MESH in the macro to make it specific for BLE Mesh.
2020-07-02 03:38:18 +00:00
lly d690e52993 ble_mesh: Format source and header files of tinycrypt 2020-07-02 03:38:18 +00:00
lly 12b9f59559 ble_mesh: Port full implementation of tinycrypt [Zephyr]
- Original code is here: https://github.com/zephyrproject-rtos/tinycrypt
- Also this fixes the compile error when NimBLE and ESP BLE Mesh
  both uses the tinycrypt.
2020-07-02 03:38:18 +00:00
Island d7353cd2ea Merge branch 'bugfix/ble_mesh_readme_fix_v3.3' into 'release/v3.3'
ble_mesh: example: Fix example README & tutorial link error (v3.3)

See merge request espressif/esp-idf!9437
2020-07-02 11:29:54 +08:00
Island 742f40a211 Merge branch 'bugfix/ble_mesh_compile_error_v3.3' into 'release/v3.3'
Bugfix/ble mesh compile error (v3.3)

See merge request espressif/esp-idf!9433
2020-07-02 11:29:15 +08:00
lly 144ae4a7fd ble_mesh: example: Fix example README & tutorial link error 2020-07-01 14:40:42 +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
lly 7a939c148c ble_mesh: ci: Add different proxy configurations 2020-07-01 12:36:08 +08:00
lly f835011e2f ble_mesh: stack: Fix compile error when only proxy enabled
Also remove some redundant CONFIG_BLE_MESH_PROXY checks, because
when the following options are satisfied, the CONFIG_BLE_MESH_PROXY
option will be selected mandatorily.
2020-07-01 12:32:04 +08:00
Island 021e23ebf7 Merge branch 'bugfix/ble_mesh_check_subnet_before_update_beacon_sent_v3.3' into 'release/v3.3'
ble_mesh: Check if subnet exists before updating beacon_sent (v3.3)

See merge request espressif/esp-idf!9398
2020-07-01 11:17:08 +08:00
Island 31b52a5c05 Merge branch 'bugfix/ble_mesh_set_recv_rssi_v3.3' into 'release/v3.3'
Bugfix/ble mesh set recv rssi (v3.3)

See merge request espressif/esp-idf!9392
2020-07-01 11:15:48 +08:00
Jiang Jiang Jian 46bc9e5dc4 Merge branch 'feature/bt_secure_conn_downgrade_check_v3.3' into 'release/v3.3'
Bluedroid: Authentication fixes in Legacy and Secure Connection.

See merge request espressif/esp-idf!9332
2020-06-30 15:12:21 +08:00
lly 9f6375db50 ble_mesh: Check if subnet exists before updating beacon_sent
- Before updating the "beacon_sent" of a subnet, we need to check
  if the subnet still exists, especially for a Provisioner.
- Fix a bug which will cause Provisioner failed to send Secure
  Network Beacon if no device is provisioned
2020-06-30 09:23:28 +08:00
lly 96865524c7 ble_mesh: stack: Copy recv_rssi for other received messages
Follow the commit: 2b80cb6883,
copy the recv_rssi for other mesh messages.
2020-06-30 09:06:42 +08:00
mbroek 86cad8b825 When a generic mesh model message is received "bt_mesh_generic_server_cb_evt_to_btc" copies the
ctx values to cb_params for the mesh stack.

recv_rssi was not copied.

This means the rssi could not be read when receiving generic server messages using ble_mesh.
2020-06-30 09:06:31 +08:00
Mahavir Jain d6a63531ce Merge branch 'bugfix/http_server_lru_v3.3' into 'release/v3.3'
esp_http_server: Update LRU counter on accepting a new connection (v3.3)

See merge request espressif/esp-idf!9353
2020-06-29 12:57:43 +08:00
Island 370bb55f42 Merge branch 'bugfix/ble_mesh_get_node_with_name_v3.3' into 'release/v3.3'
ble_mesh: Get node info with pre-configured node name (v3.3)

See merge request espressif/esp-idf!9304
2020-06-28 20:25:13 +08:00
Island 70b7a4b868 Merge branch 'bugfix/ble_mesh_example_tag_define_v3.3' into 'release/v3.3'
ble_mesh: Move TAG definition to each example (v3.3)

See merge request espressif/esp-idf!9308
2020-06-28 20:24:44 +08:00
Island 1fb6ffecad Merge branch 'bugfix/ble_mesh_bt_hex_v3.3' into 'release/v3.3'
ble_mesh: Fix wrong log output with bt_hex (v3.3)

See merge request espressif/esp-idf!9311
2020-06-28 20:23:56 +08:00
Island 036828a172 Merge branch 'bugfix/ble_mesh_not_define_bool_v3.3' into 'release/v3.3'
Bugfix/ble mesh not define bool (v3.3)

See merge request espressif/esp-idf!9318
2020-06-28 20:22:50 +08:00
Island b9cc633b50 Merge branch 'bugfix/ble_mesh_check_model_status_v3.3' into 'release/v3.3'
ble_mesh: stack: Check model status with variable length (v3.3)

See merge request espressif/esp-idf!9321
2020-06-28 20:22:11 +08:00
Shubham Kulkarni 673e433281 esp_http_server: Update LRU counter on accepting a new connection
Closes https://github.com/espressif/esp-idf/issues/3851
2020-06-26 19:25:42 +05:30
Chinmay Chhajed 99d572700d Bluedroid: Authentication fixes in Legacy and Secure Connection.
Prevent a remote device from doing a Bluetooth Impersonation Attack
(BIAS) by:

- Preventing remote device to downgrade secure connection
feature mask. Secure connection feature mask should remain same or
increase to enabled in link key generation and authentication.

- Doing a mutual authentication during Legacy Authentication.
2020-06-25 13:59:14 +00:00
Anton Maklakov f4333c8e3a Merge branch 'feature/toolchain_gcc52_psram_fixes_v3.3' into 'release/v3.3'
Update the toolchain for backport PSRAM workaround and memw  fixes (v3.3)

See merge request espressif/esp-idf!9228
2020-06-25 10:38:27 +08:00
lly 42378c8e19 ble_mesh: Move TAG definition to each example
Move the TAG definition of each example to the corresponding
source file (previously it is defined in the common example
intialization header file), which can avoid the redefinition
of TAG in some situations.
2020-06-24 12:06:58 +00:00
Anton Maklakov ff29e3e7a2 Update toolchain to 1.22.0-96-g2852398
PSRAM workaround fixes,
    Volatile loads with memw fixes
2020-06-24 11:56:59 +00:00
lly ad970addf0 ble_mesh: Get node info with pre-configured node name
Also add a function to get the entry of the nodes table.

Closes https://github.com/espressif/esp-idf/issues/5397
2020-06-24 11:53:59 +00:00
lly adbc337023 ble_mesh: Fix wrong log output with bt_hex
- This issue was introduced in the commit: a788e7cd3d
  which updated the bt_hex() function incorrectly.
- And in bt_hex(), we use 2 for the two-dimensional array, because currently
  at most two bt_hex() will be used at the same time. Also this will save
  some DRAM compared with using 4.
2020-06-24 11:50:58 +00:00
lly 1dbbc55cc0 ble_mesh: Remove boolean type definitions 2020-06-24 11:46:51 +00:00
Nikolaos Strikos 0526de4536 ble_mesh: Do not #define bool when compiling in C++ 2020-06-24 11:46:51 +00:00
lly 366dd9759d ble_mesh: stack: Check model status with variable length 2020-06-24 11:41:58 +00:00
Anton Maklakov f0b4c08e77 Merge branch 'bugfix/python_lint_v3.3' into 'release/v3.3'
tools: fix python lint (v3.3)

See merge request espressif/esp-idf!9328
2020-06-24 19:37:22 +08:00
morris 9b9502451a tools: fix python lint 2020-06-24 15:14:22 +08:00
Jiang Jiang Jian 39e5184159 Merge branch 'bugfix/fix_event_bug_in_GAP_API_release_v3.3' into 'release/v3.3'
Bugfix/fix event bug in GAP API [backport v3.3]

See merge request espressif/esp-idf!9195
2020-06-23 12:19:04 +08:00
David Čermák e3f3e0ae0f Merge branch 'feature/ws_timeout_v3.3' into 'release/v3.3'
websocket: add configurable timeout for PONG not received (v3.3)

See merge request espressif/esp-idf!8911
2020-06-19 02:22:08 +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
Island 2ea53169ad Merge branch 'bugfix/blufi_buffer_overflow_report_v3.3' into 'release/v3.3'
blufi: When the format of the received data packet is wrong, reply with an error response(backport 3.3)

See merge request espressif/esp-idf!9198
2020-06-18 13:45:34 +08:00
Michael (XIAO Xufeng) 2aaf254d44 Merge branch 'bugfix/fix_fifo_cnt_bug_v3.3' into 'release/v3.3'
bugfix(uart): fix esp32 uart fifo_cnt bug(backport v3.3)

See merge request espressif/esp-idf!9042
2020-06-18 01:43:04 +08:00
David Čermák e25b710a02 Merge branch 'bugfix/ws_send_abort_v3.3' into 'release/v3.3'
websocket client: the client now aborts the connection if send fails (v3.3)

See merge request espressif/esp-idf!8903
2020-06-17 15:05:48 +08:00
wangcheng 563c9901ca blufi: When the format of the received data packet is wrong, reply with an error response 2020-06-17 12:32:57 +08:00
liqigan 02f9eaa31a components/bt: Adjust the description of esp_bt_gap_start_discovery and esp_bt_gap_cancel_discovery.
Add some comments to explain why `ESP_BT_GAP_DISC_STATE_CHANGED_EVT` is not reported.
2020-06-17 11:27:37 +08:00
Marius Vikhammer b478dc4ad6 websocket: add configurable timeout for PONG not received
Closes IDF-1744
2020-06-17 11:13:26 +08:00
xiongyu c9d9545310 bugfix(uart): fix esp32 uart fifo_cnt bug
When using DPort to read fifo, fifo_cnt is not credible, we need to calculate the real cnt based on the fifo read and write pointer. When using AHB to read FIFO, we can use fifo_cnt to indicate the data length in fifo.
2020-06-15 12:22:33 +08:00
Angus Gratton 332e243f17 Merge branch 'feature/msys2_env_update_v3.3' into 'release/v3.3'
windows: Update pre-compiled MSYS2 environment

See merge request espressif/esp-idf!9035
2020-06-12 07:26:41 +08:00
Angus Gratton 5e84ee108c Merge branch 'bugfix/bootloader_efuse_build_regression_v3.3' into 'release/v3.3'
bootloader: add definition of esp_clk_apb_freq (v3.3)

See merge request espressif/esp-idf!9093
2020-06-10 16:01:35 +08:00
Angus Gratton f17f59fb54 Merge branch 'bugfix/parttool_get_info_wo_info_option_v3.3' into 'release/v3.3'
partition_table: Fix parttool.py crashes when retrieving partition info (v3.3)

See merge request espressif/esp-idf!9065
2020-06-10 15:58:01 +08:00
Jiang Jiang Jian 2f6f842d0f Merge branch 'bugfix/collection_of_confirmed_fixes_from_baidu_project_3.3' into 'release/v3.3'
Backport MR for baidu project for release/v3.3

See merge request espressif/esp-idf!8990
2020-06-10 13:08:11 +08:00
weitianhua 282433500e Backport MR from baid proj 2020-06-10 03:53:21 +00:00
Ivan Grokhotkov 618794e1fb bootloader: add definition of esp_clk_apb_freq
Commit 8cd04c80 has added a dependency of efuse component on
esp_clk_apb_freq, however there was no definition of this function in
the bootloader context.

Reported at https://esp32.com/viewtopic.php?f=13&t=12035

Closes: https://github.com/espressif/esp-idf/issues/5396
2020-06-08 16:45:29 +08:00
Jiang Jiang Jian eaca5a11e4 Merge branch 'bugfix/authmode_degrade_fix_v3.3' into 'release/v3.3'
esp_wifi: Remove auth_changed event and fix wpa2_ent authmode threshold (backport 3.3)

See merge request espressif/esp-idf!9058
2020-06-05 13:59:48 +08:00
Jiang Jiang Jian b4c89c6607 Merge branch 'bugfix/add_so_linger_to_menuconfig_for_3.3' into 'release/v3.3'
lw-ip:add LINGER to menuconfig(backport 3.3)

See merge request espressif/esp-idf!9062
2020-06-05 13:54:22 +08:00
Jiang Jiang Jian a5a6ba895e Merge branch 'optimization/DNS_get_function_for_3.3' into 'release/v3.3'
lw-ip:optimization DNS get function(backport 3.3)

See merge request espressif/esp-idf!9061
2020-06-05 13:54:07 +08:00
Jiang Jiang Jian b336851479 Merge branch 'workaround/wps_iot_fixes_v3.3' into 'release/v3.3'
wpa_supplicant: WPS Inter operatability Fixes ( backport v3.3)

See merge request espressif/esp-idf!9060
2020-06-05 13:49:24 +08:00
Michael (XIAO Xufeng) ace2cff01a Merge branch 'bugfix/sdmmc_check_slot_before_pullup_3.3' into 'release/v3.3'
sdmmc: Correctly check function parameters before using them (3.3)

See merge request espressif/esp-idf!9057
2020-06-05 07:19:11 +08:00
KonstantinKondrashov 28d3d6daac partition_table: Fix parttool.py crashes when retrieving partition info
Closes: IDFGH-3279
Closes: https://github.com/espressif/esp-idf/issues/5271
2020-06-04 16:43:06 +08:00
Angus Gratton 14f4c196c0 windows: Update other MSYS2 package names to all be Python 3 2020-06-04 18:39:20 +10:00
kapil.gupta 21395421d1 wpa_supplicant: WPS Inter operatability Fixes
Add WPS IOT fixes under config option

Current fixes under this flag.
1. Allow NULL-padded WPS attributes.
2. Bypass WPS-Config method validation
2020-06-04 13:57:20 +05:30
xueyunfei 68d1afb47d add LINGER to menuconfig 2020-06-04 16:16:03 +08:00
xueyunfei 32b3c255ac optimization DNS get function 2020-06-04 16:05:17 +08:00
Jiang Jiang Jian c13b946773 Merge branch 'bugfix/modify_TCP_MSS_range_v3.3' into 'release/v3.3'
Change the default value of TCP_MSS (backport v3.3)

See merge request espressif/esp-idf!9050
2020-06-04 15:59:17 +08:00
Jiang Jiang Jian 3838da57f0 Merge branch 'bugfix/compiler_err_when_performance_optimization_enabled_v3.3' into 'release/v3.3'
Bugfix/compiler err when performance optimization enabled v3.3

See merge request espressif/esp-idf!7979
2020-06-04 15:58:34 +08:00
kapil.gupta 1625c595ff esp_wifi: Remove auth_changed event and fix wpa2 authmode threshold 2020-06-04 13:13:21 +05:30
Nachiket Kukade c6ca42b1e7 wpa_supplicant: Allow NULL-padded WPS attributes
Some AP's keep NULL-padding at the end of some variable length WPS
Attributes. This is not as par the WPS2.0 specs, but to avoid interop
issues, ignore the padding by reducing the attribute length by 1.
2020-06-04 12:18:43 +05:30
Alexander Borsuk cccd679b3e sdmmc: Correctly check function parameters before using them
Closes https://github.com/espressif/esp-idf/pull/5000
2020-06-04 12:07:16 +08:00
xiehang 6f26e72817 Change the default value of TCP_MSS to 1440 and TCP_MSS Range : [536 1460] 2020-06-04 12:04:14 +08:00
Island ad2447a6ea Merge branch 'bugfix/ble_mesh_remove_relay_dependency_v3.3' into 'release/v3.3'
ble_mesh: Remove relay option dependency (v3.3)

See merge request espressif/esp-idf!9028
2020-06-03 15:20:56 +08:00
Island 686530d373 Merge branch 'bugfix/ble_mesh_example_nvs_store_v3.3' into 'release/v3.3'
Bugfix/ble mesh example nvs store (v3.3)

See merge request espressif/esp-idf!9018
2020-06-03 15:12:28 +08:00
Island c3902be87f Merge branch 'bugfix/ble_mesh_model_recv_fix_v3.3' into 'release/v3.3'
Bugfix/ble mesh model recv fix (v3.3)

See merge request espressif/esp-idf!9009
2020-06-03 15:11:38 +08:00
Island 88937185ac Merge branch 'bugfix/ble_mesh_rework_prov_pdu_len_check_v3.3' into 'release/v3.3'
ble_mesh: Rework prov pdu length check (v3.3)

See merge request espressif/esp-idf!9005
2020-06-03 15:11:11 +08:00
lly 7937a51779 ble_mesh: Remove relay option dependency
When the relay functionality of a node is not enabled, this
issue will cause the node failing to send messages to fixed
group.
2020-06-02 19:19:18 +08:00
Jiang Jiang Jian a94842d8f7 Merge branch 'bugfix/fix_some_wifi_bugs_0525_v3.3' into 'release/v3.3'
feature: optimize some wifi API  (backport v3.3)

See merge request espressif/esp-idf!8893
2020-06-02 17:39:23 +08:00
lly 5d72e0c33c ble_mesh: Add nvs operations for examples
- Store onoff_client example proper mesh info
- Store vendor_client example proper mesh info

Closes https://github.com/espressif/esp-idf/issues/5359
2020-06-02 17:29:44 +08:00
lly cabd3b9e76 ble_mesh: Add mesh example common nvs operations 2020-06-02 17:28:44 +08:00
Angus Gratton 90be3b4970 windows: Update pre-compiled MSYS2 environment
* Latest MSYS2 packages
* Uses Python 3 now (no more Python 2 in MSYS2)

This pre-compiled package is not suitable of ESP-IDF v4.x
2020-06-02 18:32:42 +10:00
weitianhua afae411857 Remove (x2) varible for BCM_STRNCPY_S and BCM_STRCPY_S 2020-06-02 08:30:02 +00:00
weitianhua 437bee123c Initialize mem_start and mem_end 2020-06-02 08:30:02 +00:00
lly cb0288d399 ble_mesh: Config and health client btc fixes
Fix an issue which may cause no error code is returned
when sending config client or health client messages
with invalid parameters.
2020-06-02 14:05:26 +08:00
lly 59cdd33dcf ble_mesh: Add more checks of net_idx & app_idx 2020-06-02 14:05:19 +08:00
lly 36c476833f ble_mesh: Optimize some send & recv logs 2020-06-02 14:05:12 +08:00
Michael (XIAO Xufeng) 13154fe5c6 Merge branch 'bugfix/fix_gpio_wake_up_disable_invalid_for_rtc_io_v3.3' into 'release/v3.3'
bugfix (GPIO): fixed gpio_wake_up_disable not working for RTC IO (release/3.3)

See merge request espressif/esp-idf!7997
2020-06-02 11:16:59 +08:00
Island bce064e655 Merge branch 'bugfix/ble_mesh_local_model_sub_v3.3' into 'release/v3.3'
Bugfix/ble mesh local model sub (v3.3)

See merge request espressif/esp-idf!8985
2020-06-02 10:58:50 +08:00
lly ac565c97a3 ble_mesh: correct the return type [Zephyr] 2020-06-02 10:33:12 +08:00
lly 8c5a8bef50 ble_mesh: Add net_buf_simple_init_with_data [Zephyr] 2020-06-02 10:33:05 +08:00
lly ac76870ad7 ble_mesh: Optimize model recv operations [Zephyr]
Previously the model recv operation is a littl fuzzy.
With the changes, the model recv operation is splitted into:
- find op
- check app_idx
- check dst
- check length
- update info & handle message
2020-06-02 10:32:57 +08:00
lly a96e1b80ac ble_mesh: Rework prov pdu length check 2020-06-02 10:17:20 +08:00
Mahavir Jain 3f57aecabd Merge branch 'bugfix/httpd_lru_purge_v3.3' into 'release/v3.3'
esp_http_server: Fixed a bug which could cause issues with LRU purge (v3.3)

See merge request espressif/esp-idf!8834
2020-06-01 11:23:53 +08:00
houwenxiang eab88f51e7 driver(GPIO): fixed gpio_wake_up_disable not working for RTC IO (release/3.3) 2020-06-01 11:16:07 +08:00
lly 6abdc9e542 ble_mesh: Local model (un)subscribes group address 2020-06-01 09:13:57 +08:00
lly 0ee9227b45 ble_mesh: Define a macro for invalid company id 2020-06-01 09:13:43 +08:00
ronghulin 8f3209b7b7 feature: optimize some wifi API
1. optimization esp_wifi_set_max_tx_power description
2. add API esp_wifi_ap_get_sta_aid
2020-05-29 12:02:24 +08:00
Jiang Jiang Jian d7e6eecd66 Merge branch 'bufix/fix_v3.3_bluedroid_bugs_mr' into 'release/v3.3'
component/bt: fix notify malloc failed , fix no BLE_AUTH_CMPL_EVT and fix bluedroid btc deinit crash(backport 3.3)

See merge request espressif/esp-idf!8754
2020-05-29 11:25:41 +08:00
zwj 38e98acca1 :add congest direct callback and modify congest evt triger threshold 2020-05-28 12:06:10 +00:00
wangcheng 340e40abbe master missing BLE_AUTH_CMPL_EVT after restart 2020-05-28 12:06:10 +00:00
wangcheng ed3a172df7 fix bta_dm_deinit_cb 2020-05-28 12:06:10 +00:00
Jiang Jiang Jian 27f03b4ac0 Merge branch 'bugfix/ble_mesh_check_timer_init_v3.3' into 'release/v3.3'
ble_mesh: Check the result of creating timer (v3.3)

See merge request espressif/esp-idf!8960
2020-05-28 15:26:53 +08:00
Jiang Jiang Jian 706d704c08 Merge branch 'nimble/update_nimble_submodule_v3.3' into 'release/v3.3'
NimBLE: Include upstream fixes and use macros for log level filtering (backport v3.3)

See merge request espressif/esp-idf!8798
2020-05-28 15:23:31 +08:00
lly b5f3f79716 ble_mesh: Check the result of creating timer 2020-05-28 10:28:36 +08:00
Island 5f43d69d21 Merge branch 'bugfix/ble_mesh_sync_zephyr_fixes_v3.3' into 'release/v3.3'
Bugfix/ble mesh sync zephyr fixes (v3.3)

See merge request espressif/esp-idf!8950
2020-05-28 10:17:29 +08:00
Island a70c956a75 Merge branch 'bugfix/ble_mesh_not_use_same_private_key_v3.3' into 'release/v3.3'
ble_mesh: Not using pre-initialized private key (v3.3)

See merge request espressif/esp-idf!8947
2020-05-28 10:15:40 +08:00
Island 6d9b618a2d Merge branch 'bugfix/ble_mesh_comp_data_store_restore_v3.3' into 'release/v3.3'
ble_mesh: Same func for storing/restoring comp data (v3.3)

See merge request espressif/esp-idf!8944
2020-05-28 10:14:01 +08:00
Piyush Shah 8890fa98c8 esp_http_server: Fixed a bug which could cause issues with LRU purge
LRU counter should be started from 1, and not 0, so that all checks
work fine.

Closes https://github.com/espressif/esp-idf/issues/4753
2020-05-27 17:14:12 +00:00
He Yin Ling 4fa5f9d1a6 Merge branch 'bugfix/ci_push_to_github_on_label_v3.3' into 'release/v3.3'
ci: Don't push to Github or deploy docs on customized pipelines (v3.3)

See merge request espressif/esp-idf!8939
2020-05-27 18:16:13 +08:00
lly 822b20eb40 ble_mesh: Transport tx fields overflow [Zephyr]
The transport segmented TX nack and seg_pending fields must be at least
6 bits to avoid overflow for 32 segment messages. This change rearranges
the seg_tx fields to gather all state flag fields in one byte, while
making the counter fields whole bytes.
2020-05-27 17:45:12 +08:00
lly b381998a23 ble_mesh: Friend with unknown appkey [Zephyr]
Ensures that friend messages are enqueued, even if the packet is
received with an appkey is unknown to the friend. Previously, sdu_recv
would return EINVAL if the appkey was unknown, which would prevent the
lower transport layer from adding the packet to the friend queue. This
is irrelevant for the logic in lower transport, and should not be
returned as an error.
2020-05-27 17:44:58 +08:00
lly 393e4e9007 ble_mesh: Not using pre-initialized private key 2020-05-27 17:38:41 +08:00
lly 4b191ac6fb ble_mesh: Same func for storing/restoring comp data 2020-05-27 17:32:56 +08:00
Island 322f461439 Merge branch 'example/ble_mesh_structural_adjust_v3.3' into 'release/v3.3'
Example/ble mesh structural adjust (v3.3)

See merge request espressif/esp-idf!8866
2020-05-27 17:22:30 +08:00
Angus Gratton 7b8cd22a46 ci: Don't push to Github or deploy docs on customized pipelines
BOT_TRIGGER_WITH_LABEL must be empty (meaning all tests are running).
2020-05-27 19:08:22 +10:00
Jiang Jiang Jian 221ca4b1e5 Merge branch 'bugfix/fix_some_wifi_bugs_0427_v3.3' into 'release/v3.3'
Bugfix/fix some wifi bugs 0427 (v3.3)

See merge request espressif/esp-idf!8573
2020-05-26 18:57:43 +08:00
David Čermák 0a558ea3c4 Merge branch 'bugfix/ws_client_fragmented_send_v3.3' into 'release/v3.3'
ws_client: fix fragmented send setting proper opcodes (v3.3)

See merge request espressif/esp-idf!8692
2020-05-25 17:22:02 +08:00
Marius Vikhammer 0829b5c5d5 websocket client: the client now aborts the connection if send fails.
Closes IDF-1744
2020-05-25 17:11:23 +08:00
Jiang Jiang Jian 19736dbedc Merge branch 'bugfix/supplicant_general_fixes_33' into 'release/v3.3'
wpa_supplicant: Fix some memleaks and invalid memory access(backport V3.3)

See merge request espressif/esp-idf!8741
2020-05-22 21:18:36 +08:00
Island a809cdba76 Merge branch 'bugfix/ble_mesh_provisioner_fail_to_pub_v3.3' into 'release/v3.3'
ble_mesh: Fix Provisioner failed to publish (v3.3)

See merge request espressif/esp-idf!8875
2020-05-22 19:14:42 +08:00
lly 879bfc608c ble_mesh: Fix Provisioner failed to publish 2020-05-22 15:49:30 +08:00
David Cermak 612b9e4a58 ws_client: fix fragmented send setting proper opcodes
Previous implementation violated the RFC by having both the actual opcode and WS_FIN flag set for all fragments of a message.
Fixed by setting the opcode only for the first fragment and WS_FIN for the last one

Closes IDFGH-2938
Closes https://github.com/espressif/esp-idf/issues/4974
2020-05-22 06:16:29 +00:00
lly 8bc195db3b ble_mesh: Fix tutorial links in examples README.md 2020-05-22 14:09:21 +08:00
lly af4ca47300 ble_mesh: Rename esp_fast_prov_* to ble_mesh_fast_prov_* 2020-05-22 14:09:21 +08:00
lly b98eee2445 ble_mesh: Rename the folders ble_mesh_fast_prov_* to fast_prov_* 2020-05-22 14:09:21 +08:00
lly 0e4faac0ee ble_mesh: Rename ble mesh example main & init files
- Rename ble_mesh_demo_main.c to main.c
- Rename ble_mesh_demo_init.* to ble_mesh_example_init.*
2020-05-22 14:09:21 +08:00
lly 6149b640c9 ble_mesh: Move the example init to the components 2020-05-22 14:08:53 +08:00
lly bdaf56b17a ble_mesh: Move the button component to components 2020-05-22 10:56:26 +08:00
lly b6ed032e1d ble_mesh: Change the EXTRA_COMPONENT_DIRS used by examples 2020-05-22 10:56:26 +08:00
lly ecf7ea897e ble_mesh: Rename common_vendor_models to components
Since the scripts of CI will bypass components when trying
to get EXAMPLE_PATHS, and these BLE Mesh components will
only be used by other mesh examples, i.e. no need to be
compiled as a single example, so we rename the folder
to componnets.
2020-05-22 10:56:26 +08:00
Island 796dc4bb35 Merge branch 'bugfix/ble_mesh_friend_init_flag_v3.3' into 'release/v3.3'
Bugfix/ble mesh friend init flag (v3.3)

See merge request espressif/esp-idf!8849
2020-05-22 10:50:55 +08:00
Island 2ae27a9ae1 Merge branch 'doc/ble_mesh_fix_v3.3' into 'release/v3.3'
ble_mesh: Doc miscellaneous fixes (v3.3)

See merge request espressif/esp-idf!8860
2020-05-22 10:49:27 +08:00
lly 6e8529c08d ble_mesh: Doc miscellaneous fixes
- Update ble mesh architecture
2020-05-21 17:49:58 +08:00
Island 6046e7b26f Merge branch 'bugfix/ble_mesh_node_old_version_to_new_v3.3' into 'release/v3.3'
ble_mesh: Fix mesh node device role restore (v3.3)

See merge request espressif/esp-idf!8725
2020-05-21 15:10:29 +08:00
lly 1b1aea24f0 ble_mesh: Clear two more vars during proxy server deinit 2020-05-21 14:29:04 +08:00
lly e55c65562c ble_mesh: Add missing sdkconfig.h 2020-05-21 14:28:57 +08:00
lly 1ad9de1131 ble_mesh: Init device name during proxy server init
Device name will be reset when deinit mesh stack. If not
initializing device name during the next mesh stack init,
it will fail to set the device name when using bluedroid.
2020-05-21 14:28:49 +08:00
lly 8e4399bf29 ble_mesh: Add init flag for friend init/deinit
Since bt_mesh_friend_init() will only be invoked when
a device is provisioned or Provisioner is enabled, so
we add a flag to indicate if the friend functionality
is initialized in case deinit before initialization.
2020-05-21 14:28:40 +08:00
Island cb4e8cef87 Merge branch 'bugfix/ble_mesh_fix_typos_v3.3' into 'release/v3.3'
ble_mesh: Fix typos (v3.3)

See merge request espressif/esp-idf!8727
2020-05-21 11:47:33 +08:00
Island f55719522e Merge branch 'bugfix/ble_mesh_remove_patch_v3.3' into 'release/v3.3'
ble_mesh: Remove patch for the bug of an App (v3.3)

See merge request espressif/esp-idf!8780
2020-05-21 11:46:49 +08:00
Prasad Alatkar 04e3cf44bc NimBLE: Include upstream fixes and use macros for log level filtering (backport v3.3)
Change list:
- Reduces the size of the compiled binary, PR: https://github.com/espressif/esp-nimble/pull/6
- Null pointer check, PR: https://github.com/apache/mynewt-nimble/pull/701
- Pairing procedure abort on unexpected req: https://github.com/apache/mynewt-nimble/pull/710
- Fix conn flags after pairing: https://github.com/apache/mynewt-nimble/pull/730
- Remove notification for update process timeout (Vol 6, Part B, section 5.2 ):
  https://github.com/apache/mynewt-nimble/pull/782
- CCCD fix : https://github.com/apache/mynewt-nimble/pull/790 and
  https://github.com/apache/mynewt-nimble/pull/804
- Host based Privacy (RPA) fix: https://github.com/espressif/esp-nimble/pull/7

 Closes https://github.com/espressif/esp-nimble/issues/10

 Closes https://github.com/espressif/esp-idf/issues/4413
2020-05-20 16:27:53 +05:30
zhangyanjiao 1a1b3a8538 wifi changes:
1. fix the bug for softAP update second channel wrong
2. change wifi_scan_time_t from union to struct
3. query country code wrong when policy change from manual to auto
4. fix the crash issue when fetch peer after delete the cur_peer
5. fix the timeout issue of EAPOL four-way handshake
2020-05-20 17:55:11 +08:00
zhangyanjiao c3d4c61650 esp_wifi:Add softap example channel configuration 2020-05-20 11:07:29 +08:00
Jiang Jiang Jian f56937f0eb Merge branch 'bugfix/fix_switch_channel_without_discon_issue_v3.3' into 'release/v3.3'
esp_wifi: Fix AP switch to adjacent channel without disconnect (backport v3.3)

See merge request espressif/esp-idf!8771
2020-05-18 22:27:12 +08:00
lly d6e189927e ble_mesh: Remove patch for the bug of an App 2020-05-15 20:24:35 +08:00
xiehang 92e4f84ec5 esp_wifi: Fix AP switch to adjacent channel without disconnect 2020-05-15 14:42:03 +08:00
kapil.gupta b91bba1a07 wpa_supplicant: Fix some memleaks and invalid memory access
Add changes to fix issues reported in clang analyzer
2020-05-14 11:28:27 +05:30
lly 8cdaf34430 ble_mesh: Fix typos 2020-05-13 18:33:46 +08:00
lly 4f402486c6 ble_mesh: Fix mesh node device role restore
Old version of BLE Mesh has no device role storage, because
previously we only support storing mesh node info.
If the binary of the node is upgraded from old version to a
new version (support storing provisioner info), the mesh info
of the node will not be restored because mesh role does not
exist in the flash.
2020-05-13 18:24:44 +08:00
Island 19893abd04 Merge branch 'bugfix/sync_zephyr_bt_mesh_bugfix_v3.3' into 'release/v3.3'
Bugfix/sync zephyr bt mesh bugfix (v3.3)

See merge request espressif/esp-idf!8689
2020-05-13 18:15:22 +08:00
Island b3c40e8e06 Merge branch 'bugfix/ble_mesh_not_ignore_msg_in_fast_prov_v3.3' into 'release/v3.3'
ble_mesh: Not ignore msg when fast prov is enabled (v3.3)

See merge request espressif/esp-idf!8712
2020-05-13 18:14:51 +08:00
lly 46a8982a80 ble_mesh: A specific fix for compile warning in idf3.3
- Remove the extra #include "bt_common.h" in mesh_timer.c
- Compared with the latest idf, idf3.3 defines BIT(nr) in
  the "soc/soc.h" without the pre-condition "#ifndef BIT",
  which will cause compile warning when using mesh. So we
  include the header file "soc/soc.h" in "mesh_util.h",
  which can bypass the definition of "BIT" in "mesh_util.h"
  when compiling.
2020-05-13 03:40:30 +00:00
lly 8deabb7945 ble_mesh: Fix not update prov addr in fast prov
When using fast provisioning, the Provisioner functionality
will be enabled. Unicast addresses within the pre-allocated
range will be used for provisioning nodes. And during the
address assignment, the allocated unicast address will be
checked that if it's duplicated with other nodes addresses
and the Provisioner's own addresses.
So before starting using fast provisioning, we need to update
the Provisioner address.
2020-05-13 03:40:30 +00:00
lly f1abf94922 ble_mesh: net_key_status only pull one key idx [Zephyr]
Fixes bug where the config client's net_key_status handler would attempt
to pull two key indexes from a message which only holds one.
2020-05-13 03:40:30 +00:00
lly f5f9d34443 ble_mesh: Update client message timeout calculation
Since the behavior of sending segmented messages has been
changed properly, the calculation of timeout value which
will be used when sending an acknowledged message by a
client model also needs to be updated.
2020-05-13 03:40:30 +00:00
lly 08a463907e ble_mesh: Add lock for segmented msg operations
Add mutex to protect some variables of the mesh segmented
messages.
Currently the timeout handler of mesh will be executed in
the btc task, while the received mesh messages will be
handled in the btu task. In case some variables are set to
NULL when handled in the btu task, meanwhile these variables
are also accessed in the timeout handler, so we add mutex to
protect these variables and related operations.
2020-05-13 03:40:30 +00:00
lly 367677c3bb ble_mesh: Fix dereferencing pointer before checking for NULL [Zephyr]
The publication context is checked for NULL in bt_mesh_model_publish()
however it was dereferenced before that. Move the assignment to
ctx.send_rel to the same place where other ctx members are set.
2020-05-13 03:40:30 +00:00
lly b0a6fc7937 ble_mesh: Optimize some mesh log output 2020-05-13 03:40:30 +00:00
lly 30d62cc00f ble_mesh: Fix restore when revoke keys [Zephyr]
Store keys (NetKey and AppKey) again after revoking.
2020-05-13 03:40:30 +00:00
lly 2983f6edb1 ble_mesh: Spit mesh_util.h into different header files
Split mesh_util.h into mesh_byteorder.h, mesh_compiler.h,
mesh_ffs.h and mesh_util.h based on the classification of
Zephyr, which will make further porting more clear.
2020-05-13 03:40:30 +00:00
lly 35c5a7a08c ble_mesh: Split mesh os related into a separate file 2020-05-13 03:40:30 +00:00
lly 0daac93e4e ble_mesh: Split mesh mutex into a separate file 2020-05-13 03:40:30 +00:00
lly ec34cd8338 ble_mesh: Rename mesh_kernel.* to mesh_timer.* 2020-05-13 03:40:30 +00:00
lly 92cfbe3c6c ble_mesh: Add and use transport macro definitions [Zephyr] 2020-05-13 03:40:30 +00:00
lly e2186b1d3a ble_mesh: Friend SeqAuth cleanup [Zephyr]
The Friend queue uses the message SeqAuth to determine whether the
message is already in the queue. To facilitate this, the SeqAuth is
passed around as a pointer throughout the transport modules. In the
bt_mesh_ctl_send functions, this parameter is also exposed in the API,
but the internal usage is inconsistent and buggy. Also, no one actually
uses this parameter.

- Removes seq_auth param from bt_mesh_ctl_send, instead passing NULL
  directly to the friend module, to enforce its addition to the queue.
- Makes the seq_auth pointer const throughout the friend module.
2020-05-13 03:40:30 +00:00
lly 489d32663b ble_mesh: Rework msg_cache [Zephyr]
Changes the behavior of the message cache to optimize for cache
capacity. Previously, the message cache's primary function was to avoid
decrypting messages multiple times, although the cache's main function
in the spec is to avoid message rebroadcasting. Optimizing for minimal
decryption causes us to fill the network cache faster, which in turn
causes more cache misses, potentially outweighing the advantage.

Now stores src + seq in message cache instead of field hash value. This
cuts cache size in two, while including more of the sequence number than
before.

Adds messages to the cache only after the packet is successfully
decrypted. This reduces noise in the cache, and ensures that no
invalid deobfuscations are added.

Additionally, this fixes a bug where multiple calls to net_decrypt with
the same packet failed, as the message cache found its own entry from
the previous call.
2020-05-13 03:40:30 +00:00
lly febe084113 ble_mesh: Segmented TX to groups [Zephyr]
Implements several changes to the transport layer segmented tx to
improve group message performance:
- Moves retransmit counter to tx context instead of per packet. As every
  unacked packet is sent every retransmit, the retransmit counters would
  be the same in each segment. This makes it easier to control progress.
- Delays the scheduling of the retransmit until the completion of the
  last segment by adding a seg_pending counter. This is essentially the
  same as the old behavior, except that the old behavior might retrigger
  the sending before all segments are finished if the advertising is
  slow.
- Allows the group transmits to stop as soon as all retransmits have
  been exhausted, instead of timing out waiting for acks that won't
  come. This allows group tx to finish without error.
- Fixes a bug where a failed TX would block IV update.
- Cancels any pending transmissions of acked segments.
- Reduces log level for several common group tx scenarios that aren't
  erronous.
2020-05-13 03:40:30 +00:00
lly b6729860dd ble_mesh: Add comment explaining use of byte order [Zephyr]
Add comment that explains why a different byte order is used for the
3-byte opcode on the CID part of the opcode.
2020-05-13 03:40:30 +00:00
lly 9f9acb6c4a ble_mesh: Use 24-bit functions [Zephyr]
Use 24-bit functions for byteorder and net_buf in order to make the
byteorder used more readable.
2020-05-13 03:40:30 +00:00
lly 6d77a8b0c8 ble_mesh: Optimize net_buf_simple routines [Zephyr]
Use sys_put_xyz() helpers instead of memcpy() whenever possible. This
brings in straight-line inline code for pushes and adds of known,
small sizes.
2020-05-13 03:40:30 +00:00
lly fa06b60568 ble_mesh: Add PRIu64 & PRIx64 in mesh_types.h 2020-05-13 03:40:30 +00:00
lly bb09078b65 ble_mesh: Add push functions for supported bit-variants [Zephyr]
Add push functions for bit-widths supported by add and pull functions.
2020-05-13 03:40:30 +00:00
lly 0522ce7cf3 ble_mesh: Add support for 64 bit data type [Zephyr]
This enables pulling and pushing values in 64 bit format.
2020-05-13 03:40:30 +00:00
lly b41d50908b ble_mesh: Add support for 48 bit data type [Zephyr]
This enables pulling and pushing values in 48 bit format.
2020-05-13 03:40:30 +00:00
lly be57df5e19 ble_mesh: Add 48 bit variants [Zephyr]
This adds sys_*_*48 functions that operation on a 48 bits values.
2020-05-13 03:40:30 +00:00
lly fd5e18eb49 ble_mesh: Add support for 24 bit data type [Zephyr]
This enables pulling and pushing values in 24 bit format.
2020-05-13 03:40:30 +00:00
lly 4963d4ddf8 ble_mesh: Add 24 bit variants [Zephyr]
This adds sys_*_*24 functions that operation on a 24 bits values.
2020-05-13 03:40:30 +00:00
lly bc1722260f ble_mesh: Group resends in proxy nodes [Zephyr]
Resend transport segments for groups on the advertiser interface, even
if a connected proxy node holds the group.
2020-05-13 03:40:30 +00:00
lly 968772d18a ble_mesh: Typo in condition in comp_add_elem of cfg_srv [Zephyr]
Vendor model IDs take up four (not two) bytes in the composition
2020-05-13 03:40:30 +00:00
lly a45406fe6e ble_mesh: GATT Proxy Spec 1.0.1 changes [Zephyr]
Backport of https://github.com/apache/mynewt-nimble/pull/724

Mesh spec 1.0.1 changes proxy disabling behavior to only affect the
relaying from proxy nodes. Previously, disabling proxy would shut down
all proxy and node activity.

Tweaks from the original commit:
- Removed redundant call to bt_mesh_adv_update() in gatt_proxy_set()
- Removed invalid ref to 4.2.11.1 in node_identity_set()

---

According to Mesh Profile Spec 1.0.1, Section 4.2.11:
"If the Proxy feature is disabled, a GATT client device can connect
over GATT to that node for configuration and control. Messages from
the GATT bearer are not relayed to the advertising bearer."

Moreover some notes have been removed from the spec compared to
version 1.0:

Mesh Profile Spec 1.0, Section 4.2.11:

"Upon transition from GATT Proxy state 0x01 to GATT Proxy state 0x00
the GATT Bearer Server shall disconnect all GATT Bearer Clients."

"The Configuration Client should turn off the Proxy state as the last
step in the configuration process."

Mesh Profile Spec 1.0, Section 4.2.11.1:

"When the GATT Proxy state is set to 0x00, the Node Identity state
for all subnets shall be set to 0x00 and shall not be changed."
2020-05-13 03:40:30 +00:00
lly 10f2ed14eb ble_mesh: Support reliable sending when publishing [Zephyr]
Until now the choice of reliable sending (segmented messages with
acks) was implicitly dependent on the size of the payload. Add a new
member to the bt_mesh_model_pub to force using segment acks even when
the payload would fit a single unsegmented message.
2020-05-13 03:40:30 +00:00
lly cd19f6faf1 ble_mesh: Check device uuid when init provisioning 2020-05-13 03:40:30 +00:00
lly abcfcc47ec ble_mesh: Fix provisioning buffer initialization [Zephyr]
When PB-GATT support has been enabled the provisioning code "borrows"
the buffer from the proxy code. However, the way that initialization
was happening the proxy buffers were initialized only after
provisioning initialization, resulting in a corrupted buffer with
buf->data pointing to NULL. Reorder the initialization calls so that
proxy is done first and provisioning only after it.
2020-05-13 03:40:30 +00:00
lly e580f98b44 ble_mesh: Skip publish if update fails [Zephyr]
Allow models to skip a periodic publish interval by returning an error
from the publish update callback.

Previously, an error return from publish update would cancel periodic
publishing. This can't be recovered from, and as such, no valid model
implementation could return an error from this callback, and there was
no way to skip a periodic publish.
2020-05-13 03:40:30 +00:00
lly 50b4bea45c ble_mesh: Enable Segmented Control Messages [Zephyr]
The function bt_mesh_ctl_send() used to support maximum length of
11 bytes. The segmentation complies with the BLE Mesh Standard.
The ack is disabled in case of non unicast address.
2020-05-13 03:40:30 +00:00
Angus Gratton 5738c3a9c6 Merge branch 'feature/ldgen_output_determinism_v3.3' into 'release/v3.3'
ldgen: determinism in mapping rule order (v3.3)

See merge request espressif/esp-idf!8662
2020-05-13 11:30:48 +08:00
lly 4748b07fa2 ble_mesh: Not ignore msg when fast prov is enabled
When fast provisioning is enabled, Provisioner shall not
ignore messages from the nodes whose addresses are not in
the provisioning database. Because other nodes which are
not provisioned by the Primary Provisioner will send node
address messages to the Primary Provisioner.
2020-05-13 10:10:40 +08:00
Renz Bagaporo ccbca45709 ldgen: determinism in mapping rule order
This MR imposes some determinism in the mapping rule order in the output
file. For each section, the archives are arranged alphabetically
(ascending), and the mapping rules in each archive are arranged by
increasing specificity then alphabetically (ascending). The default
rules remain the very first rule for each section.
2020-05-12 22:21:35 +08:00
Michael (XIAO Xufeng) 44d1c90d25 Merge branch 'bugfix/timer_group_intr_enable_v3.3' into 'release/v3.3'
Fix timer group intr enable (backport v3.3)

See merge request espressif/esp-idf!8531
2020-05-08 15:00:16 +08:00
Island 2c1c87b37d Merge branch 'bugfix/ble_mesh_add_missing_cpp_v3.3' into 'release/v3.3'
ble_mesh: Add missing #ifdef __cplusplus (v3.3)

See merge request espressif/esp-idf!8615
2020-05-06 18:16:20 +08:00
Island 4ac84bca8b Merge branch 'bugfix/ble_mesh_compile_error_o2_v3.3' into 'release/v3.3'
ble_mesh: Fix compile error when -O2 (performance) is chosen (v3.3)

See merge request espressif/esp-idf!8618
2020-05-06 18:15:28 +08:00
Island 5a53e67c7e Merge branch 'bugfix/ble_mesh_provisioner_check_key_v3.3' into 'release/v3.3'
ble_mesh: Check if appkey exist before deleting it (v3.3)

See merge request espressif/esp-idf!8619
2020-05-06 18:09:32 +08:00
Island 6ca0c6830b Merge branch 'bugfix/ble_mesh_node_reset_erase_v3.3' into 'release/v3.3'
ble_mesh: Fix node not erase info completely (v3.3)

See merge request espressif/esp-idf!8624
2020-05-06 18:06:36 +08:00
David Čermák 722043f734 Merge branch 'feature/config_mqtt_task_prio_v3.3' into 'release/v3.3'
esp_mqtt: configure task priority, esp_mqtt_abort_connection race condition, clenaup logs and docs (v3.3)

See merge request espressif/esp-idf!8477
2020-05-06 16:18:51 +08:00
lly 745aecb03d ble_mesh: Fix node not erase info completely
Previously only mesh node info is supported to be stored
in flash. So when trying to reset the node, we only need
to judge if the BLE_MESH_VALID flag is set.
Currently we support storing both node & Provisioner info
in flash, when trying to erase the node info from flash,
the BLE_MESH_NODE flag will be checked. So we need to set
bt_mesh.flags to 0 when all the erase operations are done.
2020-05-06 11:45:02 +08:00
lly e36d1d2f8a ble_mesh: Check if appkey exist before deleting it 2020-05-06 11:37:03 +08:00
lly 1432daf4c6 ble_mesh: Add length check for some mesh operations 2020-05-06 11:33:41 +08:00
lly 6e7d43dd89 ble_mesh: Fix compile error when -O2 (performance) is chosen 2020-05-06 11:33:08 +08:00
lly 3b9e0657d8 ble_mesh: Add missing #ifdef __cplusplus 2020-05-06 11:19:05 +08:00
Mahavir Jain 511dc5516d Merge branch 'bugfix/wifi_prov_not_stopping_v3.3' into 'release/v3.3'
wifi_provisioning: Catch the Wi-Fi events even after Connection errors (v3.3)

See merge request espressif/esp-idf!8609
2020-05-06 11:18:27 +08:00
Island 53a0b3f951 Merge branch 'feat/ble_mesh_ble_adv_simultaneously_v3.3' into 'release/v3.3'
ble_mesh: Support BLE advertising simultaneously (v3.3)

See merge request espressif/esp-idf!8486
2020-05-06 11:14:52 +08:00
Island b0aeff4797 Merge branch 'bugfix/ble_mesh_rpl_list_size_v3.3' into 'release/v3.3'
ble_mesh: Associate replay protection list size with nodes count (v3.3)

See merge request espressif/esp-idf!8497
2020-05-06 11:14:42 +08:00
Island ff6c18faf2 Merge branch 'bugfix/ble_mesh_use_sdkconfig_ci_v3.3' into 'release/v3.3'
ble_mesh: Add bluedroid and nimble example configurations (v3.3)

See merge request espressif/esp-idf!8500
2020-05-06 11:14:08 +08:00
Island b33b6c4f2a Merge branch 'doc/ble_mesh_fixes_v3.3' into 'release/v3.3'
doc: Fix some ble mesh description (v3.3)

See merge request espressif/esp-idf!8504
2020-05-06 11:12:46 +08:00
Island 93a13dfd10 Merge branch 'feat/ble_mesh_sensor_model_example_v3.3' into 'release/v3.3'
ble_mesh: Add ble mesh sensor model examples (v3.3)

See merge request espressif/esp-idf!8509
2020-05-06 11:11:36 +08:00
Island 551af6c4f3 Merge branch 'bugfix/ble_mesh_time_scene_wrong_name_v3.3' into 'release/v3.3'
ble_mesh: Fix time scene wrong macro name (v3.3)

See merge request espressif/esp-idf!8512
2020-05-06 11:10:38 +08:00
Piyush Shah f66fbb75e2 wifi_provisioning: Catch the Wi-Fi events even after Connection errors
It was observed that after sending credentials, if the first
Wi-Fi conection attempt fails, the Wi-Fi provisioning managager
ignores subsequent Wi-Fi events. So, even if the device eventually
connects to the AP, the provisioning stays on indefinitely.

Changing a check so that subsequent events are also captured and
provisioning finishes successfully.
2020-05-05 22:10:25 +05:30
David Cermak dea0a75547 mqtt: clenaup logs and docs, esp_mqtt_abort_connection race condition
esp_mqtt_abort_connection: Fixed an issue which could result in a race condition and subsequent crash

esp_mqtt: Change an error print to use ESP_LOGE instead of ESP_LOGI
Move Sending MQTT connect message log from Info to Debug level
docs: Makes clear that publish API could block
Change the message printed after MQTT connection failure
2020-05-04 08:06:59 +02:00
Simon Brélivet 5ede2678aa esp_mqtt: add option to configure mqtt task priority.
Merges https://github.com/espressif/esp-idf/pull/4947
2020-05-04 08:06:59 +02:00
Krzysztof Budzynski 0c41fc73b5 Merge branch 'doc/openocd_security_features_v3.3' into 'release/v3.3'
doc: Add caveats about using JTAG debugging with hardware security features (v3.3)

See merge request espressif/esp-idf!8465
2020-05-04 03:07:40 +08:00
lly a2dbe4c452 ble_mesh: Fix client local parameters not initialized 2020-04-30 11:47:12 +00:00
lly eedaf45f43 ble_mesh: Continue node info restore even if failure happens
During BLE Mesh Provisioner initialization, the stack will restore
the nodes information if settings storage is enabled.
Previously when a failure happens (e.g. found the same uuid) during
the restore procedure, the information of the following nodes will
not be restored and error will be directly returned.
But this will introduce some problem with user experience, because
some newly provisioned nodes information will not be restored and
Provisioner will not be able to control those nodes.
So we change the operation here, when a failure happens during the
restore procedure, Provisioner will only ignore the information of
the current node and continue restoring other nodes information.
2020-04-30 11:47:12 +00:00
lly eabf436a23 ble_mesh: Remove some redundant functions 2020-04-30 11:47:12 +00:00
lly 63ab37d721 ble_mesh: Notify unprovisioned device beacon to application layer
With this change, if a Provisioner has provisioned the maximum
number of nodes, it can still report the unprovisioned device
beacon from other nodes to the application layer. And this will
be more reasonable compared with the previous implementation.
Previously when the node array of Provisioner is full, no beacon
from unprovisioned devices will be reported, only some warning
logs will be given.
2020-04-30 11:47:12 +00:00
lly 77cf16e337 ble_mesh: Check if assigned node address is duplicated
Previously only check the node address when it is assigned by the
application layer. Here we also check the address when the address
is allocated internally. And this will be useful when some mesh
internal tests are performed.
2020-04-30 11:47:12 +00:00
lly 80feb4e70a ble_mesh: Update next alloc address when node info is added 2020-04-30 11:47:12 +00:00
lly 9cb7faf4bd ble_mesh: Fix Provisioner provisioning deadlock 2020-04-30 11:47:12 +00:00
lly fecfd754d9 ble_mesh: Remove BLE_MESH_MAX_STORED_NODES option
Previously the BLE_MESH_MAX_STORED_NODES option is added for
internal mesh test, which will be a little confusing for the
users to understand.
Here we remove this option, instead the BLE_MESH_MAX_PROV_NODES
will be used for all the cases. For mesh internal test, when
the test function is called to add some nodes info, the info
will be stored in the array of provisioned nodes directly.
2020-04-30 11:47:12 +00:00
lly dbc44ccc7e ble_mesh: Associate replay protection list size with nodes count
The replay protection list of Provisioner should be at least equal
to the number of nodes with the precondition that each node contains
only one element.
The help information of replay protection list is updated, and the
maximum number of nodes for Provisioner is adjusted based on the
replay protection list size.
2020-04-30 11:47:12 +00:00
lly 6e45c091e3 doc: Fix some ble mesh description 2020-04-30 11:39:07 +00:00
lly 6417f498d2 ble_mesh: Add ble mesh sensor model examples 2020-04-30 11:32:53 +00:00
lly d77da91ffb ble_mesh: Add some common macros for sensor model 2020-04-30 11:32:53 +00:00
lly 13817a190c ble_mesh: Allow empty sensor series column value 2020-04-30 11:32:53 +00:00
lly 4e858153a8 ble_mesh: Check if same sensor (settings) property id exists 2020-04-30 11:32:53 +00:00
lly ca95b54ce4 ble_mesh: Allow empty sensor settings exist 2020-04-30 11:32:53 +00:00
lly 0e89d5874f ble_mesh: Add bluedroid and nimble example configurations 2020-04-30 08:42:43 +00:00
lly 9b1b2f9b5d ble_mesh: Support BLE advertising simultaneously 2020-04-30 08:23:24 +00:00
Angus Gratton 093e40b14d Merge branch 'bugfix/heap_psram_fill_v3.3' into 'release/v3.3'
heap: Only fill new heaps with FREE_FILL_PATTERN if Comprehensive poisoning is on (v3.3)

See merge request espressif/esp-idf!8492
2020-04-30 13:45:07 +08:00
Angus Gratton f19ecd5b88 Merge branch 'bugfix/make_to_cmake_msys_py3_v3.3' into 'release/v3.3'
tools: Make Unicode from subprocess result in the CMake convert script (v3.3)

See merge request espressif/esp-idf!8545
2020-04-29 13:44:34 +08:00
Angus Gratton 2086c993d8 Merge branch 'bugfix/fix_spi_flash_clock_config_error_v3.3' into 'release/v3.3'
flash: fix spi flash clock config error (backport v3.3)

See merge request espressif/esp-idf!8514
2020-04-29 13:22:03 +08:00
Roland Dobai b4bddbb22f tools: Make Unicode from subprocess result in the CMake convert script
Fixes an issue with Python 3 in MSYS where it fails while trying to join
paths where one part is Unicode (default string on Python3) and the
second part are bytes (returned by the subprocess call).

Closes https://github.com/espressif/esp-idf/issues/5189
2020-04-28 15:22:44 +02:00
morris 67131b7d78 timer_group: fix intr_enable
timer group interrupt enable is controled by level_int_ena instead of int_ena

Closes https://github.com/espressif/esp-idf/issues/5103
2020-04-28 12:39:54 +08:00
dowster 6a448bd030 Fix typo with sigmadelta.h #ifdef 2020-04-28 12:37:29 +08:00
Jiang Jiang Jian b6599abb1f Merge branch 'bugfix/can_not_get_IP_address_from_China_mobile_v3.3' into 'release/v3.3'
wifi: fix the bug that ESP32 can't get IP address from China Mobile router (v3.3)

See merge request espressif/esp-idf!8400
2020-04-28 11:36:58 +08:00
chenjianqiang de6e8ccea7 flash: fix spi flash clock config error
Closes https://github.com/espressif/esp-idf/issues/5099
2020-04-27 17:34:15 +08:00
lly caeb040857 ble_mesh: Fix time scene wrong macro name 2020-04-27 16:27:52 +08:00
Angus Gratton bd6bbcdbd0 Merge branch 'bugfix/idf_version_v3.3' into 'release/v3.3'
idf: Bump ESP-IDF version to v3.3.2

See merge request espressif/esp-idf!8488
2020-04-27 15:16:56 +08:00
Angus Gratton 543aa45f76 heap: Only fill new heaps with FREE_FILL_PATTERN if Comprehensive poisoning is on
Significantly speeds up heap initialization at startup when default "Light" heap
poisoning is enabled.

Tip via reddit user LinkeSeitentasche https://www.reddit.com/r/esp32/comments/fnj51a/a_guide_to_improving_esp32_boot_speed/
2020-04-27 16:34:43 +10:00
Angus Gratton ad5e4236b4 idf: Bump ESP-IDF version to v3.3.2
Feature was merged after v3.3.2 release.
2020-04-27 15:45:47 +10:00
Island e8c034c24d Merge branch 'bugfix/ble_mesh_add_test_function_v3.3' into 'release/v3.3'
ble_mesh: Add ble mesh white list test function (v3.3)

See merge request espressif/esp-idf!8160
2020-04-27 11:38:48 +08:00
Island 2c3c348659 Merge branch 'feat/ble_mesh_vnd_model_example_v3.3' into 'release/v3.3'
Feat/ble mesh vnd model example (v3.3)

See merge request espressif/esp-idf!8003
2020-04-27 11:35:45 +08:00
lly 012b810d29 ble_mesh: Add ble mesh white list test function
Using the ble mesh white list test functions, a node can choose to
only receive mesh messages from a specific node and relay the
messages for it. Messages from other nodes will be ignored.
2020-04-26 06:44:45 +00:00
Angus Gratton 12c7aa9b57 Merge branch 'fix/ci_example_test_prov_v3.3' into 'release/v3.3'
CI: Fix prov example test exception handle (v3.3)

See merge request espressif/esp-idf!8441
2020-04-24 16:13:29 +08:00
Angus Gratton b2fb688eaf Merge branch 'bugfix/ci_unterminated_sdkconfig_defaults_v3.3' into 'release/v3.3'
CI: Add EOL to sdkconfig.defaults before adding sdkconfig.ci (v3.3)

See merge request espressif/esp-idf!8458
2020-04-24 16:12:06 +08:00
Angus Gratton 6744abaeac doc: Add warnings about using JTAG debugging with hardware security features
This is related to the following issues but is not a fix, just documentation of a workaround until we can
improve the support:
https://github.com/espressif/esp-idf/issues/4878
https://github.com/espressif/esp-idf/issues/4734
2020-04-24 15:34:39 +10:00
Roland Dobai bdb8c05b25 CI: Add EOL to sdkconfig.defaults before adding sdkconfig.ci 2020-04-23 16:54:46 +02:00
Angus Gratton 92c9c7269b Merge branch 'bugfix/ci_partition_table_detection_v3.3' into 'release/v3.3'
CI: Fix partition table detection if "partition" is in the project name (v3.3)

See merge request espressif/esp-idf!8433
2020-04-23 11:38:00 +08:00
Shivani Tipnis 37bcd4e0ba CI: Fix prov example test cryptography package version exception handling 2020-04-23 00:48:05 +05:30
Roland Dobai c97a0a855f CI: Fix partition table detection if "partition" is in the project name 2020-04-22 10:26:14 +02:00
Jiang Jiang Jian 957e88d12f Merge branch 'bugfix/dns_lookup_failed' into 'release/v3.3'
lw-ip:bugfix for dns lookup failed

See merge request espressif/esp-idf!8308
2020-04-21 11:27:16 +08:00
Jiang Jiang Jian 47b891c25b Merge branch 'optimization/TCPv6_connect_for_v3.3' into 'release/v3.3'
lw-ip:optimization TCPv6 connect for v3.3(backport v3.3)

See merge request espressif/esp-idf!8022
2020-04-21 11:26:28 +08:00
zhangyanjiao 6f85135471 wifi: fix the bug that ESP32 can't get IP address from China Mobile router 2020-04-20 10:56:08 +08:00
lly 6a9c1ed48c ble_mesh: Add ESP BLE Mesh vendor models example 2020-04-17 11:59:52 +00:00
lly 842f7da7d4 ble_mesh: Rename ble_mesh_vendor_models to common_vendor_models 2020-04-17 11:59:52 +00:00
Jiang Jiang Jian f3f88e241b Merge branch 'bugfix/btdm_backports_v3.3_0328' into 'release/v3.3'
Bugfix/btdm backports v3.3 0328

See merge request espressif/esp-idf!8153
2020-04-16 21:08:10 +08:00
Angus Gratton 249da85fd9 Merge branch 'bufgix/esp_ota_get_app_elf_sha256_v3.3' into 'release/v3.3'
app_update: Fix case when elf file SHA256 should be printed by panic handler while cache is disabled (v3.3)

See merge request espressif/esp-idf!8368
2020-04-16 14:31:31 +08:00
Angus Gratton a0b1f1bb07 Merge branch 'bugfix/efuse_get_coding_scheme_and_ut_v3.3' into 'release/v3.3'
efuse: Fix get_coding_scheme() using ESP_EARLY_LOG* instead of ESP_LOG* (v3.3)

See merge request espressif/esp-idf!8362
2020-04-16 14:29:54 +08:00
Angus Gratton c6f78f3071 Merge branch 'feature/add_rtc_xtal_cal_retry_option_v3.3' into 'release/v3.3'
esp32: Add a Kconfig option - Number of attempts to repeat 32k XTAL calibration (v3.3)

See merge request espressif/esp-idf!7933
2020-04-16 14:24:01 +08:00
Marius Vikhammer 9f2056dad4 app_update: fix test failure for get_app_elf_sha256 test
Commit fc03161f updated esp_ota_get_app_elf_sha256 to store and return
X number of bytes of the hash, but the test case still expected 64 bytes.

Updated test case to use CONFIG value for expected length.
2020-04-15 21:49:32 +08:00
KonstantinKondrashov 2705b76371 app_update: Fix case when elf file SHA256 should be printed by panic handler while cache is disabled
Closes: IDF-1342
2020-04-15 21:07:02 +08:00
KonstantinKondrashov 383cd73e38 efuse: Fix get_coding_scheme() when CONFIG_SECURE_FLASH_ENC_ENABLED and LOG_LEVEL is Debug
Closes: https://github.com/espressif/esp-idf/issues/4862
2020-04-15 20:24:41 +08:00
KonstantinKondrashov a5f9a0cbe4 esp32: Add a Kconfig option- Number of attempts to repeat 32k XTAL calibration
Closes: IDF-1479
2020-04-15 16:52:23 +08:00
Jiang Jiang Jian 2ebad4639e Merge branch 'bugfix/psram_single_bit_error_v3.3' into 'release/v3.3'
psram: support psram 2T mode to fix single bit error (backport v3.3)

See merge request espressif/esp-idf!7011
2020-04-15 13:28:22 +08:00
Jiang Jiang Jian a656caed7a Merge branch 'nimble/fix_ble_hs_reset_v3.3' into 'release/v3.3'
NimBLE: Reset master and slave states on host reset and fix build failure (backport v3.3)

See merge request espressif/esp-idf!8219
2020-04-15 13:28:04 +08:00
Jiang Jiang Jian 2aba47f8dd Merge branch 'bugfix/backport_some_wifi_bugs_0326_v3.3' into 'release/v3.3'
esp32: backport some WiFi fixes (backport v3.3)

See merge request espressif/esp-idf!8186
2020-04-15 13:07:01 +08:00
chenjianqiang 22c0334ad9 psram: support psram 2T mode to fix single bit error
1. add enable PSRAM 2T mode function
2. abort when himem and 2T mode are enabled meanwhile
3. set SPIRAM_2T_MODE as "n" by default, enable it when needed
2020-04-13 15:25:13 +08:00
xueyunfei 6cdb27a361 bugfix for dns lookup failed 2020-04-10 11:07:54 +08:00
Angus Gratton ec0605db4c Merge branch 'feature/idf_version_header_v3.3' into 'release/v3.3'
esp_common: add version definitions in code and build system (backport v3.3)

See merge request espressif/esp-idf!8233
2020-04-08 15:08:03 +08:00
Angus Gratton cde76fece9 Merge branch 'bugfix/efuse_write_config_v3.3' into 'release/v3.3'
efuse: set timing configuration before writing (backport v3.3)

See merge request espressif/esp-idf!8231
2020-04-08 15:06:30 +08:00
Prasad Alatkar aad04405fc NimBLE: Reset master and slave states on host reset and fix build failure (backport v3.3) 2020-04-07 10:52:01 +05:30
Mahavir Jain 8c5a0a0a57 Merge branch 'feature/upgrade_mbedtls_to_v3.3' into 'release/v3.3'
mbedtls: upgrade to release v2.16.5 (v3.3)

See merge request espressif/esp-idf!7988
2020-04-07 12:10:07 +08:00
Mahavir Jain 04d46d5d61 Merge branch 'bugfix/size_calculation_in_ota_v3.3' into 'release/v3.3'
Fix size calculation to erase partition range for OTA image (v3.3)

See merge request espressif/esp-idf!8268
2020-04-06 18:04:22 +08:00
Shubham Kulkarni 6f39fea03d esp_ota_ops.c: Fix size calculation to erase partition range for OTA image
Closes https://github.com/espressif/esp-idf/issues/4953
2020-04-06 13:40:12 +05:30
Ivan Grokhotkov ca6b009c26 esp_common: add version definitions in code and build system
Closes https://github.com/espressif/esp-idf/issues/4679
2020-04-03 01:24:33 +02:00
Ivan Grokhotkov dd5190868a efuse: set timing configuration before writing 2020-04-03 00:51:36 +02:00
David Čermák 1ba3bf2976 Merge branch 'feature/websocket_client_v3.3' into 'release/v3.3'
Feature/websocket client v3.3

See merge request espressif/esp-idf!8040
2020-04-02 20:28:24 +08:00
Marius Vikhammer b56012783c tcp_transport/ws_client: websockets now correctly handle messages longer than buffer
transport_ws can now be read multiple times in a row to read frames larger than the buffer.

Added reporting of total payload length and offset to the user in websocket_client.

Added local example test for long messages.

Closes IDF-1083
2020-04-02 07:30:12 +00:00
Marius Vikhammer d6ef9d73bb websocket: backport of websocket client to v3.3
Backports the websocket client and example to ESP-IDF release 3.3.
2020-04-02 07:30:12 +00:00
Jiang Jiang Jian a71e85fb63 Merge branch 'bugfix/btdm_dont_dequeue_the_command_queue_v3.3' into 'release/v3.3'
component/bt: fix don't dequeue the command queue after process the read_by_type_req(backport v3.3)

See merge request espressif/esp-idf!8183
2020-04-02 12:08:40 +08:00
liu zhifu a0d61eca20 esp32: backport some WiFi fixes to v3.3
Backport following Wifi fixes:

1. Optimize WiFi sleep in WiFi/BT coexist mode
   I> If any data TX/RX in WiFi slice, force wakeup next TBTT
   II> Increase active timeout to coex TBTT to avoid sleep in WiFi slice

2. Fix esp_wifi_stop() crash
   esp_wifi_stop() crashes if it's called when WiFi is not initialized.

3. Fix WiFi log print level

4. Return fails if AP's configuring AP channel is out of range

5. esp_wifi_sta_get_ap_info() returns actual values of group ciphers
2020-04-02 10:27:11 +08:00
Mahavir Jain 530b35b222 mbedtls: upgrade to release v2.16.5
For detailed release notes please refer to:
https://tls.mbed.org/tech-updates/releases/mbedtls-2.16.5-and-2.7.14-released

Closes: IDFGH-2638
Closes: https://github.com/espressif/esp-idf/issues/4716
2020-04-01 13:46:09 +00:00
Sagar Bijwe 5723e717e5 wpa_supplicant: Fix SAE test-case failure on mbedtls version udpate
Problem:
mbedtls_ctr_drbg_context was initialized in crypto_ec_point_mul. This
was okay in releases before 2.16.4 as entropy_len used to get set to
MBEDTLS_CTR_DRBG_ENTROPY_LEN in function mbedtls_ctr_drbg_seed. The
function is now changed to set the length to
MBEDTLS_CTR_DRBG_ENTROPY_LEN if previous length is 0 and hence the bug.

Solution:
Initialize mbedtls_ctr_drbg_context in crypto_ec_point_mul.
2020-04-01 13:46:09 +00:00
Angus Gratton 23c4d052ef Merge branch 'bugfix/kconfiglib_open_encoding_v3.3' into 'release/v3.3'
tools: Avoid Unicode error in kconfiglib while opening files (v3.3)

See merge request espressif/esp-idf!8178
2020-04-01 15:15:12 +08:00
Angus Gratton ba9ef572c0 Merge branch 'backport/malloc_zero_return_null_v3.3' into 'release/v3.3'
backport/malloc_zero_return_null_v3.3

See merge request espressif/esp-idf!8144
2020-04-01 14:42:50 +08:00
Mahavir Jain 08af2023c5 Merge branch 'fix/wifi_provisioning_uuid_v3.3' into 'release/v3.3'
Wifi_provisioning: Change service_uuid to non standard 128 bit UUID and add retries in test script (backport v3.3)

See merge request espressif/esp-idf!8164
2020-04-01 13:04:47 +08:00
xiewenxiang 23474dc737 component/bt: fix don't dequeue the command queue after process the read_by_type_req(backport v3.3) 2020-03-31 16:45:57 +08:00
Roland Dobai e0364cbde1 tools: Avoid Unicode error in kconfiglib while opening files
This fix is for IDF v4.0 and earlier versions. The upstream kconfiglib
included since IDF v4.1 doesn't have this issue.

Closes https://github.com/espressif/esp-idf/issues/4977
2020-03-31 08:30:35 +02:00
Prasad Alatkar 3a5c7700a7 Wifi_provisioning_mgr_test: Allow three attempts to connect to AP before concluding provisioning failure(v3.3) 2020-03-30 11:20:53 +05:30
Prasad Alatkar 296ab7c80e Wifi_provisioning_ble: Change service_uuid to non standard 128 bit UUID (v3.3)
- Modifies UUIDs in scheme_ble, manager example and esp_prov tool to custom 128
  bit UUID
2020-03-30 11:20:30 +05:30
baohongde 0ac0a3126f components/coex: Fix wakeup delay with DFS 2020-03-28 21:15:21 +08:00
baohongde 41fe01cc99 components/bt: Fix assert when create conntion cancel 2020-03-28 21:08:52 +08:00
Felipe Neves 48e78e6e07 multi_heap: ensure that malloc(0) return NULL pointer in any poisoning configuration 2020-03-27 14:35:50 -03:00
Angus Gratton 6c9c253ed1 Merge branch 'bugfix/esp_event_bugfixes_v3.3' into 'release/v3.3'
esp_event-related fixes (v3.3)

See merge request espressif/esp-idf!8073
2020-03-26 16:20:10 +08:00
Jiang Jiang Jian c44a9f9a4e Merge branch 'bugfix/send_ok_when_sta_disconnect_for_v3.3' into 'release/v3.3'
lw-ip:bugfix for TCPv6 send ok when sta disconnect for 3.3

See merge request espressif/esp-idf!8016
2020-03-25 11:15:52 +08:00
Jiang Jiang Jian 6feb88f69b Merge branch 'bugfix/Add_lwip_assert_control_v3.3' into 'release/v3.3'
lw-ip: Add lw-ip assert control (backport v3.3)

See merge request espressif/esp-idf!8028
2020-03-23 15:07:40 +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
Renz Christian Bagaporo 84227aeac0 esp_event: remove extra line from source file 2020-03-22 22:34:38 +08:00
Renz Christian Bagaporo 2e3a949f3a esp_event: test that handlers can unregister themselves 2020-03-22 22:34:30 +08:00
Renz Christian Bagaporo 0890ce9115 esp_event: iterate loop nodes safely as well 2020-03-22 22:34:21 +08:00
Xentec 9b16cb75f8 esp_event: fix crash when unregistering a handler instance in itself
When a handler instance is the last one in the list und unregisters
itself, the handler iterator will be invalidated by entering free'd
memory. Same applies for event base and id, if they become empty.

Merges https://github.com/espressif/esp-idf/pull/4139
2020-03-22 22:34:07 +08:00
Rusty Eddy 9c0cf3c28a Added semi-colon to esp_event_loop_create(...)
Title sums it up.
2020-03-22 22:32:46 +08:00
He Yin Ling 42891432c5 Merge branch 'bugfix/modify_ble_mesh_command_for_v3.3' into 'release/v3.3'
ble mesh: update ble mesh console example(backport v3.3)

See merge request espressif/esp-idf!8044
2020-03-22 18:35:41 +08:00
Chen Sheng 9fc2212e16 ble mesh: update ble mesh console example(backport v3.3) 2020-03-22 18:35:39 +08:00
Mahavir Jain 5284b0aa4f Merge branch 'bugfix/newlib_putchar_locking_v3.3' into 'release/v3.3'
newlib: don't define non-thread-safe versions of getc, putc (v3.3)

See merge request espressif/esp-idf!8029
2020-03-20 16:56:19 +08:00
Ivan Grokhotkov f6763a9d84 newlib: don't define non-thread-safe versions of getc, putc
getc, getchar, putc, putchar were defined both as functions and as
macros. The macro versions are not thread safe, and should not be used
in multithreaded applications.

Upstream fix: b0f271d1db
2020-03-19 12:44:20 +01:00
xiehang 3d821dc821 LWIP: Add lwip assert control 2020-03-19 19:15:24 +08:00
xueyunfei 1cb4cd5ec6 optimization TCPv6 connect 2020-03-19 11:43:44 +08:00
xueyunfei 649a6afeb9 bugfix for TCPv6 send ok when sta disconnect 2020-03-18 17:58:07 +08:00
Jiang Jiang Jian 9e70825d1e Merge branch 'bugfix/sntp_init_can_run_before_net_connection_v3.3' into 'release/v3.3'
lw_ip: Add to sys_arch_protect() a check that the mutex is created before use if not then creates it (v3.3)

See merge request espressif/esp-idf!7758
2020-03-18 12:07:08 +08:00
Island 151b6d9bef Merge branch 'bugfix/allow_adv_stop_again_in_host' into 'release/v3.3'
Fix allow to send stop adv hci cmd when host adv state is disable

See merge request espressif/esp-idf!7993
2020-03-17 23:52:04 +08:00
Island c4308384d6 Merge branch 'bugfix/ble_mesh_nimble_adapt_deinit_v3.3' into 'release/v3.3'
ble_mesh: Fix ble mesh nimble host deinit (v3.3)

See merge request espressif/esp-idf!7998
2020-03-17 15:54:52 +08:00
lly cc07e9d203 ble_mesh: Fix ble mesh nimble host deinit 2020-03-17 14:42:46 +08:00
gengyuchao ab175f8845 fix allow to send stop adv hci cmd when host adv state is disable 2020-03-16 21:37:07 +08:00
Jiang Jiang Jian 206a844e4a Merge branch 'bugfix/fix_scan_get_rssi_err_v3.3' into 'release/v3.3'
esp_wifi: Fix scan get rssi err (backport v3.3)

See merge request espressif/esp-idf!7963
2020-03-16 20:56:30 +08:00
Jiang Jiang Jian bf568f2eb4 Merge branch 'bugfix/ble_mesh_miscellaneous_fix_v3.3' into 'release/v3.3'
Bugfix/ble mesh miscellaneous fix (v3.3)

See merge request espressif/esp-idf!7971
2020-03-16 13:27:35 +08:00
Jiang Jiang Jian 36cddd0bae Merge branch 'bugfix/ble_mesh_update_3.3' into 'release/v3.3'
Bugfix/ble mesh update 3.3

See merge request espressif/esp-idf!7801
2020-03-16 13:26:44 +08:00
Jiang Jiang Jian 13d4ab5afb Merge branch 'nimble/misc_host_flow_ctrl_changes_v3.3' into 'release/v3.3'
NimBLE: Misc fixes in NimBLE host (backport v3.3)

See merge request espressif/esp-idf!7960
2020-03-16 13:26:37 +08:00
Prasad Alatkar 4fb4c01c53 NimBLE: Add Host based privacy (RPA) feature support (v3.3)
- This feature removes dependency on controller to use privacy (RPA)
2020-03-15 21:43:01 +05:30
Prasad Alatkar 237f7eb92a NimBLE: Fix check for static random address & add MSYS_1 in menuconfig (v3.3) 2020-03-15 21:43:01 +05:30
Hrishikesh Dhayagude 5ca8851be8 NimBLE: Use dynamic buffers instead of static memory (v3.3)
The NimBLE host buffers that consume a significant amount of memory are
now allocated dynamically.
The advantage is that, the memory can be reclaimed in cases where BLE
is turned off and not required for the current boot cycle
2020-03-15 21:43:01 +05:30
Prasad Alatkar b6c88b683f NimBLE: Misc changes in host flow control, ble_gap_unpair, ble_hs_hci_rx_evt & example (v3.3)
- Add menuconfig option for NimBLE host flow control
- Include changes in `blecent` example from upstream PR!702
- add ble_hs_lock in ble_gap_unpair Upstream PR!584
- ble_hs_hci_rx_evt, upstream PR!738
2020-03-15 21:43:01 +05:30
lly a8763e6517 ble_mesh: Move dev_role to the end of model_pub 2020-03-13 19:53:26 +08:00
lly de022501b7 ble_mesh: Use the right netkey during iv update 2020-03-13 19:53:23 +08:00
lly 0d6dd36af9 ble_mesh: Use the right net_idx & app_idx for publish 2020-03-13 19:53:19 +08:00
lly 68dba56ac8 ble_mesh: Check buf->ref before unref the buffer 2020-03-13 19:53:16 +08:00
lly 9f32f4b405 ble_mesh: Fix mesh memory use-after-free issue 2020-03-13 19:53:12 +08:00
lly c19a01d100 ble_mesh: Add ble mesh deinit in btc task 2020-03-13 19:53:08 +08:00
lly 2ae6eedb30 ble_mesh: Free beacon timer when deinit mesh 2020-03-13 19:53:02 +08:00
lly e73ad2c391 ble_mesh: Use lock for mesh timer operations 2020-03-13 19:52:50 +08:00
xiehang 6de264be1e esp_wifi: Fix scan get rssi err
Remove software modify rssi
2020-03-13 19:41:11 +08:00
Jiang Jiang Jian 766eace598 Merge branch 'bugfix/backport_some_wifi_bugs_0310_v3.3' into 'release/v3.3'
Backport some wifi bugs 0310 (backport v3.3)

See merge request espressif/esp-idf!7935
2020-03-13 19:38:01 +08:00
Mahavir Jain 1bd55a9af2 Merge branch 'bugfix/unicore_config_prevent_ipc_code_v3.3' into 'release/v3.3'
ipc: prevent code getting pulled in for unicore configuration (v3.3)

See merge request espressif/esp-idf!7945
2020-03-12 23:18:40 +08:00
Mahavir Jain 6babdfc0b7 ipc: prevent code getting pulled in for unicore configuration 2020-03-12 16:28:00 +05:30
KonstantinKondrashov 7013d2d7c5 lwip: Add to sys_arch_protect() a check that the mutex is created before use if not then creates it
Closes: https://github.com/espressif/esp-idf/issues/944
Closes: https://github.com/espressif/esp-idf/issues/3931
Closes: WIFI-1019
2020-03-11 19:23:24 +08:00
Mahavir Jain 2d7be5c35d Merge branch 'bugfix/ota_with_redirection_v3.3' into 'release/v3.3'
esp_https_ota in sync with master (v3.3)

See merge request espressif/esp-idf!7749
2020-03-11 14:44:54 +08:00
xiehang c9e7a04a9e Update wifi lib
1. Add wifi stop check at wifi deinit entry.
2. Add TX packets size check.
3. Reduce wifi bin size.
4. Fix the bug for setting channel when wifi in NULL mode.
5. Place the Vendor Specific element at the end according to the protocol.
6. Coex adjust scheme when bt is in connnected status.
2020-03-10 20:01:39 +08:00
Shubham Kulkarni 5def4ad7fe esp_https_ota.c: Add errno check for WiFi disconnection while performing OTA 2020-03-09 13:21:21 +05:30
Shubham Kulkarni 3cceacc931 OTA: Add fix in case of URL redirection
Test case for URL Redirection and Chunked server is added
2020-03-09 13:21:21 +05:30
Shubham Kulkarni 9df632482c OTA: Fixed OTA with chunked servers
If esp_http_client_read returns 0, errno check is performed if complete data is not received.
2020-03-09 13:21:21 +05:30
Angus Gratton 46c8f40a83 Merge branch 'bugfix/fix_extra_component_dirs_ordering_v3.3' into 'release/v3.3'
cmake: fix extra component dirs ordering (v3.3)

See merge request espressif/esp-idf!7730
2020-03-09 13:55:04 +08:00
Jiang Jiang Jian 6f9a7264ce Merge branch 'bugfix/bt_interrupt_disable_timing_error_v3.3' into 'release/v3.3'
(backport v3.3) btController: events scheduling error in case of wifi and bluetooth.

See merge request espressif/esp-idf!7889
2020-03-06 11:34:11 +08:00
Chinmay Chhajed 72fb22ed51 This MR is intended to fix Bluetooth event scheduling when WiFi is also enabled.
The global interrupts will be disabled before taking current
time for scheduling further bluetooth events. Earlier disabling
interrupts was taking some time because of which WiFi events were
interrupting in current bluetooth scheduling.

Also fixes ble crash issue triggered by ble event irq miss (0x20000).
2020-03-05 18:58:28 +05:30
Jakob Hasse 58cf509495 NVS: Changed all new to new (nothrow) 2020-03-04 15:26:34 +08:00
Angus Gratton cc34d5a5b0 Merge branch 'bugfix/phy_partition_address_v3.3' into 'release/v3.3'
cmake: Fix bug where PHY partition offset incorrectly set (v3.1)

See merge request espressif/esp-idf!7837
2020-03-04 07:35:52 +08:00
Angus Gratton 1eaccfae4a cmake: Fix bug where PHY partition offset incorrectly set 2020-03-02 23:27:51 +00:00
Jiang Jiang Jian ade22b2ae7 Merge branch 'bugfix/fix_wifi_stop_leads_to_memory_leak_v3.3' into 'release/v3.3'
esp32: fix the bug that WiFi stop leads to memory leak (backport v3.3)

See merge request espressif/esp-idf!7797
2020-02-28 20:40:28 +08:00
lly 0e2c77b185 ble_mesh: Calc incomplete timeout based on msg info 2020-02-27 15:47:26 +08:00
lly 91ad0f9f4a ble_mesh: Start the timer when starting to send the client message 2020-02-27 15:47:12 +08:00
lly 70eadc0b05 ble_mesh: No timeout for client message to non-unicast address 2020-02-27 15:46:54 +08:00
lly 49fc8c86b3 ble_mesh: Unify client application and lower transport layer timeout 2020-02-27 15:46:19 +08:00
lly 04a6ac3cf5 ble_mesh: Allow maximum 377 octets payload 2020-02-27 15:46:03 +08:00
lly 9fa5c14d58 ble_mesh: Reset transport info when node is removed 2020-02-27 15:45:46 +08:00
lly cc19e1da9b ble_mesh: Provisioner ignores msg from removed node 2020-02-27 15:45:15 +08:00
liu zhifu 96bb4c6e78 esp32: fix the bug that WiFi stop leads to memory leak 2020-02-27 14:28:39 +08:00
Ivan Grokhotkov f3c3605fc2 Merge branch 'feature/idf_docker_updates_v3.3' into 'release/v3.3'
tools/docker: install CMake version provided in tools.json (backport v3.3)

See merge request espressif/esp-idf!7483
2020-02-26 17:45:54 +08:00
Michael (XIAO Xufeng) b3d5fe849d Merge branch 'feat/mcpwm_hal_fixes_v3.3' into 'release/v3.3'
mcpwm: add HAL layer support (fix part, backport v3.3)

See merge request espressif/esp-idf!7744
2020-02-24 09:11:10 +08:00
Jiang Jiang Jian d0d0c979bc Merge branch 'bugfix/transport_connection_active_v3.3' into 'release/v3.3'
fix(transport): Fix a bug of the connection whether be active or not (v3.3)

See merge request espressif/esp-idf!7736
2020-02-22 16:01:13 +08:00
Jiang Jiang Jian 12aa90e6a2 Merge branch 'feature/dev_security_restore_backport_v3p3' into 'release/v3.3'
feature/dev_security_restore_backport_v3p3(backport release/v3.3)

See merge request espressif/esp-idf!7739
2020-02-22 16:00:54 +08:00
Jiang Jiang Jian ccb52dea65 Merge branch 'bugfix/mesh_ie_issues_3.3' into 'release/v3.3'
Bugfix/mesh ie issues (backport 3.3)

See merge request espressif/esp-idf!7322
2020-02-22 12:15:16 +08:00
Michael (XIAO Xufeng) c9edf16376 mcpwm: decrease test time
cherry-pick 538540ce
2020-02-21 22:39:12 +08:00
michael 919dbdd170 mcpwm: fix the fault handling and capture issues
1. The fault signal 3 for unit 2 is corrected to the right value

2. Now `mcpwm_fault_set_oneshot_mode` will clear the status before, no
need to reset the peripheral.

3. The capture feature relies on the prescaler, but it's only
initialized in the mcpwm_init funciton, which is used to initialize a
PWM channel. This means, the capture may not work correctly if no PWM
channel is enabled.

   Now the prescaler is also updated when `mcpwm_capture_enable` is
called.
2020-02-21 22:39:11 +08:00
michael 3c6f992cf0 mcpwm: enable some unit tests again 2020-02-21 22:39:03 +08:00
June 2548168277 backport mr !6031 - fix security info restore bug 2020-02-21 20:17:17 +08:00
Anton Maklakov 4b763f361d idf_tools.py: fix downloading for tools which have "on_request" options for some platforms.
'install' and 'download' options can be used for 'required' or 'all' tools
2020-02-21 11:34:04 +01:00
Ivan Grokhotkov faf86f72fb tools/docker: install CMake version provided in tools.json
Closes https://github.com/espressif/esp-idf/issues/4644
Closes IDFGH-2559
2020-02-21 11:34:04 +01:00
chenyudong a3c4b04675 mesh: fix mesh ie issues
Fix an error of mesh deinit lock.
Fix mesh send returns TIMEOUT.
Increase root window close time to 120s.
Clear ie.child when the child connected or fully associated.
Update rc_rssi when roots direct/forward.
ix assoc in mesh ie wrong.
Mesh packets use AC_VI instead of AC_BE.
2020-02-21 18:29:01 +08:00
Jiang Jiang Jian a55cd0e7f3 Merge branch 'optimization/get_dns_server_and_add_dns_enable_ipv6_dns_retrieval' into 'release/v3.3'
lw-ip:optimization get dns server and add dns enable ipv6 dns retrieval

See merge request espressif/esp-idf!7643
2020-02-21 18:20:52 +08:00
Jiang Jiang Jian 7ab0a59bb3 Merge branch 'bugfix/host_and_example_bugfix_backport_to_v3.3' into 'release/v3.3'
Bugfix/host and example bugfix backport to v3.3

See merge request espressif/esp-idf!7723
2020-02-21 18:15:48 +08:00
Jiang Jiang Jian bc77899fb2 Merge branch 'bugfix/ci_confserver_timeout_again_v3.3' into 'release/v3.3'
ci: Adjust more 'spawn' settings in test_confserver (backport v3.3)

See merge request espressif/esp-idf!5322
2020-02-21 18:09:17 +08:00
Liu Han 67be0ae585 fix(transport): Fix a bug of the connection whether be active or not by timeout option when the select function return a correct value. 2020-02-21 11:01:15 +01:00
Liu Han 8246bfa8fb fix(transport): Fix a bug of the connection whether be active or not. 2020-02-21 11:00:43 +01:00
Jiang Jiang Jian 7d1c44fb7e Merge branch 'bugfix/btdm_role_switch_v3.3' into 'release/v3.3'
Fix bugs about role switch

See merge request espressif/esp-idf!7721
2020-02-21 17:49:46 +08:00
Jiang Jiang Jian 56140d11ce Merge branch 'bugfix/mqtt_submodule_ref_update_v3.3' into 'release/v3.3'
mqtt: update submodule to point to latest commit (backport v3.3)

See merge request espressif/esp-idf!7287
2020-02-21 17:24:37 +08:00
Jiang Jiang Jian 93f151f6d4 Merge branch 'bugfix/mbedtls_esp_bignum_v3.3' into 'release/v3.3'
mbedtls: esp bignum fix for 4096 keys (v3.3)

See merge request espressif/esp-idf!7706
2020-02-21 17:17:39 +08:00
Jiang Jiang Jian 89355c2ec0 Merge branch 'bugfix/fix_some_typo_in_v3.3' into 'release/v3.3'
Fix some typo in idf backport v3.3

See merge request espressif/esp-idf!7725
2020-02-21 17:16:55 +08:00
Jiang Jiang Jian 8737c444d6 Merge branch 'bugfix/add_option_to_ipv6_stateless_address_configuration_v3.3' into 'release/v3.3'
lw-ip: Add option to ipv6 stateless address configuration (backport v3.3)

See merge request espressif/esp-idf!7694
2020-02-21 14:56:23 +08:00
Jiang Jiang Jian d386a22f1f Merge branch 'bugfix/nimble_apps_conn_handle_v3.3' into 'release/v3.3'
examples/bluetooth/nimble: Correct the connection handle in update and enc_change event (v3.3)

See merge request espressif/esp-idf!7703
2020-02-21 14:49:30 +08:00
Jiang Jiang Jian bc0d116b7a Merge branch 'feature/wifi_redo_scan_example_v3.3' into 'release/v3.3'
esp_wifi: Additional code snippets in esp_wifi_scan_example (backport v3.3)

See merge request espressif/esp-idf!7502
2020-02-21 14:48:57 +08:00
Hrudaynath Dhabe e3dadfafb8 esp_wifi: Additional code snippets in esp_wifi_scan_example (backport v3.3) 2020-02-21 14:48:56 +08:00
xueyunfei 681dba4afd optimization get dns server and add dns enable ipv6 dns retrieval 2020-02-20 14:06:07 +00:00
Mahavir Jain 32387506fb Merge branch 'bugfix/esp_log_timestamp_v3.3' into 'release/v3.3'
Use proper API to get Tick Count is esp_log_timestamp (v3.3)

See merge request espressif/esp-idf!7720
2020-02-20 20:13:23 +08:00
gengyuchao 94255c421d Fix some typo in idf release v3.3 2020-02-20 20:05:10 +08:00
gengyuchao b6e9a15e81 Component/bt :
Add handling of osi memory calloc failure.
Add length check for snprintf in osi config.
2020-02-20 19:39:03 +08:00
Mahavir Jain 3359e063a3 Merge branch 'fix/run_esptool_absolute_path_v3.3' into 'release/v3.3'
project_include.cmake: Make esptool_py_custom_target callable from other directories (v3.3)

See merge request espressif/esp-idf!7711
2020-02-20 19:38:32 +08:00
gengyuchao dcc4943b3d example/ble_hid_device_demo fix the wrong mask value according to HID protocol 2020-02-20 19:19:33 +08:00
gengyuchao 53664c80ff component/bt: Fix the issue with pointer type conversion in gattc. Unified att(db_sizedb_size) count pointer type in bta and btc, change pointer type in bta from int to uint16_t. 2020-02-20 19:16:01 +08:00
baohongde 74b964ed67 Fix bugs about role switch
Jitter in FHS
Jitter in first PULL
Receive EDR packet fail after role switch
2020-02-20 19:11:45 +08:00
Shubham Kulkarni 110620a80c log: Check for ISR context and use proper API to get Tick Count 2020-02-20 16:02:16 +05:30
gengyuchao e454d4d8e8 Bulfi: Check if ble is connected before sending a message via ble. Fix the wrong wifi storage mode from WIFI_STORAGE_RAM to default WIFI_STORAGE_FLASH. 2020-02-20 18:11:55 +08:00
gengyuchao 6241139685 example/ble_throughput:
Fixed the throughput wasting memory and packet loss issues.
Fixed the throughput crash bug because of using the Mutex.
2020-02-20 18:05:23 +08:00
gengyuchao 4375e60a6e bugfix: ble add missing gatt descriptors 2020-02-20 17:54:45 +08:00
Jiang Jiang Jian 26383e95fd Merge branch 'feature/esp32_5p0_backport_v3p3' into 'release/v3.3'
backport esp325p0 new features and code optimize to v3.3

See merge request espressif/esp-idf!7564
2020-02-20 17:38:23 +08:00
David Cermak fe5b7b549c mbedtls: fix hw accelerated big-num mul if operand and result overlap
this issue is mainly exposed when using larger (4096) client key in TLS mutual auth,
since it uses multiplications > 2048 when mbedtls_mpi_mul_mpi is used in recursion,
which works only if both operands point to different location than result since
mpi_mult_mpi_overlong() called mbedtls_mpi_grow() to reallocate buffers used in previous
pointer arithmetics and thus corrupting it. Fixed by growing the mpi buffer before
calling mpi_mult_mpi_overlong()
2020-02-20 10:05:48 +01:00
David Cermak 12d639e5b2 mbedtls: added mpi multiplication test for large numbers 2020-02-20 10:05:48 +01:00
Hrishikesh Dhayagude e14c55c3ad examples/bluetooth/nimble: Correct the connection handle in update and enc_change event 2020-02-20 14:02:33 +05:30
Amit Sheth 03b3e5eff2 project_include.cmake: Make esptool_py_custom_target callable from other directories (backport v3.3) 2020-02-20 13:11:52 +05:30
Renz Christian Bagaporo 9d0e3501c5 cmake: fix extra component dirs ordering 2020-02-20 12:31:23 +05:00
Jiang Jiang Jian c1bf7057d3 Merge branch 'bugfix/fix_sniffer_bug_caused_by_mode_switch_v3.3' into 'release/v3.3'
FIx sniffer bug caused by mode switch (backport v3.3)

See merge request espressif/esp-idf!7685
2020-02-20 14:58:33 +08:00
Jiang Jiang Jian 365092fb57 Merge branch 'bugfix/coex_a2dp_stuck_after_creating_another_connection_v3.3' into 'release/v3.3'
components/coex: Fix a2dp stuck after creating another connection

See merge request espressif/esp-idf!7663
2020-02-20 14:16:53 +08:00
xiehang cee1bc9f8e lw-ip: Add option to ipv6 stateless address configuration 2020-02-20 14:06:26 +08:00
Michael (XIAO Xufeng) 18e5d35722 Merge branch 'bugfix/add_missing_ledc_set_pin_declaration_v3.3' into 'release/v3.3'
Bugfix:  Add missing ledc_set_pin declaration in led.h (v3.3)

See merge request espressif/esp-idf!7370
2020-02-20 13:53:13 +08:00
Anton Maklakov 013b8ab34c ci: Adjust more 'spawn' settings in test_confserver 2020-02-20 04:29:57 +00:00
Jiang Jiang Jian fb2d0de8f9 Merge branch 'bugfix/enable_ipv6_address_autoconfig_v3.3' into 'release/v3.3'
lw-ip: Enable IPv6 stateless address autoconfiguration (backport v3.3)

See merge request espressif/esp-idf!7657
2020-02-20 11:46:23 +08:00
xiehang a853c84db2 esp_wifi: Small refactor for ic_set_vif 2020-02-19 21:54:04 +08:00
Jiang Jiang Jian 3aa0922221 Merge branch 'bugfix/controller_initializer_order' into 'release/v3.3'
fix initializer order for BT_CONTROLLER_INIT_CONFIG_DEFAULT

See merge request espressif/esp-idf!7623
2020-02-19 17:09:17 +08:00
Jiang Jiang Jian e0b29aca15 Merge branch 'bugfix/fix_airkiss_bug_v3.3' into 'release/v3.3'
fix the bug for Airkiss (backport v3.3)

See merge request espressif/esp-idf!7666
2020-02-19 16:40:22 +08:00
Michael (XIAO Xufeng) b1a9e364bb Merge branch 'bugfix/i2s_timergroup_some_issues_v3.3' into 'release/v3.3'
bugfix(driver): fix i2s and timergroup some issues(backport v3.3)

See merge request espressif/esp-idf!7172
2020-02-19 11:19:10 +08:00
zhangyanjiao 2dfadc9657 fix the bug for Airkiss can't get the ip of the cellphone 2020-02-19 10:19:26 +08:00
Angus Gratton 5323c159c1 Merge branch 'bugfix/kconfig_cmake_escape_v3.3' into 'release/v3.3'
confgen.py: Escape special characters for cmake (v3.3)

See merge request espressif/esp-idf!7647
2020-02-19 08:01:38 +08:00
Angus Gratton 09e2a82970 Merge branch 'doc/partition_table_app_test_v3.3' into 'release/v3.3'
partition table: Update documentation about "test" partition type (v3.3)

See merge request espressif/esp-idf!7631
2020-02-19 08:00:49 +08:00
Jiang Jiang Jian 2d2ccaacd8 Merge branch 'bugfix/unified_prov_bluedroid_v3.3' into 'release/v3.3'
Unified Provisioning - BLE: Fix characteristics read response issue (backport v3.3)

See merge request espressif/esp-idf!7649
2020-02-18 20:57:51 +08:00
Jiang Jiang Jian a4bbcbcf98 Merge branch 'bugfix/ble_mesh_fix_compile_error_with_cpp_3.3' into 'release/v3.3'
ble_mesh: Fix compile error with c++ files (v3.3)

See merge request espressif/esp-idf!7585
2020-02-18 20:44:31 +08:00
baohongde 7592ec77f5 components/coex: Fix a2dp stuck after creating another connection 2020-02-18 20:22:48 +08:00
xiehang 2f1d050133 lw-ip: Enable IPv6 stateless address autoconfiguration 2020-02-18 19:28:22 +08:00
Jiang Jiang Jian 9b1c1f21f9 Merge branch 'bugfix/strncpy_issue_in_wifi_example_v3.3' into 'release/v3.3'
replace strncpy with strlcpy in wifi examples for safety's sake (v3.3)

See merge request espressif/esp-idf!7634
2020-02-18 19:06:45 +08:00
Hrishikesh Dhayagude a1e0268f40 Unified Provisioning - BLE: Fix characteristics read response issue
Fix the issue when number of bytes to be read is an exact multiple of MTU-1
2020-02-18 15:06:44 +05:30
Roland Dobai 9c1d75cc5b confgen.py: Escape special characters for cmake
Closes https://github.com/espressif/esp-idf/issues/4751
2020-02-18 09:56:05 +01:00
June eec53257dc backport esp32 5p0 new features to v3p3 2020-02-18 15:21:07 +08:00
suda-morris a476228c8c replace strncpy with strlcpy in wifi examples for safety's sake 2020-02-18 10:41:33 +08:00
Angus Gratton f8113d89e7 partition table: Update documentation about "test" partition type
Reported from forum: https://esp32.com/viewtopic.php?f=13&t=10777&p=44164#p44164
2020-02-18 11:02:23 +11:00
Angus Gratton 6648127362 Merge branch 'bugfix/doc_sphinxcontrib_dep_v3.3' into 'release/v3.3'
Docs: Fix sphinxcontrib dependencies (v3.3)

See merge request espressif/esp-idf!7611
2020-02-17 15:07:55 +08:00
Jiang Jiang Jian 817efe8aa2 Merge branch 'bugfix/add_hostname_option_to_dhcp_request_on_reboot' into 'release/v3.3'
lw-ip:add hostname option to dhcp request on reboot

See merge request espressif/esp-idf!7383
2020-02-15 14:13:27 +08:00
xueyunfei a0eb61e8a8 add hostname option to dhcp request on reboot 2020-02-14 22:53:38 +08:00
Jiang Jiang Jian 4f41c77665 Merge branch 'bugfix/LWIP_header_missing_C++_guards' into 'release/v3.3'
lw-ip:add lw-ip header missing_C++ guards

See merge request espressif/esp-idf!7411
2020-02-14 22:44:27 +08:00
Jiang Jiang Jian fdceac415b Merge branch 'feature/add_ETHARP_SUPPORT_VLAN' into 'release/v3.3'
lw-ip:add feature ETHARP SUPPORT VLAN

See merge request espressif/esp-idf!7399
2020-02-14 19:48:09 +08:00
xueyunfei 5599d05f87 add lwip header missing_C++ guards 2020-02-14 18:50:24 +08:00
Jiang Jiang Jian f41e536f06 Merge branch 'fixbug/disable_TCP_QUEUE_OOSEQ_compile_fail' into 'release/v3.3'
lw-ip:fixbug disable TCP_QUEUE OOSEQ compile fail

See merge request espressif/esp-idf!7382
2020-02-14 17:56:08 +08:00
xueyunfei 4f0ee78558 add feature ETHARP SUPPORT VLAN 2020-02-14 17:44:05 +08:00
Roland Dobai d12048bcea Docs: Fix sphinxcontrib dependencies 2020-02-14 10:40:07 +01:00
Jiang Jiang Jian fcc9db267d Merge branch 'bugfix/crash_of_dhcp_server_reconfiguration' into 'release/v3.3'
lw-ip:fixed rare crash of DHCP Server during WIFI AP network reconfiguration and...

See merge request espressif/esp-idf!7412
2020-02-14 16:49:48 +08:00
Jiang Jiang Jian 9b67208b14 Merge branch 'hfp_a2dp_iphone_3.3' into 'release/v3.3'
components bt/: Disable sniff mode during (e)SCO connection for HFP. [backport 3.3]

See merge request espressif/esp-idf!7250
2020-02-14 16:48:06 +08:00
Jiang Jiang Jian 91f0fcc3b3 Merge branch 'feat/nimble_esp_ble_mesh_v3.3' into 'release/v3.3'
Add support of NimBLE host in ESP-BLE-Mesh (backport v3.3)

See merge request espressif/esp-idf!7510
2020-02-14 16:43:05 +08:00
Jiang Jiang Jian f88a04aa3e Merge branch 'bugfix/wifi_clear_phy_status_when_cpu_start_v3.3' into 'release/v3.3'
soc: clear PHY status when cpu start (backport v3.3)

See merge request espressif/esp-idf!7589
2020-02-14 11:34:45 +08:00
Hrishikesh Dhayagude cf6f1e8246 Add support of NimBLE host in ESP-BLE-Mesh - v3.3 2020-02-13 12:33:23 +05:30
Xia Xiaotian 79445f4234 soc: clear PHY status when cpu start 2020-02-13 14:20:30 +08:00
Jiang Jiang Jian bdc586bb52 Merge branch 'bugfix/fix_double_recycle_bar_crash_issue_v3.3' into 'release/v3.3'
esp32: fix the crash caused by double free BAR buffer (backport v3.3)

See merge request espressif/esp-idf!7567
2020-02-13 12:02:46 +08:00
lly 46b1608f44 ble_mesh: Fix compile error with c++ files 2020-02-13 09:58:56 +08:00
liu zhifu 2118af0163 esp32: fix the crash caused by double free BAR buffer 2020-02-12 19:54:38 +08:00
Ivan Grokhotkov 0dec21cfda Merge branch 'bugfix/idf_tools_virtualenv_v3.3' into 'release/v3.3'
idf_tools.py: fix install-python-env failure with virtualenv 20.0.0 (backport v3.3)

See merge request espressif/esp-idf!7554
2020-02-12 17:32:21 +08:00
Jiang Jiang Jian 2eb4374a5b Merge branch 'bugfix/coex_schm_rebased_v3.3' into 'release/v3.3'
components/esp_wifi: improve coexistence performance according to specific WiFi/BT/BLE scienario (Backport v3.3)

See merge request espressif/esp-idf!7410
2020-02-12 17:07:18 +08:00
Xia Xiaotian a41443184e components/esp_wifi: improve coexistence performance according to specific WiFi/BT/BLE scienario
1. Improve WiFi throughput in some Classic BT scienarios(idle, inquire scan,
       connected, sniff, a2dp pause, etc).

    2. Support WiFi + Classic BT + BLE mesh coexistence scienario.

    3. Improve WiFi scan and connect succeed ratio in coexistence scienario.

    4. Do not support to choose software coexistence preference anymore for it is
       determined according to coexistence scienario automatically.

components/lwip: increase TCP send buffer and receive window limitation when TCP window scale is enabled

components/ble_mesh: Fix some bugs about ble mesh

    1. fix send acl pkt after ble have sent terminate ind modify min adv interval to 10ms.
2020-02-12 16:13:28 +08:00
Jiang Jiang Jian 8c3cefca81 Merge branch 'bugfix/panic_cache_err_dig_reset_v3.3' into 'release/v3.3'
esp32: panic: do digital reset if cache error interrupt is set (backport v3.3)

See merge request espressif/esp-idf!7485
2020-02-12 15:30:59 +08:00
Ivan Grokhotkov ec222a2dff idf_tools.py: fix install-python-env failure with virtualenv 20.0.0
--no-site-packages is the default behavior since virtualenv 1.7
(released in Nov 2011). This option was removed in virtualenv 20.0.
2020-02-11 09:47:38 +01:00
Angus Gratton 72e7978f89 Merge branch 'bugfix/part_gen_subtype_fix_v3.3' into 'release/v3.3'
partition_table: Fix subtype in gen_esp32part.py (v3.3)

See merge request espressif/esp-idf!7537
2020-02-11 12:06:33 +08:00
Marius Vikhammer e9894d6efc mqtt: update submodule to point to latest commit.
Adds bugfixes for:
 - Too early publishing
 - Potential mutex memory leak
 - CI related issues.
 - Wait for entire connack message
 - Event loop not getting cleaned up

Adds support for ALPN, configurable reconnect time, QEMU CI tests and password
protected client key.

MQTT MR: esp-mqtt/merge_requests/46
Closes IDF-1162
Closes https://github.com/espressif/esp-mqtt/issues/137

MQTT MR: esp-mqtt/merge_requests/47
Closes IDF-1126

MQTT MR: esp-mqtt/merge_requests/48
Closes IDFGH-2197
Closes https://github.com/espressif/esp-idf/issues/4349
Closes https://github.com/espressif/esp-mqtt/issues/140

MQTT MR: esp-mqtt/merge_requests/48
Closes IDFGH-2235
Closes https://github.com/espressif/esp-idf/issues/4384

MQTT MR: esp-mqtt/merge_requests/49
Closes https://github.com/espressif/esp-idf/issues/4433
Closes IDFGH-2293

MQTT MR: esp-mqtt/merge_requests/50
Closes FCS-254

MQTT MR: esp-mqtt/merge_requests/53
Closes FCS-267
2020-02-10 07:57:08 +00:00
boarchuz 8c72cc5749 Fix subtype in PartitionTable.find_by_type
Fix ptype->subtype

Closes https://github.com/espressif/esp-idf/pull/4723
2020-02-10 08:37:45 +01:00
Angus Gratton a590348af2 Merge branch 'bugfix/ble_mesh_kconfig_ascii_v3.3' into 'release/v3.3'
bugfix: bt Kconfig included a UTF-8 comma

See merge request espressif/esp-idf!7523
2020-02-10 06:47:19 +08:00
El Jeffo 79dff0ef12 fix initializer order for BT_CONTROLLER_INIT_CONFIG_DEFAULT 2020-02-07 18:59:03 +08:00
Angus Gratton aafe7f73f5 Merge branch 'bugfix/doc_nwdiag_v3.3' into 'release/v3.3'
docs: Fix nwdiag dependency for documentation build (v3.3)

See merge request espressif/esp-idf!7517
2020-02-07 06:20:06 +08:00
Angus Gratton fd348b7bd8 bugfix: bt Kconfig included a UTF-8 comma
Displays incorrectly on Python 3, but can crash Python 3 if the system default encoding is not utf-8
2020-02-07 09:10:56 +11:00
Roland Dobai 350f23c9bd docs: Fix nwdiag dependency for documentation build 2020-02-06 17:52:19 +01:00
Angus Gratton 91b9310714 Merge branch 'bugfix/esp_timer_stucks_into_esp_timer_impl_set_alarm_v3.3' into 'release/v3.3'
esp_timer/esp32: Fix esp_timer_impl_set_alarm() when CPU and APB freqs are changed (v3.3)

See merge request espressif/esp-idf!7441
2020-02-06 14:33:21 +08:00
Angus Gratton 2da1db9726 Merge branch 'bugfix/wps_config_init_v3.3' into 'release/v3.3'
WPS_CONFIG_INIT_DEFAULT(type) error

See merge request espressif/esp-idf!7312
2020-02-06 14:06:27 +08:00
KonstantinKondrashov 2718fdbd95 esp_timer/esp32: Fix case when alarm_reg > counter_reg but FRC_TIMER_INT_STATUS is not set
Closes: WIFI-1576
Closes: https://github.com/espressif/esp-idf/issues/2954
2020-02-05 10:43:19 +00:00
Hrishikesh Dhayagude a03b9c7465 Add NimBLE files in ESP-BLE-Mesh again
Revert "ble_mesh: Remove NimBLE implementation for ESP-BLE-MESH"

This reverts commit 925f93614c.
2020-02-05 13:37:54 +05:30
Jiang Jiang Jian f972606763 Merge branch 'feat/ble_mesh_for_idf3.3' into 'release/v3.3'
ble_mesh: Add ESP BLE Mesh implementation (v3.3)

See merge request espressif/esp-idf!7274
2020-02-04 11:42:35 +08:00
lly 925f93614c ble_mesh: Remove NimBLE implementation for ESP-BLE-MESH 2020-02-03 12:04:00 +08:00
lly b19671e0d4 ble_mesh: Add ESP BLE Mesh implementation
1. BLE Mesh Core

    * Provisioning: Node Role
        * PB-ADV and PB-GATT
        * Authentication OOB

    * Provisioning: Provisioner Role
        * PB-ADV and PB-GATT
        * Authentication OOB

    * Networking
        * Relay
        * Segmentation and Reassembly
        * Key Refresh
        * IV Update

    * Proxy Support

    * Multiple Client Models Run Simultaneously
        * Support multiple client models send packets to different nodes simultaneously
        * No blocking between client model and server

    * NVS Storage
        * Store BLE Mesh node related information in flash
        * Store BLE Mesh Provisioner related information in flash

2. BLE Mesh Models

    * Foundation Models
        * Configuration Server Model
        * Configuration Client Model
        * Health Server Model
        * Health Client Model

    * Generic
        * Generic OnOff Server
        * Generic OnOff Client
        * Generic Level Server
        * Generic Level Client
        * Generic Default Transition Time Server
        * Generic Default Transition Time Client
        * Generic Power OnOff Server
        * Generic Power OnOff Setup Server
        * Generic Power OnOff Client
        * Generic Power Level Server
        * Generic Power Level Setup Server
        * Generic Power Level Client
        * Generic Battery Server
        * Generic Battery Client
        * Generic Location Server
        * Generic Location Setup Server
        * Generic Location Client
        * Generic Admin Property Server
        * Generic Manufacturer Property Server
        * Generic User Property Server
        * Generic Client Property Server
        * Generic Property Client

    * Sensor Server Model
        * Sensor Server
        * Sensor Setup Server
        * Sensor Client

    * Time and Scenes
        * Time Server
        * Time Setup Server
        * Time Client
        * Scene Server
        * Scene Setup Server
        * Scene Client
        * Scheduler Server
        * Scheduler Setup Server
        * Scheduler Client

    * Lighting
        * Light Lightness Server
        * Light Lightness Setup Server
        * Light Lightness Client
        * Light CTL Server
        * Light CTL Setup Server
        * Light CTL Client
        * Light CTL Temperature Server
        * Light HSL Server
        * Light HSL Setup Server
        * Light HSL Client
        * Light HSL Hue Server
        * Light HSL Saturation Server
        * Light xyL Server
        * Light xyL Setup Server
        * Light xyL Client
        * Light LC Server
        * Light LC Setup Server
        * Light LC Client

3. BLE Mesh Applications

    * BLE Mesh Node
        * OnOff Client Example
        * OnOff Server Example

    * BLE Mesh Provisioner
        * Example

    * Fast Provisioning
        * Vendor Fast Prov Server Model
        * Vendor Fast Prov Client Model
        * Examples

    * Wi-Fi & BLE Mesh Coexistence
        * Example

    * BLE Mesh Console Commands
        * Examples
2020-02-03 12:03:36 +08:00
Angus Gratton c38bf3534e Merge branch 'bugfix/idf_monitor_usbser_sys_v3.3' into 'release/v3.3'
tools: work around usbser.sys bug in IDF monitor (v3.3)

See merge request espressif/esp-idf!7471
2020-01-31 15:57:54 +08:00
Hrudaynath Dhabe 46bfd878da Fix wps config for support with gnu++11 as well as c99. 2020-01-31 05:56:00 +00:00
Angus Gratton 1de51a2cbe Merge branch 'bugfix/esp_ptr_executable_single_core_v3.3' into 'release/v3.3'
soc: Fix esp_ptr_executable() for single core ESP32 config & cache memory (v3.3)

See merge request espressif/esp-idf!7465
2020-01-31 12:59:42 +08:00
Ivan Grokhotkov f6e1a12b34 esp32: panic: do digital reset if cache error interrupt is set
Even if frame->exccause != PANIC_RSN_CACHEERR, it is possible that
the cache error interrupt status is set. For example, this may happen
due to an invalid cache access in the panic handler itself.
Check cache error interrupt status instead of frame->exccause to
decide whether to do CPU reset or digital reset.

Also remove unnecessary esp_dport_access_int_pause from
esp_cache_err_get_cpuid, since the panic handler already calls
esp_dport_access_int_abort on entry.
2020-01-30 12:31:00 +01:00
Rosa Elena Veiga Otero b81ae0873a tools: work around usbser.sys bug in idf_monitor
implemented workaround in idf_monitor for known usbser.sys bug which
causes changes in RTS signal to only be sent if DTR signal also changes.
Works by forcing a dummy change in DTR signal (re-assigning its current
value, as it has previously been done in the flashing tool)

Closes https://github.com/espressif/esp-idf/pull/4676
2020-01-30 08:39:05 +01:00
Angus Gratton 07387fbd29 soc: Fix esp_ptr_executable() for single core ESP32 config & cache memory
In single core mode, APP CPU cache region is added to the available range.
2020-01-29 10:04:01 +11:00
Ivan Grokhotkov 3386cb5400 Merge branch 'bugfix/fix_ota_timeout_issues_v3.3' into 'release/v3.3'
Change Socket timeout to avoid connection error (v3.3)

See merge request espressif/esp-idf!7451
2020-01-27 17:09:36 +08:00
Shubham Kulkarni 556f194b94 OTA example: Change OTA example timeout in sdkconfig.ci for CI testing 2020-01-24 18:37:46 +05:30
Angus Gratton b19d054407 Merge branch 'bugfix/ci_deploy_tags_v3.3' into 'release/v3.3'
ci: fix tags for internal deploy jobs (backport v3.3)

See merge request espressif/esp-idf!7294
2020-01-24 13:43:45 +08:00
Angus Gratton f8151b2bfe Merge branch 'bugfix/esp_tls_blocking_timeout_v3.3' into 'release/v3.3'
esp-tls: add timeout for blocking connection (v3.3)

See merge request espressif/esp-idf!7397
2020-01-22 11:44:01 +08:00
Ivan Grokhotkov d3cc7c0daf Merge branch 'bugfix/esp_log_from_critical_v3.3' into 'release/v3.3'
intr_alloc: don't call ESP_LOG from a critical section (backport v3.3)

See merge request espressif/esp-idf!7160
2020-01-22 00:14:32 +08:00
Ivan Grokhotkov 552eb63ec4 Merge branch 'bugfix/fix_phy_init_data_bin_generation' into 'release/v3.3'
esp32: fix generation of phy_init_data.bin

See merge request espressif/esp-idf!7258
2020-01-21 17:04:18 +08:00
xueyunfei a025eeaf5b fixbug disable TCP_QUEUE OOSEQ compile fail 2020-01-21 16:06:18 +08:00
Alex Winter faf23c095c Fixed rare crash of DHCP Server during WIFI AP network reconfiguration and DHCP restart due to missed callback
Signed-off-by: xueyunfei <xueyunfei@espressif.com>
2020-01-21 14:19:36 +08:00
Angus Gratton 5e9746bffa Merge branch 'bugfix/advanced_https_ota_example_v3.3' into 'release/v3.3'
esp_https_ota in sync with v4.x (backport v3.3)

See merge request espressif/esp-idf!7161
2020-01-21 14:09:12 +08:00
Jiang Jiang Jian 8be372a1fd Merge branch 'bugfix/wa_dport_and_intr_v3.3' into 'release/v3.3'
esp32: Fix for DPORT (v3.3)

See merge request espressif/esp-idf!7350
2020-01-21 10:53:15 +08:00
Jiang Jiang Jian 006f2c0b3a Merge branch 'bugfix/backport_some_wifi_bugs_0107_v3.3' into 'release/v3.3'
backport some Wi-Fi bugs 0107 (backport v3.3)

See merge request espressif/esp-idf!7240
2020-01-20 16:08:58 +08:00
David Cermak 3ab801e27e esp_tls: fail connection if esp_tls_conn_new() timeouts 2020-01-20 07:32:17 +01:00
Jiang Jiang Jian 613ba4c015 Merge branch 'bugfix/btdm_backports_v3.3_0114' into 'release/v3.3'
components/bt: backport release/v3.3

See merge request espressif/esp-idf!7358
2020-01-19 11:48:56 +08:00
Mahavir Jain f4a1a186a6 Merge branch 'nimble/example_update_doc_v3.3' into 'release/v3.3'
NimBLE: Update the documentation link in the examples (v3.3)

See merge request espressif/esp-idf!7366
2020-01-17 11:12:09 +08:00
Paul Abbott 9c3d2b4f70 Bugfix(LEDC): Add missing ledc_set_pin declaration in led.h 2020-01-17 10:26:15 +08:00
Hrishikesh Dhayagude b4383d609f NimBLE: Update the documentation link in the examples 2020-01-16 17:13:21 +05:30
baohongde 30779731ea components/bt: backport release/v3.3
Fix A2DP stuck when BLE's interval is too small
Bugfix that bluetooth controller may not be able to enter sleep after end of wake up request
Fix LMP sniff req timeout
2020-01-16 15:47:31 +08:00
KonstantinKondrashov 106f165899 esp32: Add UT for DPORT 2020-01-16 14:33:56 +08:00
KonstantinKondrashov 68791163b2 esp32: Fix esp_dport_access_reg_read 2020-01-16 14:33:56 +08:00
Jiang Jiang Jian 53752db908 Merge branch 'bugfix/btdm_fix_multi_open_evt_and_clear_blufi_prepare_write_len_v3.3' into 'release/v3.3'
component/bt: fix multi open evt and clear blufi prepare write len(backport v3.3)

See merge request espressif/esp-idf!7325
2020-01-16 11:48:39 +08:00
Ivan Grokhotkov a8b974f245 intr_alloc: don't call ESP_LOG from a critical section
Calling ESP_LOG from a critical section leads to abort() in 4.1, and
may also randomly abort() in earlier versions.

Closes FCS-268
2020-01-15 04:15:57 +00:00
Renz Christian Bagaporo 8b44275fbf esp32: fix generation of phy_init_data.bin
Closes https://github.com/espressif/esp-idf/issues/4567
2020-01-15 03:39:00 +00:00
Ivan Grokhotkov 367c3c09cc Merge branch 'bugfix/ci_submodule_checkout_v3.3' into 'release/v3.3'
ci: Clean submodules after fetching sources

See merge request espressif/esp-idf!7321
2020-01-15 10:25:28 +08:00
Angus Gratton 2b6021cc31 ci: Clean submodules after fetching sources
Assuming no submodule dirs contain artifacts that we can't clean
2020-01-15 11:12:34 +10:00
zhiweijian 5187d64c34 component/bt: fix blufi prepare write buf len invalid 2020-01-14 17:45:40 +08:00
zhiweijian 927c4afa5b Component/bt: Fix GATTC trigger open event multiple times 2020-01-14 17:41:45 +08:00
Shubham Kulkarni a63b5d155f Bugfix for failing OTA example
example_test.py is added to test advanced_https_ota_example and native ota_example.

Closes https://github.com/espressif/esp-idf/issues/4394
2020-01-13 17:39:01 +05:30
xiehang da656f0345 lwip: Drop packets larger than MTU 2020-01-13 15:11:06 +08:00
zhangyanjiao 431080faa1 fix the bugs for espnow and bandwidth 2020-01-13 15:10:09 +08:00
ronghulin 78d7e214d6 esp32: fix a WiFi RX bug
Support WiFi/BT MAC register writting when the WiFi/BT common clock is disabled.
2020-01-13 15:09:52 +08:00
Jiang Jiang Jian 64df5e111e Merge branch 'bugfix/udp_random_port' into 'release/v3.3'
lw-ip:Bugfix for add random udp port

See merge request espressif/esp-idf!7133
2020-01-13 11:46:09 +08:00
Anton Maklakov 852c79c76d ci: fix tags for internal deploy jobs 2020-01-10 18:31:02 +07:00
xueyunfei 92242d5d13 bugfix for add random udp port 2020-01-09 18:01:00 +08:00
Angus Gratton e28c5127c2 Merge branch 'bugfix/mdns_send_sdptr_answer_v3.3' into 'release/v3.3'
mdns: respond to discovery with the proper pseudo name _services._dns-sd._udp (v3.3)

See merge request espressif/esp-idf!7243
2020-01-09 13:01:26 +08:00
Jiang Jiang Jian 9a44c290f6 Merge branch 'bugfix/btdm_avrc_category_v3.3' into 'release/v3.3'
components/bt: Choose AVRC category according to A2DP role

See merge request espressif/esp-idf!7177
2020-01-09 11:35:02 +08:00
weitianhua e284ff818b hfp a2dp iphone 3.3 2020-01-08 19:37:51 +08:00
David Cermak 6ace6fbd85 mdns: respond to discovery with the proper pseudo name _services._dns-sd._udp
Closes https://github.com/espressif/esp-idf/issues/4369
Closes IDFGH-2219
2020-01-08 10:22:10 +01:00
Jiang Jiang Jian c5e37c7073 Merge branch 'bugfix/fix_performance_issues_new_v3.3' into 'release/v3.3'
esp32: fix WiFi performance issue (backport v3.3)

See merge request espressif/esp-idf!7224
2020-01-08 14:45:44 +08:00
liu zhifu 531416d95f esp32: fix WiFi performance issue 2020-01-06 21:07:53 +08:00
baohongde 611c0c3897 components/bt: Choose AVRC category according to A2DP role 2019-12-31 15:31:54 +08:00
Angus Gratton 2befd5c9ee Merge branch 'feature/wifi_prov_ext_httpd_v3.3' into 'release/v3.3'
wifi_provisioning_softap: Allow applications to start webserver externally (v3.3)

See merge request espressif/esp-idf!7164
2019-12-31 15:01:18 +08:00
Angus Gratton 99c4aee0ac Merge branch 'bugfix/ci_test_idf_monitor_3.3' into 'release/v3.3'
CI: Adjust the test parameters of IDF Monitor (backport v3.3)

See merge request espressif/esp-idf!7166
2019-12-31 14:54:33 +08:00
xiongyu ae94784d4c bugfix(driver): fix i2s and timergroup some issues
* fix i2s and timergroup dev array used by isr crash issue

* Closes IDFGH-2432

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

* fix i2s adc data inv issue

* Closes IDFGH-2444

* Closes https://github.com/espressif/esp-idf/issues/4557
2019-12-31 14:48:44 +08:00
Mahavir Jain 3063679f5a esp_http_client: fix issue where http parser was not invoking message_complete callback
https://github.com/espressif/esp-idf/issues/2625
https://github.com/espressif/esp-idf/issues/4209
2019-12-31 11:14:18 +05:30
Shubham Kulkarni f335bfdea7 Merge branch 'bugfix/CMake_esp_https_ota_dependencies' into master
components/esp_https_ota: Changes in public requirement list for CMake and esp_ota_ops.h is included in esp_https_ota.c

bootloader_support is added in public requirements of CMake

bootloader_common.h is included in esp_https_ota.h

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

Closes IDFGH-2066
2019-12-31 11:14:18 +05:30
Hrudaynath Dhabe 2b44bc47df esp_https_ota: Added error checking functionalities.
Current implimentation of esp_http_ota does not perform any error-checking in the data writing phase calls `esp_ota_get_next_update_partition()` irrespetive of the received state of the image. A few additional error checking mechanism have now been added inside the esp_https_ota which returns the control in case an invalid header is received and a wrapper to the function `esp_http_client_is_complete_data_received()` of `esp_http_client` has been added.
2019-12-31 11:14:18 +05:30
Hrudaynath Dhabe 012ff5775b esp_http_client: Add support to check the binary length of the recieved stream and compare it with the size mentioned in the header.
While downloading OTA firmware, if their is a Origin Respnse Timeout or the binary is only partially downloaded, OTA failure is observed. Checking binary size can also be helpful for simple http client applications.

Closes https://github.com/espressif/esp-idf/issues/3004
2019-12-31 11:14:18 +05:30
Mahavir Jain b2a1de4d62 Merge branch 'nimble/update_doc_link_v3.3' into 'release/v3.3'
NimBLE: Update the link to NimBLE upstream documentation (v3.3)

See merge request espressif/esp-idf!7168
2019-12-31 13:42:59 +08:00
Hrishikesh Dhayagude 4712d675f7 NimBLE: Update the link to NimBLE upstream documentation 2019-12-30 19:20:06 +05:30
Roland Dobai 4cde39ee42 CI: Adjust the test parameters of IDF Monitor 2019-12-30 14:37:33 +01:00
Piyush Shah 36f0728254 wifi_provisioning_softap: Allow applications to start webserver externally
If an application wants to use webserver, instead of creating another
webserver instance, the wifi provisioning manager can re-use the same.
The webserver handle can be passed using this new API.

Signed-off-by: Piyush Shah <piyush@espressif.com>
2019-12-30 17:34:30 +05:30
Angus Gratton 37aac8314e Merge branch 'bugfix/msys2_environment_update_v3.3' into 'release/v3.3'
doc: Update MSYS2 pre-compiled environment zip

See merge request espressif/esp-idf!7079
2019-12-30 11:36:10 +08:00
Angus Gratton a4f872c181 doc: Update MSYS2 pre-compiled environment zip
Required to get working MSYS2 Python cryptography package

Closes https://github.com/espressif/esp-idf/issues/4457
2019-12-30 13:44:37 +11:00
Jiang Jiang Jian 45329c2fdc Merge branch 'bugfix/btdm_revert_changes_of_security_mask_v3.3' into 'release/v3.3'
components/bt: Revert changes of security mask

See merge request espressif/esp-idf!7120
2019-12-29 14:12:50 +08:00
baohongde 09b8979987 components/bt: Revert changes of security mask 2019-12-25 20:13:35 +08:00
Mahavir Jain 9945c2fdcd Merge branch 'bugfix/touchpad_interrupt_v3.3' into 'release/v3.3'
Change critical section API for touch pad interrupt (backport v3.3)

See merge request espressif/esp-idf!7107
2019-12-25 14:09:04 +08:00
Shubham Kulkarni afb8064a29 esp32/rtc_module: Fixed critical section API
Application used to abort as portENTER_CRITICAL is used in ISR.
portENTER_CRITICAL is changed to portENTER_CRITICAL_SAFE in touch_pad_clear_status()

https://github.com/aws/amazon-freertos/issues/1651
2019-12-24 18:00:19 +05:30
Jiang Jiang Jian 1a657c255c Merge branch 'bugfix/btdm_disable_some_secrity_mask_v3.3' into 'release/v3.3'
components/bt: Disable some unsupported security mask

See merge request espressif/esp-idf!6726
2019-12-22 21:37:00 +08:00
Jiang Jiang Jian c5d79efcc5 Merge branch 'bugfix/wps_workaround_for_Telstra_AP_v3.3' into 'release/v3.3'
wps: Relax the check on older config methods in case of WPS2.0 (backport v3.3)

See merge request espressif/esp-idf!5988
2019-12-22 19:21:18 +08:00
baohongde 83184631a4 components/bt: Disable some unsupported security mask 2019-12-22 08:56:18 +00:00
Angus Gratton c3571e97cb Merge branch 'bugfix/config_assert_thread_safety_backport_v3.3' into 'release/v3.3'
freertos: Fix configASSERT thread safety (backport v3.3)

See merge request espressif/esp-idf!6660
2019-12-20 13:26:30 +08:00
Angus Gratton e395d14c59 Merge branch 'bugfix/update_can_target_test_backport_v3.3' into 'release/v3.3'
CAN: Reenable example tests (backport v3.3)

See merge request espressif/esp-idf!6735
2019-12-20 13:03:20 +08:00
Jiang Jiang Jian 54c1882b99 Merge branch 'bugfix/put_more_rx_code_to_iram_v3.3' into 'release/v3.3'
wifi: Put some rx code to iram (backportv3.3)

See merge request espressif/esp-idf!6647
2019-12-18 16:39:48 +08:00
Darian Leung 0cf891785e CAN: Reenable example tests
This commit updates the CAN example tests and updates the job
and environment labels in the target-test.yml
2019-12-18 15:39:25 +08:00
Mahavir Jain 1d70441bdc freertos: modify configASSERTs around scheduler state check
Regression introduced in commit 79e74e5d5f

It is possible that some FreeRTOS APIs are invoked prior to
scheduler start condition (e.g. flash initialization in unicore mode).
In that condition these asserts should not trigger (scheduler state being yet to be started),
hence changes per this fix.
2019-12-18 06:49:59 +00:00
Darian Leung 2c96976b13 freertos: Fix configASSERT thread safety
This commit fixes thread safety issues with configASSERT() calls
regarding the value of uxSchedulerSuspended. A false negative
occurs if a context switch to the opposite core occurs in between
the getting the core ID and the assesment.

Closes https://github.com/espressif/esp-idf/issues/4230
2019-12-18 06:49:59 +00:00
Jiang Jiang Jian a109f7de57 Merge branch 'bugfix/btdm_fix_doc_and_host_bug_backport_v3.3' into 'release/v3.3'
Bugfix/btdm fix doc and host bug backport v3.3

See merge request espressif/esp-idf!6955
2019-12-18 14:19:14 +08:00
Geng Yu Chao db8bcc60f9 Bugfix/btdm fix doc and host bug backport v3.3 2019-12-18 14:19:13 +08:00
Angus Gratton 62f9b975ac Merge branch 'bugfix/doc_fix_debian_requirements_v3.3' into 'release/v3.3'
Docs: Update Debian & Ubuntu install prerequisites (v3.3)

See merge request espressif/esp-idf!7037
2019-12-18 07:35:27 +08:00
Roland Dobai 71b29fac71 Docs: Update Debian & Ubuntu install prerequisites
Latest versions of apt-get don't install as much packages by default
as older ones. This fix adds some missing packages discovered for an OS
derived from the latest stable Debian. These packages exist for older
Debian derivatives as well (tested with Ubuntu 16.04 LTS).

Closes https://github.com/espressif/esp-idf/issues/4480
2019-12-17 13:58:51 +01:00
xiehang b764454e52 esp_wifi:Put some rx code to iram 2019-12-17 12:55:47 +00:00
Jiang Jiang Jian de9fd03b3e Merge branch 'bufgix/esp_timer_set_alarm_v3.3' into 'release/v3.3'
esp_timer: Fix set_alarm. Case when timestamp < now_time (v3.3)

See merge request espressif/esp-idf!6997
2019-12-16 19:40:52 +08:00
Jiang Jiang Jian 97dba89daf Merge branch 'bugfix/btdm_avrc_metadata_length_error_v3.3' into 'release/v3.3'
components/bt: Fix AVRC metadata length error

See merge request espressif/esp-idf!6884
2019-12-16 14:07:20 +08:00
Angus Gratton 88cf7ed87e Merge branch 'bugfix/wifi_internal_memory_v3.3' into 'release/v3.3'
wifi: Include DMA reserved pool when allocating internal-only memory (v3.3)

See merge request espressif/esp-idf!6628
2019-12-16 13:39:43 +08:00
Jiang Jiang Jian 82f1be5e5a Merge branch 'bugfix/hfp_client_indication_v3.3' into 'release/v3.3'
component/bt: Fix bugs in HFP feature v3.3

See merge request espressif/esp-idf!6852
2019-12-16 11:32:10 +08:00
Jiang Jiang Jian ce9ec29737 Merge branch 'bugfix/http_client_buffer_overflow_v3.3' into 'release/v3.3'
Fix HTTP client buffer overflow (v3.3)

See merge request espressif/esp-idf!6667
2019-12-16 11:31:55 +08:00
Jiang Jiang Jian 7b73cf613c Merge branch 'component_bt/osi_fixed_queue_v3.3' into 'release/v3.3'
component_bt/: Fix_pointer_type_fixed_queue v3.3

See merge request espressif/esp-idf!6847
2019-12-16 11:31:24 +08:00
Jiang Jiang Jian a980a1780a Merge branch 'bugfix/fix_the_bug_in_espnow_example_v3.3' into 'release/v3.3'
espnow: fix the bug for calling esp_wifi_set_channel (backport v3.3)

See merge request espressif/esp-idf!6693
2019-12-16 11:30:56 +08:00
Angus Gratton 762a9fe83f Merge branch 'bugfix/hide_unsupported_cmake_features_v3.3' into 'release/v3.3'
security: Hide Secure Boot & Flash Encryption config items when using CMake

See merge request espressif/esp-idf!6899
2019-12-16 11:17:49 +08:00
KonstantinKondrashov d071cd11c8 esp_timer: Add Test case when set_alarm needs set timer < now_time 2019-12-14 04:38:30 +08:00
Mahavir Jain 659ccfa999 Merge branch 'bugfix/set_mconf_idf_build_dir_v3.3' into 'release/v3.3'
cmake: set build dir for mconf-idf (v3.3)

See merge request espressif/esp-idf!7007
2019-12-13 20:06:45 +08:00
Shubham Kulkarni 781bd398dc cmake: set build dir for mconf-idf
Fixes an issue where if idf_build_process is called in a CMake
    subdirectory, menuconfig looks for the mconf-idf binary in the wrong
    place (in the subdirectory build dir instead of root binary dir).
2019-12-13 16:10:01 +05:30
Angus Gratton 876ac4e963 bt: Include DMA reserved pool when allocating internal-only memory
Fix for root cause of https://github.com/espressif/esp-idf/issues/3592
2019-12-12 23:09:59 +00:00
Angus Gratton 6231961683 wifi: Include DMA reserved pool when allocating internal-only memory
Fix for root cause of https://github.com/espressif/esp-idf/issues/3592
2019-12-12 23:09:59 +00:00
KonstantinKondrashov 32ec2750e0 esp_timer: Fix set_alarm. Case when timestamp < now_time
arg1 = MAX(int64_t arg1, uint64_t arg2) gave the wrong result, if arg1 < 0, it was presented as a larger value.
And ALARM_REG = (uin32_t)arg1. This leads to an infinite loop.
Fixed: both args are int64_t.

Closes: WIFI-1511
2019-12-12 14:43:44 +08:00
Angus Gratton a0c14f46ba Merge branch 'ci/artifact_expiry' into 'release/v3.3'
ci: Minimum 4 days for artifact expiry (v3.3)

See merge request espressif/esp-idf!6982
2019-12-12 14:29:50 +08:00
Angus Gratton 9926a12943 ci: Minimum 4 days for artifact expiry 2019-12-11 18:15:23 +11:00
Ivan Grokhotkov 143d26aa49 Merge branch 'bugfix/doc_package_versions_v3.3' into 'release/v3.3'
doc: Limit sphinxcontrib versions to <2.0.0 as we use Sphinx 1.8.5 (v3.3)

See merge request espressif/esp-idf!6975
2019-12-11 14:23:07 +08:00
Angus Gratton e1eabe6f6a doc: Limit sphinxcontrib versions to <2.0.0 as we use Sphinx 1.8.5 2019-12-11 14:40:41 +11:00
Angus Gratton 0407ab426e Merge branch 'bugfix/update_libexpat_v3.3' into 'release/v3.3'
expat: Update library from 2.2.5 to 2.2.9 (v3.3)

See merge request espressif/esp-idf!6922
2019-12-09 13:21:10 +08:00
Roland Dobai bcbc4a9599 expat: Update library from 2.2.5 to 2.2.9 2019-12-05 09:21:29 +01:00
Jiang Jiang Jian 50737018cc Merge branch 'bugfix/coex_fix_wifi_scan_and_connect_bugs_v3.3' into 'release/v3.3'
esp_wifi: fix WiFi scan and connect bugs when coexist with Bluetooth (backport v3.3)

See merge request espressif/esp-idf!6707
2019-12-04 14:57:09 +08:00
Xia Xiaotian 19913cec43 esp_wifi: fix WiFi scan and connect bugs when coexist with Bluetooth
1. Fix WiFi scan leads to poor performance of Bluetooth.
    2. Improve WiFi connect success ratio when coexist with Bluetooth.
    3. Check if WiFi is still connected when CSA or beacon timeout happen.
    4. add coex pre init
2019-12-04 04:19:58 +00:00
Jiang Jiang Jian bf80d8211e Merge branch 'bugfix/phy_critical_v3.3' into 'release/v3.3'
fix bug that phy_enter_critical cannot effect on dual-core

See merge request espressif/esp-idf!6866
2019-12-04 11:27:28 +08:00
Angus Gratton 46a7409965 security: Hide Secure Boot & Flash Encryption config items when using CMake
These features are not supported in the CMake build system preview, but previously
had to read the notice in the CMake Getting Started guide to know this.

Related to https://github.com/espressif/esp-idf/issues/4419
2019-12-04 11:00:06 +11:00
Mahavir Jain 7d26cf16cc Merge branch 'NimBLE/fix_send_after_controller_ready_v3.3' into 'release/v3.3'
NimBLE: Fix erroneous behaviour of NPL when controller not ready to receive (v3.3)

See merge request espressif/esp-idf!6806
2019-12-03 02:17:35 +08:00
Prasad Alatkar 86c4d8737e NimBLE: Fix erroneous behaviour of NPL when controller not ready to receive (v3.3) 2019-12-03 02:17:34 +08:00
weitianhua 3ceae811be adaptation for nano-format 2019-11-29 17:55:22 +08:00
weitianhua 8977e92b4c component_bt/:bugfix_hfp_client_indication_define_and_cnum_error 2019-11-29 16:22:34 +08:00
baohongde 42b2524776 components/bt: Fix AVRC metadata length error 2019-11-29 15:56:51 +08:00
Tian Hao 8ffe0ff357 fix bug that phy_enter_critical cannot effect on dual-core
Sometimes, libphy.a call phy_enter_critical() to protect accessing critical sections, such like
operating on I2C, but it may not effect when both the CPU core call it. It may cause accessing
I2C blocking and cannot recover by esp_restart(), until do HW reboot.
2019-11-28 17:12:07 +08:00
Jiang Jiang Jian faf96bd108 Merge branch 'bugfix/btdm_run_out_of_frame_element_v3.3' into 'release/v3.3'
components/bt: Fix assert due to no free element form

See merge request espressif/esp-idf!6701
2019-11-27 22:22:33 +08:00
weitianhua 97b43b4054 component_bt/: Fix pointer type in fixed_queue 2019-11-27 16:09:44 +08:00
Angus Gratton 8225cc75df Merge branch 'bugfix/i2s-bootloader-random-disable_v3.3' into 'release/v3.3'
bugfix(bootloader): fix bug about i2s bootloader_random_disable for release/v3.3

See merge request espressif/esp-idf!6601
2019-11-26 14:37:53 +08:00
Jiang Jiang Jian 0d6cae963b Merge branch 'bugfix/fix_timer_deleted_and_run_broken_callback_v3.3' into 'release/v3.3'
esp_timer: fix the bug that when timeout of timer happens try to run callback(v3.3)

See merge request espressif/esp-idf!6768
2019-11-25 11:05:38 +08:00
Angus Gratton 3a94beeb5b Merge branch 'feature/add_env_tag_for_32khz_xtal_uts_v3.3' into 'release/v3.3'
soc(esp32&esp32s2beta): Add test_env for 32kHz XTAL unit tests (v3.3)

See merge request espressif/esp-idf!6604
2019-11-21 19:58:24 +08:00
Mahavir Jain 29f6537faf Merge branch 'bugfix/warning_fix_latest_freertos_v3.3' into 'release/v3.3'
Fixed warnings for components driver, esp32 and mbedtls (v3.3)

See merge request espressif/esp-idf!6760
2019-11-21 13:20:42 +08:00
Ivan Grokhotkov 160f435e4d Merge branch 'feature/ci_try_to_checkout_correct_branch_for_other_projects_v3.3' into 'release/v3.3'
CI: try to use the correct branch of other projects used in CI (backport v3.3)

See merge request espressif/esp-idf!5593
2019-11-20 22:28:24 +08:00
KonstantinKondrashov 51d2d9041c soc/esp32: Add test_env for 32kHz XTAL unit tests 2019-11-20 15:49:13 +08:00
Jack 5a6ac7f32f esp_timer: fix the bug that when timeout of timer happens try to run callback, and high priority task delete the timer and break the callback 2019-11-20 04:17:41 +00:00
David Cermak 40d5f61c4d http_client: added comments to http header generation function 2019-11-19 14:07:38 +00:00
David Cermak b7a9f5e115 http_client: possible buffer overflow fixed when determining last header item to be written
closes IDF-694
2019-11-19 14:07:38 +00:00
Shubham Kulkarni 0f3f7d984a Fixed warnings for components driver, esp32 and mbedtls 2019-11-19 15:04:01 +05:30
Angus Gratton efdddbb253 Merge branch 'fix/ci_ut_psram_wroverb_v3.3' into 'release/v3.3'
ci: fix one ut issue when using Wrover-B module with newer ver of PSRAM (backport v3.3)

See merge request espressif/esp-idf!6594
2019-11-19 12:07:23 +08:00
He Yin Ling ce9c7e4f79 CI: try to use the correct branch of other projects used in CI:
1. revision defined in bot message
2. branch name (or tag name) of current IDF
3. CI_MERGE_REQUEST_TARGET_BRANCH_NAME
4. branch name parsed from `git describe`
5. default branch
2019-11-19 12:06:27 +08:00
Angus Gratton 66c0699411 Merge branch 'bugfix/mqtt_example_url_update_v3.3' into 'release/v3.3'
MQTT: update default broker URL for examples (backport v3.3)

See merge request espressif/esp-idf!6411
2019-11-19 11:28:07 +08:00
Angus Gratton 646c851824 Merge branch 'feature/idf_tools_v3.3' into 'release/v3.3'
tools, ci: backport idf_tools.py and IDF Docker image

See merge request espressif/esp-idf!6412
2019-11-19 08:29:15 +08:00
Jiang Jiang Jian 51a49a861a Merge branch 'bugfix/btdm_assert_deinit_a2dp_while_playing_v3.3' into 'release/v3.3'
components/bt: Fix assert when deinit A2DP while playing music

See merge request espressif/esp-idf!6535
2019-11-14 20:12:31 +08:00
Michael (XIAO Xufeng) 9b34085053 ci: fix one ut issue when using Wrover-B module with newer ver of PSRAM
The workaround for PSRAM that will occupy an SPI bus is enabled only when:

1. used on 32MBit ver 0 PSRAM.
2. work at 80MHz.

The test used to only check 32MBit by the config option, but for PSRAM
on Wrover-B module seems to use a newer version of 32MBit PSRAM.  So it
expects the workaround to be enabled, but actually not.

This commit split the unit test into two parts:

1. check all SPI buses are available, for all configs except psram_hspi
and psram_vspi, run on regular runners (including Wrover and Wrover-B).
a hidden option is enabled so that the compiler knows it's not building
psram_hspi or psram_vspi.

2. check the specified bus are acquired, for config psram_hspi and
psram_vspi. This only run on special runner (legacy Wrover module).
2019-11-14 08:35:05 +00:00
baohongde 0f7dc2ec02 components/bt: Fix assert due to no free element form 2019-11-14 15:51:39 +08:00
Jiang Jiang Jian 2e341f003a Merge branch 'bugfix/fix_dhcp_timeout_issue_3.3' into 'release/v3.3'
lw-ip: fix DHCP timeout truncation bug(backport v3.3)

See merge request espressif/esp-idf!6319
2019-11-14 13:27:21 +08:00
zhangyanjiao c375ddc823 espnow: fix the bug for calling esp_wifi_set_channel(), this function only can be called after Wi-Fi started and sniffer enabled. 2019-11-13 17:42:34 +08:00
ronghulin 92c8fd24bb lwip: fix DHCP timeout truncation bug 2019-11-12 13:06:55 +08:00
Angus Gratton 2aa255c875 Merge branch 'bugfix/can_critical_section_compliance_backport_v3.3' into 'release/v3.3'
CAN: Fix critical section compliance (backport v3.3)

See merge request espressif/esp-idf!6567
2019-11-08 16:52:33 +08:00
Ivan Grokhotkov 5a3af62f44 tools/docker: use correct branch and commit of IDF when building 2019-11-06 18:01:24 +01:00
Chen Zheng Wei bc1d87a846 bugfix(i2s_bootloader_random_disable): fix bug about i2s bootloader_random_disable for release/v3.3
bootloader_random_disable disables the ADC incorrectly, causing the ADC to sometimes fail to work. Fix this bug
2019-11-05 16:58:56 +08:00
Nachiket Kukade d65086d8ab wps: Relax the check on older config methods in case of WPS2.0 (backport v3.3)
Some APs incorrectly advertize newer WPS2.0 config method bits
without setting bits for the corresponding older methods. This
results in failures during 8-way handshake. Add a workaround to
relax this check so that WPS handshake can proceed.
2019-11-04 07:05:36 +00:00
Ivan Grokhotkov 71d0d08c4e tools, ci: backport idf_tools.py and IDF Docker image 2019-11-03 03:25:39 +01:00
Darian Leung 0caa96584c CAN: Fix critical section compliance
This commit makes the CAN driver ISR use the ISR version
of critical section.
2019-11-01 12:05:12 +08:00
Marius Vikhammer 5d4cd1269b MQTT: update default broker URL for examples
The MQTT broker URL used as default in the examples has ceased operation. All examples and documention have been updated to point to the new domain mqtt.eclipse.org.
This also required an update of the python example test scripts to use TLS 1.2
2019-10-31 11:51:14 +00:00
Ivan Grokhotkov 6e1eb21bae Merge branch 'doc/support_policy_v3.3' into 'release/v3.3'
docs: Add ESP-IDF support period policy (v3.3)

See merge request espressif/esp-idf!6529
2019-10-31 15:47:29 +08:00
Jiang Jiang Jian 0d1c490a7c Merge branch 'bugfix/coex_fix_some_bugs_v3.3' into 'release/v3.3'
Coexist: fix some coexist bugs (backportv3.3)

See merge request espressif/esp-idf!6435
2019-10-30 16:39:20 +08:00
Jiang Jiang Jian dbd2cd2f7a Merge branch 'bugfix/jump_time_54_sec_v3.3' into 'release/v3.3'
esp_timer: Fix time jumps back ~ 54sec (v3.3)

See merge request espressif/esp-idf!6468
2019-10-30 16:25:35 +08:00
Angus Gratton 34b14ddf5b Merge branch 'bugfix/remove_mbedtls_would_block_v33' into 'release/v3.3'
Remove check for would_block in mbedtls (Backport v3.3)

See merge request espressif/esp-idf!6398
2019-10-30 11:58:09 +08:00
Xia Xiaotian 9592346090 Coexist: fix some coexist bugs
1. Fix high beacon and broadcast packets loss ratio of WiFi to make
   MDNS test pass.
2. Improve stability of WiFi performance with a little
   sacrifice of throughput.
3. Improve BLE advertising and connection performance with dynamic
   priority. It sacrifices a little WiFi throughput, but achieves balance
   between WiFi and Bluetooth.
4. fix bug bb reset lock flag to avoid bb reset lock unhandle
5. fix bug wifi reset mac cause task watch dog timeout
6. fix bug wifi reset mac position
2019-10-29 17:18:12 +00:00
KonstantinKondrashov 696d6867b4 esp_timer: Fix System time jumps back ~54secs
Closes: https://github.com/espressif/esp-idf/issues/2513
2019-10-29 17:17:26 +00:00
KonstantinKondrashov f52b877199 esp32: Add UTs to check the System time does not jump back 2019-10-29 17:17:26 +00:00
Ivan Grokhotkov a179125fd3 esp_timer: handle esp_timer_delete in timer task
Closes https://github.com/espressif/esp-idf/issues/3458
2019-10-29 17:17:26 +00:00
Jiang Jiang Jian 1dd8411e04 Merge branch 'bugfix/coex_semaphore_take_in_isr_lock_v3.3' into 'release/v3.3'
fix bug that semaphore may schedule out in ISR locking (v3.3)

See merge request espressif/esp-idf!6427
2019-10-30 00:49:42 +08:00
Jiang Jiang Jian e6a71fe29c Merge branch 'bugfix/btdm_disable_bt_gatt_v3.3' into 'release/v3.3'
components/bt: Disable BR/EDR GATT

See merge request espressif/esp-idf!6506
2019-10-30 00:48:14 +08:00
Jiang Jiang Jian efe8490623 Merge branch 'bugfix/mdns_invalid_hostname_queries_v3.3' into 'release/v3.3'
mdns: fix crash for hostname queries (bacport v3.3)

See merge request espressif/esp-idf!6502
2019-10-30 00:27:19 +08:00
Jiang Jiang Jian a29f30b5d3 Merge branch 'bugfix/btdm_a2dp_sink_media_suspend_cmd_unack_for_v3.3' into 'release/v3.3'
bugfix/btdm_a2dp_sink_media_suspend_cmd_unack_for_v3.3(backport v3.3)

See merge request espressif/esp-idf!5939
2019-10-30 00:26:28 +08:00
baohongde c570e253fe components/bt: Fix assert when deinit A2DP while playing music 2019-10-29 20:04:15 +08:00
Marius Vikhammer 7b7f597cb4 mdns: fix crash for hostname queries
Receiving TXT, PTR, SDPTR and SRV record type queries would crash the application if the hostname
 was used as instance name.

Closes https://github.com/espressif/esp-idf/issues/4224
2019-10-29 10:49:45 +00:00
wangmengyang 3a5249aea9 bugfix that call of esp_a2d_media_ctrl(ESP_A2D_MEDIA_CTRL_SUSPEND) will not get an ACK from callback on A2DP sink 2019-10-29 10:14:19 +00:00
baohongde 28c19e623f components/bt: Disable BR/EDR GATT 2019-10-29 10:10:52 +00:00
Tian Hao cabe66195c fix bug that semaphore may schedule out in Critical Section
1. Since BLE full-scan feature for BLE mesh change the controller code cause this problem,
it cause coex semaphore take in "interrupt disable", then it may cause task schedule
and cause crash in freertos
2. Fix newlib lock ISR context and critical section check
3. Fix bt controller ISR context and critical section check
2019-10-29 14:43:00 +08:00
Jiang Jiang Jian f0855c85ad Merge branch 'bugfix/can_reset_mode_entry_backport_v3.3' into 'release/v3.3'
Bugfix/can reset mode entry backport v3.3

See merge request espressif/esp-idf!6513
2019-10-29 14:41:52 +08:00
Angus Gratton 569334267f Merge branch 'feature/can_support_low_bit_rates_backport_v3.3' into 'release/v3.3'
can: Add support for lower bit rates (backport v3.3.1)

See merge request espressif/esp-idf!6391
2019-10-29 14:36:19 +08:00
Angus Gratton 9911823658 docs: Add ESP-IDF support period policy 2019-10-29 16:36:08 +11:00
Jiang Jiang Jian b90f32bffb Merge branch 'bugfix/multi_heap_printf_backport_v3.3' into 'release/v3.3'
heap: Fix printf usage in heap poisoning (backport v3.3)

See merge request espressif/esp-idf!6091
2019-10-29 12:07:30 +08:00
Angus Gratton 20db198401 ci: Temporarily ignore CAN example test failures
Due to internal CI issue.
2019-10-28 14:54:21 +08:00
Darian Leung bf877941c4 can: Fix reset mode entry and exit calls
This commit fixes multiple bugs caused by incorrect calls to
can_enter_reset_mode() and can_exit_reset_mode. Example test
scripts also updated to match new runners.
2019-10-28 14:47:32 +08:00
Darian Leung f9a51fc784 can: Add support for lower bit rates
This commit adds support for lower bit rates in the CAN Driver for
ESP32 Rev 2 or later chips.
2019-10-28 13:10:00 +08:00
Jiang Jiang Jian aa09462685 Merge branch 'bugfix/msys2_toolchain_path_note_v3.3' into 'release/v3.3'
docs: update windows msys2 installer notes to unzip all-in-one toolchain to path without spaces (v3.3)

See merge request espressif/esp-idf!6457
2019-10-25 11:41:09 +08:00
Jiang Jiang Jian 365c336a98 Merge branch 'feature/esptool_v2.8_v3.3' into 'release/v3.3'
esptool: Bump to v2.8 release (v3.3)

See merge request espressif/esp-idf!6461
2019-10-25 11:37:08 +08:00
Angus Gratton 95c768165f Merge branch 'bugfix/select_with_sdmmc_mount_v3.3' into 'release/v3.3'
VFS: Fix bug which occurs when driver is installed during a select() call (v3.3)

See merge request espressif/esp-idf!6430
2019-10-24 11:28:14 +08:00
Angus Gratton 12f2ae47c6 Merge branch 'bugfix/mqtt_disconnect_crash_3.3' into 'release/v3.3'
mqtt: referenced esp-mqtt master to close disconnection issues (Backport 3.3)

See merge request espressif/esp-idf!5883
2019-10-24 10:47:27 +08:00
Angus Gratton fc6b44f500 esptool: Bump to v2.8 release 2019-10-23 09:08:34 +11:00
David Cermak 0042aaafa1 docs: update windows msys2 installer notes to unzip all-in-one toolchain to path without spaces (v3.3) 2019-10-22 21:18:10 +02:00
Darian Leung adcf95dc9f heap: Fix printf usage in heap poisoning
This commit fixes the bug where printf() is used in
verify_allocated_region() when ets_printf() should be used.
2019-10-22 12:01:24 +00:00
Roland Dobai e5ee10e89f VFS: Fix bug which occurs when driver is installed during a select() call
Closes https://github.com/espressif/esp-idf/issues/3554
2019-10-22 10:15:21 +02:00
Angus Gratton c9f1cb2f4c Merge branch 'bugfix/ticks_to_wait_for_uart_and_i2c_v3.3' into 'release/v3.3'
driver: Fix ticks_to_wait for uart and i2c (v3.3)

See merge request espressif/esp-idf!5247
2019-10-22 13:18:24 +08:00
David Cermak a0c8de077b mqtt: updated to latest version to include latest fixes, support for global CA store, extended error structure to receive mqtt specific errors. updated idf ssl example to use this error struct
backport of 640eac84fa
2019-10-21 12:56:18 +00:00
David Cermak 9e62340897 mqtt: referenced esp-mqtt master to fix disconnect issues
and updates doxygen macros to have mqtt docs correctly documented

Backport of 6289a26596
2019-10-21 12:56:18 +00:00
Jiang Jiang Jian f451efd1d0 Merge branch 'bugfix/vfs_fat_sdmmc_mount_v3.3' into 'release/v3.3'
Fix memory leak upon failure of esp_vfs_fat_sdmmc_mount() (v3.3)

See merge request espressif/esp-idf!6394
2019-10-21 20:15:52 +08:00
Jiang Jiang Jian f490eda68c Merge branch 'bugfix/can_driver_assertions_v3.3' into 'release/v3.3'
drivers/can: fix skipped function calls when assertions disabled (backport v3.3)

See merge request espressif/esp-idf!6406
2019-10-21 20:12:54 +08:00
Konstantin Kondrashov f2dfb0cf70 driver: Add uart and i2c UTs to check ticks_to_wait in some functions 2019-10-21 07:32:25 +00:00
Konstantin Kondrashov 03aef3c087 i2c: Fix ticks_to_wait when 0 or time expired
Closes: https://github.com/espressif/esp-idf/issues/3301

Closes: IDFGH-964
2019-10-21 07:32:25 +00:00
Angus Gratton 9a6526554d Merge branch 'bugfix/ut_pre_read_DPORT_and_hi_interrupt' into 'release/v3.3'
esp32: Fix UT - Check pre-read workaround DPORT and Hi-interrupt

See merge request espressif/esp-idf!6240
2019-10-21 15:10:14 +08:00
Roland Dobai 8d4e1c0616 Fix memory leak upon failure of esp_vfs_fat_sdmmc_mount()
Closes https://github.com/espressif/esp-idf/issues/4165
2019-10-21 08:22:12 +02:00
Jiang Jiang Jian 4e27cbb89f Merge branch 'feature/esp_https_ota_improvements' into 'release/v3.3'
esp_https_ota: component refactoring, bugfixes and feature additions (backport v3.3)

See merge request espressif/esp-idf!6047
2019-10-21 10:40:37 +08:00
Jiang Jiang Jian b51f89d827 Merge branch 'bugfix/freemodbus_fix_read_coils_event_v3_3' into 'release/v3.3'
freemodbus: fix incorrectly set coils read event backport v3.3

See merge request espressif/esp-idf!4793
2019-10-21 10:38:39 +08:00
Mahavir Jain e30c7a9b27 Merge branch 'bugfix/spi_flash_read_changes_for_less_than_16_bytes_v3.3' into 'release/v3.3'
Bugfix/spi flash read changes for less than 16 bytes v3.3(backport v3.3)

See merge request espressif/esp-idf!6248
2019-10-19 15:01:48 +08:00
Ajita Chavan 622842a983 flash_ops: fix spi_flash_read with source buffer not from internal memory and size < 16
Closes https://github.com/espressif/esp-idf/issues/4010
2019-10-19 15:01:46 +08:00
Jiang Jiang Jian 2bcb02795e Merge branch 'Bugfix/IPV6_multicast_adress_error' into 'release/v3.3'
fix ipv6 bug that input the wrong broadcast address to return OK

See merge request espressif/esp-idf!6205
2019-10-18 18:37:25 +08:00
Ivan Grokhotkov fd22441494 drivers/can: fix skipped function calls when assertions disabled
When CONFIG_FREERTOS_ASSERT_DISABLE is set, the function calls wrapped
inside the assertion macros would be removed from the code.

Closes https://github.com/espressif/esp-idf/issues/4143
2019-10-18 11:27:27 +02:00
Kedar Sovani 8f048ffddc Remove check for would_block in mbedtls
Basically, in the portability layer, it is checked if the socket is
NON-block, and if not, then even the EAGAIN and EWOULDBLOCK errors are
diverted to a RECV error. This causes a problem for sockets with
receive timeouts set. When such a timeout is set, the condition for
NON_BLOCK isn't met and hence a hard error is returned.

Searching for EAGAIN and EWOULDBLOCK in lwip returns only 3 results
(accept, recvfrom, close) and all of them look to be genuine cases for
EWOULDBLOCK. So removing this check to make receive timeout with TLS
work.
2019-10-18 14:21:35 +05:30
Jiang Jiang Jian 3e3ce3da81 Merge branch 'bugfix/backport_some_wifi_fixes_1009_v3.3' into 'release/v3.3'
esp32: fix some WiFi bugs 1009 (backport v3.3)

See merge request espressif/esp-idf!6298
2019-10-18 14:25:13 +08:00
Angus Gratton 0a0f2caa1d Merge branch 'bugfix/reset_periph_modules_v3.3' into 'release/v3.3'
driver: Add a reset before enabling if a module is off (v3.3)

See merge request espressif/esp-idf!6016
2019-10-18 13:35:09 +08:00
Angus Gratton 2441858835 Merge branch 'feature/nimble_backport_idf-v3.3' into 'release/v3.3'
NimBLE: Port NimBLE stack to IDF Release v3.3 (Backport v3.3)

See merge request espressif/esp-idf!6179
2019-10-18 13:23:25 +08:00
Prasad Alatkar 3545b58986 NimBLE: Port NimBLE stack to IDF Release v3.3 (Backport v3.3)
Includes all the latest NimBLE stack changes from idf-v4.0 with few idf-v3.3
specific modifications.
- Addition of nimble component as submodule (`nimble-1.1.0-idf-v3.3`), contains
  IDF v3.3 specific minor changes.
- Example applications are identical to idf-v4.0
- Modification in `bt/Kconfig` to accommodate NimBLE as a BT host.
2019-10-18 13:23:24 +08:00
Angus Gratton 9f10f684d3 Merge branch 'feature/handle_icy_uris_v33' into 'release/v3.3'
Modified http_parser to handle ICY uris (Backport v3.3)

See merge request espressif/esp-idf!6325
2019-10-17 13:58:05 +08:00
Angus Gratton 5d750fb8ce Merge branch 'bugfix/ut_adjtime_v3.3' into 'release/v3.3'
newlib: Fix UT - test time adjustment happens linearly (v3.3)

See merge request espressif/esp-idf!6349
2019-10-16 20:54:06 +08:00
Ivan Grokhotkov 6f8f39a2e5 Merge branch 'docs/update_bootloader_chip_revision_print_v3.3' into 'release/v3.3'
bootloader_support: fix logging prints around chip revision (v3.3)

See merge request espressif/esp-idf!6337
2019-10-16 16:07:35 +08:00
xueyunfei 6c60d3ef29 fix ipv6 bug that input the wrong broadcast address to return OK 2019-10-15 09:40:57 +00:00
Angus Gratton ecaf8a7a61 Merge branch 'feature/sntp_cb_function_v3.3' into 'release/v3.3'
sntp: Add some modes for time synchronization (backport v3.3)

See merge request espressif/esp-idf!6190
2019-10-15 14:11:43 +08:00
Jiang Jiang Jian 7ef60d2c2b Merge branch 'bugfix/alt_exit_idf_monitor_v3.3' into 'release/v3.3'
idf_monitor: Exit with CTRL+X in menu (v3.3)

See merge request espressif/esp-idf!6291
2019-10-14 21:50:31 +08:00
Jiang Jiang Jian e524b4b1fd Merge branch 'feature/add_psram_workaround_option_3.3' into 'release/v3.3'
make psram workaround depend on chip revison (v3.3)

See merge request espressif/esp-idf!6303
2019-10-14 21:45:07 +08:00
Kerry Jones 40cce58a52 lwip/sntp: Added extern "C"
so that sntp_set_time_sync_notification_cb can be used from c++

Signed-off-by: Konstantin Kondrashov <konstantin@espressif.com>

Merges: https://github.com/espressif/esp-idf/pull/3700
2019-10-14 07:09:28 +00:00
Konstantin Kondrashov c50d44e66e sntp/lwip: Add SNTP_UPDATE_DELAY option in Kconfig
Closes: https://github.com/espressif/esp-idf/issues/2277
Closes: IDFGH-337
2019-10-14 07:09:28 +00:00
Konstantin Kondrashov 07a3eca372 sntp/lwip: Add some modes for time synchronization
Closes: IDF-236
Closes: https://github.com/espressif/esp-idf/pull/1668
Closes: https://github.com/espressif/esp-idf/pull/4103
2019-10-14 07:09:28 +00:00
Angus Gratton 626684578a Merge branch 'bugfix/kconfig_autoconf_generate_v3.3' into 'release/v3.3'
Kconfig: Load properly auto.conf before writing the results to build/include

See merge request espressif/esp-idf!6315
2019-10-14 14:58:14 +08:00
KonstantinKondrashov 5ba3b8c587 newlib: Fix UT - test time adjustment happens linearly 2019-10-14 14:52:24 +08:00
Angus Gratton c286416762 Merge branch 'bugfix/read_binary_image_header_via_cache_in_cpu_start_v3.3' into 'release/v3.3'
esp32: cpu_start: read binary image header via cache (backport v3.3)

See merge request espressif/esp-idf!6076
2019-10-14 11:31:19 +08:00
Mahavir Jain fd1c127d34 Merge branch 'bugfix/set_url_discards_username_password_v3.3' into 'release/v3.3'
fixes : set_url discards username and password (v3.3)

See merge request espressif/esp-idf!6334
2019-10-14 00:52:22 +08:00
Mahavir Jain b5aa65c136 bootloader_support: fix logging prints around chip revision 2019-10-13 11:58:29 +05:30
ganeshlandge 61486620c7 fixes : set_url discards username and password 2019-10-12 10:50:27 +05:30
liu zhifu 396f477972 esp32: fix some WiFi bugs
Fix following WiFi bugs:
1. Fix the bug that wpa2 enterprise sta can connect open AP
2. Fix TKIP/CCMP PN replay attack detection bug
3. Increase buffer number type from uint8_t to uint16_t to support more than 255 buffers
4. Avoid recalculating PMK if esp_wifi_set_config() is not called
5. Fix the bug that scan done leads to crash because of uint8 overflow
6. Fix 5.5M signal test bug
2019-10-12 10:38:44 +08:00
Konstantin Kondrashov 2165154c04 rmt/driver: Add module reset before enabling 2019-10-11 19:13:44 +08:00
Konstantin Kondrashov 46e918cfa1 pcnt/driver: Add module reset before enabling 2019-10-11 19:13:44 +08:00
Konstantin Kondrashov 051d2fbdd5 sdmmc_host/driver: Add module reset before enabling 2019-10-11 19:13:44 +08:00
Konstantin Kondrashov 41f91d3ef6 i2s/driver: Add module reset before enabling 2019-10-11 19:13:44 +08:00
Konstantin Kondrashov ffce53449b can/driver: Add module reset before enabling 2019-10-11 19:13:44 +08:00
Konstantin Kondrashov 7314f44b13 uart/driver: Add module reset before enabling
This commit prevents infinite restarts caused due to an interrupt flag
was left uncleared.

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

Closes: IDF-188
2019-10-11 19:13:44 +08:00
Vikram Dattu 4936110591 Modified http_parser to handle ICY uris.
ICY URIs e.g `http://uk1.internet-radio.com/proxy/vombat?mp=/;` need to
be handled differently.

For basic use case, these URIs are similar to HTTP with exception that they reply with `ICY 200` etc in place of `HTTP/1.1 200`.

In http_parser, we now also parse ICY URIs to be able to handle these similar to HTTP.

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-10-11 16:26:42 +05:30
Angus Gratton af9472bb7a Merge branch 'bugfix/add_kconfig_help_for_eth_gpio0_output_mode' into 'release/v3.3'
ethernet: add kconfig help for GPIO0 output mode

See merge request espressif/esp-idf!6114
2019-10-11 12:57:54 +08:00
Mahavir Jain d190c53ec8 Merge branch 'power_management/i2s+i2c-v3.3' into 'release/v3.3'
Power management/i2s+i2 (Backport v3.3)

See merge request espressif/esp-idf!6002
2019-10-11 11:30:39 +08:00
Roland Dobai 26c6583bab Kconfig: Load properly auto.conf before writing the results to build/include
Partial revertion of 6cd6423092. The split
directory structure is still removed but auto.conf is properly loaded.
2019-10-10 15:41:14 +02:00
suda-morris b3720f80c7 make psram workaround depend on chip revison
Since ESP32 revision 3, the PSRAM workaround is not needed.
2019-10-10 11:38:14 +08:00
Angus Gratton 8147d48ec8 Merge branch 'feature/add_chip_revision_to_image_header_v3.3' into 'release/v3.3'
Add chip revision into image header (v3.3)

See merge request espressif/esp-idf!6128
2019-10-10 11:24:00 +08:00
Angus Gratton 8466b8d6d3 Merge branch 'bugfix/event_minor_leak_v3.3' into 'release/v3.3'
esp_event: fix minor memory leak when overwriting already registered handler (v3.3)

See merge request espressif/esp-idf!5132
2019-10-10 11:05:41 +08:00
Angus Gratton 6e47143dc5 Merge branch 'bugfix/malloc_warnings_event_loop_3.3' into 'release/v3.3'
esp_event: fix possible malloc free issues found by static analyzer (Backport 3.3)

See merge request espressif/esp-idf!5884
2019-10-10 11:04:00 +08:00
Angus Gratton 10c882764e Merge branch 'bugfix/gnu_make_windows_paths_v3.3' into 'release/v3.3'
build: In GNU Make, use "cygpath -m" to avoid backslashes (v3.3)

See merge request espressif/esp-idf!6158
2019-10-10 07:26:42 +08:00
aleks 4559434d5a freemodbus: fix incorrectly set coils read event
incorrect set of the MB_EVENT_COILS_WR event is changed while read coils in mbcontroller.c file
added read/write handling for appropriate registers in freemodbus.c example file

Closes https://github.com/espressif/esp-idf/issues/3289
2019-10-09 17:49:00 +02:00
Jitin George 25f837a148 esp-tls: Add support to add CN from config and validate PEM buffers 2019-10-09 14:02:48 +00:00
Jitin George 53e295a616 example/simple_ota_example: Fix python formatting and KConfig 2019-10-09 14:02:48 +00:00
Jitin George 156ffa412e example/simple_ota_example: Add support for skipping OTA server certificate CN field 2019-10-09 14:02:48 +00:00
Jitin George 7726102bfb esp_http_client: Add support to disable validation of certificate's CN field 2019-10-09 14:02:48 +00:00
Jitin George 8c74a4a989 tcp_transport: Add API to allow skipping of certificate CN validation 2019-10-09 14:02:48 +00:00
Jitin George 48bd2152d0 example/simple_ota_example: Add example test 2019-10-09 14:02:48 +00:00
Gregory Eslinger 7db01c954e esp_https_ota: Removed unnecessary free()
Closes https://github.com/espressif/esp-idf/issues/3504

Merges https://github.com/espressif/esp-idf/pull/3513

Signed-off-by: Jitin George <jitin@espressif.com>
2019-10-09 14:02:48 +00:00
Jitin George d90868b42e examples/system/ota/advanced_https_ota: Add example for newly introduced APIs in esp_https_ota component 2019-10-09 14:02:48 +00:00
Jitin George 7d60a78b31 esp_https_ota: Add support for URL redirection, basic auth and more control with new APIs
Bugfixes:
- Fix http url redirection issue
- Fix basic/digest auth issue with http url

Features:
- Add support for adding custom http header
- Add support for reading firmware image header
- Add support for monitoring upgrade status
  - This requires breaking down esp_https_ota API such that it allows finer application level control
  - For simpler use-cases previous API is still supported

Closes https://github.com/espressif/esp-idf/issues/3218
Closes https://github.com/espressif/esp-idf/issues/2921
2019-10-09 14:02:48 +00:00
Jitin George 23a8cbb247 esp_http_client: Add API for adding authorization info
There was existing support for adding authorization info in esp_http_client
but it was functional only while using `esp_http_client_perform` API. This commit just moves
existing authorization addition logic into publicly exposed API.
2019-10-09 14:02:48 +00:00
Sachin Parekh f3fd849da1 PM: I2S and I2C added in the Power Management docs
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-10-09 11:37:33 +00:00
Sachin Parekh 7a2bd81870 I2S: Enable Power Management locks
Acquires PM_APB_FREQ_MAX lock when carrying any transaction on I2S if
Power Management Framework is enabled.

Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-10-09 11:37:33 +00:00
Sachin Parekh 2b6f7697b9 I2C: Enable Power Management locks
Acquires PM_APB_FREQ_MAX lock when carrying any transaction on I2C if
Power Management Framework is enabled.

Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-10-09 11:37:33 +00:00
Per-Olov Jernberg 610b5579a7 idf_monitor: Exit with CTRL+X in menu
Currently, the only way of exiting the idf_monitor program is to hit the CTRL+] button, if your keyboard doesn't have that key unless you hit another modifier key, it's not super trivial to exit.

This change adds the option to exit with CTRL+T (for menu) then hitting X (or CTRL+X) for exiting.

Closes https://github.com/espressif/esp-idf/pull/4167
Closes https://github.com/espressif/esp-idf/issues/4129
2019-10-09 10:44:54 +02:00
Jiang Jiang Jian 15a9d4f4d3 Merge branch 'bugfix/fix_several_wifi_bugs_0930_v3.3' into 'release/v3.3'
fix several wifi bugs 0930 (backport v3.3)

See merge request espressif/esp-idf!6233
2019-10-09 16:16:13 +08:00
Mahavir Jain 65e9af5114 Merge branch 'bugfix/esp_tls_add_header_in_esp_tls_h_v3.3' into 'release/v3.3'
ESP32/esp_tls: include esp_err.h in esp_tls.h (v3.3)

See merge request espressif/esp-idf!6265
2019-10-09 14:29:26 +08:00
chenjianqiang 579cbd8229 esp32: cpu_start: read binary image header via cache
When flash encryption is enabled, reading via cache also decrypts the
data, whereas spi_flash_read does not.
2019-10-09 06:25:26 +00:00
Angus Gratton 2b84f3e6c4 Merge branch 'bugfix/check_for_new_cmakecache_vars_v3.3' into 'release/v3.3'
idf.py: Add check for new cmake cache values (backport v3.3)

See merge request espressif/esp-idf!5931
2019-10-09 13:54:29 +08:00
Angus Gratton 10732770d3 Merge branch 'bugfix/freertos_xTaskNotifyGive_v3.3' into 'release/v3.3'
freertos: remove semicolon in xTaskNotifyGive (v3.3)

See merge request espressif/esp-idf!6270
2019-10-09 13:37:17 +08:00
Angus Gratton f2c10cb443 Merge branch 'feature/mqtt_improve_recv_3.3' into 'release/v3.3'
MQTT improved receive (backport 3.3)

See merge request espressif/esp-idf!5075
2019-10-08 14:28:52 +08:00
suda-morris c67b02db52 freertos: remove semicolon in xTaskNotifyGive 2019-10-08 12:39:07 +08:00
suda-morris dc4c16f475 ethernet: add kconfig help for GPIO0 output mode
1. add kconfig help for GPIO0 output mode
2. fix a bug when select gpio0 output mode and initialize psram
3. make default config to official development board
4. fix wrong LAN8720 register index
2019-10-08 02:41:40 +00:00
David Cermak 3f2bf11751 esp_event: fix possible malloc free issues found by static analyzer
(v3.3)

Backport of bd537083d9
2019-10-07 19:19:23 +00:00
David Cermak b1f264be69 esp_event: fix minor memory leak when overwriting alredy registered handler 2019-10-07 19:15:59 +00:00
David Cermak d14f2c5fca esp_event: extend register/unregister test case to cover overwriting existing handler works as expected 2019-10-07 19:15:59 +00:00
David Cermak 35898c704f tcp_transport: modified ws_read to read payload directly to the read buffer and separately from header bytes
Previous version read all data to the buffer including header which reduced maximum payload read. This version uses a local array to receive header and reads payload bytes to the buffer

cherry-picked from db121a56e1
2019-10-07 19:11:30 +00:00
Aditya Patwardhan 3564d6728c ESP32/esp-tls: include esp_err.h in esp_tls.h
Closes https://github.com/espressif/esp-idf/issues/4100
2019-10-07 17:48:05 +05:30
KonstantinKondrashov c5b1b57b09 esp32: Fix UT - Check pre-read workaround DPORT and Hi-interrupt 2019-09-30 19:04:38 +08:00
zhangyanjiao fbd38ad19a modify WIFI_CONN_0101 case for wrong authmode of AP 2019-09-30 12:03:58 +08:00
zhangyanjiao 2d5ee438fa wifi:
1.Fix the bug that WiFi stop leads to task watchdog(526c6956)
2.Fix the WiFi init sequence bug
3.Fix smartconfig ipc crash
4.Put g_promis_buf to IRAM
5.esp_wifi_set_channel should return error when sniffer is not enabled
6.fix the bug when set WEP authmode or wrong authmode, there is no error return
7.fix the bug that STA parse authmode wrong when AP sets WPA_WPA2_PSK mode
8.fix the bug that wrong error code and wrong event when there is an auto AP in multi-ssid case
2019-09-30 12:02:46 +08:00
Jiang Jiang Jian 46b12a560a Merge branch 'bugfix/btdm_backports_v3.3_0903' into 'release/v3.3'
Bugfix/btdm backports v3.3 0903

See merge request espressif/esp-idf!5983
2019-09-29 16:19:22 +08:00
Jiang Jiang Jian f19bc120f1 Merge branch 'feature/bluedroid_min_encr_key_size_backport_v3.3' into 'release/v3.3'
BT/Bluedroid : Add support to set min encryption key requirement (Backport v3.3)

See merge request espressif/esp-idf!6189
2019-09-29 16:06:28 +08:00
Prasad Alatkar 9c87165bc8 BT/Bluedroid : Add support to set min encryption key requirement (Backport v3.3)
- Backport(v3.3) of IDF MR!6122
- Modifies `smp_utils.c` to add check on encryption key size received from
  peer.
- Modifies `esp_ble_gap_set_security_param` API to add minimum encryption key
  size requirement.
2019-09-29 16:06:27 +08:00
suda-morris 6514820311 bootloader: shrink bin size
1. write a bootloader version of "getting chip revision" function.
2. reduce wordy log.
2019-09-29 11:27:17 +08:00
suda-morris 0af56e2815 Add chip revision into image header
Check chip id and chip revision before boot app image

Closes https://github.com/espressif/esp-idf/issues/4000
2019-09-27 10:24:39 +08:00
Jiang Jiang Jian a06b88d7f6 Merge branch 'bugfix/backport_some_wifi_bugs_201907_v3.3' into 'release/v3.3'
Backport some wifi bugs 201907 v3.3 (backport v3.3)

See merge request espressif/esp-idf!5526
2019-09-25 19:21:17 +08:00
Jiang Jiang Jian 5e292d50ad Merge branch 'fix/add_parentheses_to_spi_swap_data_tx_3.3' into 'release/v3.3'
spi: Put argument of macro SPI_SWAP_DATA_TX/RX in parentheses (backport v3.3)

See merge request espressif/esp-idf!6108
2019-09-25 16:21:37 +08:00
Jiang Jiang Jian 321ecc94d3 Merge branch 'bugfix/btdm_a2dp_src_pkt_overflow_v3.3' into 'release/v3.3'
component/bt: fix some performance issues in A2DP source data flow control

See merge request espressif/esp-idf!5986
2019-09-25 11:14:25 +08:00
Jiang Jiang Jian f0f30f9d0c Merge branch 'test/fix_mesh_test_case_3.3' into 'release/v3.3'
test: fix test case MESH_EST_2403 (backport 3.3)

See merge request espressif/esp-idf!5908
2019-09-23 21:41:22 +08:00
Jiang Jiang Jian 9ea662a4ba Merge branch 'bugfix/fix_the_for_smartconfig_send_broadcast_to_phone_v3.3' into 'release/v3.3'
fix the bug that ESP32 sends broadcast to phone after smartconfig is done(backport v3.3)

See merge request espressif/esp-idf!6073
2019-09-23 21:40:42 +08:00
baohongde 285925a43b components:bt: backports release/v3.3 0903
Remove xtensa/xruntime.h
Fix sending Lmp_feature_req_ext in a loop
Fix 2 bugs in r_ld_fm_sket_isr
fix data loss and send same pkt twice sometimes
fix adv data error in air sometimes
fix adv start/stop crash sometimes
Fix connect fail with some speakers
clear BT/BLE interruots after controller disable
add sco_data_path to be set in sdkconfig and do not reset the value upon HCI reset command
2019-09-23 18:02:28 +08:00
wangmengyang 9e51598ee7 component/bt: fix some performance issues in A2DP source data flow control
1. modify the limit of frames to send to avoid dropping packet on A2DP source due to TX data queue overflow
2. reduce the A2DP source data queue size in order to achieve faster control respnonse
2019-09-20 11:52:46 +00:00
Angus Gratton 5e321badd5 Merge branch 'bugfix/bootloader_factory_reset_with_wake_up_from_deep_sleep_v3.3' into 'release/v3.3'
bootloader: Blocking the Factory reset during wake up from deep sleep (v3.3)

See merge request espressif/esp-idf!6021
2019-09-20 19:22:45 +08:00
chenyudong e943181f72 test: move wifi library check to esp32-wifi-lib ci 2019-09-20 17:50:23 +08:00
xiehang 2dc98f3be8 WiFi: Modify the wifi_country struct in VNC to keep it consistent with IDF.
1. Modfy wifi_country struct
2. Add md5 check esp_wifi_types.h
3. Add md5 check esp_wifi.h
2019-09-20 17:50:19 +08:00
liu zhifu 3badf6ebd9 mesh: fix the bug that esp_mesh_stop() doesn't return 2019-09-20 17:49:49 +08:00
liu zhifu 9a1b11c813 esp32: fix wifi stop bug
Fix the bug that WiFi stop causes esp_wifi_internal_reg_rxcb() fails.
2019-09-20 17:49:49 +08:00
liu zhifu b933d851bf esp32: fix WPS/WPA2-Enterprise memory leak
Fix WPS and WPA2-Enterprise memory leak bug.
2019-09-20 17:49:49 +08:00
liu zhifu 204b58a34c esp32: fix smartconfig crash when no AP is found
Fix the bug that smartconfig crashes when no AP is found during smartconfig scan.
2019-09-20 17:49:49 +08:00
Angus Gratton 88c9506469 Merge branch 'bugfix/newlib_time_test_v3.3' into 'release/v3.3'
newlib: Fix UT - test time adjustment happens linearly (v3.3)

See merge request espressif/esp-idf!6117
2019-09-20 07:49:27 +08:00
Angus Gratton 202664bac0 build: In GNU Make, use "cygpath -m" to avoid backslashes
Fixes issues where backslashes in KCONFIG paths are later expanded as shell escape sequences.
2019-09-19 21:36:16 +10:00
Mahavir Jain 0500fa2344 Merge branch 'bugfix/cmake_config_variables_scope' into 'release/v3.3'
CMake: Fix variable scope issue

See merge request espressif/esp-idf!4967
2019-09-19 13:44:16 +08:00
KonstantinKondrashov fefc65f885 newlib: Fix UT - test time adjustment happens linearly
Obtaining accurate and adjustable time occurs closer to each other.
2019-09-17 14:16:58 +08:00
Martin Thierer d7e257d8ba spi: Put argument of macro SPI_SWAP_DATA_TX/RX in parentheses
Close https://github.com/espressif/esp-idf/pull/3996
2019-09-16 17:34:14 +08:00
KonstantinKondrashov ca3df7de7f app_update: Fix UTs for FACTORY_RESET and APP_TEST 2019-09-14 09:52:58 +00:00
KonstantinKondrashov 8849d6acfa bootloader: Factory reset not for deep sleep
Closes: https://github.com/espressif/esp-idf/issues/3800

Closes: IDFGH-1536
2019-09-14 09:52:58 +00:00
Angus Gratton e8e5410cef Merge branch 'bugfix/idf_py_fixes_v3.3' into 'release/v3.3'
idf.py fixes from GitHub (v3.3)

See merge request espressif/esp-idf!6001
2019-09-13 14:52:50 +08:00
Angus Gratton cc68a512d2 Merge branch 'bugfix/use_local_kconfiglib_v3.3' into 'release/v3.3'
Use kconfiglib from $IDF_PATH/tools/kconfig_new (v3.3)

See merge request espressif/esp-idf!6080
2019-09-13 14:47:47 +08:00
Renz Christian Bagaporo 3a291da164 cmake: fix variable scope issues 2019-09-13 01:32:50 +00:00
Mahavir Jain 1173b4f51a Merge branch 'bugfix/http_header_parser_resolution_v3.3' into 'release/v3.3'
(backport v3.3) esp_http_server : Bugfix in parsing of empty header values

See merge request espressif/esp-idf!6038
2019-09-12 18:46:22 +08:00
chenyudong f6d0a913de test: fix test case MESH_EST_2403 2019-09-12 02:50:17 +00:00
Jiang Jiang Jian 149171f119 Merge branch 'bugfix/lwip_prefer_allocate_memory_in_psram_v3.3' into 'release/v3.3'
l: Try to allocate some L memories in SPIRAM first. If failed, try to allocate in internal RAM then.(Backport v3.3)

See merge request espressif/esp-idf!5671
2019-09-12 10:39:14 +08:00
Roland Dobai 94091761c4 Use kconfiglib from $IDF_PATH/tools/kconfig_new 2019-09-11 14:39:01 +02:00
zhangyanjiao 262f3774e8 fix the bug that ESP32 sends broadcast to phone after smartconfig is done 2019-09-11 11:45:08 +08:00
Angus Gratton 30f93365b5 Merge branch 'bugfix/kconfig_no_split_headers_v3.3' into 'release/v3.3'
kconfig: Don't create "split" directory structures under build/include/config (v3.3)

See merge request espressif/esp-idf!6000
2019-09-11 07:54:09 +08:00
Xia Xiaotian e0748cdaf2 lwip: Try to allocate some LWIP memories in SPIRAM first. If failed, try to allocate in internal RAM then. 2019-09-10 14:26:50 +08:00
Angus Gratton 6cd6423092 kconfig: Don't create "split" directory structures under build/include/config
Reported in https://github.com/espressif/esp-idf/issues/3299

If a config item contains a reserved filename in Windows like _CON_ then an invalid
directory is created.

We don't rely on this feature all, so disable it.
2019-09-10 05:52:29 +00:00
Chinmay 38b1c93764 esp_http_server : Bugfix in parsing of empty header values
This MR is intended to fix incorrect parsing of HTTP requests when empty header values are present.

The issue is was due to asymmetric behavior of `http_parser` library, which in case of:

    non-empty header values : invokes callbacks with the pointer to the start of a value
    empty header values : invokes callbacks with pointer to the start of next header or section

Since HTTP server relies on this pointer (along with length of the value) to locate the end of a value, and replace the line terminators (CRLFs) with null characters, the second case needed to be handled correctly.

Closes IDFGH-1539

Closes https://github.com/espressif/esp-idf/issues/3803
2019-09-09 08:21:13 +00:00
Jiang Jiang Jian 9f3f7009c0 Merge branch 'bugfix_kconfig_deps_missing_v3.3' into 'release/v3.3'
kconfig: Add -MP option so .d files include empty targets (v3.3)

See merge request espressif/esp-idf!5847
2019-09-08 23:17:29 +08:00
Jiang Jiang Jian 69d8fab619 Merge branch 'update/cjson_v1_7_12_v3.3' into 'release/v3.3'
Update cJSON to v1.7.12 (v3.3)

See merge request espressif/esp-idf!5851
2019-09-08 23:16:25 +08:00
Jiang Jiang Jian cc50d88a89 Merge branch 'test/use_correct_config_for_nvs_compatible_case_v3.3' into 'release/v3.3'
test: fix nvs compatible case error (backport v3.3)

See merge request espressif/esp-idf!5894
2019-09-08 23:14:29 +08:00
Jiang Jiang Jian 4aea2dce15 Merge branch 'fix/sdio_slave_reset_infloop_leak_3.3' into 'release/v3.3'
sdio_slave: fix the send_flush infinite loop issue (backport v3.3)

See merge request espressif/esp-idf!5836
2019-09-08 23:13:41 +08:00
Jiang Jiang Jian 54c7379060 Merge branch 'feature/move_gettimeofday_in_clock_gettime_v3.3' into 'release/v3.3'
newlib: Move _gettimeofday_r call in clock_gettime (v3.3)

See merge request espressif/esp-idf!5717
2019-09-08 23:13:13 +08:00
Jiang Jiang Jian b12c2646fa Merge branch 'bugfix/fix_wifi_stack_can_freeze_v3.3' into 'release/v3.3'
esp_wifi: ESP32_WIFI_RX_BA_WIN should be less than ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM (v3.3)

See merge request espressif/esp-idf!5617
2019-09-08 23:11:57 +08:00
Jiang Jiang Jian 39ac9cb44b Merge branch 'bugfix/btdm_fix_hci_enhance_conn_complete_evt_unpack_error_v3.3' into 'release/v3.3'
component/bt: fix unpack hci enhance connection complete event error(backport v3.3)

See merge request espressif/esp-idf!5281
2019-09-08 23:11:18 +08:00
Jiang Jiang Jian 64fbce50c2 Merge branch 'bugfix/pm_isr_exit_lock_v3.3' into 'release/v3.3'
pm: prevent interrupt nesting during esp_pm_impl_isr_hook (backport v3.3)

See merge request espressif/esp-idf!4970
2019-09-08 23:10:02 +08:00
Jiang Jiang Jian d1e8b4473d Merge branch 'test/detect_exception_in_idf_dut_v3.3' into 'release/v3.3'
tiny-test-fw: support detect exception in IDFDUT (backport v3.3)

See merge request espressif/esp-idf!4542
2019-09-08 23:09:48 +08:00
Jiang Jiang Jian 38e2d3bec6 Merge branch 'bugfix/btdm_mem_leak_v3.3' into 'release/v3.3'
components/bt: Fix memory leak about rfcomm

See merge request espressif/esp-idf!5622
2019-09-08 23:09:24 +08:00
Angus Gratton 2192de7111 idf.py: Fix encoding issue with serial port names on Windows
Closes https://github.com/espressif/esp-idf/issues/3334
2019-09-05 15:09:38 +10:00
Angus Gratton c7f4fb56d8 idf.py: Use mingw32-make for version check
Closes https://github.com/espressif/esp-idf/issues/3333
2019-09-05 15:09:38 +10:00
Angus Gratton 3201333f06 Merge branch 'bugfix/flash_encryption_disable_plaintext_v3.3' into 'release/v3.3'
flash encryption: Add config option to disable any plaintext reflashes (3.3)

See merge request espressif/esp-idf!5280
2019-09-05 08:00:39 +08:00
Angus Gratton 85a89db863 Merge branch 'bugfix/fix_i2s_channels_swapped_issue_v3.3' into 'release/v3.3'
Bugfix(i2s): fixed i2s left/right channels swapped issue for release/v3.3.

See merge request espressif/esp-idf!5899
2019-09-03 13:36:54 +08:00
Angus Gratton 21a8a9a170 Merge branch 'bugfix/dis_interrupts_up_to_6_level_for_dport_wa_v3.3' into 'release/v3.3'
esp32: Dis interrupts up to 5 lvl for DPORT (v3.3)

See merge request espressif/esp-idf!5713
2019-09-03 13:34:54 +08:00
wangmengyang 0ce9d2662d add missing source files to CMakeLists for HFP 2019-09-03 11:51:16 +08:00
Angus Gratton d4e13c011e Merge branch 'bugfix/httpd_sess_close_v3.3' into 'release/v3.3'
httpd_sess_close: Check for session validity before closing (v3.3)

See merge request espressif/esp-idf!5743
2019-09-03 09:57:37 +08:00
Angus Gratton f380d72825 Merge branch 'bugfix/add_flash_config_in_app_startup_v3.3' into 'release/v3.3'
bugfix(flash): add flash config in app startup (backport v3.3)

See merge request espressif/esp-idf!5928
2019-09-02 08:50:38 +08:00
Jiang Jiang Jian 6ccb4cf5b7 Merge branch 'bugfix/btdm_security_vulnerability_on_encryption_key_size_v3.3' into 'release/v3.3'
components/bt: set the minimum encryption key size to be 7 octects for BR/EDR link

See merge request espressif/esp-idf!5872
2019-08-30 19:09:02 +08:00
Angus Gratton f8e24754d1 Merge branch 'bugfix/test_esp_efuse_table_on_host_v3.3' into 'release/v3.3'
CI: Fix path in the Efuse table test (v3.3)

See merge request espressif/esp-idf!5954
2019-08-30 16:28:07 +08:00
Mahavir Jain 86975b7e8f Merge branch 'bugfix/pr_3250_v3.3' into 'release/v3.3'
(backport v3.3) Fix: Lost username when setting new URL with a path.

See merge request espressif/esp-idf!5665
2019-08-29 18:40:15 +08:00
Roland Dobai c2bb7d7cd6 Fix path in the Efuse table test 2019-08-29 09:53:17 +02:00
redchenjs 3451f3526f Bugfix(i2s): fixed i2s left/right channels swapped issue for release/v3.3.
The right channel data is in the high position, so the I2S_TX_MSB_RIGHT & I2S_RX_MSB_RIGHT bits should be set.
2019-08-28 19:24:17 +08:00
Roland Dobai cc3ba7186f esp_http_client: fix CI issues & return value 2019-08-28 16:46:04 +05:30
Nguyễn Hồng Quân 7d28c02fd5 Fix: Lost username when setting new URL with a path.
Closes https://github.com/espressif/esp-idf/pull/3250
2019-08-28 14:54:59 +05:30
Piyush Shah 1aa2f36dec httpd_sess_close: Check for session validity before closing
If httpd_sess_trigger_close() gets called twice for the same socket,
the first httpd_sess_close() cb closes the correct socket, but the second
invocation closes the wrong socket which was just accepted and added to
the socket db. Checking for the lru counter will help identify this as the
counter is set only for requests actually served.
2019-08-28 09:03:55 +00:00
wangmengyang 3becdd7850 components/bt: set the minimum encryption key size to be 7 octects for BR/EDR link for preventing KNOB attack
This patch is to address the CVE-2019-9506 vulnerability.
2019-08-28 08:13:30 +00:00
Sergei Silnov cfd7a5b84e idf.py: Add check for new cmake cache values 2019-08-27 18:37:25 +02:00
chenjianqiang cf2062f1d7 bugfix(flash): add flash config in app startup
We fixed some flash bugs in bootloader, but for the users used the old
vrsion bootloader, they can not fix these bugs via OTA, the solution is
add these updates in app startup.

These updates include:
1. SPI flash gpio matrix and drive strength configuration
2. SPI flash clock configuration
3. SPI flash read dummy configuration
4. SPI flash cs timing configuration
5. Update flash id of g_rom_flashchip
2019-08-27 21:04:36 +08:00
He Yin Ling a742bad8f3 test: fix nvs compatible case error:
nvs compatible test case uses new test env and app. update test config
file.
2019-08-27 02:49:44 +00:00
He Yin Ling ef11260310 Merge branch 'bugfix/reduce_ci_config_file_size_v3.3' into 'release/v3.3'
CI: use parallel attribute in CI config file

See merge request espressif/esp-idf!5895
2019-08-27 10:47:42 +08:00
He Yin Ling 7b39d5e5c5 Apply suggestion to tools/ci/build_examples_cmake.sh 2019-08-26 11:00:46 +08:00
He Yin Ling d5b0b36758 Apply suggestion to tools/ci/build_examples.sh 2019-08-26 11:00:33 +08:00
He Yin Ling 0a609be968 CI: use parallel attribute in CI config file 2019-08-26 10:46:39 +08:00
Konstantin Kondrashov 8fa409a0b5 esp32: Add UTs for DPORT and Hi-interrupt 2019-08-21 09:48:16 +00:00
Konstantin Kondrashov 2e9904556f esp32: Dis interrupts up to 5 lvl for DPORT
Disable interrupts for both DPORT workarounds up to 5 lvl.

Closes: https://esp32.com/viewtopic.php?f=2&t=10981&sid=d125cec233070ed4d2c5410bf5d3d74a
Closes: IDF-728
2019-08-21 09:48:16 +00:00
Angus Gratton 8e32eb78a4 Update cJSON to v1.7.12
Fixes potential DoS in cJSON_Minify, see https://github.com/DaveGamble/cJSON/issues/354
2019-08-21 18:55:32 +10:00
Angus Gratton a3adc6c202 kconfig: Add -MP option so .d files include empty targets
Prevents make-level errors when switching IDF versions, as headers may be removed.

Similar to some mentioned here:
https://github.com/espressif/esp-idf/issues/712
2019-08-21 18:37:42 +10:00
Jiang Jiang Jian 148a269808 Merge branch 'bugfix/improve_spi_timing_for_flash_v3.3' into 'release/v3.3'
bugfix(flash): improve spi cs timing settings for flash (backport v3.3)

See merge request espressif/esp-idf!5514
2019-08-20 16:33:57 +08:00
Michael (XIAO Xufeng) 7b3bedbc10 sdio_slave: fix the send_flush infinite loop issue
Also add some helper functions.
2019-08-20 16:25:58 +08:00
Angus Gratton 5b11428f00 Merge branch 'bugfix/fix_flash_read_error_in_dio_mode_v3.3' into 'release/v3.3'
bugfix(flash): add spi dio address bitlen configure in psram init (backport v3.3)

See merge request espressif/esp-idf!5788
2019-08-19 13:03:54 +08:00
chenjianqiang 4cd7fd89f5 bugfix(flash): add spi dio address bitlen configure in psram init 2019-08-16 07:38:54 +00:00
Angus Gratton ceb56a7a72 Merge branch 'feature/dport_eco_revision2_v3.3' into 'release/v3.3'
make dport workaround depend on chip revision (v3.3)

See merge request espressif/esp-idf!5766
2019-08-16 13:14:49 +08:00
Angus Gratton ebfa74310c Merge branch 'bugfix/link_test_components_to_executable_directly' into 'release/v3.3'
cmake: link test components to executable directly

See merge request espressif/esp-idf!5739
2019-08-15 14:59:56 +08:00
suda-morris b482ba117d efuse: update the scheme of getting chip revision 2019-08-13 15:49:01 +08:00
Angus Gratton 07735424a2 Merge branch 'bugfix/xTaskIncrementTick_v3.3' into 'release/v3.3'
freertos: Fix xTaskIncrementTick for unwind the Tick for CPU1 (v3.3)

See merge request espressif/esp-idf!5034
2019-08-13 13:42:26 +08:00
Angus Gratton f2f5a237c0 Merge branch 'bugfix/gpio_intr_enable_bug_v3.3' into 'release/v3.3'
bugfix(GPIO):  Fixed GPIO interrupt bug for v3.3

See merge request espressif/esp-idf!5650
2019-08-12 13:00:15 +08:00
Angus Gratton 3be1c70d46 Merge branch 'bugfix/cmake_extra_component_dirs_v3.3' into 'release/v3.3'
CI: additional CMake build system tests wrt EXTRA_COMPONENT_DIRS (v3.3)

See merge request espressif/esp-idf!5109
2019-08-12 12:44:19 +08:00
Angus Gratton beb34b5390 Merge branch 'bugfix/hwcrypt_fault_inj_v3.3' into 'release/v3.3'
AES & SHA fault injection checks (backport v3.3)

See merge request espressif/esp-idf!5710
2019-08-11 14:04:36 +08:00
Angus Gratton 3991084777 sha: Add fault injection checks reading hash digest state
Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
2019-08-11 13:18:23 +10:00
Angus Gratton 088439c634 aes: Add fault injection checks when writing key to hardware
Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
2019-08-11 13:18:23 +10:00
Renz Christian Bagaporo dbd05d8986 cmake: link test components to executable directly 2019-08-09 15:18:06 +08:00
raldone01 02068cf328 newlib: Move _gettimeofday_r call in clock_gettime
Signed-off-by: KonstantinKondrashov <konstantin@espressif.com>
Merges: https://github.com/espressif/esp-idf/pull/3789
2019-08-07 20:37:11 +08:00
Angus Gratton 7c5dd19c83 hwcrypto: Add AES fault injection check
Hardware AES-CBC performance changes:

Release config 11.0MB/sec -> 10.8MB/sec
Debug config 9.4MB/sec -> 9.8MB/sec

(Unrolling the loop to optimize the check improves
performance at -Og, even with the fault check.)
2019-08-07 16:04:59 +10:00
Angus Gratton a6fb161309 Merge branch 'bugfix/sec_boot_ota_fail_v33' into 'release/v3.3'
Bugfix: ota fails with secure boot on for image size greater than 3.2MB (backport v3.3)

See merge request espressif/esp-idf!5581
2019-08-06 14:51:06 +08:00
kooho 0929dbbc9b bugfix(GPIO): Fixed the bug that GPIO enables interrupts on one core,
but registers interrupt service routines on another core for release/v3.3
2019-08-06 03:20:11 +00:00
Vikram Dattu 4c27f9ced8 Add mmu pages available check in non-secure image hash check path.
Made MMU pages available check in `esp_image_format.c`
This now makes it possible to map and process bootoader image as well in chunks when image doesn't fit completely into available free pages.

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-08-05 05:34:11 +00:00
Vikram Dattu b800dfe6f1 Changed log level for spi_master
There are lot of prints of `Allocate TX buffer for DMA`
Changed these from `ESP_LOGI` to `ESP_LOGD`

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-08-05 05:34:11 +00:00
Vikram Dattu caa1ef0cb6 Bugfix: ota fails with secure boot on for image size greater than 3.2MB
When an OTA image size is larger than 50 MMU pages (approx. 3.2 MB), secure_boot_generate fails while trying to map it into memory:

https://github.com/espressif/esp-idf/blob/master/components/bootloader_support/src/esp32/secure_boot.c#L72

Instead of trying to map the whole image, secure boot code should split the image into chunks and map them one by one, like it is done in esp_image_format.c:
https://github.com/espressif/esp-idf/blob/master/components/bootloader_support/src/esp_image_format.c#L371

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-08-05 05:34:11 +00:00
Jiang Jiang Jian 97e7c14f4e Merge branch 'bugfix/btdm_sleep_twice_v3.3' into 'release/v3.3'
bugfix btdm sleep twice after wakeup request

See merge request espressif/esp-idf!5638
2019-08-04 15:51:36 +08:00
Angus Gratton c157c696e7 Merge branch 'doc/resolve-pdf-building-issues_v3.3' into 'release/v3.3'
(backport v3.3) Replace gif images on EN and zh_CN index pages with identical png images for...

See merge request espressif/esp-idf!5655
2019-08-01 14:09:57 +08:00
Angus Gratton d900cb5a35 Merge branch 'bugfix/libsodium_test_timeouts_v3.3' into 'release/v3.3'
test: Set timeout of libsodium ed25519_convert test to 60s (v3.3)

See merge request espressif/esp-idf!5554
2019-07-31 02:18:50 +08:00
Angus Gratton e8a4e70c42 flash encryption: Add config option to disable any plaintext reflashes
Enabled by default when Secure Boot is on, so Flash Encryption protection
is always available in case of a Secure Boot bypass.
2019-07-30 08:35:30 +00:00
Kirill Chalov 4cb729283d Replace gif images on EN and zh_CN index pages with identical png images for successful building of PDFs on ReadTheDocs. 2019-07-30 15:36:58 +08:00
Angus Gratton 6a3e160aaf test: Set timeout of libsodium ed25519_convert test to 60s
Test takes 28s-29s to run in some configs, can fail in CI.
2019-07-30 07:19:54 +00:00
Angus Gratton 70ecb7ec94 Merge branch 'bugfix/docs_recover_some_build_time_v3.3' into 'release/v3.3'
docs: Remove building of zipped HTML docs from build process and consequently...

See merge request espressif/esp-idf!5639
2019-07-29 19:16:46 +08:00
krzychb 21e2c417e8 docs: Remove building of zipped HTML docs from build process and consequently from Downloads as many users don't use that. We are still providing PDF documentation for people who prefer viewing docs off-line. Removal of this build step is expected to save almost 10 minutes of build time and resolve issue of build failures because of hitting 40 min build time limit on Read The Docs. 2019-07-28 01:16:47 +02:00
Tian Hao 3ca82d5923 bugfix btdm sleep twice after wakeup request
This problem may cause HCI send command timeout.

When host call VHCI api to do btdm_wakeup_request, then controller
wakeup process will be handled in ISR and controller task context.
As host task priority is lower than controller task and ISR,
it will cause an incorrect behavior that before VHCI take the
rx_flow_on_semaphore, controller sleep again, then VHCI cannot take
the semaphore and has to wait the automatic wakeup.
2019-07-27 18:07:20 +08:00
Angus Gratton 7af04d857f Merge branch 'bugfix/fix_mcpwm_example_memory_bug_v3.3' into 'release/v3.3'
Bugfix(example):  Fixed MCPWM example bug for release/v3.3

See merge request espressif/esp-idf!5544
2019-07-27 17:27:41 +08:00
Mahavir Jain e070e1886f Merge branch 'bugfix/esp_event_add_missing_include_v3.3' into 'release/v3.3'
esp_event: add missing header include (v3.3)

See merge request espressif/esp-idf!5632
2019-07-26 19:44:32 +08:00
Mahavir Jain 6da2bec1e8 esp_event: add missing header include
Required header was indirectly getting resolved through lwip includes,
apparently does not work if application is not using lwip networking stack.
2019-07-26 16:36:13 +05:30
Mahavir Jain 73345bae44 Merge branch 'bugfix/tcp_transport_http_client' into 'release/v3.3'
Minor bugfixes in esp_http_client and tcp_transport (backport v3.3)

See merge request espressif/esp-idf!5218
2019-07-25 19:43:27 +08:00
baohongde b9f2531e8c components/bt: Fix memory leak about rfcomm 2019-07-25 16:51:40 +08:00
xiehang b6e6a4f4b2 esp_wifi: ESP32_WIFI_RX_BA_WIN should be less than ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 2019-07-25 14:37:20 +08:00
He Yin Ling 9420c5398f test: handle exception by unit test script:
unit test script will detect exception, we don't need to let test fail
when exception happened.
2019-07-23 09:44:28 +00:00
He Yin Ling 31c8be0738 tiny-test-fw: support translate backtrace in IDFDUT 2019-07-23 09:44:28 +00:00
He Yin Ling cbc438c807 tiny-test-fw: support detect exception in IDFDUT 2019-07-23 09:44:28 +00:00
Jitin George 2d26163019 tcp_transport: Fix case sensitive header comparison
Closes https://github.com/espressif/esp-idf/issues/3106
2019-07-21 07:24:11 +00:00
Jitin George ff2624f09c esp_http_client: Fix header sent event bug 2019-07-21 07:24:11 +00:00
Angus Gratton 11d141e87d Merge branch 'bugfix/app_update_tests_v3.3' into 'release/v3.3'
app_update: Add [timeout=90] for UTs (v3.3)

See merge request espressif/esp-idf!5564
2019-07-18 18:25:01 +08:00
KonstantinKondrashov 8ed62223cd app_update: Add [timeout=90] 2019-07-17 18:52:39 +08:00
Ramesh 5758b739f1 Fixed the bug that the malloc memory size is smaller than the actual required. 2019-07-16 15:09:23 +08:00
chenjianqiang 232408981d bugfix(flash): improve spi cs timing settings for flash
cs setup time is recomemded to be 1.5T, and cs hold time is recommended to be 2.5T.
(cs_setup = 1, cs_setup_time = 0; cs_hold = 1, cs_hold_time = 1)
2019-07-15 14:45:35 +08:00
Renz Christian Bagaporo d7569b5862 cmake: refactor finding components 2019-07-10 16:50:23 +08:00
Renz Christian Bagaporo db9979701a ci: additional Cmake tests for EXTRA_COMPONENT_DIRS
Tests from
https://gitlab.espressif.cn:6688/idf/esp-idf/merge_requests/4253
2019-07-10 16:49:44 +08:00
zhiweijian 0e022b7db9 component/bt: fix unpack hci enhance connection complete event error 2019-06-24 03:23:59 +00:00
Konstantin Kondrashov d54fadef41 freertos/test: Add unit tests for xTaskIncrementTick 2019-06-05 10:22:48 +00:00
Konstantin Kondrashov 3b4353da5d freertos: Fix xTaskIncrementTick for unwind the Tick for CPU1
xTaskIncrementTick have to unwind uxPendedTicks on CPU1 and CPU0.

Use case: If an erase operation was run on the CPU1 then it leads
to starving other tasks which waiting time. Waited tasks just skipped.

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

Closes: IDF-183
2019-06-05 10:22:48 +00:00
Ivan Grokhotkov c763b8089c pm: prevent interrupt nesting during esp_pm_impl_isr_hook
Follows the approach proposed in https://github.com/espressif/esp-idf/pull/3110,
but masks the interrupts during the entire ISR hook, not only during
leave_idle. Interrupt nesting during update_ccompare may also cause
issues.

Closes https://github.com/espressif/esp-idf/issues/3057
2019-05-10 10:21:21 +08:00
1154 changed files with 141174 additions and 41493 deletions

File diff suppressed because it is too large Load diff

4
.gitmodules vendored
View file

@ -69,3 +69,7 @@
[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
[submodule "components/nimble/nimble"]
path = components/nimble/nimble
url = https://github.com/espressif/esp-nimble.git

View file

@ -7,7 +7,6 @@ version: 2
# Optionally build your docs in additional formats such as PDF and ePub
formats:
- htmlzip
- pdf
# Optionally set the version of Python and requirements required to build your docs
@ -16,7 +15,7 @@ python:
install:
- requirements: docs/requirements.txt
# We need to list all the submodules included in documenation build by Doxygen
# We need to list all the submodules included in documentation build by Doxygen
submodules:
include:
- components/mqtt/esp-mqtt

View file

@ -1,108 +1,6 @@
cmake_minimum_required(VERSION 3.5)
project(esp-idf C CXX ASM)
if(NOT IDF_PATH)
set(IDF_PATH ${CMAKE_CURRENT_LIST_DIR})
endif()
include(tools/cmake/idf_functions.cmake)
#
# Set variables that control the build configuration and the build itself
#
idf_set_variables()
kconfig_set_variables()
#
# Generate a component dependencies file, enumerating components to be included in the build
# as well as their dependencies.
#
execute_process(COMMAND "${CMAKE_COMMAND}"
-D "COMPONENTS=${IDF_COMPONENTS}"
-D "COMPONENT_REQUIRES_COMMON=${IDF_COMPONENT_REQUIRES_COMMON}"
-D "EXCLUDE_COMPONENTS=${IDF_EXCLUDE_COMPONENTS}"
-D "TEST_COMPONENTS=${IDF_TEST_COMPONENTS}"
-D "TEST_EXCLUDE_COMPONENTS=${IDF_TEST_EXCLUDE_COMPONENTS}"
-D "BUILD_TESTS=${IDF_BUILD_TESTS}"
-D "DEPENDENCIES_FILE=${CMAKE_BINARY_DIR}/component_depends.cmake"
-D "COMPONENT_DIRS=${IDF_COMPONENT_DIRS}"
-D "BOOTLOADER_BUILD=${BOOTLOADER_BUILD}"
-D "IDF_TARGET=${IDF_TARGET}"
-D "IDF_PATH=${IDF_PATH}"
-D "DEBUG=${DEBUG}"
-P "${IDF_PATH}/tools/cmake/scripts/expand_requirements.cmake"
WORKING_DIRECTORY "${PROJECT_PATH}"
RESULT_VARIABLE expand_requirements_result)
if(expand_requirements_result)
message(FATAL_ERROR "Failed to expand component requirements")
endif()
include("${CMAKE_BINARY_DIR}/component_depends.cmake")
#
# We now have the following component-related variables:
#
# IDF_COMPONENTS is the list of initial components set by the user
# (or empty to include all components in the build).
# BUILD_COMPONENTS is the list of components to include in the build.
# BUILD_COMPONENT_PATHS is the paths to all of these components, obtained from the component dependencies file.
#
# Print the list of found components and test components
#
string(REPLACE ";" " " BUILD_COMPONENTS_SPACES "${BUILD_COMPONENTS}")
message(STATUS "Component names: ${BUILD_COMPONENTS_SPACES}")
unset(BUILD_COMPONENTS_SPACES)
message(STATUS "Component paths: ${BUILD_COMPONENT_PATHS}")
# Print list of test components
if(TESTS_ALL EQUAL 1 OR TEST_COMPONENTS)
string(REPLACE ";" " " BUILD_TEST_COMPONENTS_SPACES "${BUILD_TEST_COMPONENTS}")
message(STATUS "Test component names: ${BUILD_TEST_COMPONENTS_SPACES}")
unset(BUILD_TEST_COMPONENTS_SPACES)
message(STATUS "Test component paths: ${BUILD_TEST_COMPONENT_PATHS}")
endif()
# Generate project configuration
kconfig_process_config()
# Include sdkconfig.cmake so rest of the build knows the configuration
include(${SDKCONFIG_CMAKE})
# Verify the environment is configured correctly
idf_verify_environment()
# Check git revision (may trigger reruns of cmake)
## sets IDF_VER to IDF git revision
idf_get_git_revision()
# Check that the targets set in cache, sdkconfig, and in environment all match
idf_check_config_target()
## get PROJECT_VER
if(NOT BOOTLOADER_BUILD)
app_get_revision("${CMAKE_SOURCE_DIR}")
endif()
# Add some idf-wide definitions
idf_set_global_compile_options()
# generate compile_commands.json (needs to come after project)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
#
# Setup variables for linker script generation
#
ldgen_set_variables()
# Include any top-level project_include.cmake files from components
foreach(component ${BUILD_COMPONENT_PATHS})
set(COMPONENT_PATH "${component}")
include_if_exists("${component}/project_include.cmake")
unset(COMPONENT_PATH)
endforeach()
#
# Add each component to the build as a library
#
@ -144,18 +42,4 @@ foreach(component ${BUILD_COMPONENTS})
add_component_dependencies(${component_target} ${dep_target} PRIVATE)
endforeach()
endif()
endforeach()
if(IDF_BUILD_ARTIFACTS)
# Write project description JSON file
make_json_list("${BUILD_COMPONENTS}" build_components_json)
make_json_list("${BUILD_COMPONENT_PATHS}" build_component_paths_json)
configure_file("${IDF_PATH}/tools/cmake/project_description.json.in"
"${IDF_BUILD_ARTIFACTS_DIR}/project_description.json")
unset(build_components_json)
unset(build_component_paths_json)
endif()
set(BUILD_COMPONENTS ${BUILD_COMPONENTS} PARENT_SCOPE)
ldgen_add_dependencies()
endforeach()

View file

@ -23,6 +23,10 @@ mainmenu "Espressif IoT Development Framework Configuration"
default "IDF_TARGET_NOT_SET" if IDF_TARGET_ENV=""
default IDF_TARGET_ENV
config IDF_FIRMWARE_CHIP_ID
hex
default 0x0000 if IDF_TARGET="esp32"
default 0xFFFF
menu "SDK tool configuration"
config TOOLPREFIX

66
SUPPORT_POLICY.md Normal file
View file

@ -0,0 +1,66 @@
The latest support policy for ESP-IDF can be found at [https://github.com/espressif/esp-idf/blob/master/SUPPORT_POLICY.md](https://github.com/espressif/esp-idf/blob/master/SUPPORT_POLICY.md)
Support Period Policy
=====================
Each ESP-IDF major and minor release (V4.0, V4.1, etc) is supported for
18 months after the initial stable release date.
Supported means that the ESP-IDF team will continue to apply bug fixes,
security fixes, etc to the release branch on GitHub, and periodically
make new bugfix releases as needed.
Users are encouraged to upgrade to a newer ESP-IDF release before the
support period finishes and the release becomes End of Life (EOL). It is
our policy to not continue fixing bugs in End of Life releases.
Pre-release versions (betas, previews, `-rc` and `-dev` versions, etc)
are not covered by any support period. Sometimes a particular feature is
marked as \"Preview\" in a release, which means it is also not covered
by the support period.
The ESP-IDF Programming Guide has information about the
[different versions of ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/latest/versions.html)
(major, minor, bugfix, etc).
Long Term Support releases
--------------------------
Some releases (starting with ESP-IDF V3.3) are designated Long Term
Support (LTS). LTS releases are supported for 30 months (2.5 years)
after the initial stable release date.
A new LTS release will be made at least every 18 months. This means
there will always be a period of at least 12 months to upgrade from the
previous LTS release to the following LTS release.
Example
-------
ESP-IDF V3.3 was released in September 2019 and is a Long Term Support
(LTS) release, meaning it will be supported for 30 months until February
2022.
- The first V3.3 release was `v3.3` in September 2019.
- The ESP-IDF team continues to backport bug fixes, security fixes,
etc to the release branch `release/v3.3`.
- Periodically stable bugfix releases are created from the release
branch. For example `v3.3.1`, `v3.3.2`, etc. Users are encouraged to
always update to the latest bugfix release.
- V3.3 bugfix releases continue until February 2022, when all V3.3.x
releases become End of Life.
Existing Releases
-----------------
ESP-IDF release V3.3 and all newer releases will follow this support
period policy. The support period for each release will be announced
when the release is made.
For releases made before the support period policy was announced,
the following support periods apply:
- ESP-IDF V3.1.x and V3.2.x will both be supported until October 2020.
- ESP-IDF V3.0.9 (planned for October 2019) will be the last V3.0
bugfix release. ESP-IDF V3.0.x is End of Life from October 2019.
- ESP-IDF versions before V3.0 are already End of Life.

View file

@ -22,4 +22,14 @@ menu "Application manager"
The PROJECT_NAME variable from the build system will not affect the firmware image.
This value will not be contained in the esp_app_desc structure.
config APP_RETRIEVE_LEN_ELF_SHA
int "The length of APP ELF SHA is stored in RAM(chars)"
default 16
range 8 64
help
At startup, the app will read this many hex characters from the embedded APP ELF SHA-256 hash value
and store it in static RAM. This ensures the app ELF SHA-256 value is always available
if it needs to be printed by the panic handler code.
Changing this value will change the size of a static buffer, in bytes.
endmenu # "Application manager"

View file

@ -72,13 +72,35 @@ static inline char IRAM_ATTR to_hex_digit(unsigned val)
return (val < 10) ? ('0' + val) : ('a' + val - 10);
}
__attribute__((constructor)) void esp_ota_init_app_elf_sha256(void)
{
esp_ota_get_app_elf_sha256(NULL, 0);
}
/* The esp_app_desc.app_elf_sha256 should be possible to print in panic handler during cache is disabled.
* But because the cache is disabled the reading esp_app_desc.app_elf_sha256 is not right and
* can lead to a complete lock-up of the CPU.
* For this reason we do a reading of esp_app_desc.app_elf_sha256 while start up in esp_ota_init_app_elf_sha256()
* and keep it in the static s_app_elf_sha256 value.
*/
int IRAM_ATTR esp_ota_get_app_elf_sha256(char* dst, size_t size)
{
size_t n = MIN((size - 1) / 2, sizeof(esp_app_desc.app_elf_sha256));
const uint8_t* src = esp_app_desc.app_elf_sha256;
static char s_app_elf_sha256[CONFIG_APP_RETRIEVE_LEN_ELF_SHA / 2];
static bool first_call = true;
if (first_call) {
first_call = false;
const uint8_t* src = esp_app_desc.app_elf_sha256;
for (size_t i = 0; i < sizeof(s_app_elf_sha256); ++i) {
s_app_elf_sha256[i] = src[i];
}
}
if (dst == NULL || size == 0) {
return 0;
}
size_t n = MIN((size - 1) / 2, sizeof(s_app_elf_sha256));
for (size_t i = 0; i < n; ++i) {
dst[2*i] = to_hex_digit(src[i] >> 4);
dst[2*i + 1] = to_hex_digit(src[i] & 0xf);
dst[2*i] = to_hex_digit(s_app_elf_sha256[i] >> 4);
dst[2*i + 1] = to_hex_digit(s_app_elf_sha256[i] & 0xf);
}
dst[2*n] = 0;
return 2*n + 1;

View file

@ -43,7 +43,7 @@
#include "esp_efuse.h"
#define SUB_TYPE_ID(i) (i & 0x0F)
#define SUB_TYPE_ID(i) (i & 0x0F)
typedef struct ota_ops_entry_ {
uint32_t handle;
@ -165,7 +165,8 @@ esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp
if ((image_size == 0) || (image_size == OTA_SIZE_UNKNOWN)) {
ret = esp_partition_erase_range(partition, 0, partition->size);
} else {
ret = esp_partition_erase_range(partition, 0, (image_size / SPI_FLASH_SEC_SIZE + 1) * SPI_FLASH_SEC_SIZE);
const int aligned_erase_size = (image_size + SPI_FLASH_SEC_SIZE - 1) & ~(SPI_FLASH_SEC_SIZE - 1);
ret = esp_partition_erase_range(partition, 0, aligned_erase_size);
}
if (ret != ESP_OK) {
@ -208,7 +209,7 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
// must erase the partition before writing to it
assert(it->erased_size > 0 && "must erase the partition before writing to it");
if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != ESP_IMAGE_HEADER_MAGIC) {
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x", data_bytes[0]);
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x)", data_bytes[0]);
return ESP_ERR_OTA_VALIDATE_FAILED;
}

View file

@ -4,7 +4,7 @@
TEST_CASE("esp_ota_get_app_elf_sha256 test", "[esp_app_desc]")
{
const int sha256_hex_len = 64;
const int sha256_hex_len = CONFIG_APP_RETRIEVE_LEN_ELF_SHA;
char dst[sha256_hex_len + 2];
const char fill = 0xcc;
int res;

View file

@ -295,7 +295,7 @@ static void test_flow1(void)
// 3 Stage: run OTA0 -> check it -> copy OTA0 to OTA1 -> reboot --//--
// 4 Stage: run OTA1 -> check it -> copy OTA1 to OTA0 -> reboot --//--
// 5 Stage: run OTA0 -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, OTA0", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow1, test_flow1, test_flow1, test_flow1);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, OTA0", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow1, test_flow1, test_flow1, test_flow1);
static void test_flow2(void)
{
@ -332,7 +332,7 @@ static void test_flow2(void)
// 2 Stage: run factory -> check it -> copy factory to OTA0 -> reboot --//--
// 3 Stage: run OTA0 -> check it -> corrupt ota data -> reboot --//--
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, corrupt ota_sec1, factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow2, test_flow2, test_flow2);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, corrupt ota_sec1, factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow2, test_flow2, test_flow2);
static void test_flow3(void)
{
@ -376,7 +376,7 @@ static void test_flow3(void)
// 3 Stage: run OTA0 -> check it -> copy OTA0 to OTA1 -> reboot --//--
// 3 Stage: run OTA1 -> check it -> corrupt ota sector2 -> reboot --//--
// 4 Stage: run OTA0 -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, currupt ota_sec2, OTA0", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow3, test_flow3, test_flow3, test_flow3);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, currupt ota_sec2, OTA0", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow3, test_flow3, test_flow3, test_flow3);
#ifdef CONFIG_BOOTLOADER_FACTORY_RESET
#define STORAGE_NAMESPACE "update_ota"
@ -443,7 +443,7 @@ static void test_flow4(void)
// 2 Stage: run factory -> check it -> copy factory to OTA0 -> reboot --//--
// 3 Stage: run OTA0 -> check it -> set_pin_factory_reset -> reboot --//--
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, sets pin_factory_reset, factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow4, test_flow4, test_flow4);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, sets pin_factory_reset, factory", "[app_update][timeout=90][ignore][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow4, test_flow4, test_flow4);
#endif
#ifdef CONFIG_BOOTLOADER_APP_TEST
@ -486,7 +486,7 @@ static void test_flow5(void)
// 2 Stage: run factory -> check it -> copy factory to Test and set pin_test_app -> reboot --//--
// 3 Stage: run test -> check it -> reset pin_test_app -> reboot --//--
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, test, factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow5, test_flow5, test_flow5);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, test, factory", "[app_update][timeout=90][ignore][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow5, test_flow5, test_flow5);
#endif
static const esp_partition_t* app_update(void)
@ -580,7 +580,7 @@ static void test_rollback1_1(void)
// 3 Stage: run OTA0 -> check it -> esp_ota_mark_app_valid_cancel_rollback() -> reboot --//--
// 4 Stage: run OTA0 -> check it -> esp_ota_mark_app_invalid_rollback_and_reboot() -> reboot
// 5 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA0, rollback -> factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback1, test_rollback1, test_rollback1, test_rollback1_1);
TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA0, rollback -> factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback1, test_rollback1, test_rollback1, test_rollback1_1);
static void test_rollback2(void)
{
@ -678,7 +678,7 @@ static void test_rollback2_1(void)
// 3 Stage: run OTA0 -> check it -> esp_ota_mark_app_valid_cancel_rollback(), copy to next app slot -> reboot --//--
// 4 Stage: run OTA1 -> check it -> PENDING_VERIFY/esp_ota_mark_app_invalid_rollback_and_reboot() -> reboot
// 5 Stage: run OTA0(rollback) -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA1, rollback -> OTA0", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback2, test_rollback2, test_rollback2, test_rollback2_1);
TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA1, rollback -> OTA0", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback2, test_rollback2, test_rollback2, test_rollback2_1);
static void test_erase_last_app_flow(void)
{
@ -729,4 +729,4 @@ static void test_erase_last_app_rollback(void)
// 3 Stage: run OTA0 -> check it -> copy factory to OTA1 -> reboot --//--
// 4 Stage: run OTA1 -> check it -> erase OTA0 and rollback -> reboot
// 5 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Test erase_last_boot_app_partition. factory, OTA1, OTA0, factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_erase_last_app_flow, test_erase_last_app_flow, test_erase_last_app_flow, test_erase_last_app_rollback);
TEST_CASE_MULTIPLE_STAGES("Test erase_last_boot_app_partition. factory, OTA1, OTA0, factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_erase_last_app_flow, test_erase_last_app_flow, test_erase_last_app_flow, test_erase_last_app_rollback);

View file

@ -223,6 +223,7 @@ endmenu # Bootloader
menu "Security features"
visible if !IDF_CMAKE
# These three are the actual options to check in code,
# selected by the displayed options
@ -505,4 +506,22 @@ menu "Security features"
Only set this option in testing environments.
endmenu # Potentially Insecure
config FLASH_ENCRYPTION_DISABLE_PLAINTEXT
bool "Disable serial reflashing of plaintext firmware"
depends on FLASH_ENCRYPTION_ENABLED
default y if SECURE_BOOT_ENABLED
default n if !SECURE_BOOT_ENABLED
help
If this option is enabled, flash encryption is permanently enabled after first boot by write-protecting
the FLASH_CRYPT_CNT efuse. This is the recommended configuration for a secure production system.
If this option is disabled, FLASH_CRYPT_CNT is left writeable and up to 4 plaintext re-flashes are allowed.
An attacker with physical access will be able to read out encrypted flash contents until all plaintext
re-flashes have been used up.
If this option is disabled and hardware Secure Boot is enabled, Secure Boot must be configured in
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.
endmenu # Security features

View file

@ -24,6 +24,7 @@
#include "bootloader_common.h"
#include "sdkconfig.h"
#include "esp_image_format.h"
#include "rom/rtc.h"
static const char* TAG = "boot";
@ -74,7 +75,8 @@ static int selected_boot_partition(const bootloader_state_t *bs)
int boot_index = bootloader_utility_get_selected_boot_partition(bs);
if (boot_index == INVALID_INDEX) {
return boot_index; // Unrecoverable failure (not due to corrupt ota data or bad partition contents)
} else {
}
if (rtc_get_reset_reason(0) != DEEPSLEEP_RESET) {
// Factory firmware.
#ifdef CONFIG_BOOTLOADER_FACTORY_RESET
if (bootloader_common_check_long_hold_gpio(CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET, CONFIG_BOOTLOADER_HOLD_TIME_GPIO) == 1) {

View file

@ -40,6 +40,7 @@ SECTIONS
*(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
*liblog.a:(.literal .text .literal.* .text.*)
*libgcc.a:(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_clock.*(.literal.esp_clk_apb_freq .text.esp_clk_apb_freq)
*libbootloader_support.a:bootloader_common.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*)
@ -52,6 +53,7 @@ SECTIONS
*libbootloader_support.a:secure_boot_signatures.*(.literal .text .literal.* .text.*)
*libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
*libspi_flash.a:*.*(.literal .text .literal.* .text.*)
*libsoc.a:rtc_clk.*(.literal.rtc_clk_apb_freq_get .text.rtc_clk_apb_freq_get)
*libsoc.a:rtc_wdt.*(.literal .text .literal.* .text.*)
*libefuse.a:*.*(.literal .text .literal.* .text.*)
*(.fini.literal)

View file

@ -1,6 +1,7 @@
set(COMPONENT_SRCS "src/bootloader_clock.c"
"src/bootloader_common.c"
"src/bootloader_flash.c"
"src/bootloader_flash_config.c"
"src/bootloader_random.c"
"src/bootloader_sha.c"
"src/bootloader_utility.c"

View file

@ -15,6 +15,7 @@
#pragma once
#include "esp_flash_data_types.h"
#include "esp_image_format.h"
#include "esp_image_format.h"
/// Type of hold a GPIO in low state
typedef enum {
@ -23,6 +24,11 @@ typedef enum {
GPIO_NOT_HOLD = 0 /*!< If the GPIO input is not low */
} esp_comm_gpio_hold_t;
typedef enum {
ESP_IMAGE_BOOTLOADER,
ESP_IMAGE_APPLICATION
} esp_image_type;
/**
* @brief Calculate crc for the OTA data select.
*
@ -125,7 +131,7 @@ int bootloader_common_select_otadata(const esp_ota_select_entry_t *two_otadata,
/**
* @brief Returns esp_app_desc structure for app partition. This structure includes app version.
*
*
* Returns a description for the requested app partition.
* @param[in] partition App partition description.
* @param[out] app_desc Structure of info about app.
@ -137,6 +143,24 @@ int bootloader_common_select_otadata(const esp_ota_select_entry_t *two_otadata,
*/
esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t *partition, esp_app_desc_t *app_desc);
/**
* @brief Get chip revision
*
* @return Chip revision number
*/
uint8_t bootloader_common_get_chip_revision(void);
/**
* @brief Check if the image (bootloader and application) has valid chip ID and revision
*
* @param[in] img_hdr: image header
* @param[in] type: image type, bootloader or application
* @return
* - ESP_OK: image and chip are matched well
* - ESP_FAIL: image doesn't match to the chip
*/
esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hdr, esp_image_type type);
/**
* @brief Configure VDDSDIO, call this API to rise VDDSDIO to 1.9V when VDDSDIO regulator is enabled as 1.8V mode.
*/

View file

@ -0,0 +1,71 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "esp_image_format.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Update the flash id in g_rom_flashchip(global esp_rom_spiflash_chip_t structure).
*
* @return None
*/
void bootloader_flash_update_id();
/**
* @brief Set the flash CS setup and hold time.
*
* @note CS setup time is recomemded to be 1.5T, and CS hold time is recommended to be 2.5T.
* cs_setup = 1, cs_setup_time = 0; cs_hold = 1, cs_hold_time = 1.
*
* @return None
*/
void bootloader_flash_cs_timing_config();
/**
* @brief Configure SPI flash clock.
*
* @note This function only set clock frequency for SPI0.
*
* @param pfhdr Pointer to App image header, from where to fetch flash settings.
*
* @return None
*/
void bootloader_flash_clock_config(const esp_image_header_t* pfhdr);
/**
* @brief Configure SPI flash gpio, include the IO matrix and drive strength configuration.
*
* @param pfhdr Pointer to App image header, from where to fetch flash settings.
*
* @return None
*/
void bootloader_flash_gpio_config(const esp_image_header_t* pfhdr);
/**
* @brief Configure SPI flash read dummy based on different mode and frequency.
*
* @param pfhdr Pointer to App image header, from where to fetch flash settings.
*
* @return None
*/
void bootloader_flash_dummy_config(const esp_image_header_t* pfhdr);
#ifdef __cplusplus
}
#endif

View file

@ -55,6 +55,19 @@ typedef enum {
#define ESP_IMAGE_HEADER_MAGIC 0xE9
/**
* @brief ESP chip ID
*
*/
typedef enum {
ESP_CHIP_ID_ESP32 = 0x0000, /*!< chip ID: ESP32 */
ESP_CHIP_ID_INVALID = 0xFFFF /*!< Invalid chip ID (we defined it to make sure the esp_chip_id_t is 2 bytes size) */
} __attribute__((packed)) esp_chip_id_t;
/** @cond */
_Static_assert(sizeof(esp_chip_id_t) == 2, "esp_chip_id_t should be 16 bit");
/** @endcond */
/* Main header of binary image */
typedef struct {
uint8_t magic;
@ -71,8 +84,9 @@ typedef struct {
uint8_t wp_pin;
/* Drive settings for the SPI flash pins (read by ROM bootloader) */
uint8_t spi_pin_drv[3];
/* Reserved bytes in ESP32 additional header space, currently unused */
uint8_t reserved[11];
esp_chip_id_t chip_id; /*!< Chip identification number */
uint8_t min_chip_rev; /*!< Minimum chip revision supported by image */
uint8_t reserved[8]; /*!< Reserved bytes in additional header space, currently unused */
/* If 1, a SHA256 digest "simple hash" (of the entire image) is appended after the checksum. Included in image length. This digest
* is separate to secure boot and only used for detecting corruption. For secure boot signed images, the signature
* is appended after this (and the simple hash is included in the signed data). */

View file

@ -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.
@ -30,6 +31,13 @@
bootloader_support components only.
*/
/**
* @brief Get number of free pages
*
* @return Number of free pages
*/
uint32_t bootloader_mmap_get_free_pages(void);
/**
* @brief Map a region of flash to data memory
*

View file

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

View file

@ -62,3 +62,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);

View file

@ -59,3 +59,12 @@ void bootloader_clock_configure()
}
#endif
}
#ifdef BOOTLOADER_BUILD
int esp_clk_apb_freq(void)
{
return rtc_clk_apb_freq_get();
}
#endif // BOOTLOADER_BUILD

View file

@ -26,9 +26,14 @@
#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"
#include "soc/spi_reg.h"
#include "soc/efuse_reg.h"
#include "soc/apb_ctrl_reg.h"
#include "esp_image_format.h"
#include "bootloader_sha.h"
#include "sys/param.h"
@ -183,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)
@ -244,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) {
@ -274,3 +266,51 @@ void bootloader_common_vddsdio_configure()
}
#endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST
}
#ifdef CONFIG_IDF_TARGET_ESP32
uint8_t bootloader_common_get_chip_revision(void)
{
uint8_t eco_bit0, eco_bit1, eco_bit2;
eco_bit0 = (REG_READ(EFUSE_BLK0_RDATA3_REG) & 0xF000) >> 15;
eco_bit1 = (REG_READ(EFUSE_BLK0_RDATA5_REG) & 0x100000) >> 20;
eco_bit2 = (REG_READ(APB_CTRL_DATE_REG) & 0x80000000) >> 31;
uint32_t combine_value = (eco_bit2 << 2) | (eco_bit1 << 1) | eco_bit0;
uint8_t chip_ver = 0;
switch (combine_value) {
case 0:
chip_ver = 0;
break;
case 1:
chip_ver = 1;
break;
case 3:
chip_ver = 2;
break;
case 7:
chip_ver = 3;
break;
default:
chip_ver = 0;
break;
}
return chip_ver;
}
#endif
esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hdr, esp_image_type type)
{
esp_err_t err = ESP_OK;
esp_chip_id_t chip_id = CONFIG_IDF_FIRMWARE_CHIP_ID;
if (chip_id != img_hdr->chip_id) {
ESP_LOGE(TAG, "mismatch chip ID, expected %d, found %d", chip_id, img_hdr->chip_id);
err = ESP_FAIL;
}
uint8_t revision = bootloader_common_get_chip_revision();
if (revision < img_hdr->min_chip_rev) {
ESP_LOGE(TAG, "can't run on lower chip revision, expected %d, found %d", revision, img_hdr->min_chip_rev);
err = ESP_FAIL;
} else if (revision != img_hdr->min_chip_rev) {
ESP_LOGI(TAG, "chip revision: %d, min. %s chip revision: %d", revision, type == ESP_IMAGE_BOOTLOADER ? "bootloader" : "application", img_hdr->min_chip_rev);
}
return err;
}

View file

@ -25,6 +25,11 @@ static const char *TAG = "bootloader_mmap";
static spi_flash_mmap_handle_t map;
uint32_t bootloader_mmap_get_free_pages()
{
return spi_flash_mmap_get_free_pages(SPI_FLASH_MMAP_DATA);
}
const void *bootloader_mmap(uint32_t src_addr, uint32_t size)
{
if (map) {
@ -91,12 +96,22 @@ static const char *TAG = "bootloader_flash";
*/
#define MMU_BLOCK0_VADDR 0x3f400000
#define MMU_BLOCK50_VADDR 0x3f720000
#define MMU_FREE_PAGES ((MMU_BLOCK50_VADDR - MMU_BLOCK0_VADDR) / FLASH_BLOCK_SIZE)
static bool mapped;
// Current bootloader mapping (ab)used for bootloader_read()
static uint32_t current_read_mapping = UINT32_MAX;
uint32_t bootloader_mmap_get_free_pages()
{
/**
* Allow mapping up to 50 of the 51 available MMU blocks (last one used for reads)
* Since, bootloader_mmap function below assumes it to be 0x320000 (50 pages), we can safely do this.
*/
return MMU_FREE_PAGES;
}
const void *bootloader_mmap(uint32_t src_addr, uint32_t size)
{
if (mapped) {

View file

@ -0,0 +1,166 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdbool.h>
#include <assert.h>
#include "string.h"
#include "sdkconfig.h"
#include "esp_err.h"
#include "esp_log.h"
#include "rom/gpio.h"
#include "rom/spi_flash.h"
#include "rom/efuse.h"
#include "soc/gpio_periph.h"
#include "soc/efuse_reg.h"
#include "soc/spi_reg.h"
#include "soc/spi_pins.h"
#include "flash_qio_mode.h"
#include "bootloader_flash_config.h"
void bootloader_flash_update_id()
{
g_rom_flashchip.device_id = bootloader_read_flash_id();
}
void IRAM_ATTR bootloader_flash_cs_timing_config()
{
SET_PERI_REG_MASK(SPI_USER_REG(0), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_HOLD_TIME_V, 1, SPI_HOLD_TIME_S);
SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
SET_PERI_REG_MASK(SPI_USER_REG(1), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_HOLD_TIME_V, 1, SPI_HOLD_TIME_S);
SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
}
void IRAM_ATTR bootloader_flash_clock_config(const esp_image_header_t* pfhdr)
{
uint32_t spi_clk_div = 0;
switch (pfhdr->spi_speed) {
case ESP_IMAGE_SPI_SPEED_80M:
spi_clk_div = 1;
break;
case ESP_IMAGE_SPI_SPEED_40M:
spi_clk_div = 2;
break;
case ESP_IMAGE_SPI_SPEED_26M:
spi_clk_div = 3;
break;
case ESP_IMAGE_SPI_SPEED_20M:
spi_clk_div = 4;
break;
default:
break;
}
esp_rom_spiflash_config_clk(spi_clk_div, 0);
esp_rom_spiflash_config_clk(spi_clk_div, 1);
}
void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
{
uint32_t drv = 2;
if (pfhdr->spi_speed == ESP_IMAGE_SPI_SPEED_80M) {
drv = 3;
}
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
// 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 {
const uint32_t spiconfig = ets_efuse_get_spiconfig();
if (spiconfig == EFUSE_SPICONFIG_SPI_DEFAULTS) {
gpio_matrix_out(SPI_IOMUX_PIN_NUM_CS, SPICS0_OUT_IDX, 0, 0);
gpio_matrix_out(SPI_IOMUX_PIN_NUM_MISO, SPIQ_OUT_IDX, 0, 0);
gpio_matrix_in(SPI_IOMUX_PIN_NUM_MISO, SPIQ_IN_IDX, 0);
gpio_matrix_out(SPI_IOMUX_PIN_NUM_MOSI, SPID_OUT_IDX, 0, 0);
gpio_matrix_in(SPI_IOMUX_PIN_NUM_MOSI, SPID_IN_IDX, 0);
gpio_matrix_out(SPI_IOMUX_PIN_NUM_WP, SPIWP_OUT_IDX, 0, 0);
gpio_matrix_in(SPI_IOMUX_PIN_NUM_WP, SPIWP_IN_IDX, 0);
gpio_matrix_out(SPI_IOMUX_PIN_NUM_HD, SPIHD_OUT_IDX, 0, 0);
gpio_matrix_in(SPI_IOMUX_PIN_NUM_HD, SPIHD_IN_IDX, 0);
//select pin function gpio
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
// flash clock signal should come from IO MUX.
// set drive ability for clock
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);
uint32_t flash_id = g_rom_flashchip.device_id;
if (flash_id == FLASH_ID_GD25LQ32C) {
// Set drive ability for 1.8v flash in 80Mhz.
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA0_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA1_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA2_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA3_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CMD_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, 3, FUN_DRV_S);
}
}
}
}
void IRAM_ATTR bootloader_flash_dummy_config(const esp_image_header_t* pfhdr)
{
int spi_cache_dummy = 0;
uint32_t modebit = READ_PERI_REG(SPI_CTRL_REG(0));
if (modebit & SPI_FASTRD_MODE) {
if (modebit & SPI_FREAD_QIO) { //SPI mode is QIO
spi_cache_dummy = SPI0_R_QIO_DUMMY_CYCLELEN;
} else if (modebit & SPI_FREAD_DIO) { //SPI mode is DIO
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN;
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_ADDR_BITLEN_V, SPI0_R_DIO_ADDR_BITSLEN, SPI_USR_ADDR_BITLEN_S);
} else if(modebit & (SPI_FREAD_QUAD | SPI_FREAD_DUAL)) { //SPI mode is QOUT or DIO
spi_cache_dummy = SPI0_R_FAST_DUMMY_CYCLELEN;
}
}
extern uint8_t g_rom_spiflash_dummy_len_plus[];
switch (pfhdr->spi_speed) {
case ESP_IMAGE_SPI_SPEED_80M:
g_rom_spiflash_dummy_len_plus[0] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_80M;
g_rom_spiflash_dummy_len_plus[1] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_80M;
break;
case ESP_IMAGE_SPI_SPEED_40M:
g_rom_spiflash_dummy_len_plus[0] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_40M;
g_rom_spiflash_dummy_len_plus[1] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_40M;
break;
case ESP_IMAGE_SPI_SPEED_26M:
case ESP_IMAGE_SPI_SPEED_20M:
g_rom_spiflash_dummy_len_plus[0] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_20M;
g_rom_spiflash_dummy_len_plus[1] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_20M;
break;
default:
break;
}
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);
}

View file

@ -49,6 +49,7 @@
#include "bootloader_config.h"
#include "bootloader_clock.h"
#include "bootloader_common.h"
#include "bootloader_flash_config.h"
#include "flash_qio_mode.h"
@ -62,7 +63,7 @@ static const char* TAG = "boot";
static esp_err_t bootloader_main();
static void print_flash_info(const esp_image_header_t* pfhdr);
static void update_flash_config(const esp_image_header_t* pfhdr);
static void flash_gpio_configure(const esp_image_header_t* pfhdr);
static void bootloader_init_flash_configure(const esp_image_header_t* pfhdr);
static void uart_console_configure(void);
static void wdt_reset_check(void);
@ -125,7 +126,15 @@ static esp_err_t bootloader_main()
ESP_LOGE(TAG, "failed to load bootloader header!");
return ESP_FAIL;
}
flash_gpio_configure(&fhdr);
/* Check chip ID and minimum chip revision that supported by this image */
uint8_t revision = bootloader_common_get_chip_revision();
ESP_LOGI(TAG, "Chip Revision: %d", revision);
if (bootloader_common_check_chip_validity(&fhdr, ESP_IMAGE_BOOTLOADER) != ESP_OK) {
return ESP_FAIL;
}
bootloader_init_flash_configure(&fhdr);
#if (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ == 240)
//Check if ESP32 is rated for a CPU frequency of 160MHz only
if (REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_CPU_FREQ_RATED) &&
@ -285,118 +294,15 @@ static void print_flash_info(const esp_image_header_t* phdr)
#endif
}
#define FLASH_CLK_IO 6
#define FLASH_CS_IO 11
#define FLASH_SPIQ_IO 7
#define FLASH_SPID_IO 8
#define FLASH_SPIWP_IO 10
#define FLASH_SPIHD_IO 9
#define FLASH_IO_MATRIX_DUMMY_40M 1
#define FLASH_IO_MATRIX_DUMMY_80M 2
#define FLASH_IO_DRIVE_GD_WITH_1V8PSRAM 3
/*
* Bootloader reads SPI configuration from bin header, so that
* the burning configuration can be different with compiling configuration.
*/
static void IRAM_ATTR flash_gpio_configure(const esp_image_header_t* pfhdr)
static void IRAM_ATTR bootloader_init_flash_configure(const esp_image_header_t* pfhdr)
{
int spi_cache_dummy = 0;
int drv = 2;
switch (pfhdr->spi_mode) {
case ESP_IMAGE_SPI_MODE_QIO:
spi_cache_dummy = SPI0_R_QIO_DUMMY_CYCLELEN;
break;
case ESP_IMAGE_SPI_MODE_DIO:
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN;
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_ADDR_BITLEN_V, SPI0_R_DIO_ADDR_BITSLEN, SPI_USR_ADDR_BITLEN_S);
break;
case ESP_IMAGE_SPI_MODE_QOUT:
case ESP_IMAGE_SPI_MODE_DOUT:
default:
spi_cache_dummy = SPI0_R_FAST_DUMMY_CYCLELEN;
break;
}
/* dummy_len_plus values defined in ROM for SPI flash configuration */
extern uint8_t g_rom_spiflash_dummy_len_plus[];
switch (pfhdr->spi_speed) {
case ESP_IMAGE_SPI_SPEED_80M:
g_rom_spiflash_dummy_len_plus[0] = FLASH_IO_MATRIX_DUMMY_80M;
g_rom_spiflash_dummy_len_plus[1] = FLASH_IO_MATRIX_DUMMY_80M;
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + FLASH_IO_MATRIX_DUMMY_80M,
SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
drv = 3;
break;
case ESP_IMAGE_SPI_SPEED_40M:
g_rom_spiflash_dummy_len_plus[0] = FLASH_IO_MATRIX_DUMMY_40M;
g_rom_spiflash_dummy_len_plus[1] = FLASH_IO_MATRIX_DUMMY_40M;
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + FLASH_IO_MATRIX_DUMMY_40M,
SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
break;
case ESP_IMAGE_SPI_SPEED_26M:
case ESP_IMAGE_SPI_SPEED_20M:
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy, SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
break;
default:
break;
}
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
// 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 {
const uint32_t spiconfig = ets_efuse_get_spiconfig();
if (spiconfig == EFUSE_SPICONFIG_SPI_DEFAULTS) {
gpio_matrix_out(FLASH_CS_IO, SPICS0_OUT_IDX, 0, 0);
gpio_matrix_out(FLASH_SPIQ_IO, SPIQ_OUT_IDX, 0, 0);
gpio_matrix_in(FLASH_SPIQ_IO, SPIQ_IN_IDX, 0);
gpio_matrix_out(FLASH_SPID_IO, SPID_OUT_IDX, 0, 0);
gpio_matrix_in(FLASH_SPID_IO, SPID_IN_IDX, 0);
gpio_matrix_out(FLASH_SPIWP_IO, SPIWP_OUT_IDX, 0, 0);
gpio_matrix_in(FLASH_SPIWP_IO, SPIWP_IN_IDX, 0);
gpio_matrix_out(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0);
gpio_matrix_in(FLASH_SPIHD_IO, SPIHD_IN_IDX, 0);
//select pin function gpio
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
// flash clock signal should come from IO MUX.
// set drive ability for clock
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);
#if CONFIG_SPIRAM_TYPE_ESPPSRAM32
uint32_t flash_id = g_rom_flashchip.device_id;
if (flash_id == FLASH_ID_GD25LQ32C) {
// Set drive ability for 1.8v flash in 80Mhz.
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA0_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA1_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA2_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA3_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CMD_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, 3, FUN_DRV_S);
}
#endif
}
}
bootloader_flash_gpio_config(pfhdr);
bootloader_flash_dummy_config(pfhdr);
bootloader_flash_cs_timing_config();
}
static void uart_console_configure(void)

View file

@ -114,17 +114,18 @@ void bootloader_random_enable(void)
void bootloader_random_disable(void)
{
/* Disable i2s clock */
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN);
/* Reset some i2s configuration (possibly redundant as we reset entire
I2S peripheral further down). */
CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START);
SET_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_RESET);
CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_RESET);
CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_CAMERA_EN);
CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_LCD_EN);
CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE_TEST_EN);
CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE);
CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START);
/* Disable i2s clock */
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN);
/* Restore SYSCON mode registers */
CLEAR_PERI_REG_MASK(SENS_SAR_READ_CTRL_REG, SENS_SAR1_DIG_FORCE);

View file

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

View file

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

View file

@ -24,6 +24,7 @@
#include <bootloader_random.h>
#include <bootloader_sha.h>
#include "bootloader_util.h"
#include "bootloader_common.h"
/* Checking signatures as part of verifying images is necessary:
- Always if secure boot is enabled
@ -280,6 +281,9 @@ static esp_err_t verify_image_header(uint32_t src_addr, const esp_image_header_t
}
err = ESP_ERR_IMAGE_INVALID;
}
if (bootloader_common_check_chip_validity(image, ESP_IMAGE_APPLICATION) != ESP_OK) {
err = ESP_ERR_IMAGE_INVALID;
}
if (!silent) {
if (image->spi_mode > ESP_IMAGE_SPI_MODE_SLOW_READ) {
ESP_LOGW(TAG, "image at 0x%x has invalid SPI mode %d", src_addr, image->spi_mode);
@ -368,24 +372,22 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme
}
#endif // BOOTLOADER_BUILD
#ifndef BOOTLOADER_BUILD
uint32_t free_page_count = spi_flash_mmap_get_free_pages(SPI_FLASH_MMAP_DATA);
ESP_LOGD(TAG, "free data page_count 0x%08x",free_page_count);
uint32_t offset_page = 0;
while (data_len >= free_page_count * SPI_FLASH_MMU_PAGE_SIZE) {
offset_page = ((data_addr & MMAP_ALIGNED_MASK) != 0)?1:0;
err = process_segment_data(load_addr, data_addr, (free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE, do_load, sha_handle, checksum);
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 = data_len;
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. */
data_len = MIN(data_len_remain, ((free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE));
err = process_segment_data(load_addr, data_addr, data_len, do_load, sha_handle, checksum);
if (err != ESP_OK) {
return err;
}
data_addr += (free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE;
data_len -= (free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE;
}
#endif
err = process_segment_data(load_addr, data_addr, data_len, do_load, sha_handle, checksum);
if (err != ESP_OK) {
return err;
data_addr += data_len;
data_len_remain -= data_len;
}
return ESP_OK;
err:

View file

@ -205,6 +205,14 @@ static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_cry
uint32_t new_flash_crypt_cnt = flash_crypt_cnt + (1 << (ffs_inv - 1));
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();
ESP_LOGI(TAG, "Flash encryption completed");

View file

@ -21,12 +21,7 @@
#include "uECC.h"
#ifdef BOOTLOADER_BUILD
#include "rom/sha.h"
typedef SHA_CTX sha_context;
#else
#include "mbedtls/sha256.h"
#endif
#include <sys/param.h>
static const char* TAG = "secure_boot";
@ -37,6 +32,9 @@ extern const uint8_t signature_verification_key_end[] asm("_binary_signature_ver
#define DIGEST_LEN 32
/* Mmap source address mask */
#define MMAP_ALIGNED_MASK 0x0000FFFF
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN];
@ -45,26 +43,44 @@ esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
data = bootloader_mmap(src_addr, length + sizeof(esp_secure_boot_sig_block_t));
if(data == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr, length+sizeof(esp_secure_boot_sig_block_t));
return ESP_FAIL;
bootloader_sha256_handle_t handle = bootloader_sha256_start();
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;
}
// Calculate digest of main image
#ifdef BOOTLOADER_BUILD
bootloader_sha256_handle_t handle = bootloader_sha256_start();
bootloader_sha256_data(handle, data, length);
/* Done! Get the digest */
bootloader_sha256_finish(handle, digest);
#else
/* Use thread-safe mbedTLS version */
mbedtls_sha256_ret(data, length, digest, 0);
#endif
// Map the signature block and verify the signature
sigblock = (const esp_secure_boot_sig_block_t *)(data + length);
// 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) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr + length, sizeof(esp_secure_boot_sig_block_t));
return ESP_FAIL;
}
// Verify the signature
esp_err_t err = esp_secure_boot_verify_signature_block(sigblock, digest);
bootloader_munmap(data);
// Unmap
bootloader_munmap(sigblock);
return err;
}

View file

@ -6,6 +6,8 @@ if(CONFIG_BT_ENABLED)
if(CONFIG_BLUEDROID_ENABLED)
list(APPEND COMPONENT_PRIV_INCLUDEDIRS
common/btc/include
common/include
bluedroid/bta/include
bluedroid/bta/ar/include
bluedroid/bta/av/include
@ -18,7 +20,6 @@ if(CONFIG_BT_ENABLED)
bluedroid/bta/sys/include
bluedroid/device/include
bluedroid/hci/include
bluedroid/osi/include
bluedroid/external/sbc/decoder/include
bluedroid/external/sbc/encoder/include
bluedroid/btc/profile/esp/blufi/include
@ -38,11 +39,29 @@ if(CONFIG_BT_ENABLED)
bluedroid/stack/a2dp/include
bluedroid/stack/rfcomm/include
bluedroid/stack/include
bluedroid/common/include)
bluedroid/common/include
common/btc/include
common/include)
list(APPEND COMPONENT_ADD_INCLUDEDIRS bluedroid/api/include/api)
list(APPEND COMPONENT_ADD_INCLUDEDIRS bluedroid/api/include/api
common/osi/include)
list(APPEND COMPONENT_SRCS "bluedroid/api/esp_a2dp_api.c"
list(APPEND COMPONENT_SRCS "common/btc/core/btc_alarm.c"
"common/btc/core/btc_manage.c"
"common/btc/core/btc_task.c"
"common/osi/alarm.c"
"common/osi/allocator.c"
"common/osi/buffer.c"
"common/osi/config.c"
"common/osi/fixed_queue.c"
"common/osi/future.c"
"common/osi/hash_functions.c"
"common/osi/hash_map.c"
"common/osi/list.c"
"common/osi/mutex.c"
"common/osi/osi.c"
"common/osi/semaphore.c"
"bluedroid/api/esp_a2dp_api.c"
"bluedroid/api/esp_avrc_api.c"
"bluedroid/api/esp_blufi_api.c"
"bluedroid/api/esp_bt_device.c"
@ -109,18 +128,15 @@ if(CONFIG_BT_ENABLED)
"bluedroid/bta/sys/bta_sys_conn.c"
"bluedroid/bta/sys/bta_sys_main.c"
"bluedroid/bta/sys/utl.c"
"bluedroid/btc/core/btc_alarm.c"
"bluedroid/btc/core/btc_ble_storage.c"
"bluedroid/btc/core/btc_config.c"
"bluedroid/btc/core/btc_dev.c"
"bluedroid/btc/core/btc_dm.c"
"bluedroid/btc/core/btc_main.c"
"bluedroid/btc/core/btc_manage.c"
"bluedroid/btc/core/btc_profile_queue.c"
"bluedroid/btc/core/btc_sec.c"
"bluedroid/btc/core/btc_sm.c"
"bluedroid/btc/core/btc_storage.c"
"bluedroid/btc/core/btc_task.c"
"bluedroid/btc/core/btc_util.c"
"bluedroid/btc/profile/esp/blufi/blufi_prf.c"
"bluedroid/btc/profile/esp/blufi/blufi_protocol.c"
@ -173,18 +189,6 @@ if(CONFIG_BT_ENABLED)
"bluedroid/hci/packet_fragmenter.c"
"bluedroid/main/bte_init.c"
"bluedroid/main/bte_main.c"
"bluedroid/osi/alarm.c"
"bluedroid/osi/allocator.c"
"bluedroid/osi/buffer.c"
"bluedroid/osi/config.c"
"bluedroid/osi/fixed_queue.c"
"bluedroid/osi/future.c"
"bluedroid/osi/hash_functions.c"
"bluedroid/osi/hash_map.c"
"bluedroid/osi/list.c"
"bluedroid/osi/mutex.c"
"bluedroid/osi/osi.c"
"bluedroid/osi/semaphore.c"
"bluedroid/stack/a2dp/a2d_api.c"
"bluedroid/stack/a2dp/a2d_sbc.c"
"bluedroid/stack/avct/avct_api.c"
@ -279,11 +283,141 @@ if(CONFIG_BT_ENABLED)
"bluedroid/stack/smp/smp_l2c.c"
"bluedroid/stack/smp/smp_main.c"
"bluedroid/stack/smp/smp_utils.c")
if(CONFIG_BLE_MESH)
list(APPEND COMPONENT_SRCS "esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c")
endif()
endif()
if(CONFIG_BLE_MESH)
list(APPEND COMPONENT_ADD_INCLUDEDIRS
"esp_ble_mesh/mesh_common/include"
"esp_ble_mesh/mesh_common/tinycrypt/include"
"esp_ble_mesh/mesh_core"
"esp_ble_mesh/mesh_core/include"
"esp_ble_mesh/mesh_core/storage"
"esp_ble_mesh/btc/include"
"esp_ble_mesh/mesh_models/common/include"
"esp_ble_mesh/mesh_models/client/include"
"esp_ble_mesh/mesh_models/server/include"
"esp_ble_mesh/api/core/include"
"esp_ble_mesh/api/models/include"
"esp_ble_mesh/api")
list(APPEND COMPONENT_SRCS
"esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c"
"esp_ble_mesh/api/core/esp_ble_mesh_common_api.c"
"esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c"
"esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c"
"esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c"
"esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c"
"esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c"
"esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c"
"esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c"
"esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c"
"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_config_model.c"
"esp_ble_mesh/btc/btc_ble_mesh_generic_model.c"
"esp_ble_mesh/btc/btc_ble_mesh_health_model.c"
"esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c"
"esp_ble_mesh/btc/btc_ble_mesh_prov.c"
"esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c"
"esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/aes_decrypt.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/aes_encrypt.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/cbc_mode.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ccm_mode.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/cmac_mode.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ctr_mode.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ctr_prng.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ecc_dh.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ecc_dsa.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ecc_platform_specific.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ecc.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/hmac_prng.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/hmac.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/sha256.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/utils.c"
"esp_ble_mesh/mesh_common/mesh_atomic.c"
"esp_ble_mesh/mesh_common/mesh_buf.c"
"esp_ble_mesh/mesh_common/mesh_common.c"
"esp_ble_mesh/mesh_common/mesh_kernel.c"
"esp_ble_mesh/mesh_common/mesh_mutex.c"
"esp_ble_mesh/mesh_common/mesh_timer.c"
"esp_ble_mesh/mesh_common/mesh_util.c"
"esp_ble_mesh/mesh_core/storage/settings_nvs.c"
"esp_ble_mesh/mesh_core/access.c"
"esp_ble_mesh/mesh_core/adv.c"
"esp_ble_mesh/mesh_core/beacon.c"
"esp_ble_mesh/mesh_core/cfg_cli.c"
"esp_ble_mesh/mesh_core/cfg_srv.c"
"esp_ble_mesh/mesh_core/crypto.c"
"esp_ble_mesh/mesh_core/fast_prov.c"
"esp_ble_mesh/mesh_core/friend.c"
"esp_ble_mesh/mesh_core/health_cli.c"
"esp_ble_mesh/mesh_core/health_srv.c"
"esp_ble_mesh/mesh_core/local_operation.c"
"esp_ble_mesh/mesh_core/lpn.c"
"esp_ble_mesh/mesh_core/main.c"
"esp_ble_mesh/mesh_core/net.c"
"esp_ble_mesh/mesh_core/prov.c"
"esp_ble_mesh/mesh_core/provisioner_main.c"
"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.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/generic_server.c"
"esp_ble_mesh/mesh_models/server/lighting_server.c"
"esp_ble_mesh/mesh_models/server/sensor_server.c"
"esp_ble_mesh/mesh_models/server/server_common.c"
"esp_ble_mesh/mesh_models/server/state_binding.c"
"esp_ble_mesh/mesh_models/server/state_transition.c"
"esp_ble_mesh/mesh_models/server/time_scene_server.c")
endif()
if(CONFIG_NIMBLE_ENABLED)
if (CONFIG_BLE_MESH)
list(APPEND COMPONENT_PRIV_INCLUDEDIRS
common/btc/include
common/include)
list(APPEND COMPONENT_ADD_INCLUDEDIRS common/osi/include)
list(APPEND COMPONENT_SRCS "esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c"
"common/btc/core/btc_alarm.c"
"common/btc/core/btc_manage.c"
"common/btc/core/btc_task.c"
"common/osi/alarm.c"
"common/osi/allocator.c"
"common/osi/buffer.c"
"common/osi/config.c"
"common/osi/fixed_queue.c"
"common/osi/future.c"
"common/osi/hash_functions.c"
"common/osi/hash_map.c"
"common/osi/list.c"
"common/osi/mutex.c"
"common/osi/osi.c"
"common/osi/semaphore.c")
endif()
endif()
endif()
# requirements can't depend on config
set(COMPONENT_PRIV_REQUIRES nvs_flash)
set(COMPONENT_PRIV_REQUIRES nvs_flash nimble)
register_component()

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,7 @@
#include "esp_bt_main.h"
#include "esp_gap_bt_api.h"
#include "common/bt_trace.h"
#include "bta/bta_api.h"
#include "btc/btc_manage.h"
#include "btc_gap_bt.h"
#include "btc/btc_storage.h"
@ -212,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();
}
@ -220,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;
@ -230,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);
}

View file

@ -46,4 +46,37 @@ esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu)
arg.set_mtu.mtu = mtu;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatt_com_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
}
#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 (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

View file

@ -431,6 +431,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);
}
@ -462,6 +465,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);
}

View file

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

View file

@ -95,6 +95,10 @@ esp_err_t esp_spp_connect(esp_spp_sec_t sec_mask,
btc_spp_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (sec_mask != ESP_SPP_SEC_NONE && sec_mask != ESP_SPP_SEC_AUTHORIZE && sec_mask != ESP_SPP_SEC_AUTHENTICATE) {
LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only\n");
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_SPP;
msg.act = BTC_SPP_ACT_CONNECT;
@ -133,6 +137,10 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
return ESP_ERR_INVALID_ARG;
}
if (sec_mask != ESP_SPP_SEC_NONE && sec_mask != ESP_SPP_SEC_AUTHORIZE && sec_mask != ESP_SPP_SEC_AUTHENTICATE) {
LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only\n");
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_SPP;
msg.act = BTC_SPP_ACT_START_SRV;
@ -146,6 +154,17 @@ 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;
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;
return (btc_transfer_context(&msg, NULL, 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)
{

View file

@ -76,7 +76,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 */

View file

@ -83,6 +83,7 @@ typedef enum {
ESP_BLUFI_DH_PARAM_ERROR,
ESP_BLUFI_READ_PARAM_ERROR,
ESP_BLUFI_MAKE_PUBLIC_ERROR,
ESP_BLUFI_DATA_FORMAT_ERROR,
} esp_blufi_error_state_t;
/**

View file

@ -267,14 +267,25 @@ typedef enum {
typedef enum {
ESP_BLE_SM_PASSKEY = 0,
/* Authentication requirements of local device */
ESP_BLE_SM_AUTHEN_REQ_MODE,
/* The IO capability of local device */
ESP_BLE_SM_IOCAP_MODE,
/* Initiator Key Distribution/Generation */
ESP_BLE_SM_SET_INIT_KEY,
/* Responder Key Distribution/Generation */
ESP_BLE_SM_SET_RSP_KEY,
/* Maximum Encryption key size to support */
ESP_BLE_SM_MAX_KEY_SIZE,
/* Minimum Encryption key size requirement from Peer */
ESP_BLE_SM_MIN_KEY_SIZE,
/* Set static Passkey */
ESP_BLE_SM_SET_STATIC_PASSKEY,
/* Reset static Passkey */
ESP_BLE_SM_CLEAR_STATIC_PASSKEY,
/* Accept only specified SMP Authentication requirement */
ESP_BLE_SM_ONLY_ACCEPT_SPECIFIED_SEC_AUTH,
/* Enable/Disable OOB support */
ESP_BLE_SM_OOB_SUPPORT,
ESP_BLE_SM_MAX_PARAM,
} esp_ble_sm_param_t;
@ -589,7 +600,7 @@ typedef enum {
typedef enum {
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR = 0, /*!< BLE advertising address , device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID, /*!< BLE mesh link ID, it is for BLE mesh, device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE, /*!< BLE mesh beacon AD type, the format is | Len | 0x2B | Beacon Type | Beacon Data | */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE, /*!< BLE mesh beacon AD type, the format is | Len | 0x2B | Beacon Type | Beacon Data | */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV, /*!< BLE mesh provisioning service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1827 | .... |` */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1828 | .... |` */
} esp_ble_duplicate_exceptional_info_type_t;

View file

@ -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;
/**
@ -361,13 +370,15 @@ esp_err_t esp_bt_gap_register_callback(esp_bt_gap_cb_t callback);
esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode);
/**
* @brief Start device discovery. This function should be called after esp_bluedroid_enable() completes successfully.
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT if discovery is started or halted.
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_DISC_RES_EVT if discovery result is got.
* @brief This function starts Inquiry and Name Discovery. It should be called after esp_bluedroid_enable() completes successfully.
* When Inquiry is halted and cached results do not contain device name, then Name Discovery will connect to the peer target to get the device name.
* esp_bt_gap_cb_t will be called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT when Inquriry is started or Name Discovery is completed.
* esp_bt_gap_cb_t will be called with ESP_BT_GAP_DISC_RES_EVT each time the two types of discovery results are got.
*
* @param[in] mode - inquiry mode
* @param[in] inq_len - inquiry duration in 1.28 sec units, ranging from 0x01 to 0x30
* @param[in] num_rsps - number of inquiry responses that can be received, value 0 indicates an unlimited number of responses
* @param[in] mode - Inquiry mode
* @param[in] inq_len - Inquiry duration in 1.28 sec units, ranging from 0x01 to 0x30. This parameter only specifies the total duration of the Inquiry process,
* - when this time expires, Inquiry will be halted.
* @param[in] num_rsps - Number of responses that can be received before the Inquiry is halted, value 0 indicates an unlimited number of responses.
*
* @return
* - ESP_OK : Succeed
@ -378,8 +389,9 @@ esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode);
esp_err_t esp_bt_gap_start_discovery(esp_bt_inq_mode_t mode, uint8_t inq_len, uint8_t num_rsps);
/**
* @brief Cancel device discovery. This function should be called after esp_bluedroid_enable() completes successfully
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT if discovery is stopped.
* @brief Cancel Inquiry and Name Discovery. This function should be called after esp_bluedroid_enable() completes successfully.
* esp_bt_gap_cb_t will be called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT if Inquiry or Name Discovery is cancelled by
* calling this function.
*
* @return
* - ESP_OK : Succeed

View file

@ -44,6 +44,11 @@ extern "C" {
*/
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
}
#endif

View file

@ -34,7 +34,7 @@ extern "C" {
* All "ESP_GATT_UUID_xxx" is attribute types
*/
#define ESP_GATT_UUID_IMMEDIATE_ALERT_SVC 0x1802 /* Immediate alert Service*/
#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803 /* Link Loss Service*/
#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803 /* Link Loss Service*/
#define ESP_GATT_UUID_TX_POWER_SVC 0x1804 /* TX Power Service*/
#define ESP_GATT_UUID_CURRENT_TIME_SVC 0x1805 /* Current Time Service Service*/
#define ESP_GATT_UUID_REF_TIME_UPDATE_SVC 0x1806 /* Reference Time Update Service*/
@ -68,8 +68,14 @@ extern "C" {
#define ESP_GATT_UUID_CHAR_PRESENT_FORMAT 0x2904 /* Characteristic Presentation Format*/
#define ESP_GATT_UUID_CHAR_AGG_FORMAT 0x2905 /* Characteristic Aggregate Format*/
#define ESP_GATT_UUID_CHAR_VALID_RANGE 0x2906 /* Characteristic Valid Range */
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907 /* External Report Reference */
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908 /* Report Reference */
#define ESP_GATT_UUID_NUM_DIGITALS_DESCR 0x2909 /* Number of Digitals */
#define ESP_GATT_UUID_VALUE_TRIGGER_DESCR 0x290A /* Value Trigger Setting */
#define ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR 0x290B /* Environmental Sensing Configuration */
#define ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR 0x290C /* Environmental Sensing Measurement */
#define ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR 0x290D /* Environmental Sensing Trigger Setting */
#define ESP_GATT_UUID_TIME_TRIGGER_DESCR 0x290E /* Time Trigger Setting */
/* GAP Profile Attributes */
#define ESP_GATT_UUID_GAP_DEVICE_NAME 0x2A00
@ -299,7 +305,7 @@ typedef enum {
* @brief Attribute description (used to create database)
*/
typedef struct
{
{
uint16_t uuid_length; /*!< UUID length */
uint8_t *uuid_p; /*!< UUID value */
uint16_t perm; /*!< Attribute permission */
@ -348,23 +354,23 @@ typedef struct
/**
* @brief Gatt include service entry element
*/
typedef struct
typedef struct
{
uint16_t start_hdl; /*!< Gatt start handle value of included service */
uint16_t end_hdl; /*!< Gatt end handle value of included service */
uint16_t uuid; /*!< Gatt attribute value UUID of included service */
uint16_t start_hdl; /*!< Gatt start handle value of included service */
uint16_t end_hdl; /*!< Gatt end handle value of included service */
uint16_t uuid; /*!< Gatt attribute value UUID of included service */
} esp_gatts_incl_svc_desc_t; /*!< Gatt include service entry element */
/**
* @brief Gatt include 128 bit service entry element
*/
typedef struct
typedef struct
{
uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */
uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */
/// Gatt attribute value
/// Gatt attribute value
typedef struct {
uint8_t value[ESP_GATT_MAX_ATTR_LEN]; /*!< Gatt attribute value */
uint16_t handle; /*!< Gatt attribute handle */
@ -426,8 +432,8 @@ typedef struct {
/**
* @brief service element
*/
typedef struct {
bool is_primary; /*!< The service flag, true if the service is primary service, else is secondly service */
typedef struct {
bool is_primary; /*!< The service flag, true if the service is primary service, else is secondary service */
uint16_t start_handle; /*!< The start handle of the service */
uint16_t end_handle; /*!< The end handle of the service */
esp_bt_uuid_t uuid; /*!< The uuid of the service */

View file

@ -30,7 +30,7 @@ typedef enum {
ESP_SPP_NO_RESOURCE /*!< No more set pm control block */
} esp_spp_status_t;
/* Security Setting Mask */
/* Security Setting Mask, Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only.*/
#define ESP_SPP_SEC_NONE 0x0000 /*!< No security. relate to BTA_SEC_NONE in bta/bta_api.h */
#define ESP_SPP_SEC_AUTHORIZE 0x0001 /*!< Authorization required (only needed for out going connection ) relate to BTA_SEC_AUTHORIZE in bta/bta_api.h*/
#define ESP_SPP_SEC_AUTHENTICATE 0x0012 /*!< Authentication required. relate to BTA_SEC_AUTHENTICATE in bta/bta_api.h*/
@ -57,6 +57,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 +67,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,6 +82,13 @@ 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
*/
@ -128,6 +137,14 @@ typedef union {
uint8_t sec_id; /*!< security ID used by this server */
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 */
} srv_stop; /*!< SPP callback param of ESP_SPP_SRV_STOP_EVT */
/**
* @brief ESP_SPP_CL_INIT_EVT
*/
@ -229,7 +246,7 @@ esp_err_t esp_spp_start_discovery(esp_bd_addr_t bd_addr);
* When the connection is established or failed,
* the callback is called with ESP_SPP_OPEN_EVT.
*
* @param[in] sec_mask: Security Setting Mask .
* @param[in] sec_mask: Security Setting Mask. Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only.
* @param[in] role: Master or slave.
* @param[in] remote_scn: Remote device bluetooth device SCN.
* @param[in] peer_bd_addr: Remote device bluetooth device address.
@ -260,7 +277,7 @@ esp_err_t esp_spp_disconnect(uint32_t handle);
* When the connection is established, the callback is called
* with ESP_SPP_SRV_OPEN_EVT.
*
* @param[in] sec_mask: Security Setting Mask .
* @param[in] sec_mask: Security Setting Mask. Security Setting Mask. Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only.
* @param[in] role: Master or slave.
* @param[in] local_scn: The specific channel you want to get.
* If channel is 0, means get any channel.
@ -273,6 +290,16 @@ 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 a SPP server
* When the server is stopped successfully, the callback is called
* with ESP_SPP_SRV_STOP_EVT.
*
* @return
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_spp_stop_srv(void);
/**
* @brief This function is used to write data, only for ESP_SPP_MODE_CB.

View file

@ -41,6 +41,7 @@
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
#include "bta/bta_ar_api.h"
#endif
#include "bta/bta_api.h"
/*****************************************************************************
** Constants
@ -528,8 +529,21 @@ static void bta_av_proc_stream_evt(UINT8 handle, BD_ADDR bd_addr, UINT8 event, t
/* look up application event */
if ((p_data == NULL) || (p_data->hdr.err_code == 0)) {
p_msg->hdr.event = bta_av_stream_evt_ok[event];
if (p_msg->hdr.event == BTA_AV_STR_START_OK_EVT) {
BTA_DmCoexEventTrigger(BTA_COEX_EVT_STREAMING_STARTED);
} else if (p_msg->hdr.event == BTA_AV_STR_START_FAIL_EVT ||
p_msg->hdr.event == BTA_AV_STR_SUSPEND_CFM_EVT ||
p_msg->hdr.event == BTA_AV_STR_CLOSE_EVT) {
BTA_DmCoexEventTrigger(BTA_COEX_EVT_STREAMING_STOPPED);
}
} else {
p_msg->hdr.event = bta_av_stream_evt_fail[event];
if (p_msg->hdr.event == BTA_AV_STR_START_FAIL_EVT ||
p_msg->hdr.event == BTA_AV_STR_START_OK_EVT ||
p_msg->hdr.event == BTA_AV_STR_SUSPEND_CFM_EVT ||
p_msg->hdr.event == BTA_AV_STR_CLOSE_EVT) {
BTA_DmCoexEventTrigger(BTA_COEX_EVT_STREAMING_STOPPED);
}
}
p_msg->initiator = FALSE;

View file

@ -114,7 +114,7 @@ void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name, UINT8 app_id,
p_buf->hdr.layer_specific = chnl;
p_buf->hdr.event = BTA_AV_API_REGISTER_EVT;
if (p_service_name) {
BCM_STRNCPY_S(p_buf->p_service_name, sizeof(p_buf->p_service_name), p_service_name, BTA_SERVICE_NAME_LEN);
BCM_STRNCPY_S(p_buf->p_service_name, p_service_name, BTA_SERVICE_NAME_LEN);
p_buf->p_service_name[BTA_SERVICE_NAME_LEN - 1] = 0;
} else {
p_buf->p_service_name[0] = 0;

View file

@ -40,8 +40,9 @@ const UINT32 bta_av_meta_caps_co_ids[] = {
AVRC_CO_BROADCOM
};
/* AVRCP cupported categories */
#define BTA_AV_RC_SUPF_CT (AVRC_SUPF_CT_CAT2)
/* AVRCP supported categories */
#define BTA_AV_RC_SNK_SUPF_CT (AVRC_SUPF_CT_CAT1)
#define BTA_AV_RC_SRC_SUPF_CT (AVRC_SUPF_CT_CAT2)
/* Added to modify
** 1. flush timeout
@ -62,9 +63,11 @@ const UINT16 bta_av_audio_flush_to[] = {
/* Note: Android doesnt support AVRC_SUPF_TG_GROUP_NAVI */
/* Note: if AVRC_SUPF_TG_GROUP_NAVI is set, bta_av_cfg.avrc_group should be TRUE */
#if AVRC_METADATA_INCLUDED == TRUE
#define BTA_AV_RC_SUPF_TG (AVRC_SUPF_TG_CAT1) /* TODO: | AVRC_SUPF_TG_APP_SETTINGS) */
#define BTA_AV_RC_SNK_SUPF_TG (AVRC_SUPF_TG_CAT2) /* TODO: | AVRC_SUPF_TG_APP_SETTINGS) */
#define BTA_AV_RC_SRC_SUPF_TG (AVRC_SUPF_TG_CAT1) /* TODO: | AVRC_SUPF_TG_APP_SETTINGS) */
#else
#define BTA_AV_RC_SUPF_TG (AVRC_SUPF_TG_CAT1)
#define BTA_AV_RC_SNK_SUPF_TG (AVRC_SUPF_TG_CAT2)
#define BTA_AV_RC_SRC_SUPF_TG (AVRC_SUPF_TG_CAT1)
#endif
/*
@ -95,8 +98,10 @@ const tBTA_AV_CFG bta_av_cfg = {
48, /* AVRCP MTU at L2CAP for control channel */
#endif
BTA_AV_MAX_RC_BR_MTU, /* AVRCP MTU at L2CAP for browsing channel */
BTA_AV_RC_SUPF_CT, /* AVRCP controller categories */
BTA_AV_RC_SUPF_TG, /* AVRCP target categories */
BTA_AV_RC_SNK_SUPF_CT, /* AVRCP controller categories as SNK */
BTA_AV_RC_SNK_SUPF_TG, /* AVRCP target categories as SNK */
BTA_AV_RC_SRC_SUPF_CT, /* AVRCP controller categories as SRC */
BTA_AV_RC_SRC_SUPF_TG, /* AVRCP target categories as SRC */
672, /* AVDTP signaling channel MTU at L2CAP */
BTA_AV_MAX_A2DP_MTU, /* AVDTP audio transport channel MTU at L2CAP */
bta_av_audio_flush_to, /* AVDTP audio transport channel flush timeout */

View file

@ -483,8 +483,7 @@ static void bta_av_api_sink_enable(tBTA_AV_DATA *p_data)
activate_sink = p_data->hdr.layer_specific;
APPL_TRACE_DEBUG("bta_av_api_sink_enable %d \n", activate_sink)
char p_service_name[BTA_SERVICE_NAME_LEN + 1];
BCM_STRNCPY_S(p_service_name, sizeof(p_service_name),
BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
BCM_STRNCPY_S(p_service_name, BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
if (activate_sink) {
AVDT_SINK_Activate();
@ -526,7 +525,7 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
tBTA_UTL_COD cod;
UINT8 index = 0;
char p_avk_service_name[BTA_SERVICE_NAME_LEN + 1];
BCM_STRNCPY_S(p_avk_service_name, sizeof(p_avk_service_name), BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
BCM_STRNCPY_S(p_avk_service_name, BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
memset(&cs, 0, sizeof(tAVDT_CS));
@ -571,9 +570,13 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
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
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REM_CTRL_TARGET, "AV Remote Control Target\n", NULL,
p_bta_av_cfg->avrc_tg_cat, BTA_ID_AV);
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);
} else {
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REM_CTRL_TARGET, "AV Remote Control Target\n", NULL,
p_bta_av_cfg->avrc_snk_tg_cat, BTA_ID_AV);
}
#endif
}
@ -707,8 +710,13 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
}
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
/* create an SDP record as AVRC CT. */
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REMOTE_CONTROL, NULL, NULL,
p_bta_av_cfg->avrc_ct_cat, BTA_ID_AV);
if (p_data->api_reg.tsep == AVDT_TSEP_SRC) {
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REMOTE_CONTROL, "AV Remote Control Controller\n", NULL,
p_bta_av_cfg->avrc_src_ct_cat, BTA_ID_AV);
} else {
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REMOTE_CONTROL, "AV Remote Control Controller\n", NULL,
p_bta_av_cfg->avrc_snk_ct_cat, BTA_ID_AV);
}
#endif
}
}

View file

@ -61,7 +61,7 @@ static void bta_dm_sdp_callback (UINT16 sdp_status);
#if (SMP_INCLUDED == TRUE)
static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, UINT8 *service_name, UINT8 service_id, BOOLEAN is_originator);
static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, BOOLEAN min_16_digit);
static UINT8 bta_dm_new_link_key_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, LINK_KEY key, UINT8 key_type);
static UINT8 bta_dm_new_link_key_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, LINK_KEY key, UINT8 key_type, BOOLEAN sc_support);
static UINT8 bta_dm_authentication_complete_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, int result);
#endif ///SMP_INCLUDED == TRUE
static void bta_dm_local_name_cback(BD_ADDR bd_addr);
@ -323,6 +323,9 @@ void bta_dm_deinit_cb(void)
}
#endif
memset(&bta_dm_cb, 0, sizeof(bta_dm_cb));
#if BTA_DYNAMIC_MEMORY
xSemaphoreGive(deinit_semaphore);
#endif /* #if BTA_DYNAMIC_MEMORY */
}
/*******************************************************************************
@ -607,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);
@ -693,7 +696,6 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
if (p_data->set_visibility.pair_mode != BTA_DM_IGNORE || p_data->set_visibility.conn_paired_only != BTA_DM_IGNORE) {
BTM_SetPairableMode((BOOLEAN)(!(bta_dm_cb.disable_pair_mode)), bta_dm_cb.conn_paired_only);
}
}
/*******************************************************************************
@ -754,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;
}
}
@ -820,7 +824,7 @@ void bta_dm_add_device (tBTA_DM_MSG *p_data)
if (!BTM_SecAddDevice (p_dev->bd_addr, p_dc, p_dev->bd_name, p_dev->features,
trusted_services_mask, p_lc, p_dev->key_type, p_dev->io_cap,
p_dev->pin_length)) {
p_dev->pin_length, p_dev->sc_support)) {
APPL_TRACE_ERROR ("BTA_DM: Error adding device %08x%04x",
(p_dev->bd_addr[0] << 24) + (p_dev->bd_addr[1] << 16) + (p_dev->bd_addr[2] << 8) + p_dev->bd_addr[3],
(p_dev->bd_addr[4] << 8) + p_dev->bd_addr[5]);
@ -1684,7 +1688,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
if (SDP_FindServiceUUIDInRec(p_sdp_rec, &service_uuid)) {
/* send result back to app now, one by one */
bdcpy (result.disc_ble_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
BCM_STRNCPY_S((char *)result.disc_ble_res.bd_name, sizeof(BD_NAME), bta_dm_get_remname(), (BD_NAME_LEN));
BCM_STRNCPY_S((char *)result.disc_ble_res.bd_name, bta_dm_get_remname(), (BD_NAME_LEN));
result.disc_ble_res.bd_name[BD_NAME_LEN] = 0;
result.disc_ble_res.service.len = service_uuid.len;
result.disc_ble_res.service.uu.uuid16 = service_uuid.uu.uuid16;
@ -1825,8 +1829,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
}
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
bta_dm_get_remname(), (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, bta_dm_get_remname(), (BD_NAME_LEN - 1));
/* make sure the string is null terminated */
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;
@ -1852,8 +1855,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
p_msg->disc_result.result.disc_res.result = BTA_FAILURE;
p_msg->disc_result.result.disc_res.services = bta_dm_search_cb.services_found;
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
bta_dm_get_remname(), (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, bta_dm_get_remname(), (BD_NAME_LEN - 1));
/* make sure the string is null terminated */
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;
@ -2237,8 +2239,7 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
p_msg->hdr.event = BTA_DM_DISCOVERY_RESULT_EVT;
p_msg->disc_result.result.disc_res.services = bta_dm_search_cb.services_found;
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
bta_dm_get_remname(), (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, bta_dm_get_remname(), (BD_NAME_LEN - 1));
/* make sure the string is terminated */
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;
@ -2423,8 +2424,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
p_msg->disc_result.result.disc_res.result = BTA_SUCCESS;
p_msg->disc_result.result.disc_res.services = bta_dm_search_cb.services_found;
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
(char *)bta_dm_search_cb.peer_name, (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, (char *)bta_dm_search_cb.peer_name, (BD_NAME_LEN - 1));
/* make sure the string is terminated */
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;
@ -2568,7 +2568,7 @@ static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc,
rem_name.length = (BD_NAME_LEN - 1);
rem_name.remote_bd_name[(BD_NAME_LEN - 1)] = 0;
}
BCM_STRNCPY_S((char *)rem_name.remote_bd_name, sizeof(BD_NAME), (char *)bd_name, (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)rem_name.remote_bd_name, (char *)bd_name, (BD_NAME_LEN - 1));
rem_name.status = BTM_SUCCESS;
bta_dm_remname_cback(&rem_name);
@ -2611,7 +2611,7 @@ static void bta_dm_remname_cback (tBTM_REMOTE_DEV_NAME *p_remote_name)
/* remote name discovery is done but it could be failed */
bta_dm_search_cb.name_discover_done = TRUE;
BCM_STRNCPY_S((char *)bta_dm_search_cb.peer_name, sizeof(BD_NAME), (char *)p_remote_name->remote_bd_name, (BD_NAME_LEN));
BCM_STRNCPY_S((char *)bta_dm_search_cb.peer_name,(char *)p_remote_name->remote_bd_name, (BD_NAME_LEN));
bta_dm_search_cb.peer_name[BD_NAME_LEN] = 0;
BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback);
@ -2624,7 +2624,7 @@ static void bta_dm_remname_cback (tBTM_REMOTE_DEV_NAME *p_remote_name)
if ((p_msg = (tBTA_DM_REM_NAME *) osi_malloc(sizeof(tBTA_DM_REM_NAME))) != NULL) {
bdcpy (p_msg->result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
BCM_STRNCPY_S((char *)p_msg->result.disc_res.bd_name, sizeof(BD_NAME), (char *)p_remote_name->remote_bd_name, (BD_NAME_LEN));
BCM_STRNCPY_S((char *)p_msg->result.disc_res.bd_name, (char *)p_remote_name->remote_bd_name, (BD_NAME_LEN));
/* make sure the string is null terminated */
p_msg->result.disc_res.bd_name[BD_NAME_LEN] = 0;
@ -2656,7 +2656,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
bdcpy(sec_event.authorize.bd_addr, bd_addr);
memcpy(sec_event.authorize.dev_class, dev_class, DEV_CLASS_LEN);
BCM_STRNCPY_S((char *)sec_event.authorize.bd_name, sizeof(BD_NAME), (char *)bd_name, (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)sec_event.authorize.bd_name, (char *)bd_name, (BD_NAME_LEN - 1));
/* make sure the string is null terminated */
sec_event.authorize.bd_name[BD_NAME_LEN - 1] = 0;
@ -2768,7 +2768,7 @@ static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_
bdcpy(sec_event.pin_req.bd_addr, bd_addr);
BTA_COPY_DEVICE_CLASS(sec_event.pin_req.dev_class, dev_class);
BCM_STRNCPY_S((char *)sec_event.pin_req.bd_name, sizeof(BD_NAME), (char *)bd_name, (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)sec_event.pin_req.bd_name, (char *)bd_name, (BD_NAME_LEN - 1));
sec_event.pin_req.bd_name[BD_NAME_LEN - 1] = 0;
sec_event.pin_req.min_16_digit = min_16_digit;
@ -2786,7 +2786,8 @@ static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_
**
*******************************************************************************/
static UINT8 bta_dm_new_link_key_cback(BD_ADDR bd_addr, DEV_CLASS dev_class,
BD_NAME bd_name, LINK_KEY key, UINT8 key_type)
BD_NAME bd_name, LINK_KEY key, UINT8 key_type,
BOOLEAN sc_support)
{
tBTA_DM_SEC sec_event;
tBTA_DM_AUTH_CMPL *p_auth_cmpl;
@ -2808,6 +2809,7 @@ static UINT8 bta_dm_new_link_key_cback(BD_ADDR bd_addr, DEV_CLASS dev_class,
p_auth_cmpl->key_present = TRUE;
p_auth_cmpl->key_type = key_type;
p_auth_cmpl->success = TRUE;
p_auth_cmpl->sc_support = sc_support;
memcpy(p_auth_cmpl->key, key, LINK_KEY_LEN);
sec_event.auth_cmpl.fail_reason = HCI_SUCCESS;
@ -2938,8 +2940,7 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
copy these values into key_notif from cfm_req */
bdcpy(sec_event.key_notif.bd_addr, p_data->cfm_req.bd_addr);
BTA_COPY_DEVICE_CLASS(sec_event.key_notif.dev_class, p_data->cfm_req.dev_class);
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, sizeof(BD_NAME),
(char *)p_data->cfm_req.bd_name, (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, (char *)p_data->cfm_req.bd_name, (BD_NAME_LEN - 1));
sec_event.key_notif.bd_name[BD_NAME_LEN - 1] = 0;
}
}
@ -2960,8 +2961,7 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
} else {
bdcpy(sec_event.key_notif.bd_addr, p_data->key_notif.bd_addr);
BTA_COPY_DEVICE_CLASS(sec_event.key_notif.dev_class, p_data->key_notif.dev_class);
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, sizeof(BD_NAME),
(char *)p_data->key_notif.bd_name, (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, (char *)p_data->key_notif.bd_name, (BD_NAME_LEN - 1));
sec_event.key_notif.bd_name[BD_NAME_LEN - 1] = 0;
}
}
@ -2982,8 +2982,7 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
} else {
bdcpy(sec_event.key_notif.bd_addr, p_data->key_notif.bd_addr);
BTA_COPY_DEVICE_CLASS(sec_event.key_notif.dev_class, p_data->key_notif.dev_class);
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, sizeof(BD_NAME),
(char *)p_data->key_notif.bd_name, (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, (char *)p_data->key_notif.bd_name, (BD_NAME_LEN - 1));
sec_event.key_notif.bd_name[BD_NAME_LEN - 1] = 0;
}
}
@ -3012,7 +3011,7 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
bdcpy(sec_event.rmt_oob.bd_addr, p_data->rmt_oob.bd_addr);
BTA_COPY_DEVICE_CLASS(sec_event.rmt_oob.dev_class, p_data->rmt_oob.dev_class);
BCM_STRNCPY_S((char *)sec_event.rmt_oob.bd_name, sizeof(BD_NAME), (char *)p_data->rmt_oob.bd_name, (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)sec_event.rmt_oob.bd_name, (char *)p_data->rmt_oob.bd_name, (BD_NAME_LEN - 1));
sec_event.rmt_oob.bd_name[BD_NAME_LEN - 1] = 0;
bta_dm_cb.p_sec_cback(BTA_DM_SP_RMT_OOB_EVT, &sec_event);
@ -3088,6 +3087,7 @@ static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data)
switch (p_msg->event) {
case BTM_BL_CONN_EVT:
p_msg->sc_downgrade = p_data->conn.sc_downgrade;
p_msg->is_new = TRUE;
bdcpy(p_msg->bd_addr, p_data->conn.p_bda);
#if BLE_INCLUDED == TRUE
@ -3314,6 +3314,7 @@ void bta_dm_acl_change(tBTA_DM_MSG *p_data)
APPL_TRACE_DEBUG("%s info: 0x%x", __func__, bta_dm_cb.device_list.peer_device[i].info);
if (bta_dm_cb.p_sec_cback) {
conn.link_up.sc_downgrade = p_data->acl_change.sc_downgrade;
bta_dm_cb.p_sec_cback(BTA_DM_LINK_UP_EVT, (tBTA_DM_SEC *)&conn);
}
} else {
@ -4348,8 +4349,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
bdcpy(sec_event.ble_req.bd_addr, bda);
p_name = BTM_SecReadDevName(bda);
if (p_name != NULL) {
BCM_STRNCPY_S((char *)sec_event.ble_req.bd_name,
sizeof(BD_NAME), p_name, (BD_NAME_LEN));
BCM_STRNCPY_S((char *)sec_event.ble_req.bd_name, p_name, (BD_NAME_LEN));
} else {
sec_event.ble_req.bd_name[0] = 0;
}
@ -4361,8 +4361,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
bdcpy(sec_event.key_notif.bd_addr, bda);
p_name = BTM_SecReadDevName(bda);
if (p_name != NULL) {
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name,
sizeof(BD_NAME), p_name, (BD_NAME_LEN));
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, p_name, (BD_NAME_LEN));
} else {
sec_event.key_notif.bd_name[0] = 0;
}
@ -4383,7 +4382,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
case BTM_LE_NC_REQ_EVT:
bdcpy(sec_event.key_notif.bd_addr, bda);
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, sizeof(BD_NAME), bta_dm_get_remname(), (BD_NAME_LEN));
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, bta_dm_get_remname(), (BD_NAME_LEN));
sec_event.ble_req.bd_name[BD_NAME_LEN] = 0;
sec_event.key_notif.passkey = p_data->key_notif;
bta_dm_cb.p_sec_cback(BTA_DM_BLE_NC_REQ_EVT, &sec_event);
@ -4403,8 +4402,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
#endif
p_name = BTM_SecReadDevName(bda);
if (p_name != NULL) {
BCM_STRNCPY_S((char *)sec_event.auth_cmpl.bd_name,
sizeof(BD_NAME), p_name, (BD_NAME_LEN));
BCM_STRNCPY_S((char *)sec_event.auth_cmpl.bd_name, p_name, (BD_NAME_LEN));
} else {
sec_event.auth_cmpl.bd_name[0] = 0;
}
@ -5685,7 +5683,7 @@ static void bta_dm_gatt_disc_result(tBTA_GATT_ID service_id)
/* send result back to app now, one by one */
bdcpy (result.disc_ble_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
BCM_STRNCPY_S((char *)result.disc_ble_res.bd_name, sizeof(BD_NAME), bta_dm_get_remname(), (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)result.disc_ble_res.bd_name,bta_dm_get_remname(), (BD_NAME_LEN - 1));
result.disc_ble_res.bd_name[BD_NAME_LEN] = 0;
memcpy(&result.disc_ble_res.service, &service_id.uuid, sizeof(tBT_UUID));
@ -5727,8 +5725,7 @@ static void bta_dm_gatt_disc_complete(UINT16 conn_id, tBTA_GATT_STATUS status)
p_msg->disc_result.result.disc_res.num_uuids = 0;
p_msg->disc_result.result.disc_res.p_uuid_list = NULL;
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
bta_dm_get_remname(), (BD_NAME_LEN - 1));
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, bta_dm_get_remname(), (BD_NAME_LEN - 1));
/* make sure the string is terminated */
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;

View file

@ -174,7 +174,7 @@ void BTA_DmSetDeviceName(const char *p_name)
if ((p_msg = (tBTA_DM_API_SET_NAME *) osi_malloc(sizeof(tBTA_DM_API_SET_NAME))) != NULL) {
p_msg->hdr.event = BTA_DM_API_SET_NAME_EVT;
/* truncate the name if needed */
BCM_STRNCPY_S((char *)p_msg->name, sizeof(p_msg->name), p_name, BD_NAME_LEN - 1);
BCM_STRNCPY_S((char *)p_msg->name, p_name, BD_NAME_LEN - 1);
p_msg->name[BD_NAME_LEN - 1] = 0;
bta_sys_sendmsg(p_msg);
@ -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;
@ -586,6 +586,7 @@ void BTA_DmPasskeyReqReply(BOOLEAN accept, BD_ADDR bd_addr, UINT32 passkey)
}
}
#endif ///BT_SSP_INCLUDED == TRUE
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
** Function BTA_DmAddDevice
@ -599,7 +600,8 @@ void BTA_DmPasskeyReqReply(BOOLEAN accept, BD_ADDR bd_addr, UINT32 passkey)
*******************************************************************************/
void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class, LINK_KEY link_key,
tBTA_SERVICE_MASK trusted_mask, BOOLEAN is_trusted,
UINT8 key_type, tBTA_IO_CAP io_cap, UINT8 pin_length)
UINT8 key_type, tBTA_IO_CAP io_cap, UINT8 pin_length,
UINT8 sc_support)
{
tBTA_DM_API_ADD_DEVICE *p_msg;
@ -612,6 +614,7 @@ void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class, LINK_KEY link_key,
p_msg->tm = trusted_mask;
p_msg->is_trusted = is_trusted;
p_msg->io_cap = io_cap;
p_msg->sc_support = sc_support;
if (link_key) {
p_msg->link_key_known = TRUE;
@ -662,7 +665,6 @@ tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr, tBT_TRANSPORT transport)
return BTA_SUCCESS;
}
#endif ///SMP_INCLUDED == TRUE
/*******************************************************************************
**
@ -736,7 +738,7 @@ UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr )
**
** Description This function adds a DI record to the local SDP database.
**
** Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
** Returns BTA_SUCCESS if record set successfully, otherwise error code.
**
*******************************************************************************/
tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
@ -1819,7 +1821,7 @@ void BTA_DmBleConfigLocalIcon(uint16_t icon)
** p_cback: callback function associated to this adv instance.
** p_ref: reference data pointer to this adv instance.
**
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
**
*******************************************************************************/
void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
@ -1857,7 +1859,7 @@ void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
** Parameters inst_id: Adv instance to update the parameter.
** p_params: pointer to the adv parameter structure.
**
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
**
*******************************************************************************/
void BTA_BleUpdateAdvInstParam (UINT8 inst_id, tBTA_BLE_ADV_PARAMS *p_params)
@ -1892,7 +1894,7 @@ void BTA_BleUpdateAdvInstParam (UINT8 inst_id, tBTA_BLE_ADV_PARAMS *p_params)
** memory space can not be freed until BTA_BLE_MULTI_ADV_DATA_EVT
** is sent to application.
**
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
**
*******************************************************************************/
void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
@ -1925,7 +1927,7 @@ void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
**
** Parameter inst_id: instance ID to disable.
**
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
**
*******************************************************************************/
void BTA_BleDisableAdvInstance (UINT8 inst_id) //this function just used for vendor debug

View file

@ -228,9 +228,9 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
{{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
{{BTA_DM_PM_SNIFF3, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */
{{BTA_DM_PM_SNIFF, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */
{{BTA_DM_PM_SNIFF, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
{{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
{{BTA_DM_PM_RETRY, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
}

View file

@ -48,6 +48,7 @@ tBTE_APPL_CFG bte_appl_cfg = {
BTM_BLE_INITIATOR_KEY_SIZE,
BTM_BLE_RESPONDER_KEY_SIZE,
BTM_BLE_MAX_KEY_SIZE,
BTM_BLE_MIN_KEY_SIZE,
BTM_BLE_ONLY_ACCEPT_SPECIFIED_SEC_AUTH_DISABLE,
BTM_BLE_OOB_DISABLE,
};
@ -407,7 +408,7 @@ void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key)
void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size)
{
#if (SMP_INCLUDED == TRUE)
if(ble_key_size >= BTM_BLE_MIN_KEY_SIZE && ble_key_size <= BTM_BLE_MAX_KEY_SIZE) {
if(ble_key_size >= bte_appl_cfg.ble_min_key_size && ble_key_size <= BTM_BLE_MAX_KEY_SIZE) {
bte_appl_cfg.ble_max_key_size = ble_key_size;
} else {
APPL_TRACE_ERROR("%s error:Invalid key size value, key_size =%d",__func__, ble_key_size);
@ -415,6 +416,17 @@ void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size)
#endif ///SMP_INCLUDED == TRUE
}
void bta_dm_co_ble_set_min_key_size(UINT8 ble_key_size)
{
#if (SMP_INCLUDED == TRUE)
if(ble_key_size >= BTM_BLE_MIN_KEY_SIZE && ble_key_size <= bte_appl_cfg.ble_max_key_size) {
bte_appl_cfg.ble_min_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)

View file

@ -28,6 +28,7 @@
#include "osi/allocator.h"
#include <string.h>
#include "esp_coexist.h"
/*****************************************************************************
** Constants and types
@ -158,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 */
};
@ -452,3 +453,27 @@ BOOLEAN bta_dm_search_sm_execute(BT_HDR *p_msg)
return TRUE;
}
void BTA_DmCoexEventTrigger(uint32_t event)
{
switch(event) {
case BTA_COEX_EVT_SCAN_STARTED:
case BTA_COEX_EVT_SCAN_STOPPED:
case BTA_COEX_EVT_SNIFF_ENTER:
case BTA_COEX_EVT_SNIFF_EXIT:
case BTA_COEX_EVT_A2DP_PAUSED_ENTER:
case BTA_COEX_EVT_A2DP_PAUSED_EXIT:
case BTA_COEX_EVT_ACL_CONNECTED:
case BTA_COEX_EVT_ACL_DISCONNECTED:
break;
case BTA_COEX_EVT_STREAMING_STARTED:
esp_coex_status_bit_set(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_STREAMING);
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_PAUSED);
break;
case BTA_COEX_EVT_STREAMING_STOPPED:
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_STREAMING);
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_PAUSED);
break;
default:
break;
}
}

View file

@ -25,7 +25,7 @@
#define BTA_DM_INT_H
#include "common/bt_target.h"
#include "freertos/semphr.h"
#if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
#include "bta/bta_gatt_api.h"
#endif
@ -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
};
@ -384,6 +384,7 @@ typedef struct {
UINT8 new_role;
BD_ADDR bd_addr;
UINT8 hci_status;
BOOLEAN sc_downgrade;
#if BLE_INCLUDED == TRUE
UINT16 handle;
tBT_TRANSPORT transport;
@ -425,6 +426,7 @@ typedef struct {
BD_NAME bd_name;
UINT8 features[BTA_FEATURE_BYTES_PER_PAGE * (BTA_EXT_FEATURES_PAGE_MAX + 1)];
UINT8 pin_length;
UINT8 sc_support;
} tBTA_DM_API_ADD_DEVICE;
/* data type for BTA_DM_API_REMOVE_ACL_EVT */
@ -1209,6 +1211,7 @@ extern tBTA_DM_DI_CB bta_dm_di_cb;
#else
extern tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
#define bta_dm_di_cb (*bta_dm_di_cb_ptr)
SemaphoreHandle_t deinit_semaphore;
#endif
extern BOOLEAN bta_dm_sm_execute(BT_HDR *p_msg);
@ -1223,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);

View file

@ -745,6 +745,8 @@ void bta_gattc_conncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data)
void bta_gattc_disconncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data)
{
if (p_rcb) {
// Clear up the notification registration information by BD_ADDR
bta_gattc_clear_notif_registration_by_bda(p_rcb, p_data->int_conn.remote_bda);
bta_gattc_send_disconnect_cback(p_rcb,
p_data->int_conn.reason,
p_data->int_conn.remote_bda,

View file

@ -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
*****************************************************************************/
@ -76,7 +76,7 @@ void BTA_GATTC_Disable(void)
** Description This function is called to register application callbacks
** with BTA GATTC module.
**
** Parameters p_app_uuid - applicaiton UUID
** Parameters p_app_uuid - application UUID
** p_client_cb - pointer to the application callback function.
**
** Returns None
@ -338,13 +338,13 @@ const tBTA_GATTC_DESCRIPTOR* BTA_GATTC_GetDescriptor(UINT16 conn_id, UINT16 hand
}
void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
btgatt_db_element_t **db, int *count)
btgatt_db_element_t **db, UINT16 *count)
{
bta_gattc_get_service_with_uuid(conn_id, svc_uuid, db, count);
}
void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
btgatt_db_element_t **db, int *count)
btgatt_db_element_t **db, UINT16 *count)
{
bta_gattc_get_db_with_opration(conn_id,
GATT_OP_GET_ALL_CHAR,
@ -359,7 +359,7 @@ void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle
}
void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
btgatt_db_element_t **db, int *count)
btgatt_db_element_t **db, UINT16 *count)
{
bta_gattc_get_db_with_opration(conn_id,
GATT_OP_GET_ALL_DESCRI,
@ -374,7 +374,7 @@ void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
}
void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, tBT_UUID char_uuid,
btgatt_db_element_t **db, int *count)
btgatt_db_element_t **db, UINT16 *count)
{
bta_gattc_get_db_with_opration(conn_id,
GATT_OP_GET_CHAR_BY_UUID,
@ -390,7 +390,7 @@ void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_han
void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t end_handle,
tBT_UUID char_uuid, tBT_UUID descr_uuid,
btgatt_db_element_t **db, int *count)
btgatt_db_element_t **db, UINT16 *count)
{
bta_gattc_get_db_with_opration(conn_id,
GATT_OP_GET_DESCRI_BY_UUID,
@ -405,7 +405,7 @@ void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t en
}
void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID descr_uuid,
btgatt_db_element_t **db, int *count)
btgatt_db_element_t **db, UINT16 *count)
{
bta_gattc_get_db_with_opration(conn_id,
GATT_OP_GET_DESCRI_BY_HANDLE,
@ -420,7 +420,7 @@ void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID
}
void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
tBT_UUID *incl_uuid, btgatt_db_element_t **db, int *count)
tBT_UUID *incl_uuid, btgatt_db_element_t **db, UINT16 *count)
{
bta_gattc_get_db_with_opration(conn_id,
GATT_OP_GET_INCLUDE_SVC,
@ -434,13 +434,13 @@ void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end
count);
}
void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count)
void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count)
{
bta_gattc_get_db_size_handle(conn_id, start_handle, end_handle, count);
}
void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count)
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count)
{
bta_gattc_get_db_size_with_type_handle(conn_id, type, start_handle, end_handle, char_handle, count);
}
@ -459,7 +459,7 @@ void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
**
*******************************************************************************/
void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
btgatt_db_element_t **db, int *count)
btgatt_db_element_t **db, UINT16 *count)
{
bta_gattc_get_gatt_db(conn_id, start_handle, end_handle, db, count);
}
@ -603,6 +603,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 +654,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;

View file

@ -1227,7 +1227,7 @@ tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
btgatt_db_element_t **svc_db,
int *count)
UINT16 *count)
{
const list_t* svc = bta_gattc_get_services(conn_id);
if(!svc) {
@ -1301,7 +1301,7 @@ void bta_gattc_get_db_with_opration(UINT16 conn_id,
tBT_UUID *descr_uuid,
UINT16 start_handle, UINT16 end_handle,
btgatt_db_element_t **char_db,
int *count)
UINT16 *count)
{
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
@ -1666,7 +1666,7 @@ static size_t bta_gattc_get_db_size(list_t *services,
return db_size;
}
void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count)
void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count)
{
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
@ -1685,7 +1685,7 @@ void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 en
}
void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count)
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count)
{
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
@ -1732,7 +1732,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
UINT16 start_handle, UINT16 end_handle,
btgatt_db_element_t **db,
int *count)
UINT16 *count)
{
APPL_TRACE_DEBUG("%s: start_handle 0x%04x, end_handle 0x%04x",
__func__, start_handle, end_handle);
@ -1880,7 +1880,7 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
** Returns None.
**
*******************************************************************************/
void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count)
void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, UINT16 *count)
{
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);

View file

@ -596,6 +596,30 @@ void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id,
return;
}
/*******************************************************************************
**
** Function bta_gattc_clear_notif_registration_by_bda
**
** Description Clear up the notification registration information by BD_ADDR.
**
**
** Returns None.
**
*******************************************************************************/
void bta_gattc_clear_notif_registration_by_bda(tBTA_GATTC_RCB *p_clrcb, BD_ADDR remote_bda)
{
if(p_clrcb == NULL) {
return;
}
for (uint8_t i = 0 ; i < BTA_GATTC_NOTIF_REG_MAX; i ++) {
if (p_clrcb->notif_reg[i].in_use &&
!bdcmp(p_clrcb->notif_reg[i].remote_bda, remote_bda))
{
memset(&p_clrcb->notif_reg[i], 0, sizeof(tBTA_GATTC_NOTIF_REG));
}
}
}
/*******************************************************************************
**
** Function bta_gattc_mark_bg_conn

View file

@ -35,6 +35,7 @@
#include "stack/btm_ble_api.h"
#include <string.h>
#include "osi/allocator.h"
#include "stack/l2c_api.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 +673,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,
@ -1014,22 +1016,14 @@ static void bta_gatts_conn_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
** Returns none.
**
*******************************************************************************/
extern void btc_congest_callback(tBTA_GATTS *param);
static void bta_gatts_cong_cback (UINT16 conn_id, BOOLEAN congested)
{
tBTA_GATTS_RCB *p_rcb;
tGATT_IF gatt_if;
tBTA_GATT_TRANSPORT transport;
tBTA_GATTS cb_data;
if (GATT_GetConnectionInfor(conn_id, &gatt_if, cb_data.req_data.remote_bda, &transport)) {
p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if);
cb_data.congest.conn_id = conn_id;
cb_data.congest.congested = congested;
if (p_rcb && p_rcb->p_cback) {
cb_data.congest.conn_id = conn_id;
cb_data.congest.congested = congested;
(*p_rcb->p_cback)(BTA_GATTS_CONGEST_EVT, &cb_data);
}
}
btc_congest_callback(&cb_data);
}
#endif /* GATTS_INCLUDED */

View file

@ -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
*****************************************************************************/
@ -76,7 +76,7 @@ void BTA_GATTS_Disable(void)
** Description This function is called to register application callbacks
** with BTA GATTS module.
**
** Parameters p_app_uuid - applicaiton UUID
** Parameters p_app_uuid - application UUID
** p_cback - pointer to the application callback function.
**
** Returns None
@ -347,7 +347,7 @@ void BTA_GATTS_DeleteService(UINT16 service_id)
** Description This function is called to start a service.
**
** Parameters service_id: the service ID to be started.
** sup_transport: supported trasnport.
** sup_transport: supported transport.
**
** Returns None.
**
@ -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;

View file

@ -498,6 +498,7 @@ extern BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR rem
extern BOOLEAN bta_gattc_check_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR remote_bda, UINT8 role);
extern UINT8 bta_gattc_num_reg_app(void);
extern void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id, UINT16 start_handle, UINT16 end_handle);
extern void bta_gattc_clear_notif_registration_by_bda(tBTA_GATTC_RCB *p_clrcb, BD_ADDR remote_bda);
extern tBTA_GATTC_SERV * bta_gattc_find_srvr_cache(BD_ADDR bda);
/* discovery functions */
@ -511,12 +512,12 @@ extern const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle);
extern tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle);
extern tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle);
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count);
extern void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count);
extern void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
btgatt_db_element_t **svc_db,
int *count);
UINT16 *count);
extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
bt_gatt_get_db_op_t op,
@ -526,9 +527,9 @@ extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
tBT_UUID *descr_uuid,
UINT16 start_handle, UINT16 end_handle,
btgatt_db_element_t **char_db,
int *count);
UINT16 *count);
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count);
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, UINT16 *count);
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *attr);

View file

@ -141,7 +141,7 @@ void BTA_HfClientRegister(tBTA_SEC sec_mask, tBTA_HF_CLIENT_FEAT features,
p_buf->features = features;
p_buf->sec_mask = sec_mask;
if (p_service_name) {
BCM_STRNCPY_S(p_buf->name, BTA_SERVICE_NAME_LEN + 1, p_service_name, BTA_SERVICE_NAME_LEN);
BCM_STRNCPY_S(p_buf->name, p_service_name, BTA_SERVICE_NAME_LEN);
p_buf->name[BTA_SERVICE_NAME_LEN] = 0;
} else {
p_buf->name[0] = '\0';

View file

@ -75,12 +75,12 @@ typedef struct {
/* CIND: storage room for indicators value range and their statuses */
static const tBTA_HF_CLIENT_INDICATOR bta_hf_client_indicators[BTA_HF_CLIENT_AT_SUPPORTED_INDICATOR_COUNT] = {
/* name | min | max | name length - used by parser */
{BTA_HF_CLIENT_INDICATOR_BATTERYCHG, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_BATTERYCHG)},
{BTA_HF_CLIENT_INDICATOR_SIGNAL, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_SIGNAL)},
{BTA_HF_CLIENT_INDICATOR_SERVICE, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_SERVICE)},
{BTA_HF_CLIENT_INDICATOR_CALL, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_CALL)},
{BTA_HF_CLIENT_INDICATOR_ROAM, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_ROAM)},
{BTA_HF_CLIENT_INDICATOR_CALLSETUP, 0, 3, sizeof(BTA_HF_CLIENT_INDICATOR_CALLSETUP)},
{BTA_HF_CLIENT_INDICATOR_SERVICE, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_SERVICE)},
{BTA_HF_CLIENT_INDICATOR_SIGNAL, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_SIGNAL)},
{BTA_HF_CLIENT_INDICATOR_ROAM, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_ROAM)},
{BTA_HF_CLIENT_INDICATOR_BATTERYCHG, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_BATTERYCHG)},
{BTA_HF_CLIENT_INDICATOR_CALLHELD, 0, 2, sizeof(BTA_HF_CLIENT_INDICATOR_CALLHELD)}
};
@ -94,7 +94,7 @@ UINT32 service_index = 0;
BOOLEAN service_availability = TRUE;
/* helper functions for handling AT commands queueing */
static void bta_hf_client_handle_ok();
static void bta_hf_client_handle_ok(void);
static void bta_hf_client_clear_queued_at(void)
{
@ -268,7 +268,7 @@ static void bta_hf_client_start_at_hold_timer(void)
** No buffer parsing is being done here.
*******************************************************************************/
static void bta_hf_client_handle_ok()
static void bta_hf_client_handle_ok(void)
{
APPL_TRACE_DEBUG("%s", __FUNCTION__);
@ -342,7 +342,7 @@ static void bta_hf_client_handle_error(tBTA_HF_CLIENT_AT_RESULT_TYPE type, UINT1
bta_hf_client_send_queued_at();
}
static void bta_hf_client_handle_ring()
static void bta_hf_client_handle_ring(void)
{
APPL_TRACE_DEBUG("%s", __FUNCTION__);
bta_hf_client_evt_val(BTA_HF_CLIENT_RING_INDICATION, 0);
@ -427,7 +427,7 @@ static void bta_hf_client_handle_ciev(UINT32 index, UINT32 value)
APPL_TRACE_DEBUG("%s index: %u value: %u", __FUNCTION__, index, value);
if (index == 0 || index > BTA_HF_CLIENT_AT_INDICATOR_COUNT) {
if (index >= BTA_HF_CLIENT_AT_INDICATOR_COUNT) {
return;
}
@ -435,7 +435,7 @@ static void bta_hf_client_handle_ciev(UINT32 index, UINT32 value)
service_availability = value == 0 ? FALSE : TRUE;
}
realind = bta_hf_client_cb.scb.at_cb.indicator_lookup[index - 1];
realind = bta_hf_client_cb.scb.at_cb.indicator_lookup[index];
if (realind >= 0 && realind < BTA_HF_CLIENT_AT_SUPPORTED_INDICATOR_COUNT) {
/* get the real in-array index from lookup table by index it comes at */
@ -576,15 +576,17 @@ static void bta_hf_client_handle_btrh( UINT16 code)
/* Check if prefix match and skip spaces if any */
#define AT_CHECK_EVENT(buf, event) \
if (strncmp("\r\n"event, buf,sizeof("\r\n"event) - 1) != 0) return buf; \
buf += sizeof("\r\n"event) - 1; \
while (*buf == ' ') buf++;
if (strncmp("\r\n"event,buf,sizeof("\r\n"event) - 1) != 0) \
return buf; \
buf += sizeof("\r\n"event) - 1; \
while (*buf == ' ') buf++;
/* check for <cr><lf> and forward buffer if match */
#define AT_CHECK_RN(buf) \
if (strncmp("\r\n", buf, sizeof("\r\n") - 1) != 0) { \
APPL_TRACE_DEBUG("%s missing end <cr><lf>", __FUNCTION__); \
return NULL;} \
APPL_TRACE_ERROR("%s missing end <cr><lf>", __FUNCTION__); \
return NULL;\
} \
buf += sizeof("\r\n") - 1;
/* skip rest of AT string up to <cr> */
@ -1022,20 +1024,20 @@ static char *bta_hf_client_parse_clcc(char *buffer)
static char *bta_hf_client_parse_cnum(char *buffer)
{
char numstr[33]; /* spec forces 32 chars, plus one for \0*/
UINT16 type;
UINT16 service = 0; /* 0 in case this optional parameter is not being sent */
int type;
int service = 0; /* 0 in case this optional parameter is not being sent */
int res;
int offset;
AT_CHECK_EVENT(buffer, "+CNUM:");
res = sscanf(buffer, ",\"%32[^\"]\",%hu,,%hu%n", numstr, &type, &service, &offset);
res = sscanf(buffer, ",\"%32[^\"]\",%d%n,,%d%n", numstr, &type, &offset, &service, &offset);
if (res < 0) {
return NULL;
}
if (res == 0) {
res = sscanf(buffer, ",\"\",%hu,,%hu%n", &type, &service, &offset);
res = sscanf(buffer, ",\"\",%d%n,,%d%n", &type, &offset, &service, &offset);
if (res < 0) {
return NULL;
}
@ -1045,7 +1047,7 @@ static char *bta_hf_client_parse_cnum(char *buffer)
numstr[0] = '\0';
}
if (res < 3) {
if (res < 2) {
return NULL;
}
@ -1257,7 +1259,7 @@ static void bta_hf_client_at_parse_start(void)
for (i = 0; i < bta_hf_client_psraser_cb_count; i++) {
tmp = bta_hf_client_parser_cb[i](buf);
if (tmp == NULL) {
APPL_TRACE_ERROR("HFPCient: AT event/reply parsing failed, skipping");
APPL_TRACE_ERROR("HFPCient: AT event/reply parsing failed, skipping %d", i);
tmp = bta_hf_client_skip_unknown(buf);
break;
}

View file

@ -850,7 +850,7 @@ void bta_hh_le_register_input_notif(tBTA_HH_DEV_CB *p_dev_cb, UINT8 srvc_inst,
**
** Function bta_hh_le_open_cmpl
**
** Description HID over GATT connection sucessfully opened
** Description HID over GATT connection successfully opened
**
*******************************************************************************/
void bta_hh_le_open_cmpl(tBTA_HH_DEV_CB *p_cb)
@ -1556,7 +1556,7 @@ void bta_hh_le_srvc_search_cmpl(tBTA_GATTC_SEARCH_CMPL *p_data)
/* close the connection and report service discovery complete with error */
bta_hh_le_api_disc_act(p_dev_cb);
}
/* GATT service discovery sucessfully finished */
/* GATT service discovery successfully finished */
else {
if (p_dev_cb->disc_active & BTA_HH_LE_DISC_SCPS) {
p_dev_cb->disc_active &= ~BTA_HH_LE_DISC_SCPS;

View file

@ -589,10 +589,10 @@ typedef struct {
typedef union {
tBLE_BD_ADDR target_addr;
tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */
tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */
tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* local name filtering */
tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufacturer data filtering */
tBTA_DM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */
tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicited service UUID filtering */
tBTA_DM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
} tBTA_DM_BLE_PF_COND_PARAM;
@ -769,6 +769,7 @@ typedef struct {
tBLE_ADDR_TYPE addr_type; /* Peer device address type */
tBT_DEVICE_TYPE dev_type;
UINT8 auth_mode;
BOOLEAN sc_support; /* Denotes if peer device supported secure connection while bonding. */
} tBTA_DM_AUTH_CMPL;
@ -784,6 +785,7 @@ typedef struct {
/* Structure associated with BTA_DM_LINK_UP_EVT */
typedef struct {
BOOLEAN sc_downgrade; /* Security downgrade state. */
BD_ADDR bd_addr; /* BD address peer device. */
#if BLE_INCLUDED == TRUE
tBTA_TRANSPORT link_type;
@ -924,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 */
@ -1204,7 +1206,7 @@ typedef UINT16 tBTA_DM_LP_MASK;
#define BTA_DM_PM_ACTIVE 0x40 /* prefers active mode */
#define BTA_DM_PM_RETRY 0x80 /* retry power mode based on current settings */
#define BTA_DM_PM_SUSPEND 0x04 /* prefers suspend mode */
#define BTA_DM_PM_NO_PREF 0x01 /* service has no prefernce on power mode setting. eg. connection to service got closed */
#define BTA_DM_PM_NO_PREF 0x01 /* service has no preference on power mode setting. eg. connection to service got closed */
typedef UINT8 tBTA_DM_PM_ACTION;
@ -1375,6 +1377,7 @@ typedef UINT8 tBTA_DM_LINK_TYPE;
#define ALLOW_ALL_FILTER 0x00
#define LOWEST_RSSI_VALUE 129
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
@ -1454,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);
/*******************************************************************************
**
@ -1683,7 +1686,8 @@ extern void BTA_DmPasskeyReqReply(BOOLEAN accept, BD_ADDR bd_addr, UINT32 passke
extern void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class,
LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask,
BOOLEAN is_trusted, UINT8 key_type,
tBTA_IO_CAP io_cap, UINT8 pin_length);
tBTA_IO_CAP io_cap, UINT8 pin_length,
UINT8 sc_support);
/*******************************************************************************
**
@ -1732,7 +1736,7 @@ extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
**
** Description This function adds a DI record to the local SDP database.
**
** Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
** Returns BTA_SUCCESS if record set successfully, otherwise error code.
**
*******************************************************************************/
extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
@ -2292,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);
/*******************************************************************************
@ -2601,6 +2605,21 @@ extern void BTA_VendorInit (void);
*******************************************************************************/
extern void BTA_VendorCleanup (void);
enum {
BTA_COEX_EVT_SCAN_STARTED = 1,
BTA_COEX_EVT_SCAN_STOPPED,
BTA_COEX_EVT_ACL_CONNECTED,
BTA_COEX_EVT_ACL_DISCONNECTED,
BTA_COEX_EVT_STREAMING_STARTED,
BTA_COEX_EVT_STREAMING_STOPPED,
BTA_COEX_EVT_SNIFF_ENTER,
BTA_COEX_EVT_SNIFF_EXIT,
BTA_COEX_EVT_A2DP_PAUSED_ENTER,
BTA_COEX_EVT_A2DP_PAUSED_EXIT,
};
extern void BTA_DmCoexEventTrigger(uint32_t event);
#endif
#ifdef __cplusplus

View file

@ -509,8 +509,10 @@ typedef struct {
UINT32 company_id; /* AVRCP Company ID */
UINT16 avrc_mtu; /* AVRCP MTU at L2CAP for control channel */
UINT16 avrc_br_mtu; /* AVRCP MTU at L2CAP for browsing channel */
UINT16 avrc_ct_cat; /* AVRCP controller categories */
UINT16 avrc_tg_cat; /* AVRCP target categories */
UINT16 avrc_snk_ct_cat; /* AVRCP controller categories as SNK */
UINT16 avrc_snk_tg_cat; /* AVRCP target categories SNK */
UINT16 avrc_src_ct_cat; /* AVRCP controller categories as SRC */
UINT16 avrc_src_tg_cat; /* AVRCP target categories as SRC */
UINT16 sig_mtu; /* AVDTP signaling channel MTU at L2CAP */
UINT16 audio_mtu; /* AVDTP audio transport channel MTU at L2CAP */
const UINT16 *p_audio_flush_to;/* AVDTP audio transport channel flush timeout */

View file

@ -205,6 +205,8 @@ extern void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key);
extern void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size);
extern void bta_dm_co_ble_set_min_key_size(UINT8 ble_key_size);
extern void bta_dm_co_ble_set_accept_auth_enable(UINT8 enable);
extern UINT8 bta_dm_co_ble_get_accept_auth_enable(void);

View file

@ -152,7 +152,7 @@ typedef UINT8 tBTA_GATT_STATUS;
#define BTA_GATTC_CLOSE_EVT 5 /* GATTC close request status event */
#define BTA_GATTC_SEARCH_CMPL_EVT 6 /* GATT discovery complete event */
#define BTA_GATTC_SEARCH_RES_EVT 7 /* GATT discovery result event */
#define BTA_GATTC_READ_DESCR_EVT 8 /* GATT read characterisitc descriptor event */
#define BTA_GATTC_READ_DESCR_EVT 8 /* GATT read characteristic descriptor event */
#define BTA_GATTC_WRITE_DESCR_EVT 9 /* GATT write characteristic descriptor event */
#define BTA_GATTC_NOTIF_EVT 10 /* GATT attribute notification event */
#define BTA_GATTC_PREP_WRITE_EVT 11 /* GATT prepare write event */
@ -739,7 +739,7 @@ extern void BTA_GATTC_Disable(void);
** Description This function is called to register application callbacks
** with BTA GATTC module.
**
** Parameters p_app_uuid - applicaiton UUID
** Parameters p_app_uuid - application UUID
** p_client_cb - pointer to the application callback function.
**
** Returns None
@ -867,32 +867,32 @@ extern const tBTA_GATTC_CHARACTERISTIC* BTA_GATTC_GetCharacteristic(UINT16 conn_
*******************************************************************************/
extern const tBTA_GATTC_DESCRIPTOR* BTA_GATTC_GetDescriptor(UINT16 conn_id, UINT16 handle);
extern void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
btgatt_db_element_t **db, int *count);
extern void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
btgatt_db_element_t **db, UINT16 *count);
extern void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
btgatt_db_element_t **db, int *count);
btgatt_db_element_t **db, UINT16 *count);
extern void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
btgatt_db_element_t **db, int *count);
btgatt_db_element_t **db, UINT16 *count);
extern void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, tBT_UUID char_uuid,
btgatt_db_element_t **db, int *count);
btgatt_db_element_t **db, UINT16 *count);
extern void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t end_handle,
tBT_UUID char_uuid, tBT_UUID descr_uuid,
btgatt_db_element_t **db, int *count);
btgatt_db_element_t **db, UINT16 *count);
extern void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID descr_uuid,
btgatt_db_element_t **db, int *count);
btgatt_db_element_t **db, UINT16 *count);
extern void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
tBT_UUID *incl_uuid, btgatt_db_element_t **db, int *count);
tBT_UUID *incl_uuid, btgatt_db_element_t **db, UINT16 *count);
extern void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
extern void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count);
extern void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count);
/*******************************************************************************
**
@ -907,7 +907,7 @@ extern void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_
**
*******************************************************************************/
extern void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
btgatt_db_element_t **db, int *count);
btgatt_db_element_t **db, UINT16 *count);
/*******************************************************************************
**
@ -1202,7 +1202,7 @@ extern void BTA_GATTS_Disable(void);
** Description This function is called to register application callbacks
** with BTA GATTS module.
**
** Parameters p_app_uuid - applicaiton UUID
** Parameters p_app_uuid - application UUID
** p_cback - pointer to the application callback function.
**
** Returns None
@ -1325,7 +1325,7 @@ extern void BTA_GATTS_DeleteService(UINT16 service_id);
** Description This function is called to start a service.
**
** Parameters service_id: the service ID to be started.
** sup_transport: supported trasnport.
** sup_transport: supported transport.
**
** Returns None.
**

View file

@ -115,15 +115,16 @@ typedef UINT8 tBTA_HF_CLIENT_EVT;
typedef UINT8 tBTA_HF_CLIENT_STATUS;
/* indicator type */
#define BTA_HF_CLIENT_IND_BATTCH 0 /* Battery charge indicator */
#define BTA_HF_CLIENT_IND_SIGNAL 1 /* Signal Strength indicator */
#define BTA_HF_CLIENT_IND_SERVICE 2 /* Service availability indicator */
#define BTA_HF_CLIENT_IND_CALL 3 /* Standard call status indicator*/
#define BTA_HF_CLIENT_IND_ROAM 4 /* Roaming status indicator */
#define BTA_HF_CLIENT_IND_CALLSETUP 5 /* Call setup status indicator */
#define BTA_HF_CLIENT_IND_CALLHELD 6 /* Call hold status indicator */
/* indicator constants HFP 1.1 and later */
#define BTA_HF_CLIENT_IND_CALL 0 /* position of call indicator */
#define BTA_HF_CLIENT_IND_CALLSETUP 1 /* position of callsetup indicator */
#define BTA_HF_CLIENT_IND_SERVICE 2 /* position of service indicator */
/* indicator constants HFP 1.5 and later */
#define BTA_HF_CLIENT_IND_SIGNAL 3 /* position of signal strength indicator */
#define BTA_HF_CLIENT_IND_ROAM 4 /* position of roaming indicator */
#define BTA_HF_CLIENT_IND_BATTCH 5 /* position of battery charge indicator */
#define BTA_HF_CLIENT_IND_CALLHELD 6 /* position of callheld indicator */
#define BTA_HF_CLIENT_IND_BEARER 7 /* position of bearer indicator */
typedef UINT8 tBTA_HF_CLIENT_IND_TYPE;
/* AT commands */

View file

@ -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;
@ -178,6 +182,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 +191,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 +248,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 +274,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 +282,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 +291,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. */
@ -304,19 +314,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. */
@ -356,6 +360,23 @@ 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;
} tBTA_JV_FREE_SCN;
/* union of data associated with JV callback */
typedef union {
@ -365,6 +386,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 +394,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 +405,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 +419,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 +452,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 +525,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 +578,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 +786,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 +817,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 +834,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 +863,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,7 +890,6 @@ 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);
/*******************************************************************************
@ -865,8 +911,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);
/*******************************************************************************
**

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,16 @@ 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,
};
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 +883,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)
{
@ -1092,6 +1186,7 @@ void bta_jv_delete_record(tBTA_JV_MSG *p_data)
}
}
#if BTA_JV_L2CAP_INCLUDED
/*******************************************************************************
**
** Function bta_jv_l2cap_client_cback
@ -1517,6 +1612,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 +1692,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 +1857,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 +1868,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 +2086,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");
}
}
@ -2351,7 +2463,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 +2903,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

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 */
@ -100,18 +110,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 +230,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 +247,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 +345,7 @@ tBTA_JV_STATUS BTA_JvDeleteRecord(UINT32 handle)
return (status);
}
#if BTA_JV_L2CAP_INCLUDED
/*******************************************************************************
**
** Function BTA_JvL2capConnectLE
@ -823,6 +859,7 @@ tBTA_JV_STATUS BTA_JvL2capWriteFixed(UINT16 channel, BD_ADDR *addr, UINT32 req_i
return (status);
}
#endif /* BTA_JV_L2CAP_INCLUDED */
/*******************************************************************************
**
@ -868,19 +905,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 +926,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;

View file

@ -52,12 +52,14 @@ 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 */
@ -66,11 +68,13 @@ const tBTA_JV_ACTION bta_jv_action[] = {
bta_jv_rfcomm_write, /* BTA_JV_API_RFCOMM_WRITE_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 */
};
/*******************************************************************************

View file

@ -48,12 +48,14 @@ 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,
@ -62,11 +64,13 @@ enum {
BTA_JV_API_RFCOMM_WRITE_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 +84,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 +125,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 +139,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 +169,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 +247,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 {
@ -300,6 +315,7 @@ typedef struct {
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 +342,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,16 +358,20 @@ 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;
@ -357,7 +379,6 @@ typedef union {
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 +389,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,12 +430,14 @@ 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);
@ -421,11 +446,12 @@ 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_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 */

View file

@ -80,7 +80,7 @@ static void _btc_storage_save(void)
//delete device info
string_to_bdaddr(need_remove_section, &bd_addr);
BTM_SecDeleteDevice(bd_addr.address, BT_TRANSPORT_LE);
//delet config info
//delete config info
if(btc_config_remove_section(need_remove_section)) {
BTIF_TRACE_WARNING("exceeded the maximum nubmer of bonded devices, delete the last device info : %s", need_remove_section);
}
@ -893,11 +893,12 @@ bt_status_t btc_storage_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev
if (_btc_storage_get_ble_bonding_key(&bd_addr, BTM_LE_KEY_PID, buffer, sizeof(tBTM_LE_PID_KEYS)) == BT_STATUS_SUCCESS) {
bond_dev->bond_key.key_mask |= ESP_BLE_ID_KEY_MASK;
tBTM_LE_PID_KEYS *pid_key = (tBTM_LE_PID_KEYS *) buffer;
memcpy(&bond_dev->bond_key.pid_key.irk, pid_key->irk, BT_OCTET16_LEN);
//Note: The memory size of the pid_key.addr_type in bond_key is different from that of (tBTM_LE_PID_KEYS) *pid_key.
memcpy(&bond_dev->bond_key.pid_key.irk, pid_key->irk, ESP_BT_OCTET16_LEN);
bond_dev->bond_key.pid_key.addr_type = pid_key->addr_type;
memcpy(&bond_dev->bond_key.pid_key.static_addr, pid_key->static_addr, sizeof(BD_ADDR));
memcpy(&bond_dev->bond_key.pid_key.static_addr, pid_key->static_addr, ESP_BD_ADDR_LEN);
}
//serch for the next bond device
//search for the next bond device
bond_dev++;
}
btc_config_unlock();

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"
@ -299,6 +299,27 @@ static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
}
#endif ///SMP_INCLUDED == TRUE
static void btc_dm_link_up_evt(tBTA_DM_LINK_UP *p_link_up)
{
BD_ADDR bd_addr;
bt_bdaddr_t bt_bdaddr;
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 {
BTC_TRACE_ERROR(" %s() BTA_DmRemoveDevice error", __FUNCTION__);
}
} else {
BTC_TRACE_ERROR(" %s() btc_storage_remove_bonded_device error", __FUNCTION__);
}
}
}
static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
{
/* Save link key, if not temporary */
@ -322,7 +343,7 @@ static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
__FUNCTION__, p_auth_cmpl->key_type);
ret = btc_storage_add_bonded_device(&bd_addr,
p_auth_cmpl->key, p_auth_cmpl->key_type,
16);
16, p_auth_cmpl->sc_support);
BTC_ASSERTC(ret == BT_STATUS_SUCCESS, "storing link key failed", ret);
} else {
BTC_TRACE_DEBUG("%s: Temporary key. Not storing. key_type=0x%x",
@ -383,11 +404,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
@ -406,11 +426,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
}
@ -434,11 +453,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
}
@ -455,11 +473,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
}
@ -475,16 +492,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;
@ -622,16 +666,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: {
@ -664,12 +699,14 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
break;
}
#endif /* BTC_GAP_BT_INCLUDED == TRUE */
case BTA_DM_LINK_UP_EVT:
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;
@ -706,8 +743,12 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
pairing_cb.ble.is_pid_key_rcvd = TRUE;
memcpy(&pairing_cb.ble.pid_key, &p_data->ble_key.p_key_value->pid_key,
sizeof(tBTM_LE_PID_KEYS));
memcpy(&param.ble_security.ble_key.p_key_value.pid_key,
&p_data->ble_key.p_key_value->pid_key, sizeof(tBTM_LE_PID_KEYS));
//Note: The memory size of the addr_type in ble_security.ble_key.p_key_value.pid_key is different from that of p_data->ble_key.p_key_value->pid_key.
memcpy(&param.ble_security.ble_key.p_key_value.pid_key.irk,
&p_data->ble_key.p_key_value->pid_key.irk, ESP_BT_OCTET16_LEN);
param.ble_security.ble_key.p_key_value.pid_key.addr_type = p_data->ble_key.p_key_value->pid_key.addr_type;
memcpy(&param.ble_security.ble_key.p_key_value.pid_key.static_addr,
&p_data->ble_key.p_key_value->pid_key.static_addr, ESP_BD_ADDR_LEN);
break;
}
case BTM_LE_KEY_PCSRK: {
@ -828,11 +869,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);

View file

@ -67,11 +67,18 @@ static void btc_init_bluetooth(void)
//load the ble local key which has been stored in the flash
btc_dm_load_ble_local_keys();
#endif /* #if (SMP_INCLUDED) */
#if BTA_DYNAMIC_MEMORY
deinit_semaphore = xSemaphoreCreateBinary();
#endif /* #if BTA_DYNAMIC_MEMORY */
}
static void btc_deinit_bluetooth(void)
{
/* Wait for the disable operation to complete */
#if BTA_DYNAMIC_MEMORY
xSemaphoreTake(deinit_semaphore, BTA_DISABLE_DELAY / portTICK_PERIOD_MS);
#endif /* #if BTA_DYNAMIC_MEMORY */
btc_gap_ble_deinit();
bta_dm_sm_deinit();
#if (GATTC_INCLUDED)
@ -87,6 +94,10 @@ static void btc_deinit_bluetooth(void)
osi_alarm_deinit();
osi_alarm_delete_mux();
future_ready(*btc_main_get_future_p(BTC_MAIN_DEINIT_FUTURE), FUTURE_SUCCESS);
#if BTA_DYNAMIC_MEMORY
vSemaphoreDelete(deinit_semaphore);
deinit_semaphore = NULL;
#endif /* #if BTA_DYNAMIC_MEMORY */
}
void btc_main_call_handler(btc_msg_t *msg)

View file

@ -37,7 +37,8 @@
bt_status_t btc_storage_add_bonded_device(bt_bdaddr_t *remote_bd_addr,
LINK_KEY link_key,
uint8_t key_type,
uint8_t pin_length)
uint8_t pin_length,
BOOLEAN sc_support)
{
bdstr_t bdstr;
@ -48,6 +49,7 @@ bt_status_t btc_storage_add_bonded_device(bt_bdaddr_t *remote_bd_addr,
int ret = btc_config_set_int(bdstr, BTC_STORAGE_LINK_KEY_TYPE_STR, (int)key_type);
ret &= btc_config_set_int(bdstr, BTC_STORAGE_PIN_LENGTH_STR, (int)pin_length);
ret &= btc_config_set_bin(bdstr, BTC_STORAGE_LINK_KEY_STR, link_key, sizeof(LINK_KEY));
ret &= btc_config_set_bin(bdstr, BTC_STORAGE_SC_SUPPORT, (uint8_t *)&sc_support, sizeof(sc_support));
/* write bonded info immediately */
btc_config_flush();
btc_config_unlock();
@ -69,6 +71,7 @@ bt_status_t btc_storage_add_bonded_device(bt_bdaddr_t *remote_bd_addr,
static bt_status_t btc_in_fetch_bonded_devices(int add)
{
BOOLEAN bt_linkkey_file_found = FALSE;
UINT8 sc_support = 0;
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)) {
@ -93,9 +96,11 @@ static bt_status_t btc_in_fetch_bonded_devices(int add)
uint2devclass((UINT32)cod, dev_class);
}
btc_config_get_int(name, BTC_STORAGE_PIN_LENGTH_STR, &pin_length);
size = sizeof(sc_support);
btc_config_get_bin(name, BTC_STORAGE_SC_SUPPORT, &sc_support, &size);
#if (SMP_INCLUDED == TRUE)
BTA_DmAddDevice(bd_addr.address, dev_class, link_key, 0, 0,
(UINT8)linkkey_type, 0, pin_length);
(UINT8)linkkey_type, 0, pin_length, (UINT8)sc_support);
#endif ///SMP_INCLUDED == TRUE
}
bt_linkkey_file_found = TRUE;
@ -160,6 +165,9 @@ bt_status_t btc_storage_remove_bonded_device(bt_bdaddr_t *remote_bd_addr)
if (btc_config_exist(bdstr, BTC_STORAGE_LINK_KEY_STR)) {
ret &= btc_config_remove(bdstr, BTC_STORAGE_LINK_KEY_STR);
}
if (btc_config_exist(bdstr, BTC_STORAGE_SC_SUPPORT)) {
ret &= btc_config_remove(bdstr, BTC_STORAGE_SC_SUPPORT);
}
/* write bonded info immediately */
btc_config_flush();
btc_config_unlock();
@ -187,12 +195,12 @@ int btc_storage_get_num_bt_bond_devices(void)
if (string_is_bdaddr(name) &&
btc_config_exist(name, BTC_STORAGE_LINK_KEY_TYPE_STR) &&
btc_config_exist(name, BTC_STORAGE_PIN_LENGTH_STR) &&
btc_config_exist(name, BTC_STORAGE_SC_SUPPORT) &&
btc_config_exist(name, BTC_STORAGE_LINK_KEY_STR)) {
num_dev++;
}
}
btc_config_unlock();
return num_dev;
}
@ -206,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;
}
@ -223,13 +233,17 @@ bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int de
if (string_is_bdaddr(name) &&
btc_config_exist(name, BTC_STORAGE_LINK_KEY_TYPE_STR) &&
btc_config_exist(name, BTC_STORAGE_PIN_LENGTH_STR) &&
btc_config_exist(name, BTC_STORAGE_SC_SUPPORT) &&
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;
}
}

View file

@ -25,6 +25,7 @@
#define BTC_STORAGE_LINK_KEY_STR "LinkKey" /* same as the ble */
#define BTC_STORAGE_LINK_KEY_TYPE_STR "LinkKeyType"
#define BTC_STORAGE_PIN_LENGTH_STR "PinLength"
#define BTC_STORAGE_SC_SUPPORT "SCSupport"
/*******************************************************************************
**
@ -40,7 +41,8 @@
bt_status_t btc_storage_add_bonded_device(bt_bdaddr_t *remote_bd_addr,
LINK_KEY link_key,
uint8_t key_type,
uint8_t pin_length);
uint8_t pin_length,
BOOLEAN sc_support);
/*******************************************************************************
**
@ -87,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 */

View file

@ -147,6 +147,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
if (blufi_env.prepare_buf == NULL) {
blufi_env.prepare_buf = osi_malloc(BLUFI_PREPAIR_BUF_MAX_SIZE);
blufi_env.prepare_len = 0;
if (blufi_env.prepare_buf == NULL) {
BLUFI_TRACE_ERROR("Blufi prep no mem\n");
status = GATT_NO_RESOURCES;
@ -174,6 +175,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
if (blufi_env.prepare_buf) {
osi_free(blufi_env.prepare_buf);
blufi_env.prepare_buf = NULL;
blufi_env.prepare_len = 0;
}
BLUFI_TRACE_ERROR("write data error , error code 0x%x\n", status);
return;
@ -209,6 +211,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
if (blufi_env.prepare_buf) {
osi_free(blufi_env.prepare_buf);
blufi_env.prepare_buf = NULL;
blufi_env.prepare_len = 0;
}
break;
@ -426,11 +429,19 @@ static void btc_blufi_recv_handler(uint8_t *data, int len)
blufi_env.aggr_buf = osi_malloc(blufi_env.total_len);
if (blufi_env.aggr_buf == NULL) {
BTC_TRACE_ERROR("%s no mem, len %d\n", __func__, blufi_env.total_len);
btc_blufi_report_error(ESP_BLUFI_DH_MALLOC_ERROR);
return;
}
}
memcpy(blufi_env.aggr_buf + blufi_env.offset, hdr->data + 2, hdr->data_len - 2);
blufi_env.offset += (hdr->data_len - 2);
if (blufi_env.offset + hdr->data_len - 2 <= blufi_env.total_len){
memcpy(blufi_env.aggr_buf + blufi_env.offset, hdr->data + 2, hdr->data_len - 2);
blufi_env.offset += (hdr->data_len - 2);
} else {
BTC_TRACE_ERROR("%s payload is longer than packet length, len %d \n", __func__, blufi_env.total_len);
btc_blufi_report_error(ESP_BLUFI_DATA_FORMAT_ERROR);
return;
}
} else {
if (blufi_env.offset > 0) { /* if previous pkt is frag */
memcpy(blufi_env.aggr_buf + blufi_env.offset, hdr->data, hdr->data_len);
@ -585,7 +596,7 @@ static void btc_blufi_wifi_conn_report(uint8_t opmode, uint8_t sta_conn_state, u
*p++ = info->softap_max_conn_num;
}
if (info->softap_channel_set) {
*p++ = BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_MAX_CONN_NUM;
*p++ = BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_CHANNEL;
*p++ = 1;
*p++ = info->softap_channel;
}

View file

@ -117,7 +117,7 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
APPL_TRACE_DEBUG("BTC MEDIA (A2DP-DATA) EVENT %u", ctrl);
if (btc_aa_ctrl_cb.a2dp_cmd_pending != ESP_A2D_MEDIA_CTRL_NONE) {
APPL_TRACE_DEBUG("un-acked a2dp cmd: %u", btc_aa_ctrl_cb.a2dp_cmd_pending);
APPL_TRACE_WARNING("un-acked a2dp cmd: %u", btc_aa_ctrl_cb.a2dp_cmd_pending);
a2dp_cmd_acknowledge(ctrl, ESP_A2D_MEDIA_CTRL_ACK_BUSY);
return;
}
@ -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,19 +182,24 @@ 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()) {
btc_dispatch_sm_event(BTC_AV_SUSPEND_STREAM_REQ_EVT, NULL, 0);
} else {
#if (BTC_AV_SINK_INCLUDED == TRUE)
if (btc_av_get_peer_sep() == AVDT_TSEP_SRC && btc_av_get_service_id() == BTA_A2DP_SINK_SERVICE_ID) {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
}
#endif
} 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);

View file

@ -828,6 +828,8 @@ static void btc_a2dp_sink_thread_cleanup(UNUSED_ATTR void *context)
fixed_queue_free(btc_aa_snk_cb.RxSbcQ, osi_free_func);
btc_aa_snk_cb.RxSbcQ = NULL;
future_ready(btc_a2dp_sink_future, NULL);
}

View file

@ -1664,6 +1664,8 @@ static void btc_a2dp_source_thread_cleanup(UNUSED_ATTR void *context)
fixed_queue_free(btc_aa_src_cb.TxAaQ, osi_free_func);
btc_aa_src_cb.TxAaQ = NULL;
future_ready(btc_a2dp_source_future, NULL);
}

View file

@ -251,7 +251,7 @@ static void handle_rc_attributes_rsp ( tAVRC_MSG_VENDOR *vendor_msg)
btc_avrc_ct_cb_to_app(ESP_AVRC_CT_METADATA_RSP_EVT, &param[i]);
attr_index += (int) vendor_msg->p_vendor_data[7 + attr_index] + 8;
attr_index += attr_length + 8;
}
}

View file

@ -1120,7 +1120,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,
@ -1189,6 +1189,12 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
bta_dm_co_ble_set_max_key_size(key_size);
break;
}
case ESP_BLE_SM_MIN_KEY_SIZE: {
uint8_t key_size = 0;
STREAM_TO_UINT8(key_size, value);
bta_dm_co_ble_set_min_key_size(key_size);
break;
}
case ESP_BLE_SM_SET_STATIC_PASSKEY: {
uint32_t passkey = 0;
for(uint8_t i = 0; i < arg->set_security_param.len; i++)

View file

@ -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)
@ -830,11 +830,14 @@ void btc_gap_bt_busy_level_updated(uint8_t bl_flags)
param.disc_st_chg.state = ESP_BT_GAP_DISCOVERY_STARTED;
btc_gap_bt_cb_to_app(ESP_BT_GAP_DISC_STATE_CHANGED_EVT, &param);
btc_gap_bt_inquiry_in_progress = true;
} else if (bl_flags == BTM_BL_INQUIRY_CANCELLED ||
bl_flags == BTM_BL_INQUIRY_COMPLETE) {
} else if (bl_flags == BTM_BL_INQUIRY_CANCELLED) {
param.disc_st_chg.state = ESP_BT_GAP_DISCOVERY_STOPPED;
btc_gap_bt_cb_to_app(ESP_BT_GAP_DISC_STATE_CHANGED_EVT, &param);
btc_gap_bt_inquiry_in_progress = false;
} else if (bl_flags == BTM_BL_INQUIRY_COMPLETE) {
/* The Inquiry Complete event is not transported to app layer,
since the app only cares about the Name Discovery Complete event */
btc_gap_bt_inquiry_in_progress = false;
}
}
@ -849,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:
@ -902,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;

View file

@ -315,7 +315,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
{
esp_gatt_status_t status;
btgatt_db_element_t *db = NULL;
int svc_num = 0;
uint16_t svc_num = 0;
tBT_UUID *bta_uuid = NULL;
if (svc_uuid) {
bta_uuid = osi_malloc(sizeof(tBT_UUID));
@ -324,7 +324,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
BTA_GATTC_GetServiceWithUUID(conn_id, bta_uuid, &db, &svc_num);
if ((status = btc_gattc_check_valid_param(svc_num, offset)) != ESP_GATT_OK) {
if ((status = btc_gattc_check_valid_param((int)svc_num, offset)) != ESP_GATT_OK) {
if (db) {
osi_free(db);
}
@ -334,7 +334,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
*count = 0;
return status;
} else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)svc_num, ESP_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
btc_gattc_fill_gatt_db_conversion(*count, svc_num, ESP_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
}
*count = svc_num;
@ -356,17 +356,17 @@ esp_gatt_status_t btc_ble_gattc_get_all_char(uint16_t conn_id,
{
esp_gatt_status_t status;
btgatt_db_element_t *db = NULL;
int char_num = 0;
uint16_t char_num = 0;
BTA_GATTC_GetAllChar(conn_id, start_handle, end_handle, &db, &char_num);
if ((status = btc_gattc_check_valid_param(char_num, offset)) != ESP_GATT_OK) {
if ((status = btc_gattc_check_valid_param((int)char_num, offset)) != ESP_GATT_OK) {
if (db) {
osi_free(db);
}
*count = 0;
return status;
} else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)char_num, ESP_GATT_DB_CHARACTERISTIC, offset, (void *)result, db);
btc_gattc_fill_gatt_db_conversion(*count, char_num, ESP_GATT_DB_CHARACTERISTIC, offset, (void *)result, db);
}
*count = char_num;
@ -384,17 +384,17 @@ esp_gatt_status_t btc_ble_gattc_get_all_descr(uint16_t conn_id,
{
esp_gatt_status_t status;
btgatt_db_element_t *db = NULL;
int descr_num = 0;
uint16_t descr_num = 0;
BTA_GATTC_GetAllDescriptor(conn_id, char_handle, &db, &descr_num);
if ((status = btc_gattc_check_valid_param(descr_num, offset)) != ESP_GATT_OK) {
if ((status = btc_gattc_check_valid_param((int)descr_num, offset)) != ESP_GATT_OK) {
if (db) {
osi_free(db);
}
*count = 0;
return status;
} else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
}
*count = descr_num;
@ -414,19 +414,19 @@ esp_gatt_status_t btc_ble_gattc_get_char_by_uuid(uint16_t conn_id,
{
esp_gatt_status_t status;
btgatt_db_element_t *db = NULL;
int char_num = 0;
uint16_t char_num = 0;
tBT_UUID bta_uuid = {0};
btc_to_bta_uuid(&bta_uuid, &char_uuid);
BTA_GATTC_GetCharByUUID(conn_id, start_handle, end_handle, bta_uuid, &db, &char_num);
if ((status = btc_gattc_check_valid_param(char_num, 0)) != ESP_GATT_OK) {
if ((status = btc_gattc_check_valid_param((int)char_num, 0)) != ESP_GATT_OK) {
if (db) {
osi_free(db);
}
*count = 0;
return status;
} else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)char_num, ESP_GATT_DB_CHARACTERISTIC, 0, (void *)result, db);
btc_gattc_fill_gatt_db_conversion(*count, char_num, ESP_GATT_DB_CHARACTERISTIC, 0, (void *)result, db);
}
*count = char_num;
@ -447,7 +447,7 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_uuid(uint16_t conn_id,
{
esp_gatt_status_t status;
btgatt_db_element_t *db = NULL;
int descr_num = 0;
uint16_t descr_num = 0;
tBT_UUID bta_char_uuid = {0};
tBT_UUID bta_descr_uuid = {0};
btc_to_bta_uuid(&bta_char_uuid, &char_uuid);
@ -456,14 +456,14 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_uuid(uint16_t conn_id,
BTA_GATTC_GetDescrByUUID(conn_id, start_handle, end_handle,
bta_char_uuid, bta_descr_uuid, &db, &descr_num);
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
if ((status = btc_gattc_check_valid_param((int)descr_num, 0)) != ESP_GATT_OK) {
if (db) {
osi_free(db);
}
*count = 0;
return status;
} else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
}
*count = descr_num;
@ -482,20 +482,20 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_char_handle(uint16_t conn_id,
{
esp_gatt_status_t status;
btgatt_db_element_t *db = NULL;
int descr_num = 0;
uint16_t descr_num = 0;
tBT_UUID bta_descr_uuid = {0};
btc_to_bta_uuid(&bta_descr_uuid, &descr_uuid);
BTA_GATTC_GetDescrByCharHandle(conn_id, char_handle, bta_descr_uuid, &db, &descr_num);
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
if ((status = btc_gattc_check_valid_param((int)descr_num, 0)) != ESP_GATT_OK) {
if (db) {
osi_free(db);
}
*count = 0;
return status;
} else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
}
*count = descr_num;
@ -516,7 +516,7 @@ esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
{
esp_gatt_status_t status;
btgatt_db_element_t *db = NULL;
int incl_num = 0;
uint16_t incl_num = 0;
tBT_UUID bta_uuid = {0};
if (incl_uuid != NULL) {
@ -526,14 +526,14 @@ esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
BTA_GATTC_GetIncludeService(conn_id, start_handle, end_handle, NULL, &db, &incl_num);
}
if ((status = btc_gattc_check_valid_param(incl_num, 0)) != ESP_GATT_OK) {
if ((status = btc_gattc_check_valid_param((int)incl_num, 0)) != ESP_GATT_OK) {
if (db) {
osi_free(db);
}
*count = 0;
return status;
}else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)incl_num, ESP_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
btc_gattc_fill_gatt_db_conversion(*count, incl_num, ESP_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
}
*count = incl_num;
@ -552,9 +552,9 @@ esp_gatt_status_t btc_ble_gattc_get_attr_count(uint16_t conn_id,
uint16_t *count)
{
if (type == ESP_GATT_DB_ALL) {
BTA_GATTC_GetDBSize(conn_id, start_handle, end_handle, (int *)count);
BTA_GATTC_GetDBSize(conn_id, start_handle, end_handle, count);
} else {
BTA_GATTC_GetDBSizeByType(conn_id, type, start_handle, end_handle, char_handle, (int *)count);
BTA_GATTC_GetDBSizeByType(conn_id, type, start_handle, end_handle, char_handle, count);
}
return ESP_GATT_OK;
@ -564,7 +564,7 @@ esp_gatt_status_t btc_ble_gattc_get_db(uint16_t conn_id, uint16_t start_handle,
esp_gattc_db_elem_t *db, uint16_t *count)
{
btgatt_db_element_t *get_db = NULL;
int num = 0;
uint16_t num = 0;
tBT_UUID bta_uuid;
uint16_t db_size = 0;
BTA_GATTC_GetGattDb(conn_id, start_handle, end_handle, &get_db, &num);

View file

@ -389,7 +389,13 @@ static void btc_gatts_act_create_attr_tab(esp_gatts_attr_db_t *gatts_attr_db,
case ESP_GATT_UUID_CHAR_AGG_FORMAT:
case ESP_GATT_UUID_CHAR_VALID_RANGE:
case ESP_GATT_UUID_EXT_RPT_REF_DESCR:
case ESP_GATT_UUID_RPT_REF_DESCR:{
case ESP_GATT_UUID_RPT_REF_DESCR:
case ESP_GATT_UUID_NUM_DIGITALS_DESCR:
case ESP_GATT_UUID_VALUE_TRIGGER_DESCR:
case ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR:
case ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR:
case ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR:
case ESP_GATT_UUID_TIME_TRIGGER_DESCR: {
uint16_t svc_hal = btc_creat_tab_env.svc_start_hdl;
tBT_UUID bta_char_uuid;
esp_bt_uuid_t uuid_temp;
@ -449,7 +455,7 @@ static esp_gatt_status_t btc_gatts_check_valid_attr_tab(esp_gatts_attr_db_t *gat
case ESP_GATT_UUID_PRI_SERVICE:
case ESP_GATT_UUID_SEC_SERVICE:
if (++svc_num > 1) {
BTC_TRACE_ERROR("Each service table can only created one primary service or secondly service.");
BTC_TRACE_ERROR("Each service table can only created one primary service or secondary service.");
return ESP_GATT_ERROR;
}
break;
@ -961,4 +967,13 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
btc_gatts_cb_param_copy_free(msg, p_data);
}
void btc_congest_callback(tBTA_GATTS *param)
{
esp_ble_gatts_cb_param_t esp_param;
esp_gatt_if_t gatts_if = BTC_GATT_GET_GATT_IF(param->congest.conn_id);
esp_param.congest.conn_id = BTC_GATT_GET_CONN_ID(param->congest.conn_id);
esp_param.congest.congested = param->congest.congested;
btc_gatts_cb_to_app(ESP_GATTS_CONGEST_EVT, gatts_if, &esp_param);
}
#endif ///GATTS_INCLUDED

View file

@ -16,6 +16,7 @@
#define __BTC_GAP_BT_H__
#include "common/bt_target.h"
#include "common/bt_defs.h"
#include "esp_bt_defs.h"
#include "esp_gap_bt_api.h"
#include "btc/btc_task.h"
@ -32,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 {

View file

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

View file

@ -29,6 +29,7 @@
#include <sys/fcntl.h>
#include "esp_vfs.h"
#include "esp_vfs_dev.h"
#include "stack/port_api.h"
#if (defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE)
@ -55,13 +56,20 @@ typedef struct {
char service_name[ESP_SPP_SERVER_NAME_MAX + 1];
} spp_slot_t;
static struct spp_local_param_t {
spp_slot_t *spp_slots[BTA_JV_MAX_RFC_SR_SESSION + 1];
typedef struct {
spp_slot_t *spp_slots[MAX_RFC_PORTS + 1];
uint32_t spp_slot_id;
esp_spp_mode_t spp_mode;
osi_mutex_t spp_slot_mutex;
esp_vfs_id_t spp_vfs_id;
} spp_local_param;
} spp_local_param_t;
#if SPP_DYNAMIC_MEMORY == FALSE
static spp_local_param_t spp_local_param;
#else
static spp_local_param_t *spp_local_param_ptr;
#define spp_local_param (*spp_local_param_ptr)
#endif
static void spp_osi_free(void *p)
{
@ -73,7 +81,7 @@ static spp_slot_t *spp_malloc_slot(void)
if (++spp_local_param.spp_slot_id == 0) {
spp_local_param.spp_slot_id = 1;
}
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
if (spp_local_param.spp_slots[i] == NULL) {
spp_local_param.spp_slots[i] = (spp_slot_t *)osi_malloc(sizeof(spp_slot_t));
if (!spp_local_param.spp_slots[i]) {
@ -81,6 +89,9 @@ static spp_slot_t *spp_malloc_slot(void)
}
spp_local_param.spp_slots[i]->id = spp_local_param.spp_slot_id;
spp_local_param.spp_slots[i]->serial = i;
spp_local_param.spp_slots[i]->sdp_handle = 0;
spp_local_param.spp_slots[i]->rfc_handle = 0;
spp_local_param.spp_slots[i]->rfc_port_handle = 0;
spp_local_param.spp_slots[i]->connected = FALSE;
spp_local_param.spp_slots[i]->write_data = NULL;
spp_local_param.spp_slots[i]->list = list_new(spp_osi_free);
@ -101,7 +112,7 @@ static spp_slot_t *spp_malloc_slot(void)
static spp_slot_t *spp_find_slot_by_id(uint32_t id)
{
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->id == id) {
return spp_local_param.spp_slots[i];
}
@ -111,7 +122,7 @@ static spp_slot_t *spp_find_slot_by_id(uint32_t id)
static spp_slot_t *spp_find_slot_by_handle(uint32_t handle)
{
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->rfc_handle == handle) {
return spp_local_param.spp_slots[i];
}
@ -121,7 +132,7 @@ static spp_slot_t *spp_find_slot_by_handle(uint32_t handle)
static spp_slot_t *spp_find_slot_by_fd(int fd)
{
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->fd == fd) {
return spp_local_param.spp_slots[i];
}
@ -129,6 +140,16 @@ static spp_slot_t *spp_find_slot_by_fd(int fd)
return NULL;
}
static spp_slot_t *spp_find_slot_by_scn(uint32_t scn)
{
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->scn == (uint8_t)scn) {
return spp_local_param.spp_slots[i];
}
}
return NULL;
}
static void spp_free_slot(spp_slot_t *slot)
{
if (!slot) {
@ -160,15 +181,6 @@ static void btc_create_server_fail_cb(void)
btc_spp_cb_to_app(ESP_SPP_START_EVT, &param);
}
static void btc_disconnect_cb(uint32_t handle)
{
esp_spp_cb_param_t param;
param.close.status = ESP_SPP_SUCCESS;
param.close.handle = handle;
param.close.async = FALSE;
btc_spp_cb_to_app(ESP_SPP_CLOSE_EVT, &param);
}
static void *btc_spp_rfcomm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data)
{
bt_status_t status;
@ -177,34 +189,53 @@ static void *btc_spp_rfcomm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *u
uint32_t id = (uintptr_t)user_data;
spp_slot_t *slot, *slot_new;
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_WARNING("%s SPP have been deinit, incoming events ignore!\n", __func__);
return new_user_data;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
switch (event) {
case BTA_JV_RFCOMM_SRV_OPEN_EVT:
case BTA_JV_RFCOMM_START_EVT:
slot = spp_find_slot_by_id(id);
if (!slot) {
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
break;
}
slot_new = spp_malloc_slot();
if (!slot_new) {
BTC_TRACE_ERROR("%s unable to malloc RFCOMM slot!", __func__);
slot->rfc_handle = p_data->rfc_start.handle;
slot->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_start.handle);
break;
case BTA_JV_RFCOMM_SRV_OPEN_EVT:
slot = p_data->rfc_srv_open.handle ? spp_find_slot_by_id(id) : spp_find_slot_by_scn((uint32_t)user_data);
if (!slot) {
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
break;
}
new_user_data = (void *)(uintptr_t)slot_new->id;
slot_new->security = slot->security;
slot_new->role = slot->role;
slot_new->scn = slot->scn;;
slot_new->max_session = slot->max_session;
strcpy(slot_new->service_name, slot->service_name);
slot_new->sdp_handle = slot->sdp_handle;
slot_new->rfc_handle = p_data->rfc_srv_open.new_listen_handle;
slot_new->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_srv_open.new_listen_handle);
memcpy(slot->addr, p_data->rfc_srv_open.rem_bda, ESP_BD_ADDR_LEN);
slot->connected = TRUE;
slot->rfc_handle = p_data->rfc_srv_open.handle;
slot->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_srv_open.handle);
BTA_JvSetPmProfile(p_data->rfc_srv_open.handle, BTA_JV_PM_ALL, BTA_JV_CONN_OPEN);
if (p_data->rfc_srv_open.handle) {
new_user_data = (void *)(uintptr_t)slot->id;
memcpy(slot->addr, p_data->rfc_srv_open.rem_bda, ESP_BD_ADDR_LEN);
slot->connected = TRUE;
slot->rfc_handle = p_data->rfc_srv_open.handle;
slot->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_srv_open.handle);
BTA_JvSetPmProfile(p_data->rfc_srv_open.handle, BTA_JV_PM_ALL, BTA_JV_CONN_OPEN);
}
if (p_data->rfc_srv_open.handle != p_data->rfc_srv_open.new_listen_handle) {
slot_new = spp_malloc_slot();
if (!slot_new) {
BTC_TRACE_ERROR("%s unable to malloc RFCOMM slot!", __func__);
break;
}
new_user_data = (void *)(uintptr_t)slot_new->id;
slot_new->security = slot->security;
slot_new->role = slot->role;
slot_new->scn = slot->scn;
slot_new->max_session = slot->max_session;
strcpy(slot_new->service_name, slot->service_name);
slot_new->sdp_handle = slot->sdp_handle;
slot_new->rfc_handle = p_data->rfc_srv_open.new_listen_handle;
slot_new->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_srv_open.new_listen_handle);
}
break;
case BTA_JV_RFCOMM_OPEN_EVT:
slot = spp_find_slot_by_id(id);
@ -223,14 +254,26 @@ static void *btc_spp_rfcomm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *u
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
break;
}
if (slot->connected) {
BTA_JvRfcommClose(slot->rfc_handle, (void *)slot->id);
if (slot->connected && p_data->rfc_close.port_status != PORT_LOCAL_CLOSED) {
BTA_JvRfcommClose(slot->rfc_handle, NULL, (void *)slot->id);
}
spp_free_slot(slot);
p_data->rfc_close.status = BTA_JV_SUCCESS;
break;
case BTA_JV_RFCOMM_DATA_IND_EVT:
break;
case BTA_JV_FREE_SCN_EVT:
if (user_data) {
id = ((tBTA_JV_FREE_SCN_USER_DATA *)user_data)->slot_id;
slot = spp_find_slot_by_id(id);
if (slot) {
spp_free_slot(slot);
} else {
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
}
osi_free(user_data);
}
break;
default:
break;
}
@ -292,8 +335,15 @@ static void btc_spp_dm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_d
} else {
BTC_TRACE_ERROR("%s unable to create record, start server fail!", __func__);
btc_create_server_fail_cb();
BTA_JvFreeChannel(slot->scn, BTA_JV_CONN_TYPE_RFCOMM);
spp_free_slot(slot);
tBTA_JV_FREE_SCN_USER_DATA *user_data = osi_malloc(sizeof(tBTA_JV_FREE_SCN_USER_DATA));
if (user_data) {
user_data->server_status = BTA_JV_SERVER_START_FAILED;
user_data->slot_id = slot->id;
} else {
BTC_TRACE_ERROR("%s unable to malloc user data!", __func__);
}
BTA_JvFreeChannel(slot->scn, BTA_JV_CONN_TYPE_RFCOMM,
(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb, (void *)user_data);
}
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
break;
@ -313,6 +363,22 @@ static void btc_spp_dm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_d
static void btc_spp_init(btc_spp_args_t *arg)
{
if (spp_local_param.spp_slot_mutex) {
esp_spp_cb_param_t param;
param.init.status = ESP_SPP_FAILURE;
btc_spp_cb_to_app(ESP_SPP_INIT_EVT, &param);
BTC_TRACE_ERROR("%s SPP has been initiated, shall uninit first!", __func__);
return;
}
#if SPP_DYNAMIC_MEMORY == TRUE
if ((spp_local_param_ptr = (spp_local_param_t *)osi_malloc(sizeof(spp_local_param_t))) == NULL) {
BTC_TRACE_ERROR("%s malloc failed\n", __func__);
return;
}
memset((void *)spp_local_param_ptr, 0, sizeof(spp_local_param_t));
#endif
if (osi_mutex_new(&spp_local_param.spp_slot_mutex) != 0) {
BTC_TRACE_ERROR("%s osi_mutex_new failed\n", __func__);
return;
@ -324,40 +390,65 @@ static void btc_spp_init(btc_spp_args_t *arg)
static void btc_spp_uninit(void)
{
esp_spp_cb_param_t param;
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
param.uninit.status = ESP_SPP_FAILURE;
btc_spp_cb_to_app(ESP_SPP_UNINIT_EVT, &param);
BTC_TRACE_ERROR("%s SPP has not been initiated, shall init first!", __func__);
return;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
// first, remove all connection
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->connected) {
BTA_JvRfcommClose(spp_local_param.spp_slots[i]->rfc_handle, (void *)spp_local_param.spp_slots[i]->id);
spp_free_slot(spp_local_param.spp_slots[i]);
spp_local_param.spp_slots[i] = NULL;
}
}
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
if (spp_local_param.spp_slots[i] != NULL && !(spp_local_param.spp_slots[i]->connected)) {
BTA_JvRfcommStopServer(spp_local_param.spp_slots[i]->sdp_handle, (void *)spp_local_param.spp_slots[i]->id);
BTA_JvDeleteRecord(spp_local_param.spp_slots[i]->sdp_handle);
BTA_JvFreeChannel(spp_local_param.spp_slots[i]->scn, BTA_JV_CONN_TYPE_RFCOMM);
spp_free_slot(spp_local_param.spp_slots[i]);
spp_local_param.spp_slots[i] = NULL;
BTA_JvRfcommClose(spp_local_param.spp_slots[i]->rfc_handle,(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb,
(void *)spp_local_param.spp_slots[i]->id);
}
}
// second, remove all server
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
if (spp_local_param.spp_slots[i] != NULL && !spp_local_param.spp_slots[i]->connected) {
if (spp_local_param.spp_slots[i]->sdp_handle > 0) {
BTA_JvDeleteRecord(spp_local_param.spp_slots[i]->sdp_handle);
}
BTA_JvDisable();
if (spp_local_param.spp_slots[i]->rfc_handle > 0) {
BTA_JvRfcommStopServer(spp_local_param.spp_slots[i]->rfc_handle,
(void *)spp_local_param.spp_slots[i]->id);
}
tBTA_JV_FREE_SCN_USER_DATA *user_data = osi_malloc(sizeof(tBTA_JV_FREE_SCN_USER_DATA));
if (user_data) {
user_data->server_status = BTA_JV_SERVER_RUNNING;
user_data->slot_id = spp_local_param.spp_slots[i]->id;
} else {
BTC_TRACE_ERROR("%s unable to malloc user data!", __func__);
param.srv_stop.status = ESP_SPP_NO_RESOURCE;
btc_spp_cb_to_app(ESP_SPP_SRV_STOP_EVT, &param);
}
BTA_JvFreeChannel(spp_local_param.spp_slots[i]->scn, BTA_JV_CONN_TYPE_RFCOMM,
(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb, (void *)user_data);
}
}
BTA_JvDisable((tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb);
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
osi_mutex_free(&spp_local_param.spp_slot_mutex);
}
static void btc_spp_start_discovery(btc_spp_args_t *arg)
{
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return;
}
BTA_JvStartDiscovery(arg->start_discovery.bd_addr, arg->start_discovery.num_uuid, arg->start_discovery.p_uuid_list, NULL);
}
static void btc_spp_connect(btc_spp_args_t *arg)
{
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
spp_slot_t *slot = spp_malloc_slot();
if (!slot) {
@ -376,6 +467,10 @@ static void btc_spp_connect(btc_spp_args_t *arg)
static void btc_spp_disconnect(btc_spp_args_t *arg)
{
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
spp_slot_t *slot = spp_find_slot_by_handle(arg->disconnect.handle);
if (!slot) {
@ -383,14 +478,16 @@ static void btc_spp_disconnect(btc_spp_args_t *arg)
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
return;
}
BTA_JvRfcommClose(arg->disconnect.handle, (void *)slot->id);
btc_disconnect_cb(slot->rfc_handle);
spp_free_slot(slot);
BTA_JvRfcommClose(arg->disconnect.handle, (tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb, (void *)slot->id);
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
}
static void btc_spp_start_srv(btc_spp_args_t *arg)
{
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
spp_slot_t *slot = spp_malloc_slot();
if (!slot) {
@ -408,8 +505,54 @@ static void btc_spp_start_srv(btc_spp_args_t *arg)
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
}
static void btc_spp_stop_srv(void) {
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return;
}
esp_spp_cb_param_t param;
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
// first, remove all connection
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->connected) {
BTA_JvRfcommClose(spp_local_param.spp_slots[i]->rfc_handle,(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb,
(void *)spp_local_param.spp_slots[i]->id);
}
}
// second, remove all server
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
if (spp_local_param.spp_slots[i] != NULL && !spp_local_param.spp_slots[i]->connected) {
if (spp_local_param.spp_slots[i]->sdp_handle > 0) {
BTA_JvDeleteRecord(spp_local_param.spp_slots[i]->sdp_handle);
}
if (spp_local_param.spp_slots[i]->rfc_handle > 0) {
BTA_JvRfcommStopServer(spp_local_param.spp_slots[i]->rfc_handle,
(void *)spp_local_param.spp_slots[i]->id);
}
tBTA_JV_FREE_SCN_USER_DATA *user_data = osi_malloc(sizeof(tBTA_JV_FREE_SCN_USER_DATA));
if (user_data) {
user_data->server_status = BTA_JV_SERVER_RUNNING;
user_data->slot_id = spp_local_param.spp_slots[i]->id;
} else {
BTC_TRACE_ERROR("%s unable to malloc user data!", __func__);
param.srv_stop.status = ESP_SPP_NO_RESOURCE;
btc_spp_cb_to_app(ESP_SPP_SRV_STOP_EVT, &param);
}
BTA_JvFreeChannel(spp_local_param.spp_slots[i]->scn, BTA_JV_CONN_TYPE_RFCOMM,
(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb, (void *)user_data);
}
}
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
}
static void btc_spp_write(btc_spp_args_t *arg)
{
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
spp_slot_t *slot = spp_find_slot_by_handle(arg->write.handle);
if (!slot) {
@ -423,7 +566,7 @@ static void btc_spp_write(btc_spp_args_t *arg)
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
return;
}
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0,990);
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0, BTA_JV_DEF_RFC_MTU);
if (item_size != 0){
slot->write_data = data;
BTA_JvRfcommWrite(arg->write.handle, slot->id, item_size, data);
@ -504,6 +647,9 @@ void btc_spp_call_handler(btc_msg_t *msg)
case BTC_SPP_ACT_START_SRV:
btc_spp_start_srv(arg);
break;
case BTC_SPP_ACT_STOP_SRV:
btc_spp_stop_srv();
break;
case BTC_SPP_ACT_WRITE:
btc_spp_write(arg);
break;
@ -562,22 +708,24 @@ void btc_spp_cb_handler(btc_msg_t *msg)
btc_spp_cb_to_app(ESP_SPP_START_EVT, &param);
break;
case BTA_JV_RFCOMM_SRV_OPEN_EVT:
if (spp_local_param.spp_mode == ESP_SPP_MODE_VFS) {
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
slot = spp_find_slot_by_handle(p_data->rfc_srv_open.handle);
if (!slot) {
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
if (p_data->rfc_srv_open.handle) {
if (spp_local_param.spp_mode == ESP_SPP_MODE_VFS) {
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
slot = spp_find_slot_by_handle(p_data->rfc_srv_open.handle);
if (!slot) {
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
break;
}
param.srv_open.fd = slot->fd;
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
break;
}
param.srv_open.fd = slot->fd;
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
param.srv_open.status = p_data->rfc_srv_open.status;
param.srv_open.handle = p_data->rfc_srv_open.handle;
param.srv_open.new_listen_handle = p_data->rfc_srv_open.new_listen_handle;
memcpy(param.srv_open.rem_bda, p_data->rfc_srv_open.rem_bda, ESP_BD_ADDR_LEN);
btc_spp_cb_to_app(ESP_SPP_SRV_OPEN_EVT, &param);
}
param.srv_open.status = p_data->rfc_srv_open.status;
param.srv_open.handle = p_data->rfc_srv_open.handle;
param.srv_open.new_listen_handle = p_data->rfc_srv_open.new_listen_handle;
memcpy(param.srv_open.rem_bda, p_data->rfc_srv_open.rem_bda, ESP_BD_ADDR_LEN);
btc_spp_cb_to_app(ESP_SPP_SRV_OPEN_EVT, &param);
break;
case BTA_JV_RFCOMM_WRITE_EVT:
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
@ -609,7 +757,7 @@ void btc_spp_cb_handler(btc_msg_t *msg)
slot->write_data = NULL;
}
size_t item_size = 0;
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0,990);
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0, BTA_JV_DEF_RFC_MTU);
if (item_size != 0){
slot->write_data = data;
BTA_JvRfcommWrite(slot->rfc_handle, slot->id, item_size, data);
@ -645,7 +793,7 @@ void btc_spp_cb_handler(btc_msg_t *msg)
slot->write_data = NULL;
}
size_t item_size = 0;
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0,990);
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0, BTA_JV_DEF_RFC_MTU);
if (item_size != 0){
slot->write_data = data;
BTA_JvRfcommWrite(slot->rfc_handle, slot->id, item_size, data);
@ -668,6 +816,22 @@ void btc_spp_cb_handler(btc_msg_t *msg)
btc_spp_cb_to_app(ESP_SPP_DATA_IND_EVT, &param);
osi_free (p_data->data_ind.p_buf);
break;
case BTA_JV_FREE_SCN_EVT:
if (p_data->free_scn.server_status == BTA_JV_SERVER_RUNNING) {
param.srv_stop.status = p_data->free_scn.status;
btc_spp_cb_to_app(ESP_SPP_SRV_STOP_EVT, &param);
}
break;
case BTA_JV_DISABLE_EVT:
param.uninit.status = ESP_SPP_SUCCESS;
BTA_JvFree();
osi_mutex_free(&spp_local_param.spp_slot_mutex);
#if SPP_DYNAMIC_MEMORY == TRUE
osi_free(spp_local_param_ptr);
spp_local_param_ptr = NULL;
#endif
btc_spp_cb_to_app(ESP_SPP_UNINIT_EVT, &param);
break;
default:
BTC_TRACE_DEBUG("%s: Unhandled event (%d)!", __FUNCTION__, msg->act);
break;
@ -705,12 +869,16 @@ int bta_co_rfc_data_incoming(void *user_data, BT_HDR *p_buf)
msg.act = BTA_JV_RFCOMM_DATA_IND_EVT;
uint32_t id = (uintptr_t)user_data;
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return -1;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
spp_slot_t *slot = spp_find_slot_by_id(id);
if (!slot) {
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
return 0;
return -1;
}
p_data.data_ind.handle = slot->rfc_handle;
@ -751,6 +919,10 @@ int bta_co_rfc_data_outgoing(void *user_data, uint8_t *buf, uint16_t size)
static ssize_t spp_vfs_write(int fd, const void * data, size_t size)
{
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return -1;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
spp_slot_t *slot = spp_find_slot_by_fd(fd);
if (!slot) {
@ -770,6 +942,10 @@ static ssize_t spp_vfs_write(int fd, const void * data, size_t size)
}
static int spp_vfs_close(int fd)
{
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return -1;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
spp_slot_t *slot = spp_find_slot_by_fd(fd);
if (!slot) {
@ -798,6 +974,10 @@ static bool incoming_list_2_ringbuf_read(spp_slot_t *slot)
static ssize_t spp_vfs_read(int fd, void * dst, size_t size)
{
if (!spp_local_param.spp_slot_mutex) {
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
return -1;
}
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
spp_slot_t *slot = spp_find_slot_by_fd(fd);
if (!slot) {

View file

@ -21,7 +21,7 @@
#include <stdlib.h>
#include <stdint.h>
#include "common/bt_trace.h"
#include "bt_common.h"
#include "common/bt_target.h"
#define UNUSED(x) (void)(x)
@ -65,31 +65,6 @@ typedef struct {
uint8_t uu[16];
} bt_uuid_t;
/** Bluetooth Error Status */
/** We need to build on this */
/* relate to ESP_BT_STATUS_xxx in esp_bt_defs.h */
typedef enum {
BT_STATUS_SUCCESS = 0,
BT_STATUS_FAIL,
BT_STATUS_NOT_READY,
BT_STATUS_NOMEM,
BT_STATUS_BUSY,
BT_STATUS_DONE, /* request already completed */
BT_STATUS_UNSUPPORTED,
BT_STATUS_PARM_INVALID,
BT_STATUS_UNHANDLED,
BT_STATUS_AUTH_FAILURE,
BT_STATUS_RMT_DEV_DOWN,
BT_STATUS_AUTH_REJECTED,
BT_STATUS_INVALID_STATIC_RAND_ADDR,
BT_STATUS_PENDING,
BT_STATUS_UNACCEPT_CONN_INTERVAL,
BT_STATUS_PARAM_OUT_OF_RANGE,
BT_STATUS_TIMEOUT,
BT_STATUS_MEMORY_FULL,
} bt_status_t;
#ifndef CPU_LITTLE_ENDIAN
#define CPU_LITTLE_ENDIAN
#endif

View file

@ -20,6 +20,8 @@
#ifndef BT_TARGET_H
#define BT_TARGET_H
#include "bt_common.h"
#ifndef BUILDCFG
#define BUILDCFG
#endif
@ -94,10 +96,20 @@
#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 */
#ifndef CLASSIC_BT_GATT_INCLUDED
#define CLASSIC_BT_GATT_INCLUDED FALSE
#endif /* CLASSIC_BT_GATT_INCLUDED */
#ifndef CONFIG_GATTC_CACHE_NVS_FLASH
#define CONFIG_GATTC_CACHE_NVS_FLASH FALSE
#endif /* CONFIG_GATTC_CACHE_NVS_FLASH */
@ -151,13 +163,13 @@
#ifndef CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM
#define BLE_ADV_REPORT_FLOW_CONTROL_NUM 100
#else
#else
#define BLE_ADV_REPORT_FLOW_CONTROL_NUM CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM
#endif /* CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM */
#ifndef CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD
#define BLE_ADV_REPORT_DISCARD_THRSHOLD 20
#else
#else
#define BLE_ADV_REPORT_DISCARD_THRSHOLD CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD
#endif /* CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD */
@ -287,6 +299,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
@ -345,10 +370,6 @@
#define BTA_AV_CO_CP_SCMS_T FALSE//FALSE
#endif
#ifndef QUEUE_CONGEST_SIZE
#define QUEUE_CONGEST_SIZE 40
#endif
#ifndef CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK
#define SCAN_QUEUE_CONGEST_CHECK FALSE
#else
@ -1339,7 +1360,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. */
@ -1708,15 +1729,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

View file

@ -23,38 +23,7 @@
#include <stdio.h>
#include "stack/bt_types.h"
#ifndef LOG_LOCAL_LEVEL
#ifndef BOOTLOADER_BUILD
#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#else
#define LOG_LOCAL_LEVEL CONFIG_LOG_BOOTLOADER_LEVEL
#endif
#endif
#include "esp_log.h"
// Mapping between ESP_LOG_LEVEL and BT_TRACE_LEVEL
#if (LOG_LOCAL_LEVEL >= 4)
#define LOG_LOCAL_LEVEL_MAPPING (LOG_LOCAL_LEVEL+1)
#else
#define LOG_LOCAL_LEVEL_MAPPING LOG_LOCAL_LEVEL
#endif
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define BT_LOG_LEVEL_CHECK(LAYER, LEVEL) (MAX(LAYER##_INITIAL_TRACE_LEVEL, LOG_LOCAL_LEVEL_MAPPING) >= BT_TRACE_LEVEL_##LEVEL)
//#define TAG "BT"
#define BT_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BT_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BT_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BT_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BT_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#ifndef assert
#define assert(x) do { if (!(x)) BT_PRINT_E("bt host error %s %u\n", __FILE__, __LINE__); } while (0)
#endif
#include "bt_common.h"
inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
{
@ -324,18 +293,6 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
#define BTIF_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
#endif
#ifdef CONFIG_BTC_INITIAL_TRACE_LEVEL
#define BTC_INITIAL_TRACE_LEVEL CONFIG_BTC_INITIAL_TRACE_LEVEL
#else
#define BTC_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
#endif
#ifdef CONFIG_OSI_INITIAL_TRACE_LEVEL
#define OSI_INITIAL_TRACE_LEVEL CONFIG_OSI_INITIAL_TRACE_LEVEL
#else
#define OSI_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
#endif
#ifdef CONFIG_BLUFI_INITIAL_TRACE_LEVEL
#define BLUFI_INITIAL_TRACE_LEVEL CONFIG_BLUFI_INITIAL_TRACE_LEVEL
#else
@ -497,22 +454,6 @@ extern UINT8 btif_trace_level;
#define HCI_TRACE_EVENT(fmt, args...) {if (HCI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(HCI,EVENT)) BT_PRINT_D("BT_HCI", fmt,## args);}
#define HCI_TRACE_DEBUG(fmt, args...) {if (HCI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(HCI,DEBUG)) BT_PRINT_D("BT_HCI", fmt,## args);}
/* define traces for BTC */
#define BTC_TRACE_ERROR(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(BTC, ERROR)) BT_PRINT_E("BT_BTC", fmt, ## args);}
#define BTC_TRACE_WARNING(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(BTC, WARNING)) BT_PRINT_W("BT_BTC", fmt, ## args);}
#define BTC_TRACE_API(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(BTC,API)) BT_PRINT_I("BT_BTC", fmt, ## args);}
#define BTC_TRACE_EVENT(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(BTC,EVENT)) BT_PRINT_D("BT_BTC", fmt, ## args);}
#define BTC_TRACE_DEBUG(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(BTC,DEBUG)) BT_PRINT_D("BT_BTC", fmt, ## args);}
#define BTC_TRACE_VERBOSE(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_VERBOSE && BT_LOG_LEVEL_CHECK(BTC,VERBOSE)) BT_PRINT_V("BT_BTC", fmt, ## args);}
/* define traces for OSI */
#define OSI_TRACE_ERROR(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(OSI, ERROR)) BT_PRINT_E("BT_OSI", fmt, ## args);}
#define OSI_TRACE_WARNING(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(OSI, WARNING)) BT_PRINT_W("BT_OSI", fmt, ## args);}
#define OSI_TRACE_API(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(OSI,API)) BT_PRINT_I("BT_OSI", fmt, ## args);}
#define OSI_TRACE_EVENT(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(OSI,EVENT)) BT_PRINT_D("BT_OSI", fmt, ## args);}
#define OSI_TRACE_DEBUG(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(OSI,DEBUG)) BT_PRINT_D("BT_OSI", fmt, ## args);}
#define OSI_TRACE_VERBOSE(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_VERBOSE && BT_LOG_LEVEL_CHECK(OSI,VERBOSE)) BT_PRINT_V("BT_OSI", fmt, ## args);}
/* define traces for BLUFI */
#define BLUFI_TRACE_ERROR(fmt, args...) {if (BLUFI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(BLUFI, ERROR)) BT_PRINT_E("BT_BLUFI", fmt, ## args);}
#define BLUFI_TRACE_WARNING(fmt, args...) {if (BLUFI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(BLUFI, WARNING)) BT_PRINT_W("BT_BLUFI", fmt, ## args);}
@ -671,22 +612,6 @@ extern UINT8 btif_trace_level;
#define APPL_TRACE_DEBUG(fmt, args...)
#define APPL_TRACE_VERBOSE(fmt, args...)
/* define traces for BTC */
#define BTC_TRACE_ERROR(fmt, args...)
#define BTC_TRACE_WARNING(fmt, args...)
#define BTC_TRACE_API(fmt, args...)
#define BTC_TRACE_EVENT(fmt, args...)
#define BTC_TRACE_DEBUG(fmt, args...)
#define BTC_TRACE_VERBOSE(fmt, args...)
/* define traces for OSI */
#define OSI_TRACE_ERROR(fmt, args...)
#define OSI_TRACE_WARNING(fmt, args...)
#define OSI_TRACE_API(fmt, args...)
#define OSI_TRACE_EVENT(fmt, args...)
#define OSI_TRACE_DEBUG(fmt, args...)
#define OSI_TRACE_VERBOSE(fmt, args...)
/* define traces for BLUFI */
#define BLUFI_TRACE_ERROR(fmt, args...)
#define BLUFI_TRACE_WARNING(fmt, args...)

View file

@ -31,6 +31,7 @@ typedef struct {
UINT8 ble_init_key;
UINT8 ble_resp_key;
UINT8 ble_max_key_size;
UINT8 ble_min_key_size;
UINT8 ble_accept_auth_enable;
UINT8 oob_support;
#endif
@ -48,4 +49,4 @@ typedef struct {
#endif
} tBTE_BT_APPL_CFG;
extern tBTE_BT_APPL_CFG bte_bt_appl_cfg;
extern tBTE_BT_APPL_CFG bte_bt_appl_cfg;

View file

@ -189,10 +189,10 @@ task_post_status_t hci_hal_h4_task_post(task_post_t timeout)
evt.par = 0;
if (xQueueSend(xHciH4Queue, &evt, timeout) != pdTRUE) {
return TASK_POST_SUCCESS;
return TASK_POST_FAIL;
}
return TASK_POST_FAIL;
return TASK_POST_SUCCESS;
}
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)

View file

@ -88,6 +88,13 @@ static void fragment_and_dispatch(BT_HDR *packet)
controller->get_acl_data_size_ble();
max_packet_size = max_data_size + HCI_ACL_PREAMBLE_SIZE;
if((packet->len > max_packet_size) && (packet->layer_specific == 0) && (event == MSG_STACK_TO_HC_HCI_ACL)) {
packet->event = MSG_HC_TO_STACK_L2C_SEG_XMIT;
current_fragment_packet = NULL;
callbacks->transmit_finished(packet, false);
return;
}
remaining_length = packet->len;
STREAM_TO_UINT16(continuation_handle, stream);
continuation_handle = APPLY_CONTINUATION_FLAG(continuation_handle);

View file

@ -366,4 +366,9 @@ void BTE_DeinitStack(void)
#if (defined(A2D_INCLUDED) && A2D_INCLUDED == TRUE)
A2D_Deinit();
#endif
#if (defined(RFCOMM_INCLUDED) && RFCOMM_INCLUDED == TRUE)
RFCOMM_Deinit();
#endif
}

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