Compare commits

...

968 Commits

Author SHA1 Message Date
6a9d14e963 versions: Update to v3.2.4 2020-07-14 20:40:03 +10:00
c243b7018f Merge branch 'bugfix/rs485_test_temp_disable_v32' into 'release/v3.2'
ci: temporarily disable RS485 related tests (backport v3.2)

See merge request espressif/esp-idf!9589
2020-07-14 12:28:21 +08:00
6eb6745a59 ci: temporarily disable RS485 related tests 2020-07-13 07:38:48 +02:00
a5c8cdd30e Merge branch 'bugfix/beacon_security_downgrade_v3.2' into 'release/v3.2'
Avoid parsing RSN/WPA IE's after connection (Backport v3.2)

See merge request espressif/esp-idf!9347
2020-07-03 14:00:05 +08:00
39e1cd4d74 Merge branch 'bugfix/blufi_buffer_overflow_report_v3.2' into 'release/v3.2'
blufi: When the format of the received data packet is wrong, reply with an error response(backport 3.2)

See merge request espressif/esp-idf!9197
2020-07-03 10:42:12 +08:00
dc237e205a Merge branch 'bugfix/http_server_lru_v3.2' into 'release/v3.2'
esp_http_server: Update LRU counter on accepting a new connection (v3.2)

See merge request espressif/esp-idf!9354
2020-07-02 15:37:46 +08:00
231773b28a esp_wifi: Update wifi lib
1. Avoid parsing RSN/WPA IE's after connection
2. Remove AUTH_CHANGED reason code logic
2020-07-02 06:37:13 +00:00
2ce9add5ba Merge branch 'bugfix/config_btu_stack_size_by_menuconfig_v3.2' into 'release/v3.2'
components/bt: Config BTU stack size by menuconifg

See merge request espressif/esp-idf!9385
2020-07-01 16:34:51 +08:00
56019e2c9d components/bt: Config BTU stack size by menuconifg 2020-06-29 21:22:16 +08:00
86c18a8e05 esp_http_server: Update LRU counter on accepting a new connection
Closes https://github.com/espressif/esp-idf/issues/3851
2020-06-26 19:26:07 +05:30
89bf6c2799 Merge branch 'bugfix/btdm_ble_assert_64_0_v3.2' into 'release/v3.2'
components/bt: Fix ble assert(64, 0)

See merge request espressif/esp-idf!8921
2020-06-24 17:17:56 +08:00
26cad6beaa Merge branch 'bugfix/att_buffer_count_fixed_v3.2' into 'release/v3.2'
Bugfix/att buffer count fixed v3.2

See merge request espressif/esp-idf!9163
2020-06-24 17:17:26 +08:00
a915420eec components/bt: Fix ble assert(64, 0) 2020-06-17 06:06:52 +00:00
1503a8951e Merge branch 'bugfix/httpd_lru_purge_v3.2' into 'release/v3.2'
esp_http_server: Fixed a bug which could cause issues with LRU purge (v3.2)

See merge request espressif/esp-idf!8835
2020-06-17 13:31:01 +08:00
ee79ef9ba1 blufi: When the format of the received data packet is wrong, reply with an error response 2020-06-17 12:31:15 +08:00
1cd415dfc1 Merge branch 'bugfix/authmode_degrade_fix_v3.2' into 'release/v3.2'
esp_wifi: Remove auth_changed event and fix wpa2_ent authmode threshold(backport v3.2)

See merge request espressif/esp-idf!9086
2020-06-15 23:20:13 +08:00
637090410b components/bt:Fixed the problem of incomplete data packets caused by disordered acl data packets 2020-06-13 15:33:36 +08:00
0df77d5a69 components/bt: Consider link_xmit_data_q in congest events to prevent excessive memory usage 2020-06-13 15:33:28 +08:00
e5dde19f74 Merge branch 'bugfix/modify_TCP_MSS_range_v3.2' into 'release/v3.2'
Change the default value of TCP_MSS (backport v3.2)

See merge request espressif/esp-idf!9049
2020-06-08 11:16:55 +08:00
4de12b3c0c esp_wifi: Remove auth_changed event and fix wpa2 authmode threshold 2020-06-07 11:25:50 +05:30
eb39527318 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-06-05 20:32:01 +00:00
0a08a35962 Change the default value of TCP_MSS to 1440 and TCP_MSS Range : [536 1460] 2020-06-04 12:02:40 +08:00
d15f2629b0 Merge branch 'bugfix/ci_push_to_github_on_label_v3.2' into 'release/v3.2'
ci: Don't push to Github or deploy docs on customized pipelines (v3.2)

See merge request espressif/esp-idf!8940
2020-05-27 18:42:35 +08:00
f66312d41c 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:52 +10:00
c55901bf02 Merge branch 'bugfix/ws_client_fragmented_send_v3.2' into 'release/v3.2'
ws_client: fix fragmented send setting proper opcodes (v3.2)

See merge request espressif/esp-idf!8693
2020-05-25 17:50:55 +08:00
75ebfacd28 Merge branch 'bugfix/mcpwm_period_error_v3.2' into 'release/v3.2'
bugfix(mcpwm_period_error): fix the issue of wrong period (backport v3.2)

See merge request espressif/esp-idf!7188
2020-05-25 15:36:11 +08:00
8e74a471ea Merge branch 'bugfix/fix_some_wifi_bugs_0427_v3.2' into 'release/v3.2'
Bugfix/fix some wifi bugs 0427 (v3.2)

See merge request espressif/esp-idf!8575
2020-05-22 22:00:31 +08:00
caf889f04d Merge branch 'bufix/fix_v3.2_bluedroid_bugs_mr' into 'release/v3.2'
component/bt: fix notify malloc failed , fix no BLE_AUTH_CMPL_EVT and fix bluedroid btc deinit crash(backport 3.2)

See merge request espressif/esp-idf!8753
2020-05-22 21:16:41 +08:00
af839f371f 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:18:13 +00:00
2ebd93e1d2 Merge branch 'bugfix/wps_config_method_war' into 'release/v3.2'
wpa_supplicant: WPS Inter operatability Fixes

See merge request espressif/esp-idf!8589
2020-05-22 01:07:18 +08:00
caff697a3d wifi changes:
Zhang Yan Jiao authored 2 weeks ago
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:40:01 +08:00
fe1969dd3b esp_wifi:Add softap example channel configuration 2020-05-20 11:22:38 +08:00
0fd913708c Merge branch 'bugfix/fix_switch_channel_without_discon_issue_v3.2' into 'release/v3.2'
esp_wifi: Fix AP switch to adjacent channel without disconnect (backport v3.2)

See merge request espressif/esp-idf!8769
2020-05-18 22:27:04 +08:00
zwj
c14e7c3360 :add congest direct callback and modify congest evt triger threshold 2020-05-15 16:09:53 +08:00
38d9958c11 master missing BLE_AUTH_CMPL_EVT after restart 2020-05-15 16:09:15 +08:00
026cec78e9 fix bta_dm_deinit_cb 2020-05-15 16:09:15 +08:00
5c25689f7f esp_wifi: Fix AP switch to adjacent channel without disconnect 2020-05-15 14:31:40 +08:00
5895ecff50 Merge branch 'bugfix/fix_spi_flash_clock_config_error_v3.2' into 'release/v3.2'
flash: fix spi flash clock config error (backport v3.2)

See merge request espressif/esp-idf!8516
2020-05-13 15:32:35 +08:00
90de9f4942 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-05-11 14:02:39 +05:30
f27b37a4f0 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-05-11 09:29:51 +05:30
e24b875621 Merge branch 'bugfix/timer_group_intr_enable_v3.2' into 'release/v3.2'
Fix timer group intr enable (backport v3.2)

See merge request espressif/esp-idf!8532
2020-05-08 14:59:54 +08:00
0b56e9d8b3 Merge branch 'feature/config_mqtt_task_prio_v3.2' into 'release/v3.2'
esp_mqtt: configure task priority, esp_mqtt_abort_connection race condition, clenaup logs and docs (v3.2)

See merge request espressif/esp-idf!8478
2020-05-06 16:17:51 +08:00
13c40b53d1 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:09:57 +02:00
65f012d612 mcpwm: fix the issue of wrong period (backport v3.2) 2020-04-28 21:40:17 +08:00
ec50038f84 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:43:12 +08:00
eee46733f0 Fix typo with sigmadelta.h #ifdef 2020-04-28 12:43:02 +08:00
19f43f92fa Merge branch 'bugfix/can_not_get_IP_address_from_China_mobile_v3.2' into 'release/v3.2'
wifi: fix the bug that ESP32 can't get IP address from China Mobile router (v3.2)

See merge request espressif/esp-idf!8409
2020-04-28 11:36:47 +08:00
04bf2db720 flash: fix spi flash clock config error
Closes https://github.com/espressif/esp-idf/issues/5099
2020-04-27 17:44:57 +08:00
7a9d02a18b esp_mqtt: add option to configure mqtt task priority.
Merges https://github.com/espressif/esp-idf/pull/4947
2020-04-24 16:37:25 +02:00
43175f22e9 Merge branch 'fix/ci_example_test_prov_v3.2' into 'release/v3.2'
CI: Fix prov example test exception handle (v3.2)

See merge request espressif/esp-idf!8442
2020-04-24 16:13:31 +08:00
fc067fda94 CI: Fix prov example test cryptography package version exception handling 2020-04-23 00:48:18 +05:30
f8ddcc7d74 wifi: fix the bug that ESP32 can't get IP address from China Mobile router 2020-04-20 20:05:36 +08:00
acfee765f7 Merge branch 'bugfix/btdm_backports_v3.2_0328' into 'release/v3.2'
Bugfix/btdm backports v3.2 0328

See merge request espressif/esp-idf!8154
2020-04-16 20:53:05 +08:00
2c21b0b2b3 Merge branch 'bugfix/psram_single_bit_error_v3.2' into 'release/v3.2'
psram: support psram 2T mode to fix single bit error (backport v3.2)

See merge request espressif/esp-idf!7111
2020-04-15 13:43:36 +08:00
0c7abb8978 Merge branch 'bugfix/backport_some_wifi_bugs_0326_v3.2' into 'release/v3.2'
esp32: backport some WiFi fixes (backport v3.2)

See merge request espressif/esp-idf!8307
2020-04-13 22:38:48 +08:00
bc4b78459a 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:53:27 +08:00
db38a4e068 Merge branch 'bugfix/backport_some_lwip_bugs_0327_v3.2' into 'release/v3.2'
lw-ip:backport some  lw-ip bugfix 0327 for v3.2

See merge request espressif/esp-idf!8133
2020-04-10 21:05:46 +08:00
795e9136c1 esp32: backport some WiFi fixes to v3.2
Backport following Wifi fixes:

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

2. Fix memory leak caused by esp_wifi_stop()

3. Fix WiFi log print level

4. esp_wifi_sta_get_ap_info() returns actual values of group ciphers
2020-04-10 10:54:56 +08:00
58197e9345 Merge branch 'feature/idf_version_header_v3.2' into 'release/v3.2'
esp_common: add version definitions in code and build system (backport v3.2)

See merge request espressif/esp-idf!8234
2020-04-08 15:07:48 +08:00
5f9003aa0a esp_common: add version definitions in code and build system 2020-04-03 01:27:15 +02:00
caacfd87fa Merge branch 'bugfix/btdm_dont_dequeue_the_command_queue_v3.2' into 'release/v3.2'
component/bt: fix don't dequeue the command queue after process the read_by_type_req(backport v3.2)

See merge request espressif/esp-idf!8184
2020-04-01 17:56:15 +08:00
c1163e29ee Merge branch 'backport/malloc_zero_return_null_v3.2' into 'release/v3.2'
backport/malloc_zero_return_null_v3.2

See merge request espressif/esp-idf!8143
2020-04-01 14:43:00 +08:00
49202b7f03 backport bugfix lwip for v3.2 2020-03-31 17:44:33 +08:00
3b54469bec component/bt: fix don't dequeue the command queue after process the read_by_type_req(backport v3.2) 2020-03-31 16:48:14 +08:00
ce9e4d0918 components/bt: Fix assert when create conntion cancel 2020-03-28 21:40:32 +08:00
98e183932c Fix bugs about role switch
Jitter in FHS
Jitter in first PULL
Receive EDR packet fail after role switch
2020-03-28 21:33:12 +08:00
4a9160a72c multi_heap: ensure that malloc(0) return NULL pointer in any poisoning configuration 2020-03-27 14:39:23 -03:00
c604f980d2 Merge branch 'bugfix/cmake_bugfixes_v3.2' into 'release/v3.2'
CMake-related bugfixes (v3.2)

See merge request espressif/esp-idf!8070
2020-03-26 16:36:42 +08:00
eed03c5288 Merge branch 'bugfix/esp_event_bugfixes_v3.2' into 'release/v3.2'
esp_event-related fixes (v3.2)

See merge request espressif/esp-idf!8074
2020-03-26 16:20:00 +08:00
4a9b258d46 Merge branch 'bugfix/backport_some_wifi_bugs_0323_v3.2' into 'release/v3.2'
esp_wifi: Backport some wifi bugs 0323 (backport v3.2)

See merge request espressif/esp-idf!8089
2020-03-25 17:53:20 +08:00
6f7f5c4d01 Merge branch 'bugfix/hide_unsupported_cmake_features_v3.2' into 'release/v3.2'
security: Hide Secure Boot & Flash Encryption config items when using CMake (v3.2)

See merge request espressif/esp-idf!7908
2020-03-24 18:07:05 +08:00
414b843755 esp_wifi: Update WiFi lib
1,Fix sniffer bug caused by mode switch
2,Reduce WiFi bin size
3,Add TX packets size check
4,Fix scan get rssi error
5,Add wifi stop check at WiFi deinit entry
6,Return fail when setting AP's channel is out of range
7,Fix the bug for setting channel when WiFi in NULL mode
2020-03-24 15:13:57 +08:00
0d120e0429 examples: split source files for one of the ulp examples 2020-03-23 11:52:54 +08:00
a472052dcf esp_event: remove extra line from source file 2020-03-22 22:43:55 +08:00
25baed5264 esp_event: test that handlers can unregister themselves 2020-03-22 22:43:47 +08:00
3d7364f16f Added semi-colon to esp_event_loop_create(...)
Title sums it up.
2020-03-22 22:42:25 +08:00
45120f176e cmake: fix build failure when git repo is initialized but no first commit
Closes https://github.com/espressif/esp-idf/issues/3920
2020-03-22 22:37:58 +08:00
1fa08d773f ci: add test for partition_table target 2020-03-22 22:37:48 +08:00
f8a7ef99ad partition_table: output partition table info for partition_table target 2020-03-22 22:37:38 +08:00
08caf05cd7 Merge branch 'bugfix/host_and_example_bugfix_backport_to_v3.2' into 'release/v3.2'
Bugfix/host and example bugfix backport to v3.2

See merge request espressif/esp-idf!8063
2020-03-21 15:25:47 +08:00
a2b063dc4e Component/bt :
Add handling of osi memory calloc failure.
Add length check for snprintf in osi config.
2020-03-21 13:16:11 +08:00
81ebffc0ad example/ble_hid_device_demo fix the wrong mask value according to HID protocol 2020-03-21 11:22:32 +08:00
9583c29f27 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-03-21 11:21:55 +08:00
d001c40425 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-03-21 11:18:44 +08:00
4643ca6ef8 example/ble_throughput:
Fixed the throughput wasting memory and packet loss issues.
Fixed the throughput crash bug because of using the Mutex.
2020-03-21 11:18:30 +08:00
da19c94976 bugfix: ble add missing gatt descriptors 2020-03-21 11:18:19 +08:00
0037a03106 Merge branch 'bugfix/newlib_putchar_locking_v3.2' into 'release/v3.2'
newlib: don't define non-thread-safe versions of getc, putc (backport v3.2)

See merge request espressif/esp-idf!8030
2020-03-20 16:58:04 +08:00
63a544dd3c 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:53:12 +01:00
51adc08070 Merge branch 'bugfix/compiler_err_when_performance_optimization_enabled_v3.2' into 'release/v3.2'
Bugfix/compiler err when performance optimization enabled v3.2

See merge request espressif/esp-idf!7980
2020-03-17 13:53:33 +08:00
3dbdbb4755 Merge branch 'bugfix/fix_beacon_frame_vendor_ie_issue_v3.2' into 'release/v3.2'
bugfix: Place the Vendor Specific element at the end according to the protocol (backport v3.2)

See merge request espressif/esp-idf!7779
2020-03-17 13:44:37 +08:00
f222a02518 Remove (x2) varible for BCM_STRNCPY_S and BCM_STRCPY_S 2020-03-14 15:04:44 +08:00
dc7c244055 Initialize mem_start and mem_end 2020-03-14 15:04:33 +08:00
aeebe24196 Merge branch 'bugfix/sntp_init_can_run_before_net_connection_v3.2' into 'release/v3.2'
lw_ip: Add to sys_arch_protect() a check that the mutex is created before use if not then creates it (v3.2)

See merge request espressif/esp-idf!7759
2020-03-13 20:10:33 +08:00
874b18eab8 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:26:43 +08:00
11995d808c Merge branch 'bugfix/transport_connection_active_v3.2' into 'release/v3.2'
fix(transport): Fix a bug of the connection whether be active (v3.2)

See merge request espressif/esp-idf!7742
2020-03-10 16:07:22 +08:00
f0138ffdf6 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-03-09 13:51:28 +00:00
6281b910d1 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
2020-03-09 11:14:25 +11:00
0f72e63b7a Merge branch 'bugfix/bt_interrupt_disable_timing_error_v3.2' into 'release/v3.2'
(backport v3.2) btController: events scheduling error in case of wifi and bluetooth.

See merge request espressif/esp-idf!7890
2020-03-06 11:30:22 +08:00
bf9e676884 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 19:21:16 +05:30
42869f4912 Merge branch 'feature/websocket_client_v3.2' into 'release/v3.2'
websocket: backport of websocket client to v3.2

See merge request espressif/esp-idf!7268
2020-03-03 16:03:25 +08:00
e5d8ae227d bugfix: Place the Vendor Specific element at the end according to the protocol 2020-03-02 14:15:31 +08:00
dc1f72c786 Merge branch 'feature/esp32_5p0_backport_v3p2' into 'release/v3.2'
backport esp325p0 new features and code optimize to v3.2(backport v3.2)

See merge request espressif/esp-idf!7565
2020-03-02 11:43:57 +08:00
511c1cee22 backport esp32 5p0 new features to release/v3.2 2020-02-29 09:12:15 +00:00
69230e2e3b Merge branch 'feature/dev_security_restore_backport_v3p2' into 'release/v3.2'
feature/dev_security_restore_backport_v3p2(backport release/v3.2)

See merge request espressif/esp-idf!7741
2020-02-28 21:26:29 +08:00
e1086b6b6f backport mr !6031 - fix security info restore bug 2020-02-28 11:48:52 +00:00
15d39eded5 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-02-27 08:56:43 +00:00
abe93ee7c3 websocket: backport of websocket client to v3.2
Backports the websocket client and example to ESP-IDF release 3.2.
2020-02-27 08:56:43 +00:00
ea7372d9aa Merge branch 'doc/partition_table_app_test_v3.2' into 'release/v3.2'
partition table: Update documentation about "test" partition type (v3.2)

See merge request espressif/esp-idf!7632
2020-02-27 09:13:24 +08:00
3c0ac69088 Merge branch 'bugfix/mesh_ie_issues_3.2' into 'release/v3.2'
mesh: fix mesh ie issues (backport 3.2)

See merge request espressif/esp-idf!7199
2020-02-26 22:45:55 +08:00
ce0808c7be Merge branch 'bugfix/ci_confserver_timeout_again_v3.2' into 'release/v3.2'
ci: Adjust more 'spawn' settings in test_confserver (backport v3.2)

See merge request espressif/esp-idf!5321
2020-02-25 19:48:01 +08:00
66790c3560 ci: Adjust more 'spawn' settings in test_confserver 2020-02-25 11:12:02 +00:00
eeeffcafbf Merge branch 'feature/wifi_redo_scan_example_v3.2' into 'release/v3.2'
esp_wifi: Additional code snippets in esp_wifi_scan_example (backport v3.2)

See merge request espressif/esp-idf!7503
2020-02-25 14:22:48 +08:00
254dcb755c esp_wifi: Additional code snippets in esp_wifi_scan_example (backport v3.2) 2020-02-25 14:22:47 +08:00
5ddeab1409 Merge branch 'bugfix/btdm_allow_start_adv_again_v3.2' into 'release/v3.2'
component/bt: allow to send stop adv again and fix tx prog crash (backport v3.2)

See merge request espressif/esp-idf!6917
2020-02-24 20:17:44 +08:00
a988c6bdb6 Merge branch 'bugfix/mbedtls_esp_bignum_v3.2' into 'release/v3.2'
mbedtls: esp bignum fix for 4096 keys (v3.2)

See merge request espressif/esp-idf!7707
2020-02-24 11:44:03 +08:00
9c1935e24c 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:55:49 +08:00
fda11a687d Merge branch 'bugfix/add_option_to_ipv6_stateless_address_configuration_v3.2' into 'release/v3.2'
lw-ip: Add option to ipv6 stateless address configuration (backport v3.2)

See merge request espressif/esp-idf!7695
2020-02-21 14:56:44 +08:00
886bc21f7f Merge branch 'fix/cmake_absolute_path_to_run_esptool' into 'release/v3.2'
project_include.cmake: Make esptool_py_custom_target callable from other directories (backport v3.2)

See merge request espressif/esp-idf!6944
2020-02-20 18:37:19 +08:00
7b495db118 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:06:28 +01:00
bdf477e76d mbedtls: added mpi multiplication test for large numbers 2020-02-20 10:06:28 +01:00
b57134d21e project_include.cmake: Make esptool_py_custom_target callable from other directories 2020-02-20 13:06:18 +05:30
bdb1391eeb component/bt: allow to send stop adv again and fix tx prog crash 2020-02-20 14:26:47 +08:00
ecb5370ca6 lw-ip: Add option to ipv6 stateless address configuration 2020-02-20 14:26:19 +08:00
59f2b3f036 Merge branch 'bugfix/enable_ipv6_address_autoconfig_v3.2' into 'release/v3.2'
lw-ip: Enable IPv6 stateless address autoconfiguration (backport v3.2)

See merge request espressif/esp-idf!7660
2020-02-20 12:44:58 +08:00
aaf98c14fd Merge branch 'bugfix/i2s_timergroup_some_issues_v3.2' into 'release/v3.2'
bugfix(driver): fix i2s and timergroup some issues(backport v3.2)

See merge request espressif/esp-idf!7174
2020-02-20 00:20:54 +08:00
491c64e337 Merge branch 'bugfix/controller_initializer_order_3.2' into 'release/v3.2'
Fix the initializer order

See merge request espressif/esp-idf!7624
2020-02-19 17:10:50 +08:00
5693dd69ed Merge branch 'bugfix/fix_airkiss_bug_v3.2' into 'release/v3.2'
fix the bug for Airkiss (backport v3.2)

See merge request espressif/esp-idf!7667
2020-02-19 16:40:18 +08:00
1b21573901 fix the bug for Airkiss can't get the ip of the cellphone 2020-02-19 10:38:05 +08:00
a40b4d7167 Merge branch 'bugfix/unified_prov_bluedroid_v3.2' into 'release/v3.2'
Unified Provisioning - BLE: Fix characteristics read response issue (backport v3.2)

See merge request espressif/esp-idf!7648
2020-02-18 20:59:13 +08:00
297146c410 lw-ip: Enable IPv6 stateless address autoconfiguration 2020-02-18 19:38:09 +08:00
3452d579ac 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 14:59:26 +05:30
fcd857e0f1 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:59 +11:00
714afdec6d Fix the initializer order 2020-02-17 16:10:53 +08:00
3f3c21c966 Merge branch 'bugfix/doc_sphinxcontrib_dep_v3.2' into 'release/v3.2'
Docs: Fix sphinxcontrib dependencies (v3.2)

See merge request espressif/esp-idf!7612
2020-02-17 15:08:00 +08:00
6db5ca3458 Merge branch 'bugfix/udp_random_port_for_3.2' into 'release/v3.2'
lw-ip:bugfix for add random udp port for 3.2

See merge request espressif/esp-idf!7297
2020-02-15 13:08:45 +08:00
c2f1cd5bc0 bugfix for add random udp port for 3.2 2020-02-14 22:00:16 +08:00
b55b6c6abf Docs: Fix sphinxcontrib dependencies 2020-02-14 10:54:17 +01:00
eb3f02a41a Merge branch 'hfp_a2dp_coex_iphone_3.2' into 'release/v3.2'
components bt/: Disable sniff mode during (e)SCO connection for HFP. [backport 3.2]

See merge request espressif/esp-idf!7251
2020-02-14 17:12:03 +08:00
263c670342 Merge branch 'bugfix/wifi_clear_phy_status_when_cpu_start_v3.2' into 'release/v3.2'
soc: clear PHY status when cpu start (backport v3.2)

See merge request espressif/esp-idf!7591
2020-02-14 11:35:14 +08:00
34f6bde8bc Merge branch 'bugfix/fix_double_recycle_bar_crash_issue_v3.2' into 'release/v3.2'
esp32: fix the crash caused by double free BAR buffer (backport v3.2)

See merge request espressif/esp-idf!7569
2020-02-14 11:33:36 +08:00
2a7d2a7795 soc: clear PHY status when cpu start 2020-02-13 14:28:33 +08:00
448dd7c6ca esp32: fix the crash caused by double free BAR buffer 2020-02-12 16:38:47 +08:00
ea7f34df17 Merge branch 'bugfix/ci_deploy_tags_v3.2' into 'release/v3.2'
ci: fix tags for internal deploy jobs (backport v3.2)

See merge request espressif/esp-idf!7293
2020-02-08 13:21:58 +08:00
2df539062f ci: fix tags for internal deploy jobs 2020-02-07 04:17:53 +00:00
8e4a63f2f8 Merge branch 'bugfix/doc_nwdiag_v3.2' into 'release/v3.2'
docs: Fix nwdiag dependency for documentation build (v3.2)

See merge request espressif/esp-idf!7518
2020-02-07 06:20:00 +08:00
53c4c55e72 docs: Fix nwdiag dependency for documentation build 2020-02-06 17:52:48 +01:00
b83749988c Merge branch 'bugfix/esp_timer_stucks_into_esp_timer_impl_set_alarm_v3.2' into 'release/v3.2'
esp_timer/esp32: Fix esp_timer_impl_set_alarm() when CPU and APB freqs are changed (v3.2)

See merge request espressif/esp-idf!7442
2020-02-06 14:31:17 +08:00
a3a0d4d2ad Merge branch 'bugfix/wps_config_init_v3.2' into 'release/v3.2'
WPS_CONFIG_INIT_DEFAULT(type) error

See merge request espressif/esp-idf!7313
2020-02-06 14:06:13 +08:00
ab0f6aceac 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:47 +00:00
e789da12bd Fix wps config for support with gnu++11 as well as c99. 2020-01-31 05:57:58 +00:00
7e416fec15 Merge branch 'bugfix/esp_ptr_executable_single_core_v3.2' into 'release/v3.2'
soc: Fix esp_ptr_executable() for single core ESP32 config & cache memory (v3.2)

See merge request espressif/esp-idf!7466
2020-01-31 12:59:38 +08:00
923cd98b9e 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:19 +11:00
3b7777e22d Merge branch 'bugfix/mqtt_submodule_ref_update_v3.2' into 'release/v3.2'
mqtt: update submodule to point to latest commit (backport v3.2)

See merge request espressif/esp-idf!7288
2020-01-22 11:29:18 +08:00
a9d3b625c4 Merge branch 'bugfix/wa_dport_and_intr_v3.2' into 'release/v3.2'
esp32: Fix for DPORT (v3.2)

See merge request espressif/esp-idf!7351
2020-01-21 10:47:35 +08:00
b2fee9a686 Merge branch 'bugfix/ci_submodule_checkout_v3.2' into 'release/v3.2'
ci: Clean submodules after fetching sources (v3.2)

See merge request espressif/esp-idf!7386
2020-01-20 21:54:08 +08:00
bccd747028 Merge branch 'bugfix/backport_some_wifi_bugs_0107_v3.2' into 'release/v3.2'
backport some Wi-Fi bugs 0107 (backport v3.2)

See merge request espressif/esp-idf!7245
2020-01-20 16:42:19 +08:00
db635956fb lwip: Drop packets larger than MTU 2020-01-20 08:01:59 +00:00
9f8efed1eb 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
2020-01-20 08:01:59 +00:00
644591b0d5 Update wifi lib
1,Fix wifi block scan crash issue.
2,Fix association request RSN information length too big lead crash
3,Fix wifi stop bug when sniffer enable
4,coex:fix wifi scan and connect bugs
5,Fix some wifi timer bugs
6,Fix wifi RX bug
7,Fix the bugs for bandwidth
8,Fix the bug for espnow
9,Fix AMSDU decrypt bug
10,Fix wifi reload issue
2020-01-20 08:01:59 +00:00
0e8f66e017 fix the bugs for espnow and bandwidth 2020-01-20 08:01:59 +00:00
d62bb227b7 esp32: fix a WiFi RX bug
Support WiFi/BT MAC register writting when the WiFi/BT common clock is disabled.
2020-01-20 08:01:59 +00:00
3914aaac76 ci: Clean submodules after fetching sources
Assuming no submodule dirs contain artifacts that we can't clean
2020-01-20 12:27:43 +11:00
5f3957a20e Merge branch 'bugfix/btdm_backports_v3.2_0114' into 'release/v3.2'
components/bt: backport release/v3.2

See merge request espressif/esp-idf!7359
2020-01-19 11:49:17 +08:00
9463114e27 components/bt: backport release/v3.2
Fix A2DP stuck when BLE's interval is too small
Fix assert due to no free element from
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 16:19:14 +08:00
a22a543636 esp32: Add UT for DPORT 2020-01-16 14:36:26 +08:00
adf8131c20 esp32: Fix esp_dport_access_reg_read 2020-01-16 14:36:26 +08:00
8442ec3413 Merge branch 'bugfix/btdm_fix_multi_open_evt_and_clear_blufi_prepare_write_len_v3.2' into 'release/v3.2'
component/bt: fix multi open evt and clear blufi prepare write len(backport v3.2)

See merge request espressif/esp-idf!7326
2020-01-16 11:48:30 +08:00
d2c80e0e73 Merge branch 'bugfix/msys2_environment_update_v3.2' into 'release/v3.2'
doc: Update MSYS2 pre-compiled environment zip (v3.2)

See merge request espressif/esp-idf!7144
2020-01-15 11:31:40 +08:00
02687b9b40 component/bt: fix blufi prepare write buf len invalid 2020-01-14 17:49:41 +08:00
0193e34c62 Component/bt: Fix GATTC trigger open event multiple times 2020-01-14 17:49:32 +08:00
e22d3dd804 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-01-14 10:53:01 +08:00
287bee03b3 Merge branch 'bugfix/mdns_send_sdptr_answer_v3.2' into 'release/v3.2'
mdns: respond to discovery with the proper pseudo name _services._dns-sd._udp (v3.2)

See merge request espressif/esp-idf!7244
2020-01-09 13:00:53 +08:00
1a897da635 Merge branch 'bugfix/btdm_avrc_category_v3.2' into 'release/v3.2'
components/bt: Choose AVRC category according to A2DP role

See merge request espressif/esp-idf!7178
2020-01-09 11:34:59 +08:00
344c86bc3e hfp a2dp iphone 3.2 2020-01-08 19:44:23 +08:00
7a74262858 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:27 +01:00
2a6a2bf39f Merge branch 'bugfix/fix_performance_issues_new_v3.2' into 'release/v3.2'
esp32: fix WiFi performance issue (backport v3.2)

See merge request espressif/esp-idf!7225
2020-01-08 14:45:32 +08:00
1d7c633349 esp32: fix WiFi performance issue 2020-01-06 21:28:18 +08:00
b3f58ed2a1 components/bt: Choose AVRC category according to A2DP role 2019-12-31 15:50:44 +08:00
393464d45e 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:58:30 +08:00
45f6e45de7 doc: Update MSYS2 pre-compiled environment zip
Required to get working MSYS2 Python cryptography package
2019-12-30 13:39:48 +11:00
6916052e6d Merge branch 'bugfix/btdm_revert_changes_of_security_mask_v3.2' into 'release/v3.2'
components/bt: Revert changes of security mask

See merge request espressif/esp-idf!7122
2019-12-29 14:12:58 +08:00
8711e67e44 components/bt: Revert changes of security mask 2019-12-25 20:16:54 +08:00
3a9e986a4e Merge branch 'bugfix/update_can_target_test_backport_v3.2' into 'release/v3.2'
CAN: Reenable example tests (backport v3.2)

See merge request espressif/esp-idf!6736
2019-12-20 13:02:34 +08:00
fd921ea6e5 Merge branch 'bugfix/put_more_rx_code_to_iram_v3.2' into 'release/v3.2'
wifi: Put some rx code to iram (backport v3.2)

See merge request espressif/esp-idf!7012
2019-12-18 16:40:13 +08:00
49b2bf2656 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:30:59 +08:00
0446bfe1f4 Merge branch 'feature/can_support_low_bit_rates_backport_v3.2' into 'release/v3.2'
can: Add support for lower bit rates (backport v3.2)

See merge request espressif/esp-idf!6390
2019-12-18 07:46:27 +08:00
574efdcbeb Merge branch 'bugfix/doc_fix_debian_requirements_v3.2' into 'release/v3.2'
Docs: Update Debian & Ubuntu install prerequisites (v3.2)

See merge request espressif/esp-idf!7038
2019-12-18 07:36:00 +08:00
2023f850de 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 14:08:42 +01:00
eecd5efec5 esp_wifi: Put some rx code to iram 2019-12-17 20:40:53 +08:00
a4b21ff6f1 Merge branch 'bufgix/esp_timer_set_alarm_v3.2' into 'release/v3.2'
esp_timer: Fix set_alarm. Case when timestamp < now_time (v3.2)

See merge request espressif/esp-idf!6998
2019-12-17 11:54:26 +08:00
09ae962c33 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-12-16 07:45:59 +00:00
ef4c513834 Merge branch 'bugfix/btdm_avrc_metadata_length_error_v3.2' into 'release/v3.2'
components/bt: Fix AVRC metadata length error

See merge request espressif/esp-idf!6885
2019-12-16 12:06:31 +08:00
d787e2a564 Merge branch 'bugfix/coex_fix_some_bugs_v3.2' into 'release/v3.2'
Coexist: fix some coexist bugs (backport v3.2)

See merge request espressif/esp-idf!6307
2019-12-16 12:05:30 +08:00
3c676171a9 Merge branch 'ci/artifact_expiry_v3.2' into 'release/v3.2'
ci: Minimum 4 days for artifact expiry (v3.3) (v3.2)

See merge request espressif/esp-idf!7015
2019-12-16 11:22:26 +08:00
6c8f72c062 ci: Minimum 4 days for artifact expiry 2019-12-16 09:39:29 +11:00
cb025c22bd CI: Add jobs 2019-12-14 17:02:53 +08:00
fcc1516fae Merge branch 'bugfix/doc_package_versions_v3.2' into 'release/v3.2'
doc: Limit sphinxcontrib versions to <2.0.0 as we use Sphinx 1.8.5 (v3.2)

See merge request espressif/esp-idf!6976
2019-12-14 06:37:00 +08:00
648f25e275 esp_timer: Add Test case when set_alarm needs set timer < now_time 2019-12-14 04:36:41 +08:00
ddc59bc7ab Merge branch 'feature/ci_try_to_checkout_correct_branch_for_other_projects_v3.2' into 'release/v3.2'
CI: try to use the correct branch of other projects used in CI (backport v3.2)

See merge request espressif/esp-idf!6737
2019-12-13 14:28:56 +08:00
873c33f990 doc: Limit sphinxcontrib versions to <2.0.0 as we use Sphinx 1.8.5 2019-12-13 05:30:13 +00:00
8061659b5f 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:44:13 +08:00
f8bcf2f459 Merge branch 'bugfix/hfp_client_indication_v3.2' into 'release/v3.2'
component/bt: Fix bugs in HFP feature v3.2

See merge request espressif/esp-idf!6853
2019-12-12 13:53:54 +08:00
c1d6c0a5bc Merge branch 'bugfix/jump_time_54_sec_v3.2' into 'release/v3.2'
esp_timer: Fix time jumps back ~ 54sec (v3.2)

See merge request espressif/esp-idf!6470
2019-12-12 13:53:33 +08:00
32f2e7f509 Merge branch 'bugfix/wifi_internal_memory_v3.2' into 'release/v3.2'
wifi: Include DMA reserved pool when allocating internal-only memory (v3.2)

See merge request espressif/esp-idf!6629
2019-12-12 13:53:14 +08:00
887decf42a Merge branch 'component_bt/osi_fixed_queue_v3.2' into 'release/v3.2'
component_bt/: fix pointer type in fixed_queue v3.2

See merge request espressif/esp-idf!6848
2019-12-12 12:16:59 +08:00
65db2bf87c Merge branch 'bugfix/btdm_disable_some_secrity_mask_v3.2' into 'release/v3.2'
components/bt: Disable some unsupported security mask

See merge request espressif/esp-idf!6727
2019-12-09 22:03:54 +08:00
26272b46cb Merge branch 'bugfix/phy_critical_v3.2' into 'release/v3.2'
fix bug that phy_enter_critical cannot effect on dual-core

See merge request espressif/esp-idf!6942
2019-12-09 22:00:29 +08:00
b0fce6855a Merge branch 'bugfix/update_libexpat_v3.2' into 'release/v3.2'
expat: Update library from 2.2.5 to 2.2.9 (v3.2)

See merge request espressif/esp-idf!6923
2019-12-09 13:20:55 +08:00
a05cc294eb 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-12-09 12:52:36 +08:00
f3aa9cc800 expat: Update library from 2.2.5 to 2.2.9 2019-12-05 09:22:01 +01:00
fa1a19e199 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-12-03 17:08:15 +11:00
b584cecea2 adaptation for nano-format 2019-11-29 17:58:52 +08:00
3357b475f7 components/bt: Fix AVRC metadata length error 2019-11-29 16:00:30 +08:00
9130b255f5 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.
2019-11-28 11:29:45 +00:00
42d7524b91 Merge branch 'bugfix/http_client_buffer_overflow_v3.2' into 'release/v3.2'
Fix HTTP client buffer overflow (v3.2)

See merge request espressif/esp-idf!6669
2019-11-28 11:53:50 +08:00
2a13317e44 component_bt/:bugfix_hfp_client_indication_define_and_cnum_error 2019-11-27 17:06:18 +08:00
e3b5a38cf6 component_bt/: fix pointer type in fixed_queue 2019-11-27 16:17:16 +08:00
7a557368e3 Merge branch 'bugfix/fix_timer_deleted_and_run_broken_callback_v3.2' into 'release/v3.2'
esp_timer: fix the bug that when timeout of timer happens try to run callback(v3.2)

See merge request espressif/esp-idf!6767
2019-11-25 10:34:26 +08:00
87357d8cf3 Merge branch 'feature/add_env_tag_for_32khz_xtal_uts_v3.2' into 'release/v3.2'
soc(esp32&esp32s2beta): Add test_env for 32kHz XTAL unit tests (v3.2)

See merge request espressif/esp-idf!6605
2019-11-21 12:00:20 +08:00
3265b7ce0c ci: Add test configs for 32kHz crystals 2019-11-20 16:07:17 +08:00
3a402fa7b2 soc/esp32: Add test_env for 32kHz XTAL unit tests 2019-11-20 16:07:17 +08:00
9d557afe26 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-19 22:58:05 +08:00
1176d8be6f http_client: added comments to http header generation function 2019-11-19 14:07:54 +00:00
0d0cb3b991 http_client: possible buffer overflow fixed when determining last header item to be written
closes IDF-694
2019-11-19 14:07:54 +00:00
b1254618cd Merge branch 'bugfix/mqtt_example_url_update_v3.2' into 'release/v3.2'
MQTT: update default broker URL for examples (backport v3.2)

See merge request espressif/esp-idf!6404
2019-11-19 11:28:39 +08:00
63feac091d components/bt: Disable some unsupported security mask 2019-11-17 13:54:17 +08:00
3cd682e9f9 Merge branch 'bugfix/fix_the_bug_in_espnow_example_v3.2' into 'release/v3.2'
espnow: fix the bug for calling esp_wifi_set_channel (backport v3.2)

See merge request espressif/esp-idf!6694
2019-11-14 19:28:40 +08:00
6ce1bea29a 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:51:52 +08:00
99ab26ac32 Merge branch 'bugfix/backport_some_wifi_fixes_1009_v3.2' into 'release/v3.2'
esp32: fix some WiFi bugs 1009 (backport v3.2)

See merge request espressif/esp-idf!6296
2019-11-12 11:28:02 +08:00
03762d5f65 Merge branch 'bugfix/i2s-bootloader-random-disable_v3.2' into 'release/v3.2'
bugfix(bootloader): fix bug about i2s bootloader_random_disable for release/v3.2

See merge request espressif/esp-idf!6600
2019-11-08 18:02:47 +08:00
da8103bb59 bt: Include DMA reserved pool when allocating internal-only memory
Fix for root cause of https://github.com/espressif/esp-idf/issues/3592
2019-11-08 11:38:29 +08:00
ce44590c8b wifi: Include DMA reserved pool when allocating internal-only memory
Fix for root cause of https://github.com/espressif/esp-idf/issues/3592
2019-11-08 11:38:29 +08:00
9c051965d2 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-11-06 01:26:48 +00:00
ee84cbdf4e esp_timer: Fix System time jumps back ~54secs
Closes: https://github.com/espressif/esp-idf/issues/2513
2019-11-05 12:47:17 +00:00
48a3f7d716 esp32: Add UTs to check the System time does not jump back 2019-11-05 12:47:17 +00:00
01007698b7 esp_timer: handle esp_timer_delete in timer task
Closes https://github.com/espressif/esp-idf/issues/3458
2019-11-05 12:47:17 +00:00
e5d7addcf7 bugfix(i2s_bootloader_random_disable): fix bug about i2s bootloader_random_disable for release/v3.2
bootloader_random_disable disables the ADC incorrectly, causing the ADC to sometimes fail to work. Fix this bug
2019-11-05 17:04:42 +08:00
b8243b5fbe Merge branch 'bugfix/btdm_disable_bt_gatt_v3.2' into 'release/v3.2'
components/bt: Disable BR/EDR GATT

See merge request espressif/esp-idf!6508
2019-11-01 13:58:40 +08:00
a456543b8a Merge branch 'bugfix/multi_heap_printf_backport_v3.2' into 'release/v3.2'
heap: Fix printf usage in heap poisoning (backport v3.2)

See merge request espressif/esp-idf!6090
2019-11-01 13:24:27 +08:00
81c45ffe14 Merge branch 'bugfix/btdm_assert_deinit_a2dp_while_playing_v3.2' into 'release/v3.2'
components/bt: Fix assert when deinit A2DP while playing music

See merge request espressif/esp-idf!6537
2019-11-01 11:57:39 +08:00
09e657460f esp32: fix some WiFi bugs
Fix following WiFi bugs:
1. Fix the bug for API_CHECK_ENABLED
2. Fix the bug that wpa2 enterprise sta can connect open AP
3. Fix TKIP/CCMP PN replay attack detection bug
4. Increase buffer number type from uint8_t to uint16_t to support more than 255 buffers
5. Avoid recalculating PMK if esp_wifi_set_config() is not called
6. Fix the bug that WiFi stop leads to task watchdog
7. Fix smartconfig IPC crash
8. Fix the crash bug that sniffer may access flash when cached is disabled
9. Fix 5.5M signal test bug
2019-11-01 03:34:06 +00:00
077bd351e4 Merge branch 'bugfix/can_driver_assertions_v3.2' into 'release/v3.2'
drivers/can: fix skipped function calls when assertions disabled (backport v3.2)

See merge request espressif/esp-idf!6407
2019-10-30 03:53:45 +08:00
fb4b29e83a Merge branch 'bugfix/mdns_invalid_hostname_queries_v3.2' into 'release/v3.2'
mdns: fix crash for hostname queries (backport v3.2)

See merge request espressif/esp-idf!6501
2019-10-30 00:51:44 +08:00
840a011c01 components/bt: Fix assert when deinit A2DP while playing music 2019-10-29 20:11:26 +08:00
2b5f488d88 ci: Temporarily ignore CAN example test failures
Due to internal CI issue.
2019-10-28 15:37:04 +08:00
896ba6a83e 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 15:35:42 +08:00
56afe0fdca components/bt: Disable BR/EDR GATT 2019-10-28 11:36:52 +08:00
e94215443b 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-28 11:04:46 +08:00
7aee8722fe Merge branch 'bugfix/msys2_toolchain_path_note_v3.2' into 'release/v3.2'
docs: update windows msys2 installer notes to unzip all-in-one toolchain to path without spaces (v3.2)

See merge request espressif/esp-idf!6458
2019-10-25 11:36:29 +08:00
d3ac9cc863 Merge branch 'feature/esptool_v2.8_v3.2' into 'release/v3.2'
esptool: Bump to v2.8 release (v3.2)

See merge request espressif/esp-idf!6462
2019-10-25 11:35:53 +08:00
1d3b83e2c0 Merge branch 'bugfix/btdm_a2dp_sink_media_suspend_cmd_unack_for_v3.2' into 'release/v3.2'
bugfix/btdm_a2dp_sink_media_suspend_cmd_unack_for_v3.2(backport v3.2)

See merge request espressif/esp-idf!5920
2019-10-25 10:58:28 +08:00
5067ecaebe Merge branch 'bugfix/select_with_sdmmc_mount_v3.2' into 'release/v3.2'
VFS: Fix bug which occurs when driver is installed during a select() call (v3.2)

See merge request espressif/esp-idf!6431
2019-10-24 11:29:02 +08:00
54e217b8d4 Merge branch 'bugfix/mqtt_disconnect_crash_3.2' into 'release/v3.2'
mqtt: referenced esp-mqtt master to close disconnection issues (backport 3.2)

See merge request espressif/esp-idf!5882
2019-10-24 10:28:13 +08:00
e98ff1beb7 Merge branch 'bugfix/remove_mbedtls_would_block_v32' into 'release/v3.2'
Remove check for would_block in mbedtls (Backport v3.2)

See merge request espressif/esp-idf!6397
2019-10-23 17:00:36 +08:00
e41ef9396f esptool: Bump to v2.8 release 2019-10-23 09:09:07 +11:00
b4aa4de694 docs: update windows msys2 installer notes to unzip all-in-one toolchain to path without spaces (v3.2) 2019-10-22 21:17:00 +02:00
ab7e411f4e 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 08:26:43 +02:00
696a9fa0ba Merge branch 'bugfix/ticks_to_wait_for_uart_and_i2c_v3.2' into 'release/v3.2'
driver: Fix ticks_to_wait for uart and i2c (v3.2)

See merge request espressif/esp-idf!5248
2019-10-22 13:18:00 +08:00
360b966938 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-21 13:19:41 +00:00
7ed6748534 Merge branch 'test/fix_mesh_test_case_3.2' into 'release/v3.2'
test: fix test case MESH_EST_2403 (backport 3.2)

See merge request espressif/esp-idf!5910
2019-10-21 20:13:36 +08:00
eecd2f56ee 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 05:49:54 +00:00
7d8ff31c59 mqtt: referenced esp-mqtt master to fix disconnect crash issue and
update docs generation for mqtt library

Backport of 6fb085dbc9e6d8bc232e7b8f506217f680d50ed0
2019-10-21 05:49:54 +00:00
2dc1d1b568 Merge branch 'docs/update_bootloader_chip_revision_print_v3.2' into 'release/v3.2'
bootloader_support: fix logging prints around chip revision (v3.2)

See merge request espressif/esp-idf!6338
2019-10-21 10:48:46 +08:00
a1c1175fa7 Merge branch 'bugfix/add_kconfig_help_for_eth_gpio0_output_mode_v3.2' into 'release/v3.2'
ethernet: add kconfig help for GPIO0 output mode (v3.2)

See merge request espressif/esp-idf!6343
2019-10-21 10:48:44 +08:00
5adc487133 Merge branch 'bugfix/wps_workaround_for_Telstra_AP_v3.2' into 'release/v3.2'
wps: Relax the check on older config methods in case of WPS2.0 (backport v3.2)

See merge request espressif/esp-idf!5922
2019-10-21 10:46:15 +08:00
eea3e63c39 Merge branch 'bugfix/fix_the_for_smartconfig_send_broadcast_to_phone_v3.2' into 'release/v3.2'
fix the bug that ESP32 sends broadcast to phone after smartconfig is done(backport v3.2)

See merge request espressif/esp-idf!6074
2019-10-21 10:45:34 +08:00
ce07474148 Merge branch 'bugfix/vfs_fat_sdmmc_mount_v3.2' into 'release/v3.2'
Fix memory leak upon failure of esp_vfs_fat_sdmmc_mount() (v3.2)

See merge request espressif/esp-idf!6395
2019-10-21 10:44:22 +08:00
cbe8274651 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:28:35 +02:00
700976f709 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:18:34 +05:30
5519afe675 Fix memory leak upon failure of esp_vfs_fat_sdmmc_mount()
Closes https://github.com/espressif/esp-idf/issues/4165
2019-10-18 10:28:24 +02:00
f819b7da90 Merge branch 'bugfix/reset_periph_modules_v3.2' into 'release/v3.2'
driver: Add a reset before enabling if a module is off (v3.2)

See merge request espressif/esp-idf!6017
2019-10-18 13:34:15 +08:00
47f3be89be Merge branch 'bugfix/add_flash_config_in_app_startup_v3.2' into 'release/v3.2'
bugfix(flash): add flash config in app startup (backport v3.2)

See merge request espressif/esp-idf!5927
2019-10-17 10:56:34 +08:00
f4201de05d 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-16 13:21:30 +00:00
db8ddf050f driver: Add uart and i2c UTs to check ticks_to_wait in some functions 2019-10-16 15:18:31 +08:00
e64f3d43ad i2c: Fix ticks_to_wait when 0 or time expired
Closes: https://github.com/espressif/esp-idf/issues/3301

Closes: IDFGH-964
2019-10-16 15:18:31 +08:00
2bd77056bb rmt/driver: Add module reset before enabling 2019-10-16 05:49:26 +00:00
4be011785e pcnt/driver: Add module reset before enabling 2019-10-16 05:49:26 +00:00
5ce96ab227 sdmmc_host/driver: Add module reset before enabling 2019-10-16 05:49:26 +00:00
b8d4a53260 i2s/driver: Add module reset before enabling 2019-10-16 05:49:26 +00:00
fc31437236 can/driver: Add module reset before enabling 2019-10-16 05:49:26 +00:00
dc63c2e9cb 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-16 05:49:26 +00:00
d3d4787335 bootloader_support: fix logging prints around chip revision 2019-10-15 10:35:23 +05:30
ae39c659d0 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-15 12:08:04 +08:00
3349c99882 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-10-15 12:08:04 +08:00
90af68bd3c Merge branch 'bugfix/alt_exit_idf_monitor_v3.2' into 'release/v3.2'
idf_monitor: Exit with CTRL+X in menu (v3.2)

See merge request espressif/esp-idf!6292
2019-10-14 21:46:22 +08:00
093214c86f Merge branch 'feature/add_psram_workaround_option_3.2' into 'release/v3.2'
make psram workaround depend on chip revison (v3.2)

See merge request espressif/esp-idf!6304
2019-10-14 21:45:34 +08:00
f55cb56380 Merge branch 'feature/handle_icy_uris_v32' into 'release/v3.2'
Modified http_parser to handle ICY uris (Backport v3.2)

See merge request espressif/esp-idf!6326
2019-10-14 18:56:01 +08:00
f612a39127 Merge branch 'bugfix/freertos_xTaskNotifyGive_v3.2' into 'release/v3.2'
freertos: remove semicolon in xTaskNotifyGive (v3.2)

See merge request espressif/esp-idf!6271
2019-10-14 11:20:41 +08:00
ae2cec834e 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-14 10:50:49 +08:00
31c720602d 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:24:31 +05:30
0b4faeb781 Merge branch 'bugfix/btdm_backports_v3.2_0903' into 'release/v3.2'
Bugfix/btdm backports v3.2 0903

See merge request espressif/esp-idf!5987
2019-10-11 18:34:31 +08:00
ef796860d7 bootloader: shrink bin size
1. write a bootloader version of "getting chip revision" function.
2. reduce wordy log.
2019-10-10 12:08:34 +08:00
9742acc33d make psram workaround depend on chip revison
Since ESP32 revision 3, the PSRAM workaround is not needed.
2019-10-10 11:55:16 +08:00
83c87764f4 Merge branch 'bugfix_kconfig_deps_missing_v3.2' into 'release/v3.2'
kconfig: Add -MP option so .d files include empty targets (v3.2)

See merge request espressif/esp-idf!5848
2019-10-09 23:53:08 +08:00
0afad4c7a7 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:56:56 +02:00
dc20fa029d Merge branch 'feature/bluedroid_min_encr_key_size_backport_v3.2' into 'release/v3.2'
BT/Bluedroid : Add support to set min encryption key requirement (Backport v3.2)

See merge request espressif/esp-idf!6257
2019-10-09 16:19:48 +08:00
cf26a8b0f0 BT/Bluedroid : Add support to set min encryption key requirement (Backport v3.2)
- Backport(v3.2) 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-10-09 16:19:48 +08:00
fe83420144 Merge branch 'bugfix/check_for_new_cmakecache_vars_v3.2' into 'release/v3.2'
idf.py: Add check for new cmake cache values (backport v3.2)

See merge request espressif/esp-idf!5930
2019-10-09 13:54:09 +08:00
14098b4832 Merge branch 'fix/add_parentheses_to_spi_swap_data_tx_3.2' into 'release/v3.2'
spi: Put argument of macro SPI_SWAP_DATA_TX/RX in parentheses (backport v3.2)

See merge request espressif/esp-idf!6110
2019-10-09 12:51:55 +08:00
5088758640 freertos: remove semicolon in xTaskNotifyGive 2019-10-08 12:39:28 +08:00
ca824d0ddf components/bt: backports release/v3.2 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
2019-09-23 17:53:29 +08:00
d3e562907f Merge branch 'feature/add_chip_min_revision_3.2' into 'release/v3.2'
support esp32 eco revision 2 and 3 (v3.2)

See merge request espressif/esp-idf!6133
2019-09-20 18:13:58 +08:00
eb4c8d9991 support esp32 eco revision 2 and 3 2019-09-19 17:05:08 +08:00
d56892b563 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:40:40 +08:00
b1ee664367 Merge branch 'bugfix/bootloader_factory_reset_with_wake_up_from_deep_sleep_v3.2' into 'release/v3.2'
bootloader: Blocking the Factory reset during wake up from deep sleep (v3.2)

See merge request espressif/esp-idf!6024
2019-09-16 15:11:38 +08:00
ee5604cad0 Merge branch 'bugfix/dis_interrupts_up_to_6_level_for_dport_wa_v3.2' into 'release/v3.2'
esp32: Dis interrupts up to 5 lvl for DPORT (v3.2)

See merge request espressif/esp-idf!5714
2019-09-16 15:11:33 +08:00
88d8e93223 Merge branch 'update/cjson_v1_7_12_v3.2' into 'release/v3.2'
Update cJSON to v1.7.12 (v3.2)

See merge request espressif/esp-idf!5852
2019-09-16 08:20:59 +08:00
43def55de8 Merge branch 'bugfix/use_local_kconfiglib_v3.2' into 'release/v3.2'
Use kconfiglib from $IDF_PATH/tools/kconfig_new (v3.2)

See merge request espressif/esp-idf!6081
2019-09-13 14:48:04 +08:00
62f201b4bd Merge branch 'bugfix/http_header_parser_resolution_v3.2' into 'release/v3.2'
(backport v3.2) esp_http_server : Bugfix in parsing of empty header values

See merge request espressif/esp-idf!6040
2019-09-13 13:42:16 +08:00
2b22f3e853 app_update: Fix UTs for FACTORY_RESET and APP_TEST 2019-09-12 22:07:05 +08:00
70954c0b3e bootloader: Factory reset not for deep sleep
Closes: https://github.com/espressif/esp-idf/issues/3800

Closes: IDFGH-1536
2019-09-12 22:07:05 +08:00
69be477885 esp32: Add UTs for DPORT and Hi-interrupt 2019-09-12 13:47:48 +00:00
76f97f3abd 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-09-12 13:47:48 +00:00
d0bfde2ceb test: fix test case MESH_EST_2403 2019-09-12 02:51:06 +00:00
544e9831e8 Use kconfiglib from $IDF_PATH/tools/kconfig_new 2019-09-11 14:40:57 +02:00
b937de7df2 fix the bug that ESP32 sends broadcast to phone after smartconfig is done 2019-09-11 11:50:58 +08:00
fa952e5d30 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

Backports !5663
2019-09-09 08:57:29 +00:00
ca1e5e5bc5 Merge branch 'bugfix/fix_the_bug_for_WPA_WPA2_PSK_connection_fail_v3.2' into 'release/v3.2'
fix the bug for WPA_WPA2_PSK connection fail(backport v3.2)

See merge request espressif/esp-idf!6007
2019-09-06 11:44:09 +08:00
23b3d97099 1. fix the bug that STA fails to connect WPA_WPA2_PSK Apple AP
2. fix the bug for softAP set authmode
2019-09-05 20:08:52 +08:00
0a0f5a3bdc Merge branch 'bugfix/flash_encryption_disable_plaintext_v3.2' into 'release/v3.2'
flash encryption: Add config option to disable any plaintext reflashes (v3.2)

See merge request espressif/esp-idf!5998
2019-09-05 17:26:04 +08:00
ec331b3979 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-09-05 18:54:29 +10:00
73e040e584 Merge branch 'test/use_correct_config_for_nvs_compatible_case_v3.2' into 'release/v3.2'
test: fix nvs compatible case error (backport v3.2)

See merge request espressif/esp-idf!5893
2019-09-05 16:51:30 +08:00
d1f40c15ac Merge branch 'bugfix/fix_i2s_channels_swapped_issue_v3.2' into 'release/v3.2'
Bugfix(i2s): fixed i2s left/right channels swapped issue for release/v3.2.

See merge request espressif/esp-idf!5898
2019-09-03 13:36:29 +08:00
7718234acc Merge branch 'bugfix/coex_bb_reset_lock_v3.2' into 'release/v3.2'
fix bug that wifi start/stop may cause crash

See merge request espressif/esp-idf!5969
2019-09-02 14:26:03 +08:00
01cd149cb7 fix bug that wifi start/stop may cause crash
1. fix bug bb reset lock flag to avoid bb reset lock unhandle,
   may cause assert in vPortCPUReleaseMutexIntsDisabledInternal.
2. fix bug wifi reset mac cause task watch dog timeout
3. fix bug wifi reset mac position
2019-08-30 22:13:01 +08:00
7dd4923190 Merge branch 'bugfix/httpd_sess_close_v3.2' into 'release/v3.2'
httpd_sess_close: Check for session validity before closing (v3.2)

See merge request espressif/esp-idf!5744
2019-08-29 10:29:41 +08:00
0b9fc36e62 idf.py: Add check for new cmake cache values 2019-08-27 18:33:03 +02:00
151ddb4cda wps: Relax the check on older config methods in case of WPS2.0 (backport v3.2)
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-08-27 14:10:43 +05:30
1fab985f63 Merge branch 'bugfix/btdm_security_vulnerability_on_encryption_key_size_v3.2' into 'release/v3.2'
components/bt: set the minimum encryption key size to be 7 octects for BR/EDR link

See merge request espressif/esp-idf!5873
2019-08-26 18:01:01 +08:00
548844b5cc Bugfix(i2s): fixed i2s left/right channels swapped issue for release/v3.2.
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-26 14:02:27 +08:00
9bc71370b7 test: fix integration test jobs not executed:
naming rule for parallel test job config file is different.
rename test job config file to make it unified.
2019-08-26 14:01:34 +08:00
66118ab580 test: fix nvs compatible case error:
use new env for nvs compatible test case and update test config
2019-08-26 09:36:32 +08:00
fae3bad007 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-23 08:30:23 +08:00
48e5dcd9b5 Merge branch 'power_management/i2s+i2c-v3.2' into 'release/v3.2'
Power management/i2s+i2c (backport v3.2)

See merge request espressif/esp-idf!5863
2019-08-22 23:29:52 +08:00
d609daf0cd Merge branch 'fix/sdio_slave_reset_infloop_leak_3.2' into 'release/v3.2'
sdio_slave: fix the send_flush infinite loop issue (backport v3.2)

See merge request espressif/esp-idf!5835
2019-08-22 13:38:12 +08:00
eeb9a0359c PM: I2S and I2C added in the Power Management docs
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-08-21 18:15:51 +05:30
4cdf488de8 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-08-21 18:15:41 +05:30
c56f147d48 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-08-21 18:15:29 +05:30
1d953831bd Update cJSON to v1.7.12
Fixes potential DoS in cJSON_Minify, see https://github.com/DaveGamble/cJSON/issues/354
2019-08-21 18:58:37 +10:00
a0a5e367d6 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:56 +10:00
a393bb6f1b sdio_slave: fix the send_flush infinite loop issue
Also add some helper functions.
2019-08-20 17:00:21 +08:00
ad565f27f7 Merge branch 'bugfix/fix_flash_read_error_in_dio_mode_v3.2' into 'release/v3.2'
bugfix(flash): add spi dio address bitlen configure in psram init (backport v3.2)

See merge request espressif/esp-idf!5787
2019-08-15 15:43:31 +08:00
3bf6c5b604 bugfix(flash): add spi dio address bitlen configure in psram init 2019-08-15 10:34:04 +08:00
90747cc8b3 Merge branch 'bugfix/fix_wifi_bugs_for_authmode_and_multi_ssid_v3.2' into 'release/v3.2'
fix wifi bugs for authmode and multi ssid (backport v3.2)

See merge request espressif/esp-idf!5729
2019-08-11 17:14:53 +08:00
feeb22bdbe Merge branch 'bugfix/hwcrypt_fault_inj_v3.2' into 'release/v3.2'
AES & SHA fault injection checks (backport v3.2)

See merge request espressif/esp-idf!5740
2019-08-11 14:04:22 +08:00
91451d31be sha: Add fault injection checks reading hash digest state
Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
2019-08-11 13:19:21 +10:00
8fe9e4b09f aes: Add fault injection checks when writing key to hardware
Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
2019-08-11 13:19:21 +10:00
910cede38d 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-11 13:19:21 +10:00
107d927547 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-09 14:58:28 +05:30
f023bf52c9 Merge branch 'bugfix/btdm_backports_v3.2_0808' into 'release/v3.2'
components/bt: Backport 3 bugfixs into release v3.2

See merge request espressif/esp-idf!5723
2019-08-09 14:02:48 +08:00
dc1db1c4e7 components/bt: Backport 3 bugfixs into release v3.2
1. Bugfix btdm sleep twice after wakeup request
2. Fix connect fail duo to loop of send extended feature request
3. Clear BT/BLE interrupts after controller_disable to overwrite the default non-zero value of intcntl registers
2019-08-09 03:04:40 +00:00
db898de8fb Merge branch 'bugfix/lwip_prefer_allocate_memory_in_psram_v3.2' into 'release/v3.2'
Try to allocate some Lw-ip memories in SPIRAM first. If failed, try to allocate in internal RAM then.(Backport v3.2)

See merge request espressif/esp-idf!5719
2019-08-09 10:56:54 +08:00
d657a679a2 Merge branch 'feature/move_gettimeofday_in_clock_gettime_v3.2' into 'release/v3.2'
newlib: Move _gettimeofday_r call in clock_gettime (v3.2)

See merge request espressif/esp-idf!5718
2019-08-08 22:02:43 +08:00
e451282f18 modify WIFI_CONN_0101 case for wrong authmode of AP 2019-08-08 16:54:35 +08:00
f3ffce3096 wifi: fix wifi bugs for authmode and multi ssid 2019-08-08 16:48:50 +08:00
754a292309 lwip: Try to allocate some LWIP memories in SPIRAM first. If failed, try to allocate in internal RAM then. 2019-08-07 21:11:06 +08:00
00f1ac748b Merge branch 'bugfix/add_wifi_internal_ioctl_declared_v3.2' into 'release/v3.2'
esp_wifi: add esp_wifi_internal_ioctl declared (v3.2)

See merge request espressif/esp-idf!5707
2019-08-07 20:48:58 +08:00
b0cff945cf 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:25 +08:00
ff772e91e8 Merge branch 'bugfix/cmake_extra_component_dirs_v3.2' into 'release/v3.2'
ci: additional Cmake tests for EXTRA_COMPONENT_DIRS (backport v3.2)

See merge request espressif/esp-idf!5492
2019-08-07 16:05:29 +08:00
1beac49f3a Merge branch 'feature/mqtt_improve_recv_3.2' into 'release/v3.2'
MQTT improved receive (backport 3.2)

See merge request espressif/esp-idf!5098
2019-08-07 16:05:07 +08:00
207438f2da esp_wifi: add esp_wifi_internal_ioctl declared 2019-08-07 11:17:39 +08:00
7f03e70164 Merge branch 'bugfix/win_fullclean_symlink_v3.2' into 'release/v3.2'
idf.py: Detect symlinks on Windows during fullclean (v3.2)

See merge request espressif/esp-idf!4925
2019-08-01 16:01:04 +08:00
f3d6fa21c1 Merge branch 'doc/resolve-pdf-building-issues_v3.2' into 'release/v3.2'
(backport v3.2) Replace gif images on EN and zh_CN index pages with identical png images for...

See merge request espressif/esp-idf!5654
2019-08-01 14:10:38 +08:00
83e5e6b24c Merge branch 'bugfix/improve_spi_timing_for_flash_v3.2' into 'release/v3.2'
bugfix(flash): improve spi cs timing settings for flash (backport v3.2)

See merge request espressif/esp-idf!5513
2019-07-31 23:39:07 +08:00
6510c6f495 Merge branch 'bugfix/select_init_sem_v3.2' into 'release/v3.2'
VFS: Allocate socket select semaphore outside ISR (backport v3.2)

See merge request espressif/esp-idf!4989
2019-07-31 16:11:57 +08:00
b460718954 Merge branch 'bugfix/libsodium_test_timeouts_v3.2' into 'release/v3.2'
test: Set timeout of libsodium ed25519_convert test to 60s (v3.2)

See merge request espressif/esp-idf!5555
2019-07-30 21:59:51 +08:00
0a05900096 Replace gif images on EN and zh_CN index pages with identical png images for successful building of PDFs on ReadTheDocs. 2019-07-30 14:19:20 +08:00
b7196d21c9 Merge branch 'bugfix/gpio_intr_enable_bug_v3.2' into 'release/v3.2'
bugfix(GPIO): Fixed GPIO  interrupts bug for v3.2

See merge request espressif/esp-idf!5651
2019-07-30 14:10:29 +08:00
1a307a417d 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 04:44:30 +00:00
f6a9f76401 bugfix(GPIO): Fixed the bug that GPIO enables interrupts on one core,
but registers interrupt service routines on another core for release/v3.2
2019-07-29 19:22:59 +08:00
7149a30d0d Merge branch 'bugfix/docs_recover_some_build_time_v3.2' into 'release/v3.2'
docs: Remove building of zipped HTML docs from build process and consequently...

See merge request espressif/esp-idf!5640
2019-07-29 19:17:34 +08:00
13c9612810 Merge branch 'bugfix/fix_wifi_stack_can_freeze_v3.2' into 'release/v3.2'
esp_wifi: ESP32_WIFI_RX_BA_WIN should be less than ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM (v3.2)

See merge request espressif/esp-idf!5618
2019-07-28 14:56:52 +08:00
aeccf793fe 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:28:15 +02:00
6ca302ed3a Merge branch 'bugfix/fix_mcpwm_example_memory_bug_v3.2' into 'release/v3.2'
Bugfix(example):  Fixed MCPWM example bug for release/v3.2

See merge request espressif/esp-idf!5545
2019-07-27 17:27:56 +08:00
e34aeae1a0 esp_wifi: ESP32_WIFI_RX_BA_WIN should be less than ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 2019-07-27 06:40:01 +00:00
43600262a8 Merge branch 'bugfix/mesh_scan_done_crash_3.2' into 'release/v3.2'
mesh: fix scan done crash caused by uint8_t overflow (backport 3.2)

See merge request espressif/esp-idf!5614
2019-07-27 14:38:39 +08:00
8fdea83505 Merge branch 'bugfix/btdm_mem_leak_v3.2' into 'release/v3.2'
components/bt: Fix memory leak about rfcomm

See merge request espressif/esp-idf!5623
2019-07-27 14:38:28 +08:00
7e77f67777 Merge branch 'feature/tcp_transport_http_client_v3.2' into 'release/v3.2'
Minor bugfixes in esp_http_client and tcp_transport (backport v3.2)

See merge request espressif/esp-idf!5221
2019-07-25 19:37:26 +08:00
e1518b4112 Merge branch 'bugfix/sec_boot_ota_fail_v32' into 'release/v3.2'
Bugfix: ota fails with secure boot on for image size greater than 3.2MB (backport v3.2)

See merge request espressif/esp-idf!5580
2019-07-25 18:04:39 +08:00
151638fdbb components/bt: Fix memory leak about rfcomm 2019-07-25 17:10:52 +08:00
b3a5dc869f Merge branch 'bugfix/supplicant_security_fixes_v3.2' into 'release/v3.2'
wpa_supplicant: Fix sprintf security bugs. (v3.2)

See merge request espressif/esp-idf!5465
2019-07-25 12:18:19 +08:00
87947004c4 mesh: fix scan done crash caused by uint8_t overflow 2019-07-25 11:16:53 +08:00
3ce3c4f54c Merge branch 'bugfix/backport_some_wifi_bugs_201907_v3.2' into 'release/v3.2'
Backport some wifi bugs 201907 v3.2 (backport v3.2)

See merge request espressif/esp-idf!5525
2019-07-23 21:17:09 +08:00
b56b7fe655 ci: add a UT_T1_1 job 2019-07-22 11:17:21 +08:00
f892937780 test: move wifi library check to esp32-wifi-lib ci 2019-07-22 11:17:04 +08:00
105e3302a7 esp_http_client: Fix header sent event bug 2019-07-21 07:25:23 +00:00
19fd2b3d93 tcp_transport: Fix case sensitive header comparison
Closes https://github.com/espressif/esp-idf/issues/3106
2019-07-21 07:25:23 +00:00
8be97410a4 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-07-21 10:30:45 +08:00
6af16447f8 mesh: fix the bug that esp_mesh_stop doesn't return 2019-07-21 10:26:17 +08:00
eee568ddc5 wps: add overlap event 2019-07-21 10:23:01 +08:00
c119a1a0f4 esp32: fix wifi stop bug
Fix the bug that WiFi stop causes esp_wifi_internal_reg_rxcb() fails.
2019-07-21 10:20:25 +08:00
ed6b453346 esp32: fix WPS/WPA2-Enterprise memory leak
Fix WPS and WPA2-Enterprise memory leak bug.
2019-07-21 10:15:19 +08:00
ba69e61ed5 esp32: fix smartconfig crash when no AP is found
Fix the bug that smartconfig crashes when no AP is found during smartconfig scan.
2019-07-21 09:59:37 +08:00
6ba62f7b0b Merge branch 'bugfix/fix_the_watchdog_during_WiFi_scan_BLE_scan_v3.2' into 'release/v3.2'
fix the watchdog bug during WiFi scan and BLE scan (v3.2)

See merge request espressif/esp-idf!5541
2019-07-19 18:08:56 +08:00
e155cd7a78 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-07-19 10:08:39 +05:30
13069ecb26 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-07-19 10:08:39 +05:30
7f42d63687 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-07-19 09:56:32 +05:30
ed7664d19f Merge branch 'bugfix/fix_flash_read_error_in_dio_26MHz_mode_v3.2' into 'release/v3.2'
bugfix(flash): fix flash read error in DIO/26MHz mode (backport v3.2)

See merge request espressif/esp-idf!5507
2019-07-16 18:41:45 +08:00
da355d39b8 Fixed the bug that the malloc memory size is smaller than the actual required. 2019-07-16 15:20:41 +08:00
3675e3182f fix the watchdog bug during WiFi scan and BLE scan 2019-07-16 14:29:29 +08:00
9edc9674bc 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:44:28 +08:00
7a79cc4a5e Merge branch 'bugfix/error_on_unknown_component_v3.2' into 'release/v3.2'
cmake: error out when component is not found (backport v3.2)

See merge request espressif/esp-idf!5488
2019-07-12 15:01:40 +08:00
376377ceca Merge branch 'bugfix/i2s_apll_clock_fix_v3.2' into 'release/v3.2'
driver/i2s: fix apll_clock_rate for different sample rates (v3.2)

See merge request espressif/esp-idf!5449
2019-07-12 11:36:01 +08:00
490a7e682d bugfix(flash): fix flash read error in DIO/26MHz mode 2019-07-11 21:10:20 +08:00
1b9d62ad95 Merge branch 'bugfix/fix_uart_wait_done_bug_v3.2' into 'release/v3.2'
bugfix(UART): fixed two UART issues for release/v3.2

See merge request espressif/esp-idf!5480
2019-07-11 14:56:32 +08:00
8efef29544 cmake: refactor finding components 2019-07-10 17:32:27 +08:00
21601f00f4 Merge branch 'bugfix/fix_no_disconnect_event_when_rx_disassoc_after_send_auth_v3.2' into 'release/v3.2'
wifi: fix the bug no disconnect event when STA recv disassoc after sending auth (backport v3.2)

See merge request espressif/esp-idf!5099
2019-07-10 15:40:23 +08:00
b330ea88e6 ci: additional Cmake tests for EXTRA_COMPONENT_DIRS
Tests from
https://gitlab.espressif.cn:6688/idf/esp-idf/merge_requests/4253
2019-07-10 12:18:31 +08:00
81139df91e cmake: error out when component is not found
Closes https://github.com/espressif/esp-idf/issues/3637
2019-07-10 11:56:47 +08:00
e5c15c068e Merge branch 'bugfix/btdm_can_not_get_informations_of_song_v3.2' into 'release/v3.2'
components/bt: Fix iphone can't get song's informations

See merge request espressif/esp-idf!5473
2019-07-09 15:17:22 +08:00
7e2465995f bugfix(UART): fixed two UART issues:
1. uart_wait_tx_done works incorrect when sending a byte of data.
2. uart_set_rx_timeout sets an incorrect rx timeout value when ref_tick is enabled.
2019-07-09 14:47:04 +08:00
aaa0853572 components/bt: Fix iphone can't get song's informations 2019-07-08 19:46:10 +08:00
878d70d9e6 Merge branch 'fix/update_curr_page_state_3.2' into 'release/v3.2'
nvs_util: Set previous page state to FULL before creating new page (v3.2)

See merge request espressif/esp-idf!5326
2019-07-08 14:05:40 +08:00
4b43c10490 wpa_supplicant: Fix sprintf security bugs.
Revert back to using os_snprintf instead of sprintf.

Closes WIFI-624
2019-07-08 10:39:48 +05:30
a8916daeb2 Merge branch 'fix/nvs_util_keylen_3.2' into 'release/v3.2'
nvs_util: Add check for keylen in input csv (v3.2)

See merge request espressif/esp-idf!5396
2019-07-08 12:59:55 +08:00
b7a2516242 wifi bugfix:
1. fix the bug no disconnect event when STA recv disassoc after sending auth
2. fix the bug full scan send multi events when recv deauth/disassoc
2019-07-08 11:42:36 +08:00
4a9f339447 Merge branch 'mesh/bugfix_0628' into 'release/v3.2'
mesh: bugfix (backport3.2)

See merge request espressif/esp-idf!5402
2019-07-05 22:43:16 +08:00
c1af728239 Merge branch 'bugfix/prov_examples_strlcpy_backport_v3.2' into 'release/v3.2'
Various bugfixes in Protocomm / Unified Provisioning (backport v3.2)

See merge request espressif/esp-idf!5372
2019-07-05 20:56:35 +08:00
35789eef16 Merge branch 'bugfix/improve_flash_dio_read_timing_v3.2' into 'release/v3.2'
bugfix(flash): fix flash dio read mode configuration error on SPI0 (backport v3.2)

See merge request espressif/esp-idf!5288
2019-07-05 20:42:06 +08:00
4a0d8ef478 Merge branch 'bugfix/btdm_fix_rxwinsz_assert_in_wifi_ble_coex_v3.2' into 'release/v3.2'
component/bt: fix rxwinsz assert in ble and wifi coex(backport v3.2)

See merge request espressif/esp-idf!5450
2019-07-05 20:27:52 +08:00
23c17c4c0d nvs_util: Add check for keylen in input csv 2019-07-05 11:06:02 +00:00
2821e99bcc component/bt: fix rxwinsz assert in ble and wifi coex 2019-07-04 21:17:51 +08:00
a4f2283384 i2s: fix a bug when calculating i2s apll parameters
Closes https://github.com/espressif/esp-idf/issues/2634
Closes https://github.com/espressif/esp-idf/issues/3380
Fixes https://github.com/espressif/esp-idf/issues/3407
2019-07-04 18:28:18 +05:30
b905f2de4d mesh: bugfix
1. resend eb which are pending in g_ic.tx_buf due to channel switch.
2. add lock for mgmg/xon/bcast to protect send from user flush.
3. softap: add check if secondary offset is correct when start softap.
4. softap: in inactive timer handler, add check if child bss is removed to avoid removing it again.
5. disable A-MPDU for non-root.
6. fix reusing a freed eb.
7. fix when node becomes root, it does not record assoc value to nvs.
8. discard unnecessary forwarded group packets.
9. fix toDS state is not updated in time.
10. fix s_sta_cnx_times is not cleared when deinit causes root sends ADD annoucement.
11. root: increase beacon timeout time from 6 seconds to 15 seconds to delay initiation of reconnection.
12. add esp_mesh_get_tsf_time to return TSF time.
13. send the whole routing table multi-times.
14. clear candidate settings if not receive candidate beacon within 8 seconds.
2019-07-04 11:39:17 +08:00
c517628c77 nvs_util: Set previous page state to FULL before creating new page 2019-07-03 11:09:49 +00:00
cbec031c91 Merge branch 'bugfix/btdm_backport_2_bugs_v3.2' into 'release/v3.2'
Bugfix/btdm backport 2 bugs v3.2

See merge request idf/esp-idf!5269
2019-07-02 17:33:53 +08:00
90c7885f4d bugfix(flash): improve flash dio read timing
When flash work in DIO Mode, in order to ensure the fast read mode of flash
is a fixed value, we merged the mode bits into address part, and the fast
read mode value is 0 (the default value).
2019-07-02 14:57:13 +08:00
476d4ba1b7 Merge branch 'bugfix/fix_wpa2_vulnerability_and_lwip_window_scale_v3.2' into 'release/v3.2'
esp32/lfix wpa2-enterprise vulnerability and support lwindow scale (backport v3.2)

See merge request idf/esp-idf!5411
2019-07-02 14:26:48 +08:00
da80efa8bc Merge branch 'bugfix/pm_isr_exit_lock_v3.2' into 'release/v3.2'
pm: prevent interrupt nesting during esp_pm_impl_isr_hook (backport v3.2)

See merge request idf/esp-idf!4969
2019-07-02 13:55:35 +08:00
725ecf108f Merge branch 'protocomm_ble_128bit_uuid_v3.2' into 'release/v3.2'
protocomm_ble : Fix support for custom service UUIDs (backport v3.2)

See merge request idf/esp-idf!5018
2019-07-01 19:22:28 +08:00
d10dec358d esp32/lwip: fix wpa2-enterprise vulnerability and support lwip window scale
1. Fix WiFi wpa2-enterprise vulnerability bug
2. Support LWIP window scale
2019-07-01 11:34:35 +08:00
7b2ece3ac2 Merge branch 'bugfix/fix_some_wifi_bugs_0508_v3.2' into 'release/v3.2'
esp32: fix some WiFi bugs 0508 (backport v3.2)

See merge request idf/esp-idf!4962
2019-07-01 11:32:26 +08:00
293a665601 esp32: fix some WiFi bugs
Fix following WiFi bugs:
1. Make smartconfig thread-safe
2. Fix WiFi stop/deinit memory leak
3. Refactor for WiFi init/deinit/ioctl etc
4. Fix the bug that WiFi stop leads to task watchdog
2019-06-30 21:36:38 +08:00
c6c1d089cc Merge branch 'bugfix/xTaskIncrementTick_v3.2' into 'release/v3.2'
freertos: Fix xTaskIncrementTick for unwind the Tick for CPU1 (v3.2)

See merge request idf/esp-idf!5035
2019-06-30 18:01:45 +08:00
e5fe1c0e68 protocomm_ble : Example updated to use custom 128bit service UUID
Also removed old hardcoded UUIDs from README of esp_prov
2019-06-28 10:14:52 +00:00
09cf34c9aa esp_prov : Runtime discovery of Service UUID and endpoint name mapping
List of changes:
* Retrieve UUID property from Bluez device object before connecting to retrieve UUID contained in advertisement
* Read Characteristic User Descriptions attribute of each UUID for mapping endpoint names
* To support older implementations with hardcoded Name-UUID map, revert to fallback mode in order if advertisement data has no UUID field
2019-06-28 10:14:52 +00:00
d76d94549a protocomm_ble : Fixed custom service UUID support
List of changes:
* Use 128 bit characteristic UUIDs when creating GATT table entries
* Change primary service attribute value to 128 bit custom service UUID
* Use raw advertisement data to convey flags and 128 bit primary service UUID
* Use raw scan response to send device name as complete local name
* Increase maximum device name length in relation to maximum scan response length
* Set Characteristic User Description attributes for each characteristic to convey protocomm endpoint names
2019-06-28 10:14:52 +00:00
f3e22bc23c Merge branch 'feature/backport_component_target_var' into 'release/v3.2'
cmake: make COMPONENT_TARGET available (v3.2)

See merge request idf/esp-idf!5339
2019-06-28 15:35:43 +08:00
444ded835d Merge branch 'bugfix/mbedtls_mpi_exp_mod_v3.2' into 'release/v3.2'
mbedtls: Fix mbedtls_mpi_exp_mod() set n and s values (v3.2)

See merge request idf/esp-idf!5355
2019-06-28 08:31:41 +08:00
57c7a25bb3 protocomm_ble : Bugfix for unbound memcpy on prepare write buffer
Closes https://github.com/espressif/esp-idf/issues/3633
2019-06-27 18:59:34 +05:30
8c17eb91e2 Merge branch 'feature/config_spi_pins_based_on_efuse_value_v3.2' into 'release/v3.2'
feat(psram): config SPI psram pins based on efuse value (backport v3.2)

See merge request idf/esp-idf!5237
2019-06-27 19:22:34 +08:00
91ec6068e9 Merge branch 'bugfix/httpd_log_purge_v3.2' into 'release/v3.2'
esp_http_server : Logging of purged data to monitor made configurable (backport v3.2)

See merge request idf/esp-idf!5016
2019-06-27 16:16:05 +08:00
dab432d7ff Protocomm : Minor fixes
List of changes:
* protocomm_httpd : Reset session_id static variable on start and stop
* security1 : Typo in checking failed dynamic allocation
2019-06-27 12:38:20 +05:30
accef886a9 Provisioning Examples : Bugfix in copying Wi-Fi SSID and Passphrase 2019-06-27 12:38:13 +05:30
76719b9c37 Wi-Fi Provisioning : Bugfix in copying SSID and Passphrase
These changes guarantee that the SSID and Passphrase received via protocomm are NULL terminated and size limited to their standard lengths.

List of changes:
* Corrected length of passphrase field in wifi_prov_config_set_data_t structure
* Performing length checks on SSID, passphrase and bssid, when populating wifi_prov_config_set_data_t structure with received credentials
2019-06-27 12:38:07 +05:30
da10a5b7e9 Merge branch 'bugfix/btdm_fix_hci_enhance_conn_complete_evt_unpack_error_v3.2' into 'release/v3.2'
component/bt: fix unpack hci enhance connection complete event error(backport v3.2)

See merge request idf/esp-idf!5282
2019-06-27 14:28:49 +08:00
901e8338ac mbedtls: Add UTs for modexp 2019-06-26 14:20:30 +08:00
fbe566ac67 mbedtls: Fix Z->s in mbedtls_mpi_exp_mod()
Z->s should never be zero, only 1 or -1.
Added additional checks for X, Y and M args to correctly set Z->s.

Closes: https://github.com/espressif/esp-idf/issues/1681
Closes: https://github.com/espressif/esp-idf/issues/3603
Closes: IDFGH-1313
2019-06-26 14:20:30 +08:00
381bd7d785 Merge branch 'feature/add_nimble_ssc_backport_for_3.2' into 'release/v3.2'
test: modified test case for bluedroid (backport v3.2)

See merge request idf/esp-idf!5213
2019-06-25 23:18:47 +08:00
c0a68466a7 test: modified test case for bluedroid (backport v3.2) 2019-06-25 23:18:47 +08:00
e9786e3038 cmake: make COMPONENT_TARGET available in components 2019-06-25 13:05:46 +08:00
eaf8cfbf8d component/bt: fix unpack hci enhance connection complete event error 2019-06-24 03:23:31 +00:00
055943e293 Merge branch 'bugfix/docs_rtd_failure_on_missing_submodule_v3_2_bis' into 'release/v3.2'
docs: Add mqtt submodule to RTD build configuration to correct file and delete...

See merge request idf/esp-idf!5310
2019-06-24 09:12:59 +08:00
b34a0874b1 Merge branch 'bugfix/spi_concurrency_3.2' into 'release/v3.2'
spi: fix a possible concurrency issue (port to v3.2)

See merge request idf/esp-idf!5278
2019-06-21 13:22:22 +08:00
0d7f6a54e5 docs: Add mqtt submodule to RTD build configuration to correct file and delete similar file with typo in filename 2019-06-21 11:04:19 +08:00
100379c4aa Merge branch 'test/fix_some_error_wifi_cases_v3.2' into 'release/v3.2'
test: fix some wifi case issues (backport v3.2)

See merge request idf/esp-idf!5254
2019-06-20 22:10:44 +08:00
5d7d46a76d Merge branch 'bugfix/docs_rtd_failure_on_missing_submodule_v3_2' into 'release/v3.2'
docs: Add mqtt submodule to RTD build configuration. Now any submodule...

See merge request idf/esp-idf!5286
2019-06-20 08:07:51 +08:00
eaaad51f81 docs: Add mqtt submodule to RTD build configuration. Now any submodule included in documentation build by Doxygen should be included in this file 2019-06-19 16:05:03 +08:00
f21762eeef spi: fix a possible concurrency issue 2019-06-19 12:38:31 +08:00
e7f57fef55 component/bt: Allow configuration of default SCO_DATA_PATH in bluetooth controller 2019-06-17 14:12:09 +08:00
284362d62d add missing source files to CMakeLists for HFP 2019-06-17 14:06:33 +08:00
29b009d6fd 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-06-17 14:06:19 +08:00
86e8983499 test: fix some wifi case issues:
* remove heap size check cases as we have bg tasks allocate memory
* fix wifi connect to open ap issue
2019-06-14 14:55:09 +08:00
fa42f63226 Merge branch 'bugfix/dns_bug_3.2' into 'release/v3.2'
DNS: fix the crash  under static IP address(backport3.2)

See merge request idf/esp-idf!5238
2019-06-14 11:34:50 +08:00
93c9c07e22 bugfix(psram): make sure the psram_io struct is initialized and make unknown psram package version more obvious 2019-06-14 10:34:56 +08:00
483fc9be6f Merge branch 'bugfix/btdm_coex_assert_in_lc_lmppdu_v3.2' into 'release/v3.2'
components/bt: Fix assert due to alloc LMP TX buffer failed

See merge request idf/esp-idf!5215
2019-06-13 22:36:58 +08:00
2ed18dcdd7 lwip:fix dns bug for 3.2 2019-06-13 16:47:50 +08:00
cb2e328c5f feat(psram): config SPI psram pins based on efuse value 2019-06-13 16:07:21 +08:00
267ce80355 components/bt: Fix assert due to alloc LMP TX buffer failed 2019-06-12 19:25:59 +08:00
8b54542a88 Merge branch 'bugfix/custom_bootloader_subproject_build_v3.2' into 'release/v3.2'
CMake: Fix custom bootloader does not override original (v3.2)

See merge request idf/esp-idf!5082
2019-06-11 08:26:08 +08:00
030f17ae28 Merge branch 'fix/mfg_util_3.2' into 'release/v3.2'
mfg_util: Fix unnecessary csv files creation for values with REPEAT tags (backport 3.2)

See merge request idf/esp-idf!5046
2019-06-10 22:56:27 +08:00
a8fe057219 Merge branch 'bugfix/https_doc_api_v3.2' into 'release/v3.2'
esp_http_server : Minor clarification in httpd_req_get_url_query_str() API documentation (backport v3.2)

See merge request idf/esp-idf!5014
2019-06-10 11:49:57 +08:00
adc5b2e08f freertos/test: Add unit tests for xTaskIncrementTick 2019-06-07 09:54:03 +00:00
0be4deeb22 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-07 09:54:03 +00:00
1ffaf8aad9 Merge branch 'bugfix/reset_log_uart_port_v3.2' into 'release/v3.2'
esp32: Add reset CONSOLE_UART port (v3.2)

See merge request idf/esp-idf!5121
2019-06-06 16:19:22 +08:00
9e7d9ef385 ci: check that custom bootloader overrides original 2019-06-04 23:04:47 +08:00
88eaa34075 cmake: fix custom bootloader issue
Issue is that when users creates a custom bootloader from
$IDF_PATH/components/bootloader. Parent project build uses the copy but
bootloader subproject build uses the original still. The issue is solved
by passing the custom bootloader as extra component directory so
bootloader build knows to use the new copy (itself) in the build.
2019-06-04 23:04:47 +08:00
b434b8f5d2 esp32: Add reset uart
Fixed the case when the first part of log was missed
this was happened when:
 * CONFIG_CONSOLE_UART_CUSTOM option is selected (UART1)
 * The selected CONSOLE_UART port is used also for the console component
 * in code esp_restart() or abort() functions were called.
2019-06-04 20:16:40 +08:00
7e6d1ef4bc esp_http_server : Logging of purged data to monitor made configurable
List of changes:
* Kconfig option HTTPD_LOG_PURGE_DATA enables logging of purged data
* Kconfig option HTTPD_PURGE_BUF_LEN sets purge buffer length
* Purged data is logged in hex

Closes https://github.com/espressif/esp-idf/issues/3359
2019-06-03 08:37:41 +00:00
92dc6a6dde esp_http_server : Minor clarification in httpd_req_get_url_query_str() API documentation
Closes https://github.com/espressif/esp-idf/issues/3374
2019-06-03 08:36:24 +00:00
8e51f7e236 Merge branch 'bugfix/custom_log_uart_rx_pin_v3.2' into 'release/v3.2'
bootloader_support: Fix UART RXD pin for console output (CUSTOM option) (v3.2)

See merge request idf/esp-idf!5032
2019-06-03 14:23:55 +08:00
492c682dbe mfg_util: Fix unnecessary csv files creation for values with REPEAT tags
(cherry picked from commit 8b96668c9123fbbf8c78b347479215f471b102ed)
2019-05-31 13:53:01 +05:30
3886be23c8 soc: Add some headers into gpio_periph.h 2019-05-29 13:46:37 +08:00
814ee9db7f 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-05-29 07:45:13 +02:00
ddbce78bff Merge branch 'bugfix/fix_smartconfig_bug' into 'release/v3.2'
esp32: fix a smartconfig bug (backport v3.2)

See merge request idf/esp-idf!5055
2019-05-28 10:54:51 +08:00
a230075447 Merge branch 'bugfix/docs_build_failure_on_rtd_v3_2' into 'release/v3.2'
Fix Breathe version to avoid docs build failure on ReadTheDocs server. Provide...

See merge request idf/esp-idf!5061
2019-05-27 13:58:33 +08:00
4b5be79c0c Merge branch 'feature/esp_http_client_mutual_auth_backport_v3.2' into 'release/v3.2'
esp_http_client: Add support for mutual authentication (backport v3.2)

See merge request idf/esp-idf!5026
2019-05-27 13:16:47 +08:00
b80b5dad32 Fix Breathe version to avoid docs build failure on ReadTheDocs server. Provide RTD project configuration file to be able to select python version for specific esp-idf release. (backport v3.2) 2019-05-23 19:57:43 +08:00
ee39083d1b Merge branch 'feature/add_promiscuous_control_for_ethernet_v3.2' into 'release/v3.2'
add promiscuous mode control for Ethernet (v3.2)

See merge request idf/esp-idf!4976
2019-05-23 14:23:48 +08:00
38b4d1d70c esp32: fix a smartconfig bug
Fix a smartconfig bug which leads to deadlock between WiFi task and timer task.
2019-05-22 21:47:02 +08:00
2e85c5b62e Merge branch 'bugfix/fix_softap_crash_when_sta_reset_3.2' into 'release/v3.2'
wifi: fix softap crash when sta reset (backport v3.2)

See merge request idf/esp-idf!5001
2019-05-22 21:02:15 +08:00
a820787414 wifi: fix softap crash when sta (backport v3.2) 2019-05-20 20:30:41 +08:00
cea6908238 bootloader_support: Fix UART RXD pin for console output (CUSTOM option)
The RXD pin is assigned as input (fix for custom uart option).

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

Closes: IDFGH-505
2019-05-20 18:31:13 +08:00
d81c79d79f esp_http_client: Add support for mutual authentication
Closes https://github.com/espressif/esp-idf/pull/2688
Closes https://github.com/espressif/esp-idf/issues/3438
2019-05-20 11:01:04 +05:30
70c9b1ca22 VFS: Allocate socket select semaphore outside ISR 2019-05-15 10:50:49 +02:00
2f8508c7eb Merge branch 'bugfix/http_server_lf_term_hdr_backport_v3d2' into 'release/v3.2'
HTTP Server : Fix for tolerating LF terminated headers (backport v3.2)

See merge request idf/esp-idf!4657
2019-05-13 20:29:03 +08:00
fd281c11cc add promiscuous mode control in emac driver
1. add promiscuous mode control in emac driver
2. fix minor bugs in IP101 driver
2019-05-10 12:56:35 +08:00
5328154a01 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:20:29 +08:00
6dd653392b Merge branch 'bugfix/core_dump_flash_write_addr_check_v3.2' into 'release/v3.2'
Backport v3.2: Fixes freezing core dump with enabled flash write address checks

See merge request idf/esp-idf!4961
2019-05-09 19:45:48 +08:00
dd623febf5 esp32: Fixes freezing core dump process when flash write address checks are enabled 2019-05-08 13:55:31 +03:00
106c8813ed Merge branch 'bugfix/nvs_fix_erase_any_v3.2' into 'release/v3.2'
nvs_flash: Multi-page blob erased using nvs_erase_key should be cleaned properly (v3.2)

See merge request idf/esp-idf!4817
2019-05-08 09:37:13 +08:00
524308c98d Merge branch 'bugfix/backport_some_wifi_bugs_to_v3.2' into 'release/v3.2'
esp32: backport some WiFi fixes to v3.2 (backport v3.2)

See merge request idf/esp-idf!4937
2019-05-07 22:42:15 +08:00
553725df84 nvs_flash: Multi-page blob erased using nvs_erase_key should be cleaned properly
Earlier eraseItem function in Storage class would do lazy cleanup of
multi-page blobs if called using type "ANY" instead of "BLOB". It used to
just delete BLOB data and index would remain as is. Any subsequent read
would delete index entry as well. This however would return a valid
length without error if nvs_get_blob API was just used for finding
length and not reading the complete blob. This change fixes this issue.

Closes https://github.com/espressif/esp-idf/issues/3255
2019-05-07 05:53:19 +00:00
7d3733d255 esp32: backport some WiFi fixes to v3.2
Backport following WiFi fixes to v3.2:
1. Add support for STA HT2040 coexist management
2. Add support for WPA2 improvements
3. Disallow HT rate when unicast/mcast cipher is TKIP/WEP
4. Add support for signal test
5. Fix the bug that WPS fails when AP is encrypted
2019-05-07 10:50:09 +08:00
20e66fa815 idf.py: Detect symlinks on Windows during fullclean
Closes https://github.com/espressif/esp-idf/issues/3377
2019-05-06 09:40:21 +02:00
038f51ffa6 Merge branch 'bugfix/scan_fail_when_no_ap_found_v3.2' into 'release/v3.2'
fix the bug when scan fail after STA failed to connect to a nonexistent AP (backport v3.2)

See merge request idf/esp-idf!4913
2019-05-06 11:39:31 +08:00
4e78900fbf fix the bug when scan fail after STA failed to connect to a nonexistent AP 2019-05-05 11:53:33 +08:00
87215ca0c3 HTTP Server : Fix for tolerating LF terminated headers
List of changes:
* When parsing requests, count termination from LF characters only
* Correct memcpy() length parameter in httpd_unrecv() (pointed out by jimparis in GitHub issue thread)
* Use ssize_t to store results of length subtractions during parsing
* Modify some comments to reduce ambiguity

Closes https://github.com/espressif/esp-idf/issues/3182
2019-05-02 05:56:49 +00:00
f6bfe13eb3 Merge branch 'bugfix/erase_with_vtaskdelay_v3.2' into 'release/v3.2'
spi_flash: Add vTaskDelay while a long erasing (v3.2)

See merge request idf/esp-idf!4875
2019-04-28 22:14:41 +08:00
294a051538 Merge branch 'bugfix/ci_submodule_paths_v3.2' into 'release/v3.2'
CI - Fix the parsing of submodule paths (backport v3.2)

See merge request idf/esp-idf!4575
2019-04-28 22:13:29 +08:00
4aa1058e8a Merge branch 'feature/himem_readme_backport_v3.2' into 'release/v3.2'
Proper README.md for himem example (backport v3.2)

See merge request idf/esp-idf!4304
2019-04-28 22:13:16 +08:00
a08c77ae96 Merge branch 'bugfix/fix_iperf_exit_error_v3.2' into 'release/v3.2'
examples: fix iperf exit error

See merge request idf/esp-idf!4842
2019-04-28 12:00:48 +08:00
df874cd070 Merge branch 'bugfix/httpd_accept_conn_v3.2' into 'release/v3.2'
esp_http_server : Only accept new connections if server has capacity to handle more (backport v3.2)

See merge request idf/esp-idf!4722
2019-04-28 11:47:14 +08:00
36fff1d751 ci: Fix the parsing of submodule paths 2019-04-28 03:46:29 +00:00
fe0d45d549 spi_flash: Add vTaskDelay while a long erasing
Added Kconfig options to enable yield operation during flash erase.
By default disable.

Closes: https://github.com/espressif/esp-idf/issues/2083
Closes: IDFGH-261
2019-04-28 02:42:31 +00:00
6f19193de6 Merge branch 'bugfix/adjtime_ut_v3.2' into 'release/v3.2'
newlib: Fix adjtime (v3.2)

See merge request idf/esp-idf!4871
2019-04-28 10:36:55 +08:00
8f4e7d2456 Merge branch 'backport/bugfix_url_redirect_v32' into 'release/v3.2'
Fix url redirection issue. (backport v3.2)

See merge request idf/esp-idf!4852
2019-04-28 10:36:09 +08:00
4156c6ddec Merge branch 'bugfix/improve_spi_timing_for_psram_and_flash_v3.2' into 'release/v3.2'
bugfix(psram): improve spi cs timing settings for psram (backport v3.2)

See merge request idf/esp-idf!4846
2019-04-28 10:35:41 +08:00
cb20ba50b1 Proper README.md for himem example 2019-04-28 02:34:48 +00:00
131979e517 Merge branch 'bugfix/doc_ubuntu_packages_v3.2' into 'release/v3.2'
docs: Update package dependencies (backport v3.2)

See merge request idf/esp-idf!4458
2019-04-28 10:27:19 +08:00
9d6cace1fd Merge branch 'test/detect_exception_in_idf_dut_v3.2' into 'release/v3.2'
tiny-test-fw: support detect exception in IDFDUT (backport v3.2)

See merge request idf/esp-idf!4543
2019-04-28 10:26:48 +08:00
a5b007f6bb Merge branch 'bugfix/msys_cancel_idfpy_v3.2' into 'release/v3.2'
tools: re-run idf.py in MSYS with winpty (backport v3.2)

See merge request idf/esp-idf!4456
2019-04-28 10:26:10 +08:00
0beb60e8fc Merge branch 'test/fix_unit_test_job_pass_even_no_test_executed_v3.2' into 'release/v3.2'
test: fix CI UT job pass even ut app bootup fail (backport v3.2)

See merge request idf/esp-idf!4388
2019-04-28 10:25:53 +08:00
9294e4d08d Merge branch 'feature/poll_v3.2' into 'release/v3.2'
VFS: Implement poll() based on select() (backport v3.2)

See merge request idf/esp-idf!4350
2019-04-28 10:24:41 +08:00
193b8e93a8 Merge branch 'bugfix/btdm_abort_if_deinit_spp_without_init_v3.2' into 'release/v3.2'
components/bt: Fix abort if call esp_spp_deinit without calling esp_spp_init

See merge request idf/esp-idf!4862
2019-04-26 21:01:35 +08:00
8da392aa1d Merge branch 'feature/esp_http_client_global_ca_store_v3.2' into 'release/v3.2'
esp_http_client: add support for using certs from global ca store (backport_v3.2)

See merge request idf/esp-idf!4868
2019-04-26 10:08:23 +08:00
c3cee5e3de Merge branch 'backport/feature_set_redirect_function_v32' into 'release/v3.2'
Add a `esp_http_client_set_redirection` function. (backport v3.2)

See merge request idf/esp-idf!4867
2019-04-26 10:07:04 +08:00
0c13ae6b45 Merge branch 'feature/btdm_add_ble_link_timeout_config_v3.2' into 'release/v3.2'
Component/bt: add ble link timeout config in menuconfig(backport v3.2)

See merge request idf/esp-idf!4826
2019-04-25 20:05:19 +08:00
306a1173af Merge branch 'feature/wifi_refactor_softap_power_save_v3.2' into 'release/v3.2'
refactor softap power save (backport v3.2)

See merge request idf/esp-idf!4823
2019-04-25 17:05:49 +08:00
592a4295be newlib: Fix adjtime
Fixed adjtime function: While using the adjtime() function,
the time correction accumulated an error
when reading the time frequently (using gettimeofday).
2019-04-24 17:42:38 +08:00
2549951498 esp_http_client: add support for using certs from global ca store
Closes https://github.com/espressif/esp-idf/issues/3062

(cherry picked from commit 27e00cf7aa)
2019-04-24 14:06:33 +05:30
b2384dc9ee Add a esp_http_client_set_redirection function When using direct operations instead of esp_http_client_perform, we need a way to set redirection URL when we get 30x response codes. Added the function for the same. User can now check status code and call esp_http_client_set_redirection function to enable redirection. Related change in adf: https://gitlab.espressif.cn:6688/adf/esp-adf-internal/merge_requests/187
Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-04-24 13:54:22 +05:30
f95826144e components/bt: Fix abort if call esp_spp_deinit without calling esp_spp_init 2019-04-24 11:34:06 +08:00
344cb99d34 Fix url redirection issue.
Operation:
In `esp_http_client_set_url`, we check for if old_host is same as new_host.
Delete and open new connection if host is different.

Issue:
We just pointed `client->connection_info.host` to `old_host` and reassigned it.
This made old_host and new_host always point to same location and hence, using old_host with new request.

Fix:
Made a separate copy for old_host using strdup.

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

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-04-23 14:28:21 +05:30
464df4b788 bugfix: fix bug in flash 80M + sram 40M mode 2019-04-23 02:18:15 +00:00
8ff0d986b6 bugfix(psram): improve spi cs timing settings for psram
1. remove redundant SPI clock settings, use rom functions to set clock.
2. remove redundant SPI cs setup and hold settings.
3. for old 32Mbit psram, cs hold time must only be 0.5T due to the special driving mode.(cs_setup = 0; cs_hold = 0)
4. for new 64Mbit psram, cs hold time is recommended to be 2.5T. (cs_setup = 1, cs_setup_time = 0;cs_hold = 1, cs_hold_time = 1)
2019-04-23 02:18:15 +00:00
225bc0f80a Merge branch 'bugfix/remove_second_sha_enable_v3.2' into 'release/v3.2'
esp32/sha: Remove second enabling in esp_sha_lock_engine_common (backport v3.2)

See merge request idf/esp-idf!4780
2019-04-23 07:38:00 +08:00
96c8343e46 Component/bt: add ble link timeout config in menuconfig
- add ble link timeout config in menuconfig
- disable background connection when call gatts_open
2019-04-22 21:55:06 +08:00
d9cdbcdc8b examples: fix iperf exit error 2019-04-22 13:02:42 +08:00
3ee11bcafc refactor softap power save
1. Softap support multicast and broadcast saving and flushing
    when the associated stations enable IEEE80211 legacy power
    save(which is called modem sleep in ESP32).

    2. Improve the frame saving and flushing mechanism of softap power
    save.
2019-04-19 14:14:33 +08:00
bcb543eb10 Merge branch 'bugfix/coex_decouple_wifi_and_bt_code_with_coexist_v3.2' into 'release/v3.2'
Decouple WiFi and BT with coexist to reduce bin size (backport v3.2)

See merge request idf/esp-idf!4811
2019-04-19 13:31:06 +08:00
bb73659c9c Merge branch 'test/modify_mesh_ci_v3.2' into 'release/v3.2'
test: update mesh test cases for ci  (backport v3.2)

See merge request idf/esp-idf!4650
2019-04-18 11:29:43 +08:00
58bc6be4c0 test:update mesh test cases for ci test(v3.2)
add mesh test case in TC_IT_MESH_EST.yml and TC_IT_MESH_COMM.yml

add job form IT_02 to IT_08
2019-04-17 17:25:17 +08:00
5059c7fac3 Decouple WiFi and BT with coexist to reduce bin size
1. Do not link WiFi code when only BT or BLE is used and WiFi is not
used.

2. Do not link coexist code when CONFIG_SW_COEXIST_ENABLE is disabled.
2019-04-17 16:59:24 +08:00
cf866f23f2 Merge branch 'bugfix/fix_some_wifi_and_coexist_bugs_0416_v3.2' into 'release/v3.2'
esp32: fix some WiFi and coexist bugs (backport v3.2)

See merge request idf/esp-idf!4803
2019-04-17 14:24:32 +08:00
faec3211bd esp32: fix some WiFi and coexist bugs
Fix following WiFi and coexist bugs:
1. Fix BT disconnecting due to too many reset BB
2. Fix the bug that no TBTT is generated after rx wrong beacon when WiFi/BT coexist
3. Fix a DelBA bug
4. Add out of memory check
5. Fix the bug that STA incorrectly receives packets when scanning in connected status
6. PHY4008: Disable BT TX in force wifi mode, and enable BT TX in un-force wifi mode
2019-04-17 10:02:51 +08:00
c7d0df5451 Merge branch 'bugfix/fix_scan_and_connect_bugs_0415_v3.2' into 'release/v3.2'
fix wifi scan and connect bugs (backport v3.2)

See merge request idf/esp-idf!4772
2019-04-16 21:09:15 +08:00
7097cb9c9d Merge branch 'bugfix/fix_deprecated_warning_with_dfs_init_auto_config_v3.2' into 'release/v3.2'
cpu_start: fix warnings with CONFIG_PM_DFS_INIT_AUTO option (v3.2)

See merge request idf/esp-idf!4791
2019-04-16 20:30:09 +08:00
1fcef31195 cpu_start: fix warnings with CONFIG_PM_DFS_INIT_AUTO option
Closes https://github.com/espressif/esp-idf/issues/3297
2019-04-16 11:21:26 +05:30
acc882f4dd Merge branch 'bugfix/btdm_bugx_backport_3.2' into 'release/v3.2'
Some bugs backport 3.2

See merge request idf/esp-idf!4773
2019-04-16 10:45:04 +08:00
e4c1bcddc5 Merge branch 'bugfix/freemodbus_fix_critical_sections' into 'release/v3.2'
freemodbus: fix critical sections to semaphore mutex (backport v3.2)

See merge request idf/esp-idf!4435
2019-04-16 08:53:23 +08:00
b2455219cc esp32/sha: Remove second enabling in esp_sha_lock_engine_common 2019-04-15 21:14:38 +08:00
de6b7d6520 fix wifi scan and connect bugs:
1. fix the bug block scan tiemout before scan finish
2. make menuconfig can set the WiFi mgmt short buffer num
3. modify wifi reason code
4. fix the bug PMK recal too long
2019-04-15 18:59:52 +08:00
fa40e43c8d Merge branch 'bugfix/btdm_fix_warning_when_disable_logs_v3.2' into 'release/v3.2'
components/bt: Fix warning when disable debug logs or in release mode and improve the code structure

See merge request idf/esp-idf!4620
2019-04-15 18:52:09 +08:00
9f29dbf656 Merge branch 'bugfix/btdm_fix_build_warning_when_bluedroid_disable_log_v3.2' into 'release/v3.2'
Component/bt: fix build warning when bluedroid disable log (backport v3.2)

See merge request idf/esp-idf!4566
2019-04-15 18:50:58 +08:00
b2d61989f1 Merge branch 'mesh/decouple_addition_v3.2' into 'release/v3.2'
Decouple Wifi and ESP-Mesh to reduce bin size (backport v3.2)

See merge request idf/esp-idf!4523
2019-04-15 17:06:00 +08:00
bb518afb59 Some bugs backport 3.2
1.Fix memory leak when set txpower
2.Fix some bugs
    Disconnect with apple device
    hci_refresh_enc_key_cmd will be ignore
    hci_refresh_enc_key_cmd will crash
2019-04-15 16:51:29 +08:00
37063ea9b6 Decouple Wifi and ESP-Mesh to reduce bin size
Do not link mesh code when mesh is not used
2019-04-14 20:36:14 +08:00
f6837e6117 Merge branch 'bugfix/esp_sha_signing_sha256_v3.2' into 'release/v3.2'
secure boot: Fix esp_sha INT WDT, switch to using mbedTLS API  (backport v3.2)

See merge request idf/esp-idf!4511
2019-04-14 02:57:45 +08:00
c4f39094d3 Merge branch 'bugfix/cmake_component_path_v3.2' into 'release/v3.2'
cmake: Set COMPONENT_PATH during early expansion of dependencies (v3.2)

See merge request idf/esp-idf!4594
2019-04-14 02:57:16 +08:00
2da22620f8 Merge branch 'feature/btdm_add_mesh_adv_type_and_srv_uuid_for_dup_scan_except_v3.2' into 'release/v3.2'
Component/bt: add mesh beacon adv and svc uuid for duplicate scan exceptional list (backport v3.2)

See merge request idf/esp-idf!4606
2019-04-14 02:56:43 +08:00
f77d0a9cdb Merge branch 'bugfix/ci_tag_for_cmake_linter_v3.2' into 'release/v3.2'
ci: A small CI stabilizing fix (backport v3.2)

See merge request idf/esp-idf!4710
2019-04-14 02:55:38 +08:00
ddf4991024 Merge branch 'bugfix/bootloader_flash_crypt_cnt_ff_v3.2' into 'release/v3.2'
flash encryption: reduce FLASH_CRYPT_CNT bit width to 7 bits (v3.2)

See merge request idf/esp-idf!4728
2019-04-14 02:55:21 +08:00
f8597be435 Merge branch 'bugfix/wifi_modify_wifi_kconfig_v3.2' into 'release/v3.2'
esp32: modify WiFi Kconfig in order to achieve better compatility and performance (bakcport v3.2)

See merge request idf/esp-idf!4386
2019-04-12 23:11:24 +08:00
6e5e430ef4 Merge branch 'bugfix/mesh_memory_leak_v3.2' into 'release/v3.2'
mesh: fix memory leak and group send (backport v3.2)

See merge request idf/esp-idf!4519
2019-04-12 22:02:08 +08:00
065d451e47 Merge branch 'bugfix/btdm_modify_HCI_GET_CMD_BUF_v3.2' into 'release/v3.2'
Component/bt: modify HCI_GET_CMD_BUF (backport v3.2)

See merge request idf/esp-idf!4599
2019-04-12 21:58:51 +08:00
c8990eb39d Merge branch 'bugfix/btdm_add_scan_window_interval_check_v3.2' into 'release/v3.2'
Component/bt: add scan window and interval check when set scan params (backport v3.2)

See merge request idf/esp-idf!4311
2019-04-12 21:57:50 +08:00
c90f770599 Merge branch 'bugfix/btdm_fix_blufi_prepare_write_crash_v3.2' into 'release/v3.2'
Component/bt: fix blufi prepare write crash (backport V3.2)

See merge request idf/esp-idf!4563
2019-04-12 21:57:23 +08:00
48978c6f2b Merge branch 'bugfix/btdm_fix_iOS_and_win10_compatibility_error_for_HID_v3.2' into 'release/v3.2'
Component/bt: fix iOS and win10 compatibility error  for HID (backport v3.2)

See merge request idf/esp-idf!4424
2019-04-12 21:56:40 +08:00
5bb5670d69 efuse/flash encryption: Reduce FLASH_CRYPT_CNT to a 7 bit efuse field
8th bit is not used by hardware.

As reported https://esp32.com/viewtopic.php?f=2&t=7800&p=40895#p40894
2019-04-12 07:28:57 +00:00
7197811861 Merge branch 'bugfix/prov_fix_conn_id_v3.2' into 'release/v3.2'
(backport v3.2) Unified Provisioning: Miscellaneous fixes in BLE

See merge request idf/esp-idf!4734
2019-04-12 13:46:06 +08:00
892c2be168 esp32: Chunk input blocks for esp_sha() function performance, add perf test 2019-04-12 05:45:05 +00:00
5c6be8380e secure boot: Use mbedtls_sha256() not esp_sha()
Latter is probably compiled into most firmwares already, saves some size.

Ref https://github.com/espressif/esp-idf/issues/3127
2019-04-12 05:45:05 +00:00
1d8e1c4ce4 esp32 hwcrypto: Prevent esp_sha() from disabling interrupts for extended period
* Closes https://github.com/espressif/esp-idf/issues/3127
* Closes IDFGH-681

Also reported at https://esp32.com/viewtopic.php?f=13&t=9506
2019-04-12 05:45:05 +00:00
1778573dad mesh: fix memory leak and group send
fix a bug in group send
fix esp_mesh_set_router when router_t not initialized
fix mesh memory leak with invalid option
2019-04-11 20:43:38 +08:00
9778549759 Merge branch 'bugfix/tw28146_make_wifi_iram_optimization_configurable_v3.2' into 'release/v3.2'
esp32: make WiFi IRAM optimization configurable (backport v3.2)

See merge request idf/esp-idf!4040
2019-04-11 18:44:19 +08:00
e5e226a121 Merge branch 'bugfix/external_rtc_start_fail_v3.2' into 'release/v3.2'
Bugfix/external rtc start fail (v3.2)

See merge request idf/esp-idf!4662
2019-04-10 14:17:41 +08:00
71845041e0 Unified Provisioning: Miscellaneous fixes in BLE
1. Pass the correct conn_id to protocomm_req_handle
In transport_simple_ble_write(), passing param->exec_write.conn_id would
be invalid. Instead param->write.conn_id should be passed
Similar change in transport_simple_ble_exec_write() to use
param->exec_write.conn_id

2. simple_ble_start() assumes that the mode is BLE only and enables
Bluetooth controller accordingly. For, cases having BT + BLE like Alexa
(Provisioning over BLE + Audio over classic BT), this assumption should
be removed.
2019-04-09 11:25:42 +05:30
54dff92df5 Merge branch 'feature/mfg_util_v3.2' into 'release/v3.2'
Add changes to mfg_util as per changes in nvs_util (backport v3.2)

See merge request idf/esp-idf!4702
2019-04-09 09:19:43 +08:00
a5bd08a6b6 esp_http_server : Test added to check limit on max_open_sockets config option 2019-04-08 11:36:08 +05:30
befc74e0f0 esp_http_server : Only accept new connections if server has capacity to handle more
This fix prevents HTTP server from accepting new connections when the total count of connected
sockets has reached the max_open_sockets limit set during configuration. The pending connections
are kept in backlog until atleast one of the connected sockets is closed. The maximum number of
connection requests that can kept in backlog is specified as backlog_conn configuration option.
Note that this modification has no effect when LRU purge is enabled.

Also added sanity check on setting for max_open_sockets during configuration.

Solution suggested by jimparis https://github.com/espressif/esp-idf/issues/3183#issue-421234265

Closes https://github.com/espressif/esp-idf/issues/3183
2019-04-08 11:34:20 +05:30
12bf1017de Merge branch 'bugfix/heap_caps_int_overflows_v3.2' into 'release/v3.2'
heap: Add integer overflow checks on MALLOC_CAP_32BIT & MALLOC_CAP_EXEC (v3.2)

See merge request idf/esp-idf!4569
2019-04-05 09:31:03 +08:00
006442cd9d mfg_util: Add changes to mfg_util as per changes in nvs_util
revert changeson this file

Update README for mfg util

Update to correct coding style of script

(cherry picked from commit a88b40483d)
2019-04-04 18:28:10 +05:30
25a134afdc ci: Fix runner choice for CMake verification job and change .check_job_template tag to host_test 2019-04-04 17:23:20 +07:00
70811110fc Merge branch 'fix/spi_on_readonly_pins_v3.2' into 'release/v3.2'
spi: fix the bug of connecting SPI peripheral to read-only pins (backport v3.2)

See merge request idf/esp-idf!4307
2019-04-02 12:29:06 +08:00
b87e440c69 Merge branch 'update/nvs_part_util_v3.2' into 'release/v3.2'
Update/nvs partition utility v3.2 (backport v3.2)

See merge request idf/esp-idf!4280
2019-04-02 11:58:56 +08:00
f85294b058 Fix external start fail 2019-04-02 12:52:58 +11:00
413b6487fb soc/rtc: Bypass touchpad current to external 32k crystal oscillator 2019-04-02 12:50:50 +11:00
f608afbe6b Merge branch 'bugfix/build_fails_when_editor_assoc_with_py_scripts_v3.2' into 'release/v3.2'
Fix issues with CMake builds when python scripts are associated with an editor (backport v3.2)

See merge request idf/esp-idf!4637
2019-04-02 09:40:10 +08:00
325fca94c0 spi: fix the bug of connecting SPI peripheral to read-only pins
The requirements of pin capabilites is different for spi master and
slave.  The master needs CS, SCLK, MOSI to be output-able, while slave
needs MISO to be output-able.

Previous code is for master only.

This commit allows to place other 3 pins than MISO on input-only pins
for slaves. Refactoring for spi_common is also included.

Resolves https://github.com/espressif/esp-idf/issues/2455
2019-04-01 18:39:02 +08:00
3130b19cf8 Component/bt: add mesh beacon adv and svc uuid for duplicate scan exceptional list 2019-03-28 11:20:51 +08:00
5d2c23c8ab nvs_util: Add support for creation of unique encryption keys
(cherry picked from commit e1f466e708c2c1b825e955ec28b70dc3058f9262)
2019-03-27 18:24:18 +05:30
8480e79ae2 nvs_util: Add support for creation of unique encryption keys
(cherry picked from commit 8b88b3303d83f5f03249e7b3410f6ecabaa00396)
2019-03-26 15:52:10 +05:30
86052eec78 nvs_util: Fix to support write of multiple singlepage big blob data
Closes https://github.com/espressif/esp-idf/issues/3011

(cherry picked from commit 60b5cdde20)
2019-03-26 15:49:25 +05:30
5ede49ca4a components/bt: Fix warning when disable debug logs or in release mode and improve the code structure 2019-03-26 15:29:22 +08:00
bbdb236ab7 components/bt: Fix warning when disable debug logs or in release mode and improve the code structure 2019-03-26 14:59:58 +08:00
0a0113bcce ci: test full build never runs '/usr/bin/env python' or similar 2019-03-25 11:41:00 +08:00
84a534a4a0 cmake: Fix for Python files executed directly, not via PYTHON variable 2019-03-25 11:41:00 +08:00
286202caa3 Merge branch 'bugfix/mqtt_fragmented_packed_msg_3.2' into 'release/v3.2'
MQTT support for fragmented and packed messages (Backport 3.2)

See merge request idf/esp-idf!4593
2019-03-25 10:49:56 +08:00
6b4dcd4f5c Component/bt: modify HCI_GET_CMD_BUF 2019-03-22 15:02:20 +08:00
4f62227030 cmake: Set COMPONENT_PATH during early expansion of dependencies
Works around bug where components/soc/CMakeLists.txt was testing "EXISTS
${COMPONENT_PATH}/${SOC_NAME}" and this test could pass during early
expansion if COMPONENT_PATH was empty and a directory /esp32 exists
on Windows.

Closes https://github.com/espressif/esp-idf/issues/3195
2019-03-22 10:12:06 +11:00
9ebaf36c28 tcp_transport: modification of ws to read headers first in order to read the exact payload
closes https://github.com/espressif/esp-mqtt/issues/69
2019-03-21 14:35:59 +01:00
1ece141c52 mqtt: support for BEFORE_CONNECT event in idf
Updated examples to use new event id, idf to use mqtt with fixed retained, oversized messages
2019-03-21 14:35:49 +01:00
f49e2afe94 Merge branch 'bugfix/sphinx_build_failure_on_rtd_v3.2' into 'release/v3.2'
docs: Upgraded sphinx package version to prevent build failures on readthedocs…

See merge request idf/esp-idf!4554
2019-03-21 14:24:24 +08:00
17b260d05c Merge branch 'bugfix/nvs_api_usage_in_simple_ota_example_v3.2' into 'release/v3.2'
Minor bugfix in simple ota example (backport v3.2)

See merge request idf/esp-idf!4584
2019-03-21 13:06:48 +08:00
07fc1d181f bugfix(simple_ota): Compatible with V3.1 and V3.2
(cherry picked from commit 0fa31d3e31)
2019-03-21 10:24:09 +08:00
beb29bc88a Merge branch 'bugfix/btdm_fix_no_adv_report_when_scaning_with_sleep_enable_v3.2' into 'release/v3.2'
Component/bt: fix no adv report when scanning with sleep enable(backport v3.2)

See merge request idf/esp-idf!4537
2019-03-20 22:03:12 +08:00
76c20ab9b3 esp32: make WiFi IRAM optimization configurable
With this feature, the WiFi IRAM optimization can be disabled/enabled via menuconfig.
2019-03-20 13:45:54 +00:00
241ba1a6bb Component/bt: fix iOS and win10 compatibility error for HID 2019-03-20 19:47:04 +08:00
1fac58deb7 heap: Add integer overflow checks on MALLOC_CAP_32BIT & MALLOC_CAP_EXEC 2019-03-20 18:30:17 +11:00
78d32f2e8b Component/bt: fix build warning when bluedroid disable log 2019-03-20 15:06:17 +08:00
f237b92bc4 Component/bt: fix blufi prepare write crash 2019-03-20 14:27:11 +08:00
ccc1263ca8 docs: Upgraded sphinx package version to prevent build failures on readthedocs site. Upgraded versions of other packages that are used during documentation build. (backport v3.2) 2019-03-19 20:22:07 +01:00
51a44c81de 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-03-19 21:06:16 +08:00
1b96cefaf8 tiny-test-fw: support translate backtrace in IDFDUT 2019-03-19 21:06:16 +08:00
ef82e8d0bc tiny-test-fw: support detect exception in IDFDUT 2019-03-19 21:03:41 +08:00
d6bdaed141 Component/bt: fix no adv report when scanning with sleep enable 2019-03-18 17:40:19 +08:00
13018449fe Merge branch 'bugfix/remove_malloc_ble_prov_v3.2' into 'release/v3.2'
(backport v3.2) Protocomm BLE: Make changes in handling BLE read/write requests

See merge request idf/esp-idf!4495
2019-03-15 14:29:30 +08:00
b6687e56ed Merge branch 'bugfix/console_allow_buffered_v3.2' into 'release/v3.2'
console example: use buffered stdout by default (backport v3.2)

See merge request idf/esp-idf!4507
2019-03-15 14:03:29 +08:00
6494927766 examples: don't enable buffering on stdout in console examples
newlib uses significantly more stack space when printing to an
unbuffered stream. To reduce the amount of stack space required to
use the console, don’t disable buffering. linenoise should support
unbuffered stdout instead.
2019-03-15 11:29:56 +08:00
6ce5c7668f console/linenoise: support buffered stdout 2019-03-15 11:29:56 +08:00
c97a05c0d5 Merge branch 'feature/btdm_add_update_duplicate_scan_exceptional_list_apis_v3.2' into 'release/v3.2'
Component/bt: add update duplicate scan exceptional list APIs

See merge request idf/esp-idf!4494
2019-03-15 10:46:57 +08:00
fed772641a Component/bt: add update duplicate scan exceptional list APIs 2019-03-14 20:59:38 +08:00
39d8a89c80 Protocomm BLE: Make changes in handling BLE read/write requests
1. Remove unwanted malloc during BLE send response
2. Populate the missing parameters in the response - handle, offset, auth_req
2019-03-14 12:50:03 +05:30
62980ae995 Merge branch 'feature/btdm_add_adv_report_flow_control_v3.2' into 'release/v3.2'
component/bt: add vendor hci and adv report flow control (backport v3.2)

See merge request idf/esp-idf!4462
2019-03-14 13:51:52 +08:00
029a155a71 Merge branch 'bugfix/mdns_add_remove_multiple_srv_3.2' into 'release/v3.2'
mdns: fix possible crash if tx packet contained answer to removed service (backport 3.2)

See merge request idf/esp-idf!4481
2019-03-14 07:56:40 +08:00
4849d7ae90 Merge branch 'bugfix/mdns_incorrect_semaphore_use_v3.2' into 'release/v3.2'
mdns: use binary semaphore instead of mutex when searching (Backport 3.2)

See merge request idf/esp-idf!4478
2019-03-14 06:26:51 +08:00
10b4ddb467 mdns: fix possible crash when probing on particular interface with duplicated service instances due to naming conflicts on network
Issue: MDNS server initially sends probing packets to resolve naming confilicts with already registered service instances. In case of a conflict, instance name is altered and probing restarts. Original instance however wasnnot removed from the structure and upon service removal only one entry was removed and a dangling service might have been kept in the structure to bring about a crash.
Resolution: Keep only one instance of a service in the probing structure.

Closes IDF-438
2019-03-13 16:24:18 +01:00
288bc2bfca mdns: enable pcbs before starting service thread to avoid updating pcb's internal variables from concurent tasks
possible race condition: user task runs mdns_init, which enables pcbs while mdns-task already created could execute enable/disable of the same pcbs if an appropriate system event received
2019-03-13 16:24:03 +01:00
8e4ec90dc4 mdns: fix possible deadlock on mdns deinit calling mdns_free()
mnds_free() initiates stop and delete timer tasks, which after locking the mutex could lead to a dead lock in case timer task executed before deleting the task, as it would wait indefinitelly for unlocking the mutex. This condition is fixed by calling _mdns_stop_timer without locking the mutex, because there's no need to protect any data when stopping and deleting the timer task

Closes https://github.com/espressif/esp-idf/issues/1696
2019-03-13 16:24:03 +01:00
0e06b4d653 mdsn: fix race condition in updating packet data from user task when failed to allocate or queue a new service
Issue: mdns_service_add API allocates and queues an action to be processed in mdns task context; when allocation or queueing fails, allocated structure needs to be freed. Function _mdns_free_service did not only fee all the structures, but also updates packet data.
Resolution: Moved removal of packet data outside of _mdns_free_service function.
2019-03-13 16:24:03 +01:00
8fe4007dfa mdns: fix possible crash when packet scheduled to transmit contained service which might have been already removed
packets scheduled to transmit are pushed to action queue and removed from tx_queue_head structure, which is searched for all remaining services and while service is removed, then service questions/asnwers are also removed from this structure. This update fixes possible crash when packet is pushed to action queue, and when service is removed, its answers are removed from tx_queue_head, but not from action queue. this could lead to a crash when the packet is poped from action queue containing questions/answers to already removed (freed) service

Closes IDF-438
2019-03-13 16:24:03 +01:00
09f4015300 mdns: use binary semaphore instead of mutex when searching
mdns_search_once_t::lock is used to synchronize tasks (taken by one
task and given by the other) so it should not be a mutex.
Convert to semaphore, and rename to indicate its purpose.
2019-03-13 14:55:01 +01:00
56918682f9 Merge branch 'bugfix/confgen_expr_value_v3.2' into 'release/v3.2'
confgen: Fix bug with JSON metadata conditional range generation

See merge request idf/esp-idf!4470
2019-03-13 16:54:41 +08:00
6b49a355f7 confgen: Fix bug with JSON metadata conditional range generation
When generating JSON metadata for ranges where there are conditional ranges (ie different allowed range
depending on another config setting), the JSON metadata would always have the last named range as
the expression was not evaluated properly.

Thanks to ulfalizer on GitHub for pointing this out.

Closes https://github.com/espressif/esp-idf/issues/2195
2019-03-13 16:50:55 +11:00
6628fddae6 Component/bt: add BLE adv report flow control 2019-03-12 20:18:30 +08:00
ff99e0ea69 Merge branch 'feature/upgrade_sphinx_and_breathe_v3.2' into 'release/v3.2'
docs: Preparation for upgrade of Sphinx and Breathe packages to versions 1.8.4…

See merge request idf/esp-idf!4380
2019-03-12 16:53:11 +08:00
zwj
b305a96a74 component/bt: add vendor hci cmd 2019-03-12 11:55:42 +08:00
fe4e68132f docs: Update package dependencies
Closes https://github.com/espressif/esp-idf/issues/2384
2019-03-11 10:33:15 +01:00
e870a0f0f1 tools: re-run idf.py in MSYS with winpty
This is done in order to cancel subprocesses on keyboard interrupt
(CTRL+C).
2019-03-11 08:54:44 +01:00
12643e063c Merge branch 'bugfix/autoip_memoey_leak_debug_v3.2' into 'release/v3.2'
fix the bug in auto Ip memory leak (backport v3.2)

See merge request idf/esp-idf!4431
2019-03-08 19:54:34 +08:00
a7dc804476 Merge branch 'bugfix/httpd_sess_ctx_backportv3.2' into 'release/v3.2'
esp_http_server: Provide apps an option to let http_server ignore sess_ctx changes

See merge request idf/esp-idf!4421
2019-03-08 11:52:17 +08:00
7342811c37 freemodbus: change critical sections to semaphore mutex
revert changes made in mbrtu.c, mbascii.c
change critical section type to semaphore mutex instead of spin lock

Closes: https://github.com/espressif/esp-idf/issues/3009
2019-03-07 16:01:43 +01:00
8e0b0af09b fix the bug in auto Ip memory leak 2019-03-06 20:01:36 +08:00
e1e82c8949 Merge branch 'bugfix/lack_of_break_in_tcp_client_v3.2' into 'release/v3.2'
fix the bug in tcp_client (backport v3.2)

See merge request idf/esp-idf!4391
2019-03-06 14:22:59 +08:00
d99d92e170 Merge branch 'bugfix/fix_dig_gpio_unable_hold_bug_v3.2' into 'release/v3.2'
Bugfix/fix digital gpio unable hold bug  (backport v3.2)

See merge request idf/esp-idf!4355
2019-03-06 12:10:38 +08:00
1ca67e98d6 test: fix CI UT job pass even ut app bootup fail 2019-03-05 07:58:39 +00:00
f8f0c81077 esp_http_server: Provide apps an option to let http_server ignore sess_ctx changes
By default, if a URI handler changes the http session context,
the webserver internally clears the older context after the handler
returns. However, if applications want to change this behavior and
manage the allocation/de-allocation/freeing themselves and let the
server handle only the "socket close" case, this commit provides such
an option.
2019-03-05 13:06:33 +05:30
727c2cfa00 Merge branch 'feature/add_api_get_rmt_idle_level_v3.2' into 'release/v3.2'
Bugfix:  Fixed some RMT related issues (backport v3.2)

See merge request idf/esp-idf!4358
2019-03-05 10:51:00 +08:00
1d4eeeb464 VFS: Implement poll() based on select()
Closes https://github.com/espressif/esp-idf/issues/2945
2019-03-04 08:02:03 +01:00
e9a764d9a5 Merge branch 'bugfix/make_get_coreid_volatile_backport_v3.2' into 'release/v3.2'
freertos: Make xPortGetCoreID() volatile (backport v3.2)

See merge request idf/esp-idf!4379
2019-03-01 18:49:00 +08:00
b2e4af4ed0 Merge branch 'bugfix/ble_reconn_rescan_readv_crash_v3.2' into 'release/v3.2'
component/bt : fix bug that there's low ratio crash when BLE do re-connect/re-scan/re-adv

See merge request idf/esp-idf!4325
2019-03-01 18:06:02 +08:00
66a0b64e54 freertos: Make xPortGetCoreID() volatile
When xPortGetCoreID() is called twice within a function,
it might only be called once after compilation. This
commit makes the inline assembly of the function volatile.

Closes #3093
2019-03-01 02:05:33 +00:00
9d48cdb6f3 Merge branch 'bugfix/multiple_backports_v3.2' into 'release/v3.2'
multiple backports (v3.2)

See merge request idf/esp-idf!4367
2019-02-28 21:42:19 +08:00
258e9c98be Merge branch 'bugfix/cmake_psram_fix_flag_v3.2' into 'release/v3.2'
cmake: Fix psram workaround compiler flag application (backport v3.2)

See merge request idf/esp-idf!4364
2019-02-28 21:06:11 +08:00
35e491856e ci: Only use "github_sync" tagged runners to talk to GitHub 2019-02-28 20:38:31 +08:00
226c790766 ci: Retry submodule sync 2 more times before failing 2019-02-28 20:38:31 +08:00
c0d32f6e48 nvs: add a blob fragmentation test case
Ref. TW12937
2019-02-28 20:38:31 +08:00
203f75223e nvs: do eager cleanup of HashListBlocks
Previously when HashList was removing items, HashListBlocks were
removed lazily. This resulted in empty HashListBlocks dangling around
in full pages, even when all items have been erased. These blocks
would only be deleted when NVS was re-initialized
(nvs_flash_deinit/nvs_flash_init).

This change does eager cleanup instead, based on the code from
@negativekelvin offered in
https://github.com/espressif/esp-idf/issues/1642#issuecomment-367227994.

Closes https://github.com/espressif/esp-idf/issues/1642.
2019-02-28 20:38:31 +08:00
742f8e7f8a esp_timer: fix occasional failures in "monotonic values" test
1. ref_clock used in unit tests occasionally produces time off by ~100
microseconds shortly after being started. Add a delay to let
ref_clock stabilise, until the cause is found.

2. Reduce roundoff error accumulation which would occasionally cause
the test to fail, by choosing an overflow value which can be divided
by APB frequency.

3. Move time sampling part of the test into an IRAM function to
reduce variations due to cache behavior.

4. Remove calculation of "standard deviation" in the test, as what was
calculated was not actually standard deviation, and it did not add any
useful information.
2019-02-28 20:38:31 +08:00
7e16a79cf7 esp_timer: improve unit test robustness
1. call esp_timer_get_time and ref_clock_get in the same order on
   start and in the loop

2. disable interrupts when calculating delta between ref_clock
   and esp_timer

3. ensure both functions are in cache before calculating the delta
2019-02-28 20:38:31 +08:00
22dc4898d9 soc: define named constants for DPORT_CPUPERIOD_SEL values 2019-02-28 20:38:31 +08:00
f78c96a3d7 bootloader: check previously used clock frequency at run time
In the situation when bootloader was compiled for 240MHz, and app was
compiled for 160MHz, and the chip is a revision 0 chip, the
bootloader will assume that the application has also been running at
240MHz. This will cause the chip to lock up later. Modify this to use
a run time check of DPORT_CPUPERIOD_SEL, which indicates which of the
PLL frequencies was used.

Closes https://github.com/espressif/esp-idf/issues/2731.
2019-02-28 20:38:31 +08:00
b4727a8765 soc/rtc_clk: don’t clear DPORT_CPUPERIOD_SEL when switching to XTAL
This is not necessary since RTC_CNTL_SOC_CLK_SEL is set before this.
2019-02-28 20:38:31 +08:00
8bbd99ad9e make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.

For example:

    main/
        component.mk
        main.c
        test/
            component.mk
            test_main.c

Would compile test_main.c and link libtest.a.

2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.

For example:

    esp/
        esp-idf/
        esp32/
            (random stuff)
        mycomponent/
            component.mk
            mycomponent.c
        myproject/
            main/
            Makefile

and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.

3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.

For example:

    my_components/
        my_component/
            component.mk
            my_component.c
        esp32/
            (some random stuff)

and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-28 20:38:31 +08:00
5dcdef0639 kconfig: fix compatibility with very old versions of flex
See 4e762e4918

Closes https://github.com/espressif/esp-idf/issues/2703
2019-02-28 20:38:31 +08:00
d651ee3d28 fix the bug in tcp_client
Closes https://github.com/espressif/esp-idf/issues/3058
2019-02-28 14:25:54 +08:00
34f1c208a8 esp32: modify WiFi Kconfig in order to achieve better compatility
and performance
2019-02-28 10:07:13 +08:00
83d7b4591c Merge branch 'esp_http_server/lru_counter_for_timestamp_backportv3.2' into 'release/v3.2'
esp_http_server/lru_counter_for_timestamp:Added LRU counter for timer(backport v3.2)

See merge request idf/esp-idf!4319
2019-02-28 07:03:38 +08:00
f5096892f9 docs: Preparation for upgrade of Sphinx and Breathe packages to versions 1.8.4 and 4.11.1. Updated check of Sphinx warnings to account for the filename instead of the whole path, that for the same errors may be different between English and Chinese docs. (backport v3.2) 2019-02-27 23:21:47 +01:00
56694fb4b6 cmake: Fix psram workaround compiler flag application
Previously, this compiler flag was not being applied
regardless of CONFIG_SPIRAM_CACHE_WORKAROUND setting.

Explanation: add_compile_options() only applies to
source files added after the function is run, or in
subdirectories added after the function is run. In
this case, no new source files were being added after
this function was run.
2019-02-27 16:38:29 +11:00
929542d4fa driver(rmt): Fixed some RMT related issues.
1. Add missing get function to RMT API: rmt_get_idle_level().
2. Suppress error message from rmt_wait_tx_done() if wait_time==0 (allows for polling).
3. Remove the blank lines between parameter lists.

Merges https://github.com/espressif/esp-idf/pull/2666
2019-02-26 20:46:23 +08:00
be49c8d841 driver(gpio): fixed digital gpio unable hold bug during deep-sleep for release/v3.2. 2019-02-26 20:20:25 +08:00
67aefe1011 component/bt : fix bug that there's low ratio crash when BLE do re-connect/re-scan/re-adv
fix 3 bugs:
1. do BLE connect (both of slave and master), it mgiht cause crash due to there's much interrupts happens effect ble code running, for example, wifi run on the same core as bluetooth controller and wifi run throughtput test.
2. do BLE scan stop or adv stop or connection stop, it might cause ASSERT or crash due to memory corrupted in controller memory poll.
3. minor bug fix, not really effect bluetooth.
2019-02-25 13:40:46 +00:00
46a3c36343 Component/bt: add scan window and interval check when set scan params 2019-02-25 13:22:32 +00:00
58e49d169c esp_http_server/lru_counter_for_timestamp:Added LRU counter for timer
Replaced the os timer in http server by LRU counter. The timestamp is
unnecessary for LRU.
2019-02-25 09:16:28 +00:00
a241f95407 Merge branch 'bugfix/freertos_unused_xSize_backport_v3.2' into 'release/v3.2'
freertos: Fix unused variable warning (backport v3.2)

See merge request idf/esp-idf!4296
2019-02-25 15:44:22 +08:00
aaaa491c42 freertos: Fix unused variable warning
This commit fixes an unused variable warning when
configASSERT is undefined.
2019-02-22 01:06:44 +08:00
91aa35e831 Merge branch 'bugfix/mdns_service_memory_leak_3.2' into 'release/v3.2'
mdns: fix memory leak when query for service plus various other fixes (Backport v3.2)

See merge request idf/esp-idf!4287
2019-02-21 17:53:32 +08:00
113e829552 mdns: fix memory leak in pbuf if tcpipadapter failed to get netif 2019-02-21 06:43:23 +00:00
3802fddefb mdns example: fix print result for IPv6 addresses 2019-02-21 06:43:23 +00:00
bb2eb9adeb mdns: fix malfuctional query_txt
when running a query for a single txt, result entries were not created and attached to result structure. this issue was introduced when fixing memory leak in txt structure, which worked correctly for PTR queries, but caused trouble for TXT query.
2019-02-21 06:43:23 +00:00
78116afa01 mdns: fix possible crash when mdns_free called while action queue not empty 2019-02-21 06:43:23 +00:00
b865e72aec mdns: fix memory leak when query for service receives multiple ptr entries for one instance
fixes redmine issue 27300
2019-02-21 06:43:23 +00:00
f1b2457b6c Merge branch 'bugfix/psram_move_qsort_setlocale_flash_v3.2' into 'release/v3.2'
psram: Move newlib qsort() and setlocale() functions from IRAM to flash (backport v3.2)

See merge request idf/esp-idf!4322
2019-02-21 14:42:17 +08:00
46fa5654a7 Merge branch 'bugfix/btdm_fix_connection_params_update_issues_v3.2' into 'release/v3.2'
component/bt:fix connection params update issues (backport v3.2)

See merge request idf/esp-idf!4297
2019-02-21 11:49:16 +08:00
bf28a1a27b psram: Move newlib qsort() and setlocale() functions from IRAM to flash 2019-02-21 10:32:00 +11:00
b7beefba9e Merge branch 'bugfix/cmake_stack_protector_v3.2' into 'release/v3.2'
esp32: disable stack protector for startup code (CMake) (backport v3.2)

See merge request idf/esp-idf!4250
2019-02-20 15:40:14 +08:00
0784c52131 Merge branch 'doc/add_coap_readme' into 'release/v3.2'
doc: add CoAP README.md(backport v3.2)

See merge request idf/esp-idf!4262
2019-02-20 15:38:43 +08:00
a7f826750b Merge branch 'revert-00d10688' into 'release/v3.2'
Revert "Merge branch 'bugfix/external_rtc_start_fail_3.2' into 'release/v3.2'"

See merge request idf/esp-idf!4293
2019-02-20 15:09:59 +08:00
38086ae737 Merge branch 'bugfix/spiram_linker_wildcards_v3.2' into 'release/v3.2'
esp32 psram: Provide library name for ROM libc objects linked as PSRAM workarounds (backport v3.2)

See merge request idf/esp-idf!4153
2019-02-20 14:17:52 +08:00
6173660ff0 Merge branch 'bugfix/coex_lc_protect_v3.2' into 'release/v3.2'
component/esp32 : fix coexist lc protect cause memory corrupted

See merge request idf/esp-idf!4267
2019-02-20 11:14:22 +08:00
79b450cfb4 esp32 psram: Provide library name for ROM libc objects linked as PSRAM workarounds
Fixes bug reported on forums where any source file ending in *lock.c or *creat.c
was being linked to IRAM.

https://esp32.com/viewtopic.php?f=13&t=8909&p=37362#p37362
2019-02-20 00:30:25 +00:00
c7fbc6dd85 Merge branch 'bugfix/wdt_compability_app_with_old_bootloader_v3.2' into 'release/v3.2'
esp32: Fix wdt settings in esp_restart_noos (backport v3.2)

See merge request idf/esp-idf!4294
2019-02-20 02:17:09 +08:00
3b5bba1812 Merge branch 'bugfix/fix_psram_eid_v3.2' into 'release/v3.2'
bugfix(psram): fix psram size acquisition method, support esp32-pico chips (backport v3.2)

See merge request idf/esp-idf!4254
2019-02-20 02:13:47 +08:00
zwj
b4feb67b5f component/bt:fix connection params update issues 2019-02-19 20:26:36 +08:00
578d7902af Merge branch 'bugfix/btdm_crash_when_inquiry_cancel_v3.2' into 'release/v3.2'
Bugfix/btdm crash when inquiry cancel v3.2

See merge request idf/esp-idf!4277
2019-02-19 17:57:00 +08:00
509884c5ac Revert "Merge branch 'bugfix/external_rtc_start_fail_3.2' into 'release/v3.2'"
This reverts merge request !4272
2019-02-19 12:47:44 +08:00
8a656f006e esp32: Fix wdt settings in esp_restart_noos
Fixed compatibility the new apps with the old bootloaders.

Closes: https://github.com/espressif/esp-idf/issues/2927
2019-02-19 12:43:35 +08:00
0f79c72704 Merge branch 'bugfix/aws_iot_backport_few_fixes_for_v3.2' into 'release/v3.2'
Bugfix/aws iot backport few fixes for v3.2 (backport_v3.2)

See merge request idf/esp-idf!4247
2019-02-19 11:36:18 +08:00
6d6f71bbae component/esp32 : fix coexist lc protect cause memory corrupted
The bug will cause memory corrupted (the largest range is from 0x3ffc0000 ~ 0x3ffc8000),
some strange error will happen, like IllegalInstruction, LoadProhibited and .etc.
2019-02-19 03:30:02 +00:00
332ccd0925 Merge branch 'feature/provisioning_backport_api_changes' into 'release/v3.2'
(backport v3.2)  Provisioning Framework API changes

See merge request idf/esp-idf!4249
2019-02-19 10:47:47 +08:00
2ee1c6fd3e provisioning examples : typos fixed and minor change in timer callback execution
Note : Examples have been updated to prevent invocation of bluedroid/wifi APIs from inside timer callback when stopping provisioning. Workaround is to spawn new task from inside the timer callback.
2019-02-18 08:18:44 +00:00
6a328992d7 protocomm : typos fixed and descriptions corrected 2019-02-18 08:18:44 +00:00
b51f109dd7 protocomm unit_tests : test cases updated
Changes:
* Version endpoint test added
* Memory leak test updated to include corner case exceptions in protocomm
2019-02-18 08:18:44 +00:00
85e8dea26a protocomm security : memory leaks fixed
List of changes:
* Corner case exceptions are properly handled to ensure release of memory occupied by security infrastructure
* fixed erroneous cleanup of security instance by protocomm_console
2019-02-18 08:18:44 +00:00
093c7b176d protocomm : version endpoint behavior simplified
List of changes:
* Version endpoint now sends the set version string instead of verifying the incoming version string. This simplifies fetching version info from the provisioning application.
* esp_prov script updated to expect version string as response.
2019-02-18 08:18:44 +00:00
30e39631db wifi_provisioning : context pointer added to wifi_config_t structure and related examples/docs updated
Closes https://github.com/espressif/esp-idf/issues/2874
2019-02-18 08:18:44 +00:00
a7ff611b10 provisioning framework : 'extern C' directives added for C++ support 2019-02-18 08:18:44 +00:00
2e64d2d56e softap_prov: Changes in the example code as per changes to protocomm_httpd
Signed-off-by: Piyush Shah <piyush@espressif.com>
2019-02-18 08:18:44 +00:00
3e6b402756 protocomm_httpd: Allow applications to pass HTTPD handle
This will be useful if a webserver is already running and the application
does not want protocomm to start a new instance.

Signed-off-by: Piyush Shah <piyush@espressif.com>
2019-02-18 08:18:44 +00:00
5568ca2855 components/bt: Add precautions for esp_vhci_host_send_packet (backport 3.2) 2019-02-18 08:15:17 +00:00
30f2371917 components/bt: Fix crash when inquiry stop (backport v3.2) 2019-02-18 08:15:17 +00:00
ebaa944a9a Merge branch 'test/disable_sdio_example_ci_v3.2' into 'release/v3.2'
sdio: temporarily disable the sdio example ci

See merge request idf/esp-idf!4284
2019-02-18 16:14:01 +08:00
d83598a64a sdio: temporarily disable the sdio example ci, since the runners have
some power issue
2019-02-18 11:02:43 +08:00
00d1068869 Merge branch 'bugfix/external_rtc_start_fail_3.2' into 'release/v3.2'
Bugfix/external rtc start fail (backport 3.2)

See merge request idf/esp-idf!4272
2019-02-15 17:51:49 +08:00
49be9fb836 doc: add CoAP README.md 2019-02-15 16:03:54 +08:00
6f0c70daf6 Merge branch 'bugfix/bugfix/mdns_notask_timer_crash_v3.2' into 'release/v3.2'
mdns: fix crash after init if no memory for task (Backport 3.2)

See merge request idf/esp-idf!4237
2019-02-15 13:49:29 +08:00
219c85cf60 Merge branch 'bugfix/btdm_allow_a2dp_codec_dynamic_allocated_for_v3.2' into 'release/v3.2'
bugfix/btdm_allow_a2dp_codec_dynamic_allocated_for_v3.2(backport v3.2)

See merge request idf/esp-idf!4260
2019-02-15 13:42:39 +08:00
524696d59a Merge branch 'bugfix/fix_some_wifi_bugs_0131_v3.2' into 'release/v3.2'
esp32: fix some WiFi bugs (backport v3.2)

See merge request idf/esp-idf!4217
2019-02-15 12:14:54 +08:00
9a229f4077 soc/rtc: fix RTC_TOUCH_TRIG_EN or RTC_ULP_TRIG_EN should keep RTC_PERIPH power on 2019-02-15 10:58:14 +08:00
016c8d8b05 soc/rtc: Bypass touchpad current to external 32k crystal oscillator 2019-02-15 10:55:08 +08:00
9914b839aa Merge branch 'update/nvs_partition_utility_v3.2' into 'release/v3.2'
Update/nvs partition utility v3.2 (backport v3.2)

See merge request idf/esp-idf!4258
2019-02-15 08:51:17 +08:00
76e4ea7f68 nvs_util: Fix to support write of multiple singlepage big blob data
Closes https://github.com/espressif/esp-idf/issues/3011

(cherry picked from commit ce4944edf01b2a4c997eafe36b66d71f98f2fe29)
2019-02-14 18:05:59 +05:30
3ec0f415a5 nvs_util: Fix to support write of multiple singlepage big blob data Closes https://github.com/espressif/esp-idf/issues/3011
(cherry picked from commit 21688e3bffee80ddfbef5364a44dd1821e28c776)
2019-02-14 15:57:23 +05:30
fa40b3d5d0 Update minimum version for cryptography package required
(cherry picked from commit e1774cb6f9)
2019-02-13 17:20:01 +05:30
f742808333 nvs_util: update test case
(cherry picked from commit 0c72b08872)
2019-02-13 17:12:57 +05:30
51bd64c754 Update README
(cherry picked from commit 582c547191)
2019-02-13 17:12:50 +05:30
b85321be97 Closes https://github.com/espressif/esp-idf/issues/2472
(cherry picked from commit c44f15441f)
2019-02-13 17:12:40 +05:30
dcd63f73f6 nvs_util: Add changes to nvs part gen util
nvs_util: Add changes to nvs part gen util

nvs_host_test: Add test case for keygen and keyfile paratmeters

(cherry picked from commit 9db1987892)
2019-02-13 17:11:59 +05:30
b8f0c32a0a component/bt: allow dynamic allocation of SBC encoder/decoder buffer used in A2DP to save internal DRAM 2019-02-13 19:15:34 +08:00
8f2e1471af bugfix(psram): made some modifcations to support the psram driver backport 2019-02-13 16:06:38 +08:00
a159e58ead feature(psram): add psram support for esp32-pico chip
1. esp32-pico use standard spi driver to access psram
2. for esp32-pico, flash and psram share the clock
3. for esp32-pico, psram cs io can be overwrite via menuconfig
2019-02-13 14:27:44 +08:00
fe767855df bugfix(psram): fix psram size acquisition method
1. Use BIT[7:5] of EID to determine psram size
2. Add ID support for 16Mbit psram
3. Remove module reset on SPI1
4. Confirmed with the vendor that only the old 32Mbit psram need special clock timing. For other psram chips, we should use standard QPI mode.
2019-02-13 14:24:20 +08:00
1e674fb4ed esp32: disable stack protector for startup code (CMake)
Files where stack protector is initialized should not be compiled with
stack protector enabled. This was done for Make but missing for CMake.

Fixes https://github.com/espressif/esp-idf/issues/2990.
2019-02-13 10:27:22 +08:00
3660ccac4c Merge branch 'bugfix/esp-http-client-fixes' into 'release/v3.2'
Minor Bugfixes in esp_http_client, tcp_transport and simple_ota_example. (backport v3.2)

See merge request idf/esp-idf!4248
2019-02-13 07:10:34 +08:00
4f9a4e8ed7 examples/simple_ota_example: Fix incorrect component reference in README 2019-02-12 11:32:54 +05:30
582bf18789 tcp_transport: Fix incorrect error logging in ssl_read and ssl_write APIs
Closes https://github.com/espressif/esp-idf/issues/2805
2019-02-12 11:32:44 +05:30
2e3f06ece8 esp_http_client: Fix for setting incorrect post header length
Closes https://github.com/espressif/esp-idf/issues/2638
2019-02-12 11:32:23 +05:30
c62a20f162 ci: remove IDF_CI_BUILD variable, no active users 2019-02-12 11:03:40 +05:30
ed4d83af8e examples: aws_iot: fix cmake build issue which used to pick dummy certificates
For CI build now `sdkconfig.ci` file is used which builds examples assuming certificate
stored on SDCard.
2019-02-12 11:03:14 +05:30
1444868917 Merge branch 'bugfix/eth_gpio0_output_v3.2' into 'release/v3.2'
ethernet cleanup && support GPIO0 output mode && support IP101(backport v3.2)

See merge request idf/esp-idf!4214
2019-02-12 07:54:57 +08:00
05ba4f15d6 examples: update default root-ca for aws_iot demos 2019-02-08 18:54:01 +05:30
37b7153c0e Merge branch 'feature/http_server_backport_api_changes' into 'release/v3.2'
(backport v3.2) HTTP Server API changes

See merge request idf/esp-idf!4232
2019-02-08 11:43:33 +08:00
1a53334843 mdns: fix crash after init if no memory for task
mdns init first starts timer task, then starts service task. if service task failed to be created, timer task needs to be stopped too.
fixed https://ezredmine.espressif.cn:8765/issues/28466
2019-02-05 07:59:38 +01:00
fd29b0165f Merge branch 'bugfix/event_loop_library_memory_leak_v3.2' into 'release/v3.2'
Fix event loop library memory leak (backport v3.2)

See merge request idf/esp-idf!4221
2019-02-04 16:35:17 +08:00
9c3262f80b esp_http_server : APIs renamed and context get/set implementations fixed
* http_sess_set_*_override APIs are now the only ones available to set custom recv/send/pending functions
* Fixed side effects to using http_sess_set/get_context inside URI handlers
2019-02-03 21:50:35 +05:30
900dbfd1f6 esp_http_server example tests : updated advanced_tests as per API changes 2019-02-03 21:32:21 +05:30
13a1f4ed78 esp_http_server improvements to allow adding transport layer encryption
Changes:
- renamed `httpd_free_sess_ctx_fn_t` to `httpd_free_ctx_fn_t`
- added a `httpd_handle_t` argument to `httpd_send_func_t` and `httpd_recv_func_t`
- internal function `httpd_sess_get()` is no longer static, as it's used in other
  files besides httpd_sess.c

Bug fixes:
- removed a trailing semicolon from `HTTPD_DEFAULT_CONFIG()`
- fixed issue with failed `select()`, now it automatically closes invalid sockets
  instead of shutting down the entire server

New features:
- `httpd_resp_send()` and `httpd_resp_send_chunk()` now accept -1 as length to use
  `strlen()` internally
- added `httpd_sess_set_ctx()` to accompany `httpd_sess_get_ctx()`
- added a "transport context" to the session structure (next to user context)
- added `httpd_sess_{get,set}_transport_ctx()` to work with this transport context
- added "global user context" and "global transport context" stored in the server
  config (and then the handle); supports a user-provided free_fn
- added a "pending func" to e.g. check for data in the transport layer receive
  buffer
- added functions `httpd_set_sess_{send,recv,pending}_override()` that target
  a session by ID (i.e. not using a request object)
- added `httpd_set_pending_override()`
- added a "open_fn" and "close_fn" - functions called when creating and closing
  a session. These may be used to set up transport layer encryption or some other
  session-wide feature
2019-02-03 21:32:07 +05:30
8a69ffc36f Merge branch 'bugfix/btdm_add_handle_in_gatts_conf_event_for_indication_v3.2' into 'release/v3.2'
Component/bt: add handle in gatts conf event for indication (backport v3.2)

See merge request idf/esp-idf!4222
2019-02-01 21:34:05 +08:00
a437e4dc5c Merge branch 'bugfix/btdm_fix_write_char_crash_after_disconnection_v3.2' into 'release/v3.2'
Component/bt: fix write char crash after disconnection (backport v3.2)

See merge request idf/esp-idf!4210
2019-02-01 21:28:29 +08:00
741f97da4e esp32: fix some WiFi bugs
Fix following WiFi bugs:
1. Fix a crash bug which is caused by WiFi static TX buffer alloc/free.
2. Fix the bug that iphone fails to connect to ESP32 AP by enabling AP BAR receiving.
3. Fix the bug that ESP32 station fails to connect some APs, such as Xiaomi hotspot etc,
   after reset.
2019-02-01 11:52:40 +08:00
eae2baa0f1 esp_event: detect leaks in unit test 2019-02-01 10:08:50 +08:00
f49f5ff35a esp_event: fix post data type inconsistency 2019-02-01 10:08:50 +08:00
020b295f06 esp_event: fix memory leaks
Closes https://github.com/espressif/esp-idf/issues/2886
2019-02-01 10:08:50 +08:00
6e14de0fa8 Merge branch 'mesh/malloc_routing_table_v3.2' into 'release/v3.2'
mesh: modify to malloc routing table (backport v3.2)

See merge request idf/esp-idf!4178
2019-02-01 10:02:24 +08:00
95c7f45e84 Component/bt: add handle in gatts conf event for indication 2019-01-31 20:30:23 +08:00
651a08f710 Component/bt: fix write char crash after disconnection 2019-01-31 12:20:16 +00:00
18cb87b4ce ethernet: support new PHY (IP101)
1. Add support for new PHY IP101.
2. Re-enable GPIO0 output mode.
3. Clean up some docs.
2019-01-31 15:02:45 +08:00
1fedece94d Merge branch 'feature/add_ipv6_related_change_v3.2' into 'release/v3.2'
modify test case to support ipv6 (backport v3.2)

See merge request idf/esp-idf!4074
2019-01-31 14:31:44 +08:00
137810915c mesh: modify to malloc routing table 2019-01-31 13:46:50 +08:00
bb766355b5 Merge branch 'bugfix/tw28445_wps_thread_safe_v3.2' into 'release/v3.2'
esp32: fix WPS thread-safe (backport v3.2)

See merge request idf/esp-idf!4195
2019-01-30 17:50:33 +08:00
807ef53c38 Merge branch 'bugfix/mdns_crash_free_strdup_3.2_fix' into 'release/v3.2'
mdns: fixed crash on free undefined ptr if strdup is skipped (Backport 3.2 FIX)

See merge request idf/esp-idf!4197
2019-01-30 14:24:12 +08:00
e585121011 Merge branch 'bugfix/backtrace_from_interrupts_backport_v3.2' into 'release/v3.2'
Make backtrace work across interrupts (backport v3.2)

See merge request idf/esp-idf!4183
2019-01-30 13:11:29 +08:00
671be20cc5 Merge branch 'bugfix/regenerate_sdkconfig_fails_v3.2' into 'release/v3.2'
Fix issues with regenerating sdkconfig on modification (backport v3.2)

See merge request idf/esp-idf!4169
2019-01-30 09:27:47 +08:00
022a9295b0 confgen: disable config override warnings 2019-01-29 20:50:51 +08:00
a34d788a5e kconfiglib: allow disabling of config override warnings
Patches ESP-IDF copy of kconfiglib.py with modifications in commit
b65baa47f69ae4c3993876a7edf0da0075aa70ff from kconfiglib repository.
2019-01-29 20:50:51 +08:00
2a47c5c7a4 esp32: fix WPS thread-safe
Fix WPS thread-safe bug
2019-01-29 19:44:24 +08:00
cfc4f74b52 Merge branch 'bugfix/coex_update_phy_to_fix_interrupt_wdt_v3.2' into 'release/v3.2'
esp32: update libphy.a to fix interrupt watchdog when WiFi and BT run at the same time and both enable modem sleep (backport v3.2)

See merge request idf/esp-idf!4192
2019-01-29 19:41:36 +08:00
43a722f0de mdns: fixed crash on free undefined ptr after skipped strdup
Shortcircuit evaluation may cause skip of _mdns_strdup_check of any further question field, which after clear_rx_packet freed undefined memory.
Fixes https://ezredmine.espressif.cn:8765/issues/28465
2019-01-29 10:34:04 +01:00
eff24857bc esp32: update libphy.a to fix interrupt watchdog when WiFi and BT run at
the same time and both enable modem sleep
2019-01-29 11:05:15 +08:00
18118a6d5c Merge branch 'bugfix/mdns_crash_free_strdup_3.2' into 'release/v3.2'
mdns: fixed crash on free undefined ptr if strdup is skipped (Backport 3.2)

See merge request idf/esp-idf!4190
2019-01-29 10:37:25 +08:00
64757c0228 mdns: fixed crash on free undefined ptr after skipped strdup
Shortcircuit evaluation may cause skip of _mdns_strdup_check of any further question field, which after clear_rx_packet freed undefined memory.
Fixes https://ezredmine.espressif.cn:8765/issues/28465
2019-01-28 20:17:37 +01:00
bab80ad202 freertos: Make backtrace work across interrupts (backport v3.2)
This commit adds the ability for backtracing to trace from the itnerrupt to the
task stack, and across nested interrupts. Test cases have also been added.

See MR !4084
2019-01-29 02:22:04 +08:00
76f0dda3a4 Merge branch 'mesh/bugfix_backport_v3.2' into 'release/v3.2'
Mesh/bugfix backport v3.2

See merge request idf/esp-idf!4117
2019-01-28 14:05:51 +08:00
ce9878ce71 modify test case to support ipv6 2019-01-26 13:03:35 +00:00
403a24ab64 confgen: disable redundant assignment warning 2019-01-25 18:49:55 +08:00
d2cf266762 kconfiglib: allow disabling of redundant definition warnings
Patches ESP-IDF copy of kconfiglib.py with modifications in commit
94c63de77c7a3422347e59e168b05174d0b9e84d from kconfiglib repository.
2019-01-25 18:49:55 +08:00
cec39b750a tool: Add unit test for Kconfig gen 2019-01-25 14:11:35 +08:00
0420f290a4 docs: remove invalid arg in confgen invocation on docs generation 2019-01-25 14:11:35 +08:00
eb6dbeb15a cmake: only generate sdkconfig on top level project 2019-01-25 14:11:35 +08:00
5c9ab21d81 confgen: base config creation on output type args 2019-01-25 14:11:35 +08:00
bab379faf8 Merge branch 'bugfix/i2c_master_clear_bus_v3.2' into 'release/v3.2'
i2c/fix i2c_master_clear_bus (backport v3.2)

See merge request idf/esp-idf!4127
2019-01-25 13:52:48 +08:00
fb7cd2a7a7 Merge branch 'bugfix/ble_active_scan_not_wait_scan_rsp_v3.2' into 'release/v3.2'
component/bt: add a option to make report adv data and scan response individually (backport v3.2)

See merge request idf/esp-idf!4157
2019-01-25 13:52:16 +08:00
c208a6b451 Merge branch 'bugfix/mqtt_tests_local_broker_v3.2' into 'release/v3.2'
MQTT tests: connect to local broker in CI (Backport 3.2)

See merge request idf/esp-idf!4119
2019-01-24 22:00:26 +08:00
78511c3cc3 component/bt: add a option to make report adv data and scan response individually
Originally, when doing BLE active scan, Bluedroid will not report adv to
application layer until receive scan response. This option is used to
disable the behavior. When enable this option, Bluedroid will report
adv data or scan response to application layer immediately.
2019-01-24 14:43:36 +08:00
cd6bbaa727 Merge branch 'bugfix/bootloader_map_size_v3.2' into 'release/v3.2'
bootloader: fix incorrect mapping size (backport v3.2)

See merge request idf/esp-idf!4138
2019-01-24 14:09:35 +08:00
55b8f2ea8c Merge branch 'bugfix/sha_ownership_v3.2' into 'release/v3.2'
hwcrypto sha: Allow SHA contexts to be shared between tasks (backport v3.2)

See merge request idf/esp-idf!4143
2019-01-24 14:08:35 +08:00
ec2f1a6b9a test: modify the reason code from 204 to 15 in WIFI_CONN_0904 2019-01-24 11:33:06 +08:00
26646b5b31 mesh: bugfix
1. fix network channel switch function.
2. support not configuring the network channel.
3. support not configuring the router BSSID even if the router is hidden.
4. add allow_channel_switch to mesh configuration.
5. add allow_router_switch to mesh router configuration.
6. support handling beacon without IE of DS Parameter Set.
7. fix Wi-Fi RX fails in a specific scenario (update libphy.a).
8. fix STAs can not detect disconnection from AP when encrypt transmission is used.
9. fix can not find hidden APs.
10. for root, modify the active scan time to 120ms.
11. remove all rc when clear parent Wi-Fi configuration.
12. fix memory leak caused by the remove announcement being sent is not released when esp_mesh_stop() is called.
13. fix modify IE encrypt after mesh is started.
14. ignore esp_mesh_connect() if mesh automatic reconnection is enabled.
15. fix reason is cleared before vote is done.
16. fix issues in the example of manual_networking when mesh network is encrypted.
17. detect and fix root conflicts when router BSSID is not set.
18. when root can not connect to the router due to NO_MORE_STAS(reason code:5), root will stop re-connection and perform MESH_NWK_LOOK_FOR_NETWORK.
19. wifi: fix the disconnection caused by receiving a deauth frame from non-parent node during scanning.
20. fix routing table redundant issue due to the remove announcement is not 100% reliable.
21. modify the max routes limitation from 300 to 1000.
22. wifi: fix ap does not deauth the sta which has not yet completed the 4-way handshake but the max replay count is reached.
2019-01-24 11:31:00 +08:00
1ae9a2ae0b Merge branch 'bugfix/wifi_fix_invalid_csi_data_index_v3.2' into 'release/v3.2'
esp32: fix invalid channel state information(CSI) data index (backort v3.2)

See merge request idf/esp-idf!4129
2019-01-23 22:14:04 +08:00
28eb488892 Merge branch 'bugfix/vfs_unregister_nested_v3.2' into 'release/v3.2'
vfs: fix unregister removing top level VFS instead of nested (backport v3.2)

See merge request idf/esp-idf!4137
2019-01-23 21:54:50 +08:00
fcf1dba9cd Merge branch 'bugfix/init_memctl_v3.2' into 'release/v3.2'
bootloader, esp32: add workaround for Tensilica erratum 572 (backport v3.2)

See merge request idf/esp-idf!4134
2019-01-23 21:43:58 +08:00
94ed7b8298 hwcrypto sha: Use spinlocks instead of semaphores for small state changes
Significant performance improvement and smaller RAM footprint.
2019-01-23 18:18:13 +08:00
24fab0b7a9 hwcrypto sha: Allow SHA contexts to be shared between tasks
Previously, hardware SHA engine "locks" were mutex semaphores. This meant that the task which
started a particular SHA session (in hardware) needed to finalise that session, or an invalid
FreeRTOS state was created.

Replace with binary semaphore which can be shared between tasks.

Includes a unit test, but unit test doesn't crash even without this fix
(some other unknown condition is required).
2019-01-23 18:18:13 +08:00
c4c1af114e Update esptool.py to v2.6 2019-01-23 17:02:02 +08:00
b1ee25afde bootloader: account for load address when mapping cache pages
Bootloader used to calculate the number of cache pages assuming that
load address was aligned, while in reality load address for DROM and
IROM was offset by 0x20 bytes from the start of 64kB page. This
caused the bootloader to map one less page if the size of the image
was 0x4..0x1c less than a multiple of 64kB.

Reported in https://esp32.com/viewtopic.php?f=13&t=6952.
2019-01-23 17:02:02 +08:00
cccaa68467 bootloader: fix IROM and DROM swapped in log messages 2019-01-23 17:02:02 +08:00
6080767379 vfs: fix unregister removing top level VFS instead of nested
Credits @neoniousTR.

Fixes https://github.com/espressif/esp-idf/pull/2770
2019-01-23 16:28:48 +08:00
42b6c4953d bootloader, esp32: add workaround for Tensilica erratum 572
If zero-overhead loop buffer is enabled, under certain rare conditions
when executing a zero-overhead loop, the CPU may attempt to execute an invalid instruction. Work around by disabling the buffer.
2019-01-23 16:23:56 +08:00
746e831c19 esp32: fix invalid channel state information(CSI) data index
Due to a hardware limitation in ESP32, the first four bytes of some
    CSI data is invalid, not the last four bytes.

    Correct a mistake of CSI sub-carrier index in documentation.
2019-01-22 20:30:05 +08:00
36f9091e03 ci, examples: use sdkconfig.ci as an extra defaults file, if present
- Allows placing CI-specific settings into sdkconfig.ci file
- Allows substituting environment variables in sdkconfig.ci
2019-01-22 10:15:10 +01:00
553ba51924 bugfix(i2c): reduce speed of I2C master bus reset routine and release SDA
closes https://github.com/espressif/esp-idf/issues/2494
closes https://github.com/espressif/esp-idf/pull/2493
closes https://github.com/espressif/esp-idf/pull/2496

1. Change bus reset to handle interrupted READ sequences.
2. Slow down I2C to 100khz during reset
3. If a SLAVE device was in a read operation when the bus was interrupted, the SLAVE device is controlling SDA.The only bit during the 9 clock cycles of a byte READ the MASTER(ESP32) is guaranteed control over, is during the ACK bit period.
If the SLAVE is sending a stream of ZERO bytes, it will only release SDA during the ACK bit period. The master(ESP32) cannot generate a STOP unless SDA is HIGH. So, this reset code synchronizes the bit stream with, Either, the ACK bit, Or a 1 bit.
2019-01-22 11:43:55 +08:00
929d98538e 1. Slow down I2C to 100khz During Reset
I am stealing this delay coding from @jeremyherbert #2493 pr.

2. Change Bus Reset to handle interrupted READ sequences.

The current code does not handle interrupted READ cycles.

 If a SLAVE device was in a read operation when the bus was interrupted, the SLAVE device is controlling SDA.

The only bit during the 9 clock cycles of a byte READ the MASTER(ESP32) is guaranteed control over, is during the ACK bit period.

If the SLAVE is sending a stream of ZERO bytes, it will only release SDA during the ACK bit period. The master(ESP32) cannot generate a STOP unless SDA is HIGH.

So, this reset code synchronizes the bit stream with, Either, the ACK bit, Or a 1 bit.

3. fix typo

correct `sda_id` to `sda_io` in `i2c_master_clear_bus()` @ryan-ma found it.  This typo was generated when I manually edited this patch on GitHub, I should have done a Copy/Paste operation!
2019-01-22 11:43:40 +08:00
b810b32675 reduce speed of i2c master bus reset routine and release sda 2019-01-22 11:43:28 +08:00
00bf376bc3 mqtt tests: connect to local broker when running in CI to make the tests more reliable 2019-01-21 06:36:02 +01:00
fe19ea977b Merge branch 'bugfix/phy_rtc_cache_disabled_v3.2' into 'release/v3.2'
Fix PHY/RTC functions called in ISR, but stored in flash

See merge request idf/esp-idf!4114
2019-01-18 10:54:03 +08:00
a953f73c64 Fix some bugs in phy
1. fix bug PHY/RTC functions called in ISR (update phy to v4007)
2. add UnitTest to test it
3. fix task watchdog bug when wifi change channel
4. disable/enable agc to mac deinit/init
2019-01-16 22:04:49 +08:00
bed50a93f0 Merge branch 'bugfix/wifi_fix_incorrect_tx_complete_state_v3.2' into 'release/v3.2'
esp32: fix the incorrect tx complete state issue (backport v3.2)

See merge request idf/esp-idf!4105
2019-01-13 00:10:50 +08:00
a80bfc1dcf esp32: fix the incorrect tx complete state issue 2019-01-12 19:40:52 +08:00
51d846417e Merge branch 'bugfix/fix_ba_hardware_index_deleting_issue_v3.2' into 'release/v3.2'
esp32: fix wrongly deleting hardware BA index bug (backport v3.2)

See merge request idf/esp-idf!4102
2019-01-12 14:23:33 +08:00
ca54a5ce2a esp32: fix wrongly deleting hardware BA index bug
Fix the bug that hardware BA index will be wrongly removed in
WiFi mode WIFI_MODE_APSTA.
2019-01-11 21:46:28 +08:00
7b1777dd30 Merge branch 'bugfix/wifi_defragmentation_only_for_data_frame_v3.2' into 'release/v3.2'
esp32: do defragmentation only for data and management frame (backport v3.2)

See merge request idf/esp-idf!4090
2019-01-11 21:25:19 +08:00
64b46ff1d9 Merge branch 'bugfix/check_dependencies_msys_v3.2' into 'release/v3.2'
tools: Be more helpful to MSYS32 users with package installation & check if current python is inside virtual environment (backport v3.2)

See merge request idf/esp-idf!4063
2019-01-11 15:42:20 +08:00
c355d8a88e python: Add check if current python is inside virtual environment 2019-01-10 09:37:21 +01:00
977af32d0f tools: Be more helpful to MSYS32 users with package installation 2019-01-10 09:37:02 +01:00
f0a6432717 esp32: do defragmentation only for data and management frame
Check frame type before defragmentation. Only data and management frame
    can do defragmentation.
2019-01-10 14:17:21 +08:00
c18e86a826 Merge branch 'bugfix/coex_unforce_wifi_if_no_data_buffered_in_beacon_v3.2' into 'release/v3.2'
esp32: unforce wifi if receiving beacon with no data buffered in dream (backport v3.2)

See merge request idf/esp-idf!4036
2019-01-10 14:11:02 +08:00
b5d53a0eff Merge branch 'bugfix/timer_delete_dispatch_race_v3.2' into 'release/v3.2'
esp_timer: do not allow deleting timers while callbacks are dispatched (backport v3.2)

See merge request idf/esp-idf!4062
2019-01-10 13:44:15 +08:00
10afc3de77 esp32: unforce wifi if receiving beacon with no data buffered in dream
state and reduce force receiving broadcast data time

    1. If receiving beacon which indicates that there is no data buffered,
    do not force to receive WiFi data.
    2. If receiving beacon which indicates that there is broadcast data
    buffered, reduce the time to force receiving broadcast data.
2019-01-09 14:13:08 +08:00
545878d4e9 Merge branch 'bugfix/ignore_windows_conf_tools_v32' into 'release/v3.2'
gitignore: Add mconf-idf.exe and conf-idf.exe (v3.2)

See merge request idf/esp-idf!4071
2019-01-09 13:57:54 +08:00
ec7909956d Merge branch 'bugfix/fix_mbox_thread_safe_issue_v3.2' into 'release/v3.2'
tcpip: fix mbox thread-safe issue  (backport v3.2)

See merge request idf/esp-idf!4005
2019-01-09 10:21:22 +08:00
d9c3a08813 Merge branch 'bugfix/mdns_udp_send_protected_backport3.2' into 'release/v3.2'
mdns networking udp send protected (Backport 3.2)

See merge request idf/esp-idf!4020
2019-01-08 12:04:23 +08:00
eb9a93f9b7 Merge branch 'bugfix/mdns_crash_when_query_backport3.2' into 'release/v3.2'
mdns crash when query (backport 3.2)

See merge request idf/esp-idf!3950
2019-01-08 12:03:52 +08:00
710019a47f Merge branch 'bugfix/fix_the_country_code_bug_v3.2' into 'release/v3.2'
wifi: fix the bug that STA can scan the channel out of the country regdomain range (backport v3.2)

See merge request idf/esp-idf!4068
2019-01-07 20:33:02 +08:00
2d27358f61 Merge branch 'feature/i2s_tx_descriptor_auto_clear_backport_v3.2' into 'release/v3.2'
i2s: add (optional) support to clear tx descriptor in underflow case (backport v3.2)

See merge request idf/esp-idf!4056
2019-01-07 16:34:01 +08:00
b80eba8d5a wifi: fix the bug that STA can scan the channel out of the country regdomain range 2019-01-04 14:34:36 +08:00
7832db7bb3 gitignore: Add mconf-idf.exe and conf-idf.exe
Problem since f6cd55d2ac

Closes https://github.com/espressif/esp-idf/issues/2751
2019-01-04 10:09:35 +11:00
efa70bc8e3 lwip: fix mbox thread-safe issue
Fix a mbox free thread-safe issue that can lead to crash in sys_arch_mbox_fetch.
2019-01-02 22:48:19 +08:00
31b7db5c38 esp_timer: do not allow deleting timers while callbacks are dispatched
timer_process_alarm function of esp_timer holds a spinlock for the
entire duration of its operation, except for the time when timer
callback function is called. It is possible that when
timer_process_alarm releases the spinlock, a higher priority task may
run and delete the timer. Then the execution will return to
timer_process_alarm, and this will either cause a crash, or undesired
execution of callback after the timer has been stopped or deleted.

To solve this problem, add a mutex which will prevent deletion of timers
while callbacks are being dispatched.
2019-01-02 20:06:06 +11:00
8d02ccd2f7 examples: enable option to auto clear I2S tx descriptor on underflow
Closes: https://github.com/espressif/esp-idf/issues/1945
(cherry picked from commit 1751607adf)
2018-12-31 13:43:34 +05:30
62eb0f4c12 i2s: add (optional) support to clear tx descriptor in underflow case
It has been observed that, in case of underflow (data unavailability) in
I2S transmission, previously filled up tx descriptors continue to get
transmitted on line, causing noise in case of audio use case.

This change adds optional `tx_desc_auto_clear` field during I2S driver intialization
than can zero initialize tx descriptor in case of underflow situation in
interrupt handler itself.

Closes: https://github.com/espressif/esp-idf/issues/1789
(cherry picked from commit 765bf674d0)
2018-12-31 13:42:26 +05:30
155f034b1e Merge branch 'feature/freemodbus_move_rs485_mode_control_v3.2' into 'release/v3.2'
examples: freemodbus port serial slave move uart mode settings into example (backport v3.2)

See merge request idf/esp-idf!4015
2018-12-29 10:28:27 +08:00
47dea73b03 Merge branch 'doc/btdm_modem_sleep_EVED_mode_for_v3.2' into 'release/v3.2'
doc/btdm_modem_sleep_EVED_mode_for_v3.2(backport v3.2)

See merge request idf/esp-idf!4016
2018-12-29 10:27:52 +08:00
28fdf96828 Merge branch 'bugfix/ota_magic_byte_issue_v3.2' into 'release/v3.2'
Bugfix/ota magic byte issue v3.2(backport v3.2)

See merge request idf/esp-idf!4004
2018-12-29 10:24:24 +08:00
3969fe0dad Merge branch 'bugfix/lwip_add_hostname_option_in_dhcp_discover_v3.2' into 'release/v3.2'
add hostname option in dhcp discover (backport v3.2)

See merge request idf/esp-idf!3938
2018-12-29 10:07:50 +08:00
c70c25afd0 Merge branch 'mesh/bugfix_v3.2' into 'release/v3.2'
mesh: when no parent is found, send probe request

See merge request idf/esp-idf!3940
2018-12-28 14:02:23 +08:00
d59d9eef4f Merge branch 'bugfix/bbpll_wakeup_reset_v3.2' into 'release/v3.2'
BBPLL reset fixes (backport v3.2)

See merge request idf/esp-idf!4011
2018-12-24 18:16:47 +08:00
22514e12d8 mdns: fix networking running udp_sendif from lwip thread 2018-12-21 16:44:15 +01:00
f48ffb37f2 mdns: check all mallocs for failure and add default hook to log error with free heap
solves crash about _mdns_result_txt_create when stress test
2018-12-21 16:27:58 +01:00
0f041ee7bb mdns: fixed static memory leak 2018-12-21 16:26:39 +01:00
c320a3ee4c mdns: resolve memory leak when txt record received multiple times 2018-12-21 16:26:39 +01:00
1f35716ef4 mdns: skip sending search when finished, not properly locked timer task 2018-12-21 16:26:39 +01:00
358de85eb3 component/bt: add more information and description for bluetooth modem sleep
Add remark that "EVED" mode for bluetooth modem sleep is only used for internal test
2018-12-21 19:29:47 +08:00
84277e5887 mesh: when no parent is found, send probe request via broadcast
1. fix error in checking Wi-Fi commit ID.
2018-12-21 17:49:58 +08:00
52a70e0489 Merge branch 'bugfix/ext_ram_bss_align_v3.2' into 'release/v3.2'
Fix ext_ram_bss alignment crash (backport v3.2)

See merge request idf/esp-idf!4014
2018-12-21 17:31:33 +08:00
6523d912f2 examples: freemodbus port serial slave move uart mode settings into example
Update freemodbus component file esp-idf/components/freemodbus/port/portserial.c to remove UART mode settings;
Move UART mode settings into esp-idf/examples/protocols/modbus_slave/main/freemodbus.c
Move UART pin settings from Component config into example Kconfig.projbuild file
Move setup of UART port pins from freemodbus component into example file

TW#27721
Closes https://github.com/espressif/esp-idf/issues/2784#issuecomment-443600157
2018-12-21 09:54:26 +01:00
aa0d2078b7 psram: Use 8-bit type for _ext_ram_bss_start/_ext_ram_bss_end
Fixes pointer arithmetic when printing size of remaining heap
2018-12-21 19:03:12 +11:00
348d6d5d3f multi_heap: Fix bug when start of heap is unaligned
Alignment was accounted for in one place only.

TW27954
2018-12-21 19:03:12 +11:00
46228db9a8 linker external bss: Align end of ext bss to word boundary
TW27954
2018-12-21 19:03:12 +11:00
2cac11f162 Merge branch 'bugfix/btdm_fix_crash_adv_scan_coex_v3.2' into 'release/v3.2'
component/bt: fix crash when adv and scan coex and optimize duplicate scan (backport v3.2)

See merge request idf/esp-idf!3994
2018-12-21 15:59:53 +08:00
64eeee4532 Merge branch 'bugfix/btdm_fix_two_bugs_about_pairing_v3.2' into 'release/v3.2'
components/bt: Fix two bugs about pairing(backport 3.2)

See merge request idf/esp-idf!3995
2018-12-21 14:26:19 +08:00
a9eb37e2c8 Merge branch 'bugfix/btdm_prevent_light_sleep_for_v3.2' into 'release/v3.2'
bugfix/btdm_prevent_light_sleep_for_v3.2(backport v3.2)

See merge request idf/esp-idf!3986
2018-12-21 14:25:49 +08:00
c7a297195f soc/rtc: reset another BBPLL related register
Follow-up to b21ffc8a: an additional register needs to be reset.

Ref. https://github.com/espressif/esp-idf/issues/2711
2018-12-21 12:40:08 +08:00
19e96add8a soc/rtc: reset BBPLL configuration after enabling it
A workaround to reset BBPLL configuration after light sleep. Fixes the
issue that Wi-Fi can not receive packets after waking up from light
sleep.

Ref. https://github.com/espressif/esp-idf/issues/2711
2018-12-21 12:39:49 +08:00
a0a0328e4f Merge branch 'bugfix/idf_monitor_without_toolchain_v3.2' into 'release/v3.2'
tools: Print useful error message from idf_monitor when toolchain isn't available (backport v3.2)

See merge request idf/esp-idf!3949
2018-12-21 12:01:54 +08:00
04aebc464c bugfix/ota_magic_byte_issue: Fix indent and replace constant by macro
Replace 0xE9 by ESP_IMAGE_HEADER_MAGIC.
2018-12-20 12:29:25 +05:30
30e01847ad bugfix/ota_magic_byte_issue: Fixes OTA magic byte error
On enabling flash encryption, OTA fails with magic byte error in the second chunk
if the http data is split into two or more chunks and first chunk is less than 16.
2018-12-20 12:29:00 +05:30
zwj
3f6033d8bd fix crash when adv and scan coex and optimize duplicate scan 2018-12-19 19:53:01 +08:00
45e59a9f56 components/bt: Fix two bugs about pairing
1. Fix Legacy Pairing failed without remote device name
2. Fix discovery no device after disabling SSP
2018-12-19 19:42:47 +08:00
587e6ec93f component/bt: use a pm_lock to prevent light sleep when bluetooth is enabled due to current imcompatibility 2018-12-18 14:51:19 +08:00
6d00c7fc49 Merge branch 'bugfix/btdm_assert_ble_65536_v3.2' into 'release/v3.2'
fix bug that there's very low ratio to cause BLE assert(65536, 0) in rwble.c at line 222

See merge request idf/esp-idf!3968
2018-12-18 12:03:21 +08:00
c418714ec6 Merge branch 'bugfix/btdm_fix_receive_adv_pkt_when_duplicate_scan_enabled_v3.2' into 'release/v3.2'
Component/bt: fix receive adv pkt when enable duplicate scan (backport v3.2)

See merge request idf/esp-idf!3942
2018-12-18 11:45:28 +08:00
19d8c050cd Merge branch 'bugfix/tw27963_fix_wifi_stop_bug_v3.2' into 'release/v3.2'
esp32: fix WiFi stop bug in WiFi/BT coexist mode (backport v3.2)

See merge request idf/esp-idf!3982
2018-12-18 11:41:03 +08:00
cb650382ca esp32: fix WiFi stop bug in WiFi/BT coexist mode
This fix includes following changes:
1. Fix the bug that esp_restart()/esp_wifi_stop() sometimes fails in WiFi/BT coexist mode.
2. Add a timer for WiFi stop and stop WiFi forcibly once the timer expires.
2018-12-17 20:52:40 +08:00
e5e592e5b6 fix bug that there's very low ratio to cause BLE assert(65536, 0) in rwble.c at line 222 2018-12-17 20:50:42 +08:00
28e20e90e3 Component/bt: fix receive adv pkt when enable duplicate scan 2018-12-17 15:51:28 +08:00
1c4d9f2aca Merge branch 'bugfix/btdm_modem_sleep_cowork_with_DFS_for_v3.2' into 'release/v3.2'
Bugfix/btdm modem sleep cowork with dfs for v3.2(backport v3.2)

See merge request idf/esp-idf!3962
2018-12-14 20:28:31 +08:00
ded8b0102a Merge branch 'bugfix/btdm_fix_auth_mode_error_when_reconnection_in_smp_v3.2' into 'release/v3.2'
Component/bt: fix auth_mode error when reconnection in SMP (backport v3.2)

See merge request idf/esp-idf!3955
2018-12-14 18:24:01 +08:00
401970495d component/bt: add DRAM_ATTR attribute to global variables(mostly in bss segment) in bt.c which can be accessed in ISR 2018-12-14 14:59:41 +08:00
5d46bb596d Merge branch 'bufix/btdm_fix_save_key_when_auth_mode_without_bond_v3.2' into 'release/v3.2'
Component/bt: fix save keys when auth mode without bond (backport V3.2)

See merge request idf/esp-idf!3957
2018-12-14 14:59:24 +08:00
8de9149b11 component/bt: bugfix of bluetooth modem sleep not being able to work with Dynamic Frequency Scaling
1. start an esp_timer on entering sleep to acquire pm_lock before wake up from modem sleep
2. decrease the clock division of XTAL fed to bluetooth low power clock from 32us to 2us period to allow to work under 240MHz Max CPU frequency
3. decrease the minimum sleep duration threshold to allow shorter bluetooth modem sleep period, especially for BLE with short connection interval
4. reconfigure bluetooth baseband(BT-BB) settings after PHY/RF init upon waking up from modem sleep to avoid packet RX/TX performance degradation
2018-12-14 14:56:29 +08:00
e8b8946e6e tools: Print useful error message from idf_monitor when toolchain isn't available 2018-12-13 22:03:25 +01:00
2c1e3d1ef2 Component/bt: fix save keys when auth mode without bond 2018-12-13 15:45:53 +08:00
bf608b6709 Component/bt: fix auth_mode error when reconnection in SMP 2018-12-13 15:33:37 +08:00
24ebdbd3f4 Merge branch 'test/add_case_to_detect_ds2ds_issue_v3.2' into 'release/v3.2'
test: add case to detect ds2ds issue (backport v3.2)

See merge request idf/esp-idf!3851
2018-12-13 14:52:58 +08:00
fd00d3213b Merge branch 'bugfix/btdm_fix_accept_specified_sec_auth_v3.2' into 'release/v3.2'
Component/bt: fix accept specified sec auth error(backport v3.2)

See merge request idf/esp-idf!3836
2018-12-13 11:20:02 +08:00
c921a5bc4b Merge branch 'feature/illegal_instruction_panic_info_v3.2' into 'release/v3.2'
panic: dump some instruction memory on IllegalInstruction exception (backport v3.2)

See merge request idf/esp-idf!3946
2018-12-12 15:58:22 +08:00
ade85cc850 panic: dump some instruction memory on IllegalInstruction exception 2018-12-12 11:58:55 +08:00
5c8d25b795 add hostname option in dhcp discover
Hostname option has been removed from dhcp discover since IDFv3.2.
But it remains in dhcp request due to which ESP32 can not get IPv4 address
from some APs. Re-add hostname option to dhcp discover to solve this issue.
2018-12-10 21:26:24 +08:00
ac051f0afc Merge branch 'bugfix/btdm_assert_ble_32768_v3.2' into 'release/v3.2'
fix bug that there's very low ratio to cause BLE assert(32768, 0) in rwble.c at line 222

See merge request idf/esp-idf!3919
2018-12-10 15:04:44 +08:00
bb47146710 Merge branch 'fix/spi_callback_in_iram_v3.2' into 'release/v3.2'
spi: fix the crash when callbacks are not in the IRAM (Backports v3.2)

See merge request idf/esp-idf!3884
2018-12-07 10:37:07 +08:00
07cb228f64 Merge branch 'bugfix/win_path_print_v3.2' into 'release/v3.2'
tools: correct printed path on MS Win (backport v3.2)

See merge request idf/esp-idf!3913
2018-12-07 10:36:31 +08:00
3cfe1c89b5 Merge branch 'ci/combine_unit_test_and_integration_test_v3.2' into 'release/v3.2'
ci: combine unit_test and integration_test stage (backport v3.2)

See merge request idf/esp-idf!3845
2018-12-07 10:36:00 +08:00
4f805d558c Merge branch 'bugfix/fix_uart_read_bug_when_using_dual_core_v3.2' into 'release/v3.2'
driver(uart): fixed uart read error bug when using dual core (backport v3.2)

See merge request idf/esp-idf!3813
2018-12-07 10:35:17 +08:00
f53716d851 Merge branch 'bugfix/idfpy_monitor_msys_v3.2' into 'release/v3.2'
tools: fix idf.py monitor for MSYS (backport v3.2)

See merge request idf/esp-idf!3898
2018-12-07 10:34:44 +08:00
f8fd922ca5 unit-test-app: fix the RegEx to detect test case:
tags are not correctly parsed if eol do not contain `\r`
2018-12-07 02:04:55 +00:00
61d07ffbfc tiny-test-fw: fix exception when expect RegEx:
match.groups() could return None. We can't do decode on None object.
2018-12-07 02:04:55 +00:00
6b5649190f test: add test case to receive ds2ds packet 2018-12-07 02:04:55 +00:00
f44507de53 fix bug that there's very low ratio to cause BLE assert(32768, 0) in rwble.c at line 222 2018-12-06 21:35:19 +08:00
88c7a61a63 tools: correct the coding style of check_python_dependencies.py 2018-12-06 08:33:17 +01:00
6af90457f7 tools: correct printed path on MS Win 2018-12-06 08:32:45 +01:00
3aafb2cfcf Merge branch 'bugfix/ethernet_enable_second_failure_v3.2' into 'release/v3.2'
fix phy init timeout(backport v3.2)

See merge request idf/esp-idf!3896
2018-12-06 15:22:32 +08:00
8ec0c82c3f tools: fix idf.py monitor for MSYS 2018-12-05 10:48:30 +01:00
a338c1b712 ethernet: phy init timeout
When ethernet enable again after disable it before, phy init will report timeout.
The cause of this problem is that the enabling of emac clock is too late, and should be placed before phy init.
2018-12-05 16:32:24 +08:00
0b21be508e Merge branch 'bugfix/btdm_bugs_caused_by_coex_v3.2' into 'release/v3.2'
component/bt and esp32:  fix two bluetooth bugs that caused by coexist module

See merge request idf/esp-idf!3861
2018-12-05 14:17:25 +08:00
3b4d51bbfa Merge branch 'doc/security_features_small_fixes_v3.2' into 'release/v3.2'
doc: Small secure boot & flash encryption corrections (v3.2)

See merge request idf/esp-idf!3888
2018-12-05 11:07:41 +08:00
60c556eb55 docs: flash encryption: Fix description of behaviour when all bits of FLASH_CRYPT_CNT are set
Correct behaviour is described in section 25.3.3 Flash Decryption Block of the ESP32 TRM
2018-12-05 11:20:05 +11:00
9933e37c8b doc: secure boot: Explain output of digest_secure_bootloader command
Mentioned on forum https://esp32.com/viewtopic.php?f=13&t=8162&start=10#p34714
2018-12-05 11:20:05 +11:00
67bdc8aaf4 doc: security: Use less ambiguous language about using bot flash encryption & secure boot together 2018-12-05 11:20:05 +11:00
44bd6f72bc spi: fix the crash when callbacks are not in the IRAM
Introduced in 9c23b8e5 and 4f87a62f. To get higher speed, menuconfig
options are added to put ISR and other functions into the IRAM.  The
interrupt flag ESP_INTR_FLAG_IRAM is also mistakenly set when the ISR is
put into the IRAM. However callbacks, which are wrote by the user, are
called in the master and slave ISR. The user may not be aware of that
these callbacks are not disabled during flash operations. Any cache miss
during flash operation will cause panic.

Essentially IRAM functions and intrrupt flag ESP_INTR_FLAG_IRAM are
different, the latter means not disabling the ISR during flash
operations.  New bus_config flag intr_flags is offered to help set the
interrupt attribute, including priority level, SHARED, IRAM (not
disabled during flash operations).  It introduced a small BREAK to
IDFv3.1 (but the same as IDFv3.0) that the user has to manually set IRAM
flag now (therefore he's aware of the IRAM thing) to void the ISR being
disabled during flash operations.
2018-12-04 21:35:20 +08:00
2d67ce3109 component/bt and esp32: fix two bluetooth bugs that caused by coexist module
1. Fix interrupt watchdog timeout in bluetooth "btdm_bb_isr"
    2. Fix BLE assert(512) or assert(1536)  in rwble.c at line 222
    3. Update librtc.a to fix BLE assert(512) in rwble.c at line 222

    The #1 and #2 occurs random.
    The #3 bug occurs in certain scenario:
    	1. If Wifi start softap and BLE is working
    	2. If wifi start station, but do not use normal station operation, such
    		as just use espnow, while BLE is working
    	3. Any other scenario, that wifi works without use software coexist
    		operation, while BLE is working(such as do advertising and ...)

    4. update libcoexist.a version to v1.1.2
2018-12-03 19:30:28 +08:00
e85cb6d148 ci: combine unit_test and integration_test stage:
The number of runners of integration test is not bottleneck to CI
pipeline performance now. Combine these 2 stages will make integration
test executed even unit test fails. This could help us to collect more
info about test history.
2018-11-30 13:44:11 +08:00
7658b8ab62 Merge branch 'test/enhanced_junit_test_result_v3.2' into 'release/v3.2'
test: enhanced junit test result (backport v3.2)

See merge request idf/esp-idf!3794
2018-11-30 11:39:31 +08:00
7969a566e3 Merge branch 'bugfix/fat_lock_log_v3.2' into 'release/v3.2'
fatfs: Do not log from critical sections (backport v3.2)

See merge request idf/esp-idf!3721
2018-11-29 23:00:55 +08:00
be05b1e654 Merge branch 'bugfix/uart_select_buffer_v3.2' into 'release/v3.2'
VFS: select() on UART should return immediately when data is buffered (backport v3.2)

See merge request idf/esp-idf!3829
2018-11-29 23:00:17 +08:00
ca51b60033 Component/bt: fix accept specified sec auth error 2018-11-29 20:46:08 +08:00
9b3ff1bed0 Merge branch 'bugfix/i2c_hardware_filter_default_enable_v3.2' into 'release/v3.2'
driver(i2c): enable I2C master hardware filter by default for release/v3.2

See merge request idf/esp-idf!3815
2018-11-29 19:28:32 +08:00
f859f9e25b VFS: select() on UART should return immediately when data is buffered 2018-11-29 10:08:26 +01:00
f2ae151dab Merge branch 'bugfix/btdm_rf_reg_v3.2' into 'release/v3.2'
fix bug to unsupport rf reg access from hci cmd

See merge request idf/esp-idf!3786
2018-11-28 21:20:05 +08:00
bae0d8a313 driver(i2c): enable I2C master hardware filter by default for release/v3.2 2018-11-28 17:02:04 +08:00
cfcc0edc33 driver(uart): fixed uart read error bug when using dual core for release/v3.2. 2018-11-28 16:37:59 +08:00
54e6f0793a ci: split build unit test job:
it takes long time to build with both make and cmake
2018-11-26 21:59:42 +08:00
e98f4d2751 ci: use artifacts:reports feature of Gitlab CI 2018-11-26 17:06:41 +08:00
33cf0faac8 ci: assign unit test cases in sequence of config and name 2018-11-26 17:06:40 +08:00
7385e71c84 test: fix unit test script code style warnings 2018-11-26 17:05:04 +08:00
7778ce83bd test: generate junit test report according to executed cases 2018-11-26 17:05:04 +08:00
0f8070a6fd tiny-test-fw: support capture raw data in DUT:
test cases might want to use `expect` and get raw data from DUT at the same time. New added capture method provides a way to do that.
2018-11-26 17:05:04 +08:00
0fcb9056f8 tiny-test-fw: enhanced junit test report support:
1. replace xunitgen with junit_xml, which can log more info
2. allow test cases to handle junit test report by them own
3. allow test cases to log some info into report via `sysout` tag
2018-11-26 17:05:04 +08:00
5110d4b303 fatfs: Do not log from critical sections
Logging in the critical section can result in a deadlock when the logger
is redirected to FATFS.

Closes https://github.com/espressif/esp-idf/issues/1693
2018-11-26 09:21:44 +01:00
fc19954376 Merge branch 'bugfix/adjtime_test2_v3.2' into 'release/v3.2'
Resolve ""test for thread safety adjtime and gettimeofday functions" fails randomly"  (backport v3.2)

See merge request idf/esp-idf!3791
2018-11-26 16:17:05 +08:00
16d32c58e7 newlib: Fix UT adjtime 2018-11-26 15:55:17 +11:00
3d926da642 Merge branch 'bugfix/fix_cmake_args_issue_backport_3.2' into 'release/v3.2'
Fix cmake args issue (backport 3.2)

See merge request idf/esp-idf!3789
2018-11-26 09:53:38 +08:00
9bb719dd68 fix bug to unsupport rf reg access from hci cmd
Always return 0 when read rf register and do nothing when write rf register
2018-11-24 14:21:25 +08:00
536cb0489e Merge branch 'bugfix/fix_some_wifi_bugs_1121_v3.2' into 'release/v3.2'
esp32: fix some wifi bugs (backport v3.2)

See merge request idf/esp-idf!3762
2018-11-23 17:08:31 +08:00
98c7cb5560 cmake: remove unecessary info passed to bootloader build 2018-11-23 16:12:14 +08:00
4baf333c79 ulp: fix passing ulp srcs due to cmake_args bug 2018-11-23 16:10:54 +08:00
79401934a1 Merge branch 'bugfix/backports_v3.2' into 'release/v3.2'
Multiple v3.2 backports

See merge request idf/esp-idf!3727
2018-11-23 13:43:24 +08:00
ec1daf32e1 Merge branch 'bugfix/btdm_move_func_into_iram_v3.2' into 'release/v3.2'
components/bt: Move function in interrupt into IRAM(backport 3.2)

See merge request idf/esp-idf!3758
2018-11-23 13:39:27 +08:00
1cac0d2cf2 esp32: fix some wifi bugs
Fix some Wifi bugs:
1. Enable RX BAR
2. Fix the bug that ESP32 AP negotiates with iphone to 11g
3. Fix the bug that ESP32 STA has ap_loss because CMCC AP contains two SSID
2018-11-22 20:27:52 +08:00
8d1594c339 components/bt: Move function in interrupt into IRAM
1. Move function in interrupt into IRAM
2. Delete unused code, saving 240B DRAM and some code size
2018-11-22 16:19:21 +08:00
a0f516de0b Merge branch 'mesh/bugfix_v3.2_backport' into 'release/v3.2'
mesh: bugfix (backport3.2)

See merge request idf/esp-idf!3771
2018-11-22 10:22:12 +08:00
802d94aa35 utest: increase IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME to 50000 2018-11-22 00:39:38 +08:00
3c3e375d8d mesh: bugfix
1. fix failture of mesh stop caused by block-sending.
2. fix when FIXED_ROOT is set, 2nd layer devices can not receive mesh event ESP_ERR_MESH_NO_PARENT_FOUND.
3. fix when FIXED_ROOT is set and the root turns off mesh function, 2nd layer devices do not look for new parents.
4. add APIs esp_mesh_disconnect() and esp_mesh_connect().
5. disconnect from parent/router when the DSSS channel in received beacon is different from the home channel.
6. remove nvs task to release 3k bytes memory.
2018-11-22 00:39:02 +08:00
d57ea422be Merge branch 'bugfix/cmake_utf_decode_v3.2' into 'release/v3.2'
tools: Fix Unicode decode error & indentation error (backport v3.2)

See merge request idf/esp-idf!3733
2018-11-21 11:44:54 +08:00
3b3242cbae freertos: use xTaskQueueMutex to protect tick count
Having two different spinlocks is problematic due to possibly
different order in which the locks will be taken. Changing the order
would require significant restructuring of kernel code which is
undesirable.

An additional place where taking xTickCountMutex was needed was in
vApplicationSleep function. Not taking xTickCountMutex resulted in
other CPU sometimes possibly advancing tick count while light sleep
entry/exit was happening. Taking xTickCountMutex in addition to
xTaskQueueMutex has shown a problem that in different code paths,
these two spinlocks could be taken in different order, leading to
(unlikely, but possible) deadlocks.
2018-11-21 03:42:15 +00:00
96c2b34eb9 pm: prevent entering light sleep again immediately after wakeup
When light sleep is finished on one CPU, it is possible that the other
CPU will enter light sleep again very soon, before interrupts on the
first CPU get a chance to run. To avoid such situation, set a flag
for the other CPU to skip light sleep attempt.
2018-11-21 03:42:15 +00:00
6b3a8acdc3 pm: fix entering light sleep in single core mode
Tickless idle/light sleep procedure had a bug in single core mode.
Consider the flow of events:
1. Idle task runs and calls vApplicationIdleHook
2. This calls esp_vApplicationIdleHook, which calls esp_pm_impl_idle_hook, and pm lock for RTOS on the current core is released.
3. Then esp_vApplicationIdleHook calls esp_pm_impl_waiti, which checks that s_entered_light_sleep[core_id]==false and goes into waiti state.
4. Some interrupt happens, calls esp_pm_impl_isr_hook, which takes pm lock for RTOS. PM state goes back to CPU_FREQ_MAX.
5. Once the interrupt is over, vApplicationIdleHook returns, and Idle task continues to run, finally reaching the call to vApplicationSleep.
6. vApplicationSleep does not enter light sleep, because esp_pm_impl_isr_hook has already changed PM state from IDLE to CPU_FREQ_MAX.

This didn’t happen in dual core mode, because waiti state of one CPU was interrupted by CCOMPARE update interrupt from the other CPU, in which case PM lock for FreeRTOS was not taken.

Fix by inverting the meaning of the flag (for convenience) and only setting it to true when vApplicationSleep actually fails to enter light sleep.
2018-11-21 03:42:15 +00:00
a10abd695b freertos: fix compilation warning in single core mode
When tickless idle is enabled
2018-11-21 03:42:15 +00:00
0f28a51996 spiffs: increase timeout in readdir test
Timeout of 15 seconds is not sufficient if SPIFFS partition needs to
be formatted, on some of the boards.
2018-11-21 03:42:15 +00:00
6681096e55 Merge branch 'bugfix/mdns_query_failed_after_init_v3.2' into 'release/v3.2'
Fixed: mdns query failed after init (Backport v3.2)

See merge request idf/esp-idf!3729
2018-11-21 11:41:34 +08:00
18b65dca26 Merge branch 'bugfix/btdm_controller_disable_v3.2' into 'release/v3.2'
Fix two bugs when disable bluetooth controller(backport v3.2)

See merge request idf/esp-idf!3716
2018-11-21 11:26:14 +08:00
a398116b1c Merge branch 'bugfix/btdm_add_check_peer_addr_type_in_set_adv_params_v3.2' into 'release/v3.2'
Component/bt: add check peer addr type in set adv params (backport v3.2)

See merge request idf/esp-idf!3734
2018-11-20 20:02:37 +08:00
331c7c7dc3 Fix two bugs when disable bluetooth controller
1. Fix the bug that disable controller suddenly cause crash when ble is working.
2. Fix the bug that when disable controller, it will cause wifi cannot RX, TX timeout, buffer lack and etc.
2018-11-20 09:01:57 +00:00
7bd9559e7e Merge branch 'bugfix/wifi_sta_sniffer_phy_config_bug_v3.2' into 'release/v3.2'
wifi: fix wifi sta and sniffer phy config bug (backport v3.2)

See merge request idf/esp-idf!3718
2018-11-20 14:20:29 +08:00
e84289077c Merge branch 'bugfix/fix_bug_ethernet_v3.2' into 'release/v3.2'
ethernet: fix some bugs in phy&mac driver(backport v3.2)

See merge request idf/esp-idf!3640
2018-11-19 17:54:27 +08:00
c59c40741b Component/bt: add check peer addr type in set adv params 2018-11-19 17:15:41 +08:00
f3c1903791 tools: Fix UTF decode error 2018-11-19 10:11:34 +01:00
2885ec3831 ethernet: multi-call failure in esp_eth_init
Because of incomplete state machine, ethernet driver will broken if esp_eth_init is called twice.
Detailed information here: https://ezredmine.espressif.cn:8765/issues/27332
2018-11-19 14:55:43 +08:00
a7db0e2291 ethernetif: fix potential memory leak
1. If L2_TO_L3_RX_BUF_MODE is not selected, we must assign l2_owner explictly before we call pbuf_free.
2. free intr resource in esp_eth_deinit

Closes https://github.com/espressif/esp-idf/issues/2670
2018-11-19 14:55:43 +08:00
cb98f5a814 ethernet: fix some bugs in phy&mac driver
1. Original register mapping for LAN8720 has some registers that doesn't exist/support.
So just remove them, and fix the power and init function for LAN8720.
2. GPIO16 and GPIO17 is occupied by PSRAM, so only ETH_CLOCK_GPIO_IN mode is supported in that case if using PSRAM.
3. Fix bug of OTA failing with Ethernet
4. Fix bug of multicast with Ethernet
5. Fix potential memory leak
2018-11-19 14:55:43 +08:00
8725bce5bc Merge branch 'bugfix/btdm_errors_in_comment_v3.2' into 'release/v3.2'
components/bt: Some errors in comment(backport 3.2)

See merge request idf/esp-idf!3713
2018-11-19 14:36:45 +08:00
174b3b89e4 mdns: sending search packets also in probing and announcing state
mdns queries did not work properly when send imeadiately after set_hostname, which cuased reinit of pcb and therefore restarted probing, so search packets were blocked until probing finished
closes #2507, closes #2593
2018-11-19 04:38:04 +01:00
8d9d8e27ca wifi: fix the bug that if station (sleep is enabled) and sniffer are enabled at the same time,
when disable sniffer, station will never enable phy and rf again.
2018-11-16 19:09:31 +08:00
93f4dc6b32 Merge branch 'bugfix/btdm_fuction_in_isr_is_not_in_iram_v3.2' into 'release/v3.2'
components/bt: Put function in isr into iram(backport 3.2)

See merge request idf/esp-idf!3689
2018-11-16 18:15:01 +08:00
b021bbdc80 components/bt: Some errors in comment 2018-11-16 15:27:28 +08:00
c9fe4fa13e components/bt: Put function in isr into iram(backport 3.2) 2018-11-16 07:19:51 +00:00
96252c493a Merge branch 'bugfix/app_template_build_v3.2' into 'release/v3.2'
esp-idf-template app: some fixes for the updated template app  (backport v3.2)

See merge request idf/esp-idf!3700
2018-11-16 15:18:36 +08:00
007a4fcc4e tools: fix cmake build script for sdkconfig test 2018-11-16 02:48:35 +00:00
dbeb8ae02a cmake: fix the creation dummy main to avoid rebuilding 2018-11-16 02:48:35 +00:00
9921c8b91f ci: If there is no sdkconfig, we have to generate one 2018-11-16 02:48:35 +00:00
e16f65f4e6 Merge branch 'bugfix/tw27096_fix_lwip_mbox_free_crash_v3.2' into 'release/v3.2'
fix the crash caused by sys_mbox_free (backport v3.2)

See merge request idf/esp-idf!3676
2018-11-15 10:31:46 +08:00
fe0a5b41bf Merge branch 'bugfix/fix_memory_leak_for_v3.2' into 'release/v3.2'
Component/bt: fix memory leak in service change(backport v3.2)

See merge request idf/esp-idf!3685
2018-11-14 15:35:03 +08:00
1f7c54ae85 Component/bt: fix memory leak in service change 2018-11-12 19:41:19 +08:00
049bd9fe0a Merge branch 'bugfix/mesh_start_stop_v3.2' into 'release/v3.2'
mesh: update libs (backport3.2)

See merge request idf/esp-idf!3648
2018-11-12 15:59:14 +08:00
167fb50a22 Merge branch 'temp/release_v3_2_fastforward' into 'release/v3.2'
release v3.2 fastforward

See merge request idf/esp-idf!3678
2018-11-12 15:31:58 +08:00
5f3b532c8d lwip: fix crash caused by sys_mbox_free
Fix lwip crashed bug caused by sys_mbox_free()
2018-11-11 12:17:36 +08:00
841a6dcd9a mesh: update libs
1. fix ap_loss that occurs when the parent turns off the mesh function and becomes a normal WiFi with a different SSID.
2. add an event MESH_EVENT_NETWORK_STATE that contains information about whether there is a root in the current network.
3. modify the mechanism of mesh IE update.
4. fix a problem in the process of re-voting to select the root, the device that does not meet the conditions of being a root votes for itself.
5. fix an issue that occurs in esp_mesh_recv_toDS() when stopping the mesh.
6. when the user specifies a parent for the device, the device will set the authmode and password of its AP mode to the same value as the specified parent.
7. add two disconnected reason codes MESH_REASON_EMPTY_PASSWORD and MESH_REASON_PARENT_UNENCRYPTED.
2018-11-06 23:00:59 +08:00
671 changed files with 33565 additions and 10524 deletions

View File

@ -2,8 +2,7 @@ stages:
- build
- assign_test
- host_test
- unit_test
- integration_test
- target_test
- check
- deploy
- post_check
@ -20,7 +19,7 @@ variables:
GET_SOURCES_ATTEMPTS: "10"
ARTIFACT_DOWNLOAD_ATTEMPTS: "10"
# We use get_sources.sh script to fetch the submodules and/or re-fetch the repo
# We use get-full-sources.sh script to fetch the submodules and/or re-fetch the repo
# if it was corrupted (if submodule update fails this can happen)
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: none
@ -114,19 +113,21 @@ build_template_app:
- build
variables:
BATCH_BUILD: "1"
IDF_CI_BUILD: "1"
only:
variables:
- $BOT_TRIGGER_WITH_LABEL == null
- $BOT_LABEL_BUILD
- $BOT_LABEL_REGULAR_TEST
script:
- git clone https://github.com/espressif/esp-idf-template.git
- cd esp-idf-template
# Set the variable for 'esp-idf-template' testing
- ESP_IDF_TEMPLATE_GIT=${ESP_IDF_TEMPLATE_GIT:-"https://github.com/espressif/esp-idf-template.git"}
- git clone ${ESP_IDF_TEMPLATE_GIT}
# Try to use the same branch name for esp-idf-template that we're
# using on esp-idf. If it doesn't exist then just stick to the default
# branch
- python $CHECKOUT_REF_SCRIPT esp-idf-template
- python $CHECKOUT_REF_SCRIPT esp-idf-template esp-idf-template
- cd esp-idf-template
- make defconfig
# Test debug build (default)
- make all V=1
# Now test release build
@ -164,8 +165,8 @@ build_template_app:
- $BOT_LABEL_REGULAR_TEST
script:
- git clone $SSC_REPOSITORY
- python $CHECKOUT_REF_SCRIPT SSC SSC
- cd SSC
- python $CHECKOUT_REF_SCRIPT SSC
- MAKEFLAGS= ./ci_build_ssc.sh "${CI_JOB_NAME}" "${IDF_PATH}/.gitlab-ci.yml"
# don't forget to add to dependency to test_template when adding new build_ssc jobs
@ -180,25 +181,44 @@ build_ssc_02:
# If you want to add new build ssc jobs, please add it into dependencies of `assign_test` and `.test_template`
build_esp_idf_tests:
.build_esp_idf_unit_test_template: &build_esp_idf_unit_test_template
<<: *build_template
artifacts:
paths:
- tools/unit-test-app/output
- components/idf_test/unit_test/TestCaseAll.yml
- components/idf_test/unit_test/CIConfigs/*.yml
expire_in: 2 days
expire_in: 4 days
only:
variables:
- $BOT_TRIGGER_WITH_LABEL == null
- $BOT_LABEL_BUILD
- $BOT_LABEL_UNIT_TEST
- $BOT_LABEL_REGULAR_TEST
build_esp_idf_tests_make:
<<: *build_esp_idf_unit_test_template
script:
- export PATH="$IDF_PATH/tools:$PATH"
- cd $CI_PROJECT_DIR/tools/unit-test-app
- export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
- export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
- cd $CI_PROJECT_DIR/tools/unit-test-app
- MAKEFLAGS= make help # make sure kconfig tools are built in single process
- make ut-clean-all-configs
- make ut-build-all-configs
- python tools/UnitTestParser.py
- if [ "$UNIT_TEST_BUILD_SYSTEM" == "make" ]; then exit 0; fi
# If Make, delete the CMake built artifacts
- rm -rf builds output sdkconfig
- rm -rf $CI_PROJECT_DIR/components/idf_test/unit_test/TestCaseAll.yml
- rm -rf $CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/*.yml
build_esp_idf_tests_cmake:
<<: *build_esp_idf_unit_test_template
script:
- export PATH="$IDF_PATH/tools:$PATH"
- export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
- export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
- cd $CI_PROJECT_DIR/tools/unit-test-app
# Build with CMake first
- idf.py ut-clean-all-configs
- idf.py ut-build-all-configs
@ -207,14 +227,8 @@ build_esp_idf_tests:
- if [ "$UNIT_TEST_BUILD_SYSTEM" == "cmake" ]; then exit 0; fi
# If Make, delete the CMake built artifacts
- rm -rf builds output sdkconfig
- rm -rf components/idf_test/unit_test/TestCaseAll.yml
- rm -rf components/idf_test/unit_test/CIConfigs/*.yml
# Then build with Make
- cd $CI_PROJECT_DIR/tools/unit-test-app
- MAKEFLAGS= make help # make sure kconfig tools are built in single process
- make ut-clean-all-configs
- make ut-build-all-configs
- python tools/UnitTestParser.py
- rm -rf $CI_PROJECT_DIR/components/idf_test/unit_test/TestCaseAll.yml
- rm -rf $CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/*.yml
.build_examples_make_template: &build_examples_make_template
<<: *build_template
@ -225,14 +239,14 @@ build_esp_idf_tests:
when: always
paths:
- build_examples/*/*/*/build/*.bin
- build_examples/*/*/*/sdkconfig
- build_examples/*/*/*/build/*.elf
- build_examples/*/*/*/build/*.map
- build_examples/*/*/*/build/download.config
- build_examples/*/*/*/build/bootloader/*.bin
- $LOG_PATH
expire_in: 2 days
expire_in: 4 days
variables:
IDF_CI_BUILD: "1"
LOG_PATH: "$CI_PROJECT_DIR/log_examples_make"
only:
variables:
@ -257,14 +271,14 @@ build_esp_idf_tests:
when: always
paths:
- build_examples_cmake/*/*/*/build/*.bin
- build_examples_cmake/*/*/*/sdkconfig
- build_examples_cmake/*/*/*/build/*.elf
- build_examples_cmake/*/*/*/build/*.map
- build_examples_cmake/*/*/*/build/download.config
- build_examples_cmake/*/*/*/build/bootloader/*.bin
- $LOG_PATH
expire_in: 2 days
expire_in: 4 days
variables:
IDF_CI_BUILD: "1"
LOG_PATH: "$CI_PROJECT_DIR/log_examples_cmake"
only:
variables:
@ -351,7 +365,7 @@ build_docs:
- docs/zh_CN/sphinx-warning-log.txt
- docs/zh_CN/sphinx-warning-log-sanitized.txt
- docs/zh_CN/_build/html
expire_in: 1 day
expire_in: 4 days
only:
variables:
- $BOT_TRIGGER_WITH_LABEL == null
@ -370,9 +384,17 @@ build_docs:
- make html
- ../check_doc_warnings.sh
verify_cmake_style:
stage: build
.check_job_template: &check_job_template
stage: check
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
tags:
- host_test
dependencies: []
before_script: *do_nothing_before_no_filter
verify_cmake_style:
<<: *check_job_template
stage: build
only:
variables:
- $BOT_TRIGGER_WITH_LABEL == null
@ -583,9 +605,12 @@ push_to_github:
tags:
- deploy
only:
- master
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
refs:
- master
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
variables:
- $BOT_TRIGGER_WITH_LABEL == null
when: on_success
dependencies: []
before_script: *do_nothing_before
@ -605,6 +630,7 @@ deploy_docs:
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
tags:
- deploy
- shiny
only:
refs:
- master
@ -663,14 +689,6 @@ check_doc_links:
- cd docs
- make linkcheck
.check_job_template: &check_job_template
stage: check
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
tags:
- build
dependencies: []
before_script: *do_nothing_before_no_filter
check_line_endings:
<<: *check_job_template
script:
@ -689,6 +707,18 @@ check_permissions:
script:
- tools/ci/check-executable.sh
check_version:
<<: *check_job_template
# Don't run this for feature/bugfix branches, so that it is possible to modify
# esp_idf_version.h in a branch before tagging the next version.
only:
- master
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
script:
- export IDF_PATH=$PWD
- tools/ci/check_idf_version.sh
check_examples_cmake_make:
<<: *check_job_template
except:
@ -715,8 +745,11 @@ check_ut_cmake_make:
check_submodule_sync:
<<: *check_job_template
tags:
- github_sync
variables:
GIT_STRATEGY: clone
retry: 2
script:
# check if all submodules are correctly synced to public repostory
- git submodule update --init --recursive
@ -749,7 +782,8 @@ assign_test:
- build_ssc_00
- build_ssc_01
- build_ssc_02
- build_esp_idf_tests
- build_esp_idf_tests_make
- build_esp_idf_tests_cmake
variables:
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
@ -773,13 +807,13 @@ assign_test:
- python $TEST_FW_PATH/CIAssignUnitTest.py $IDF_PATH/components/idf_test/unit_test/TestCaseAll.yml $IDF_PATH/.gitlab-ci.yml $IDF_PATH/components/idf_test/unit_test/CIConfigs
# clone test script to assign tests
- git clone $TEST_SCRIPT_REPOSITORY
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
- cd auto_test_script
- python $CHECKOUT_REF_SCRIPT auto_test_script
# assgin integration test cases
- python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
.example_test_template: &example_test_template
stage: integration_test
stage: target_test
when: on_success
only:
refs:
@ -814,6 +848,8 @@ assign_test:
paths:
- $LOG_PATH
expire_in: 1 week
reports:
junit: $LOG_PATH/*/XUNIT_RESULT.xml
variables:
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
@ -825,18 +861,18 @@ assign_test:
- test -e $CONFIG_FILE || exit 0
# clone test env configs
- git clone $TEST_ENV_CONFIG_REPOSITORY
- cd ci-test-runner-configs
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
- cd $TEST_FW_PATH
# run test
- python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
.unit_test_template: &unit_test_template
<<: *example_test_template
stage: unit_test
stage: target_test
dependencies:
- assign_test
- build_esp_idf_tests
- build_esp_idf_tests_make
- build_esp_idf_tests_cmake
only:
refs:
- master
@ -855,7 +891,7 @@ assign_test:
ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
.test_template: &test_template
stage: integration_test
stage: target_test
when: on_success
only:
refs:
@ -882,19 +918,19 @@ assign_test:
LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/${CI_JOB_NAME}_.yml"
before_script: *add_gitlab_key_before
script:
# first test if config file exists, if not exist, exit 0
- test -e $CONFIG_FILE || exit 0
# clone local test env configs
- git clone $TEST_ENV_CONFIG_REPOSITORY
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
- cd ci-test-runner-configs
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
# clone test bench
- git clone $TEST_SCRIPT_REPOSITORY
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
- cd auto_test_script
- python $CHECKOUT_REF_SCRIPT auto_test_script
# run test
- python CIRunner.py -l "$LOG_PATH/$CI_JOB_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH -m $MODULE_UPDATE_FILE
@ -912,12 +948,12 @@ nvs_compatible_test:
script:
# clone local test env configs
- git clone $TEST_ENV_CONFIG_REPOSITORY
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
- cd ci-test-runner-configs
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
# clone test bench
- git clone $TEST_SCRIPT_REPOSITORY
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
- cd auto_test_script
- git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
# prepare nvs bins
- ./Tools/prepare_nvs_bin.sh
# run test
@ -942,17 +978,23 @@ example_test_002_01:
- ESP32
- Example_ShieldBox_Basic
example_test_003_01:
.example_test_003_01:
<<: *example_test_template
tags:
- ESP32
- Example_SDIO
example_test_004_01:
example_test_004A_01:
<<: *example_test_template
tags:
- ESP32
- Example_CAN
- Example_CAN1
example_test_004B_01:
<<: *example_test_template
tags:
- ESP32
- Example_CAN2
example_test_005_01:
<<: *example_test_template
@ -1210,6 +1252,68 @@ UT_001_40:
- ESP32_IDF
- UT_T1_1
UT_001_41:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
UT_001_42:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
UT_001_43:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_no32kXTAL
UT_001_44:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_no32kXTAL
UT_001_45:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_no32kXTAL
UT_001_46:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_no32kXTAL
- psram
UT_001_47:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_32kXTAL
UT_001_48:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_32kXTAL
UT_001_49:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_32kXTAL
UT_001_50:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_32kXTAL
- psram
UT_002_01:
<<: *unit_test_template
tags:
@ -1336,7 +1440,14 @@ UT_004_13:
- ESP32_IDF
- UT_T1_1
- psram
UT_004_14:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
- psram
UT_005_01:
<<: *unit_test_template
tags:
@ -1522,6 +1633,45 @@ UT_012_03:
- UT_T1_1
- 8Mpsram
UT_012_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
- 8Mpsram
UT_017_01:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T2_1
UT_017_02:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T2_1
UT_017_03:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T2_1
UT_017_04:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T2_1
- psram
UT_017_05:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T2_1
- 8Mpsram
UT_601_01:
<<: *unit_test_template
tags:
@ -1678,6 +1828,18 @@ IT_006_05:
- ESP32_IDF
- SSC_T1_6
IT_006_06:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_6
IT_006_07:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_6
IT_007_01:
<<: *test_template
tags:
@ -1690,6 +1852,12 @@ IT_007_02:
- ESP32_IDF
- SSC_T1_7
IT_007_03:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_7
IT_008_01:
<<: *test_template
tags:
@ -1708,11 +1876,71 @@ IT_010_01:
- ESP32_IDF
- SSC_T5_1
IT_010_02:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T5_1
IT_010_03:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T5_1
IT_010_04:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T5_1
IT_011_01:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T50_1
- SSC_T1_MESH1
IT_011_02:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T2_MESH1
IT_011_03:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T2_MESH1
IT_011_04:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T3_MESH1
IT_011_05:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T6_MESH1
IT_011_06:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T12_MESH1
IT_011_07:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T50_MESH1
IT_011_08:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_MESH2
IT_012_01:
<<: *test_template
@ -1720,6 +1948,12 @@ IT_012_01:
- ESP32_IDF
- SSC_T1_9
IT_012_02:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_9
IT_013_01:
<<: *test_template
tags:

21
.readthedocs.yml Normal file
View File

@ -0,0 +1,21 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
# Optionally set the version of Python and requirements required to build your docs
python:
version: 2.7
install:
- requirements: docs/requirements.txt
# We need to list all the submodules included in documentation build by Doxygen
submodules:
include:
- components/mqtt/esp-mqtt

10
Kconfig
View File

@ -8,6 +8,10 @@ config IDF_CMAKE
bool
option env="IDF_CMAKE"
config IDF_FIRMWARE_CHIP_ID
hex
default 0x0000
menu "SDK tool configuration"
config TOOLPREFIX
string "Compiler toolchain path/prefix"
@ -132,17 +136,17 @@ choice STACK_CHECK_MODE
- In NORMAL mode (GCC flag: -fstack-protector) only functions that call alloca,
and functions with buffers larger than 8 bytes are protected.
- STRONG mode (GCC flag: -fstack-protector-strong) is like NORMAL, but includes
additional functions to be protected -- those that have local array definitions,
or have references to local frame addresses.
- In OVERALL mode (GCC flag: -fstack-protector-all) all functions are protected.
Modes have the following impact on code performance and coverage:
- performance: NORMAL > STRONG > OVERALL
- coverage: NORMAL < STRONG < OVERALL

View File

@ -38,9 +38,9 @@
#include "esp_log.h"
#define OTA_MAX(a,b) ((a) >= (b) ? (a) : (b))
#define OTA_MIN(a,b) ((a) <= (b) ? (a) : (b))
#define SUB_TYPE_ID(i) (i & 0x0F)
#define OTA_MAX(a,b) ((a) >= (b) ? (a) : (b))
#define OTA_MIN(a,b) ((a) <= (b) ? (a) : (b))
#define SUB_TYPE_ID(i) (i & 0x0F)
typedef struct ota_ops_entry_ {
uint32_t handle;
@ -145,9 +145,8 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
if (it->handle == handle) {
// 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 && size > 0 && data_bytes[0] != 0xE9) {
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x", data_bytes[0]);
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]);
return ESP_ERR_OTA_VALIDATE_FAILED;
}
@ -303,10 +302,10 @@ static esp_err_t esp_rewrite_ota_data(esp_partition_subtype_t subtype)
//named data in first sector as s_ota_select[0], second sector data as s_ota_select[1]
//e.g.
//if s_ota_select[0].ota_seq == s_ota_select[1].ota_seq == 0xFFFFFFFF,means ota info partition is in init status
//so it will boot factory application(if there is),if there's no factory application,it will boot ota[0] application
//so it will boot factory application(if there is),if there's no factory application,it will boot ota[0] application
//if s_ota_select[0].ota_seq != 0 and s_ota_select[1].ota_seq != 0,it will choose a max seq ,and get value of max_seq%max_ota_app_number
//and boot a subtype (mask 0x0F) value is (max_seq - 1)%max_ota_app_number,so if want switch to run ota[x],can use next formulas.
//for example, if s_ota_select[0].ota_seq = 4, s_ota_select[1].ota_seq = 5, and there are 8 ota application,
//for example, if s_ota_select[0].ota_seq = 4, s_ota_select[1].ota_seq = 5, and there are 8 ota application,
//current running is (5-1)%8 = 4,running ota[4],so if we want to switch to run ota[7],
//we should add s_ota_select[0].ota_seq (is 4) to 4 ,(8-1)%8=7,then it will boot ota[7]
//if A=(B - C)%D

View File

@ -431,7 +431,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
@ -474,5 +474,5 @@ 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

View File

@ -163,6 +163,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
@ -426,4 +427,22 @@ config SECURE_BOOT_TEST_MODE
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

@ -15,10 +15,10 @@ set(bootloader_binary_files
externalproject_add(bootloader
# TODO: support overriding the bootloader in COMPONENT_PATHS
SOURCE_DIR "${IDF_PATH}/components/bootloader/subproject"
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/subproject"
BINARY_DIR "${bootloader_build_dir}"
CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH=${IDF_PATH} -DEXTRA_COMPONENT_DIRS=${COMPONENT_DIRS}
-DTESTS_ALL=0 -DTEST_COMPONENTS=""
CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH=${IDF_PATH}
-DEXTRA_COMPONENT_DIRS=${CMAKE_CURRENT_LIST_DIR}
INSTALL_COMMAND ""
BUILD_ALWAYS 1 # no easy way around this...
BUILD_BYPRODUCTS ${bootloader_binary_files}

View File

@ -18,6 +18,7 @@
#include "esp_log.h"
#include "rom/gpio.h"
#include "rom/spi_flash.h"
#include "rom/rtc.h"
#include "bootloader_config.h"
#include "bootloader_init.h"
#include "bootloader_utility.h"
@ -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

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

@ -14,6 +14,7 @@
#pragma once
#include "esp_flash_data_types.h"
#include "esp_image_format.h"
/// Type of hold a GPIO in low state
typedef enum {
@ -22,6 +23,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 partition.
*
@ -91,3 +97,27 @@ bool bootloader_common_label_search(const char *list, char *label);
* - ESP_FAIL: An allocation error occurred.
*/
esp_err_t bootloader_common_get_sha256_of_partition(uint32_t address, uint32_t size, int type, uint8_t *out_sha_256);
/**
* @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.
*/
void bootloader_common_vddsdio_configure();

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

@ -91,6 +91,13 @@ esp_err_t esp_efuse_apply_34_encoding(const uint8_t *in_bytes, uint32_t *out_wor
*/
void esp_efuse_write_random_key(uint32_t blk_wdata0_reg);
/**
* @brief Returns chip version from efuse
*
* @return chip version
*/
uint8_t esp_efuse_get_chip_ver(void);
#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");
/* Main header of binary image */
typedef struct {
uint8_t magic;
@ -71,8 +84,12 @@ 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];
/*!< Chip identification number */
esp_chip_id_t chip_id;
/*!< Minimum chip revision supported by image */
uint8_t min_chip_rev;
/*!< Reserved bytes in additional header space, currently unused */
uint8_t reserved[8];
/* 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

@ -30,6 +30,13 @@
bootloader_support components only.
*/
/**
* @brief Get number of free pages
*
* @return Number of free pages
*/
uint32_t bootloader_mmap_get_free_pages();
/**
* @brief Map a region of flash to data memory
*
@ -111,4 +118,21 @@ esp_err_t bootloader_flash_erase_sector(size_t sector);
*/
esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size);
/* Cache MMU block size */
#define MMU_BLOCK_SIZE 0x00010000
/* Cache MMU address mask (MMU tables ignore bits which are zero) */
#define MMU_FLASH_MASK (~(MMU_BLOCK_SIZE - 1))
/**
* @brief Calculate the number of cache pages to map
* @param size size of data to map
* @param vaddr virtual address where data will be mapped
* @return number of cache MMU pages required to do the mapping
*/
static inline uint32_t bootloader_cache_pages_to_map(uint32_t size, uint32_t vaddr)
{
return (size + (vaddr - (vaddr & MMU_FLASH_MASK)) + MMU_BLOCK_SIZE - 1) / MMU_BLOCK_SIZE;
}
#endif

View File

@ -31,14 +31,14 @@ void bootloader_clock_configure()
/* Set CPU to 80MHz. Keep other clocks unmodified. */
int cpu_freq_mhz = 80;
/* On ESP32 rev 0, switching to 80MHz if clock was previously set to
/* On ESP32 rev 0, switching to 80/160 MHz if clock was previously set to
* 240 MHz may cause the chip to lock up (see section 3.5 of the errata
* document). For rev. 0, switch to 240 instead if it was chosen in
* menuconfig.
* document). For rev. 0, switch to 240 instead if it has been enabled
* previously.
*/
uint32_t chip_ver_reg = REG_READ(EFUSE_BLK0_RDATA3_REG);
if ((chip_ver_reg & EFUSE_RD_CHIP_VER_REV1_M) == 0 &&
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ == 240) {
DPORT_REG_GET_FIELD(DPORT_CPU_PER_CONF_REG, DPORT_CPUPERIOD_SEL) == DPORT_CPUPERIOD_SEL_240) {
cpu_freq_mhz = 240;
}

View File

@ -27,6 +27,11 @@
#include "bootloader_flash.h"
#include "bootloader_common.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"
@ -192,3 +197,64 @@ esp_err_t bootloader_common_get_sha256_of_partition (uint32_t address, uint32_t
return ESP_OK;
}
void bootloader_common_vddsdio_configure()
{
#if CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V
rtc_vddsdio_config_t cfg = rtc_vddsdio_get_config();
if (cfg.enable == 1 && cfg.tieh == RTC_VDDSDIO_TIEH_1_8V) { // VDDSDIO regulator is enabled @ 1.8V
cfg.drefh = 3;
cfg.drefm = 3;
cfg.drefl = 3;
cfg.force = 1;
rtc_vddsdio_set_config(cfg);
ets_delay_us(10); // wait for regulator to become stable
}
#endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST
}
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;
}
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,14 +96,22 @@ static const char *TAG = "bootloader_flash";
*/
#define MMU_BLOCK0_VADDR 0x3f400000
#define MMU_BLOCK50_VADDR 0x3f720000
#define MMU_FLASH_MASK 0xffff0000
#define MMU_BLOCK_SIZE 0x00010000
#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) {
@ -112,10 +125,11 @@ const void *bootloader_mmap(uint32_t src_addr, uint32_t size)
}
uint32_t src_addr_aligned = src_addr & MMU_FLASH_MASK;
uint32_t count = (size + (src_addr - src_addr_aligned) + 0xffff) / MMU_BLOCK_SIZE;
uint32_t count = bootloader_cache_pages_to_map(size, src_addr);
Cache_Read_Disable(0);
Cache_Flush(0);
ESP_LOGD(TAG, "mmu set paddr=%08x count=%d", src_addr_aligned, count );
ESP_LOGD(TAG, "mmu set paddr=%08x count=%d size=%x src_addr=%x src_addr_aligned=%x",
src_addr & MMU_FLASH_MASK, count, size, src_addr, src_addr_aligned );
int e = cache_flash_mmu_set(0, 0, MMU_BLOCK0_VADDR, src_addr_aligned, 64, count);
if (e != 0) {
ESP_LOGE(TAG, "cache_flash_mmu_set failed: %d\n", e);

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

@ -17,6 +17,7 @@
#include <sys/param.h>
#include "esp_attr.h"
#include "esp_efuse.h"
#include "esp_log.h"
#include "rom/cache.h"
@ -33,12 +34,10 @@
#include "soc/cpu.h"
#include "soc/rtc.h"
#include "soc/dport_reg.h"
#include "soc/io_mux_reg.h"
#include "soc/efuse_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/timer_group_reg.h"
#include "soc/gpio_reg.h"
#include "soc/gpio_sig_map.h"
#include "soc/gpio_periph.h"
#include "soc/rtc_wdt.h"
#include "sdkconfig.h"
@ -50,6 +49,8 @@
#include "bootloader_random.h"
#include "bootloader_config.h"
#include "bootloader_clock.h"
#include "bootloader_common.h"
#include "bootloader_flash_config.h"
#include "flash_qio_mode.h"
@ -63,8 +64,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 vddsdio_configure();
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);
@ -72,6 +72,7 @@ static void wdt_reset_check(void);
esp_err_t bootloader_init()
{
cpu_configure_region_protection();
cpu_init_memctl();
/* Sanity check that static RAM is after the stack */
#ifndef NDEBUG
@ -118,7 +119,7 @@ esp_err_t bootloader_init()
static esp_err_t bootloader_main()
{
vddsdio_configure();
bootloader_common_vddsdio_configure();
/* Read and keep flash ID, for further use. */
g_rom_flashchip.device_id = bootloader_read_flash_id();
esp_image_header_t fhdr;
@ -126,7 +127,13 @@ 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) &&
@ -286,128 +293,15 @@ static void print_flash_info(const esp_image_header_t* phdr)
#endif
}
static void vddsdio_configure()
{
#if CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V
rtc_vddsdio_config_t cfg = rtc_vddsdio_get_config();
if (cfg.enable == 1 && cfg.tieh == RTC_VDDSDIO_TIEH_1_8V) { // VDDSDIO regulator is enabled @ 1.8V
cfg.drefh = 3;
cfg.drefm = 3;
cfg.drefl = 3;
cfg.force = 1;
rtc_vddsdio_set_config(cfg);
ets_delay_us(10); // wait for regulator to become stable
}
#endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST
}
#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_DIO_DUMMY_CYCLELEN;
break;
case ESP_IMAGE_SPI_MODE_DIO:
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN; //qio 3
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;
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)
@ -441,10 +335,18 @@ static void uart_console_configure(void)
// (arrays should be optimized away by the compiler)
const uint32_t tx_idx_list[3] = { U0TXD_OUT_IDX, U1TXD_OUT_IDX, U2TXD_OUT_IDX };
const uint32_t rx_idx_list[3] = { U0RXD_IN_IDX, U1RXD_IN_IDX, U2RXD_IN_IDX };
const uint32_t uart_reset[3] = { DPORT_UART_RST, DPORT_UART1_RST, DPORT_UART2_RST };
const uint32_t tx_idx = tx_idx_list[uart_num];
const uint32_t rx_idx = rx_idx_list[uart_num];
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[uart_rx_gpio]);
gpio_pad_pullup(uart_rx_gpio);
gpio_matrix_out(uart_tx_gpio, tx_idx, 0, 0);
gpio_matrix_in(uart_rx_gpio, rx_idx, 0);
DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, uart_reset[uart_num]);
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, uart_reset[uart_num]);
}
#endif // CONFIG_CONSOLE_UART_CUSTOM

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

@ -389,7 +389,7 @@ static void unpack_load_app(const esp_image_metadata_t* data)
// Find DROM & IROM addresses, to configure cache mappings
for (int i = 0; i < data->image.segment_count; i++) {
const esp_image_segment_header_t *header = &data->segments[i];
if (header->load_addr >= SOC_IROM_LOW && header->load_addr < SOC_IROM_HIGH) {
if (header->load_addr >= SOC_DROM_LOW && header->load_addr < SOC_DROM_HIGH) {
if (drom_addr != 0) {
ESP_LOGE(TAG, MAP_ERR_MSG, "DROM");
} else {
@ -399,7 +399,7 @@ static void unpack_load_app(const esp_image_metadata_t* data)
drom_load_addr = header->load_addr;
drom_size = header->data_len;
}
if (header->load_addr >= SOC_DROM_LOW && header->load_addr < SOC_DROM_HIGH) {
if (header->load_addr >= SOC_IROM_LOW && header->load_addr < SOC_IROM_HIGH) {
if (irom_addr != 0) {
ESP_LOGE(TAG, MAP_ERR_MSG, "IROM");
} else {
@ -430,6 +430,7 @@ static void set_cache_and_start_app(
uint32_t irom_size,
uint32_t entry_addr)
{
int rc;
ESP_LOGD(TAG, "configure drom and irom and start");
Cache_Read_Disable( 0 );
Cache_Flush( 0 );
@ -441,20 +442,34 @@ static void set_cache_and_start_app(
DPORT_PRO_FLASH_MMU_TABLE[i] = DPORT_FLASH_MMU_TABLE_INVALID_VAL;
}
uint32_t drom_page_count = (drom_size + 64*1024 - 1) / (64*1024); // round up to 64k
ESP_LOGV(TAG, "d mmu set paddr=%08x vaddr=%08x size=%d n=%d", drom_addr & 0xffff0000, drom_load_addr & 0xffff0000, drom_size, drom_page_count );
int rc = cache_flash_mmu_set( 0, 0, drom_load_addr & 0xffff0000, drom_addr & 0xffff0000, 64, drom_page_count );
ESP_LOGV(TAG, "rc=%d", rc );
rc = cache_flash_mmu_set( 1, 0, drom_load_addr & 0xffff0000, drom_addr & 0xffff0000, 64, drom_page_count );
ESP_LOGV(TAG, "rc=%d", rc );
uint32_t irom_page_count = (irom_size + 64*1024 - 1) / (64*1024); // round up to 64k
ESP_LOGV(TAG, "i mmu set paddr=%08x vaddr=%08x size=%d n=%d", irom_addr & 0xffff0000, irom_load_addr & 0xffff0000, irom_size, irom_page_count );
rc = cache_flash_mmu_set( 0, 0, irom_load_addr & 0xffff0000, irom_addr & 0xffff0000, 64, irom_page_count );
ESP_LOGV(TAG, "rc=%d", rc );
rc = cache_flash_mmu_set( 1, 0, irom_load_addr & 0xffff0000, irom_addr & 0xffff0000, 64, irom_page_count );
ESP_LOGV(TAG, "rc=%d", rc );
DPORT_REG_CLR_BIT( DPORT_PRO_CACHE_CTRL1_REG, (DPORT_PRO_CACHE_MASK_IRAM0) | (DPORT_PRO_CACHE_MASK_IRAM1 & 0) | (DPORT_PRO_CACHE_MASK_IROM0 & 0) | DPORT_PRO_CACHE_MASK_DROM0 | DPORT_PRO_CACHE_MASK_DRAM1 );
DPORT_REG_CLR_BIT( DPORT_APP_CACHE_CTRL1_REG, (DPORT_APP_CACHE_MASK_IRAM0) | (DPORT_APP_CACHE_MASK_IRAM1 & 0) | (DPORT_APP_CACHE_MASK_IROM0 & 0) | DPORT_APP_CACHE_MASK_DROM0 | DPORT_APP_CACHE_MASK_DRAM1 );
uint32_t drom_load_addr_aligned = drom_load_addr & MMU_FLASH_MASK;
uint32_t drom_page_count = bootloader_cache_pages_to_map(drom_size, drom_load_addr);
ESP_LOGV(TAG, "d mmu set paddr=%08x vaddr=%08x size=%d n=%d",
drom_addr & MMU_FLASH_MASK, drom_load_addr_aligned, drom_size, drom_page_count);
rc = cache_flash_mmu_set(0, 0, drom_load_addr_aligned, drom_addr & MMU_FLASH_MASK, 64, drom_page_count);
ESP_LOGV(TAG, "rc=%d", rc);
rc = cache_flash_mmu_set(1, 0, drom_load_addr_aligned, drom_addr & MMU_FLASH_MASK, 64, drom_page_count);
ESP_LOGV(TAG, "rc=%d", rc);
uint32_t irom_load_addr_aligned = irom_load_addr & MMU_FLASH_MASK;
uint32_t irom_page_count = bootloader_cache_pages_to_map(irom_size, irom_load_addr);
ESP_LOGV(TAG, "i mmu set paddr=%08x vaddr=%08x size=%d n=%d",
irom_addr & MMU_FLASH_MASK, irom_load_addr_aligned, irom_size, irom_page_count);
rc = cache_flash_mmu_set(0, 0, irom_load_addr_aligned, irom_addr & MMU_FLASH_MASK, 64, irom_page_count);
ESP_LOGV(TAG, "rc=%d", rc);
rc = cache_flash_mmu_set(1, 0, irom_load_addr_aligned, irom_addr & MMU_FLASH_MASK, 64, irom_page_count);
ESP_LOGV(TAG, "rc=%d", rc);
DPORT_REG_CLR_BIT( DPORT_PRO_CACHE_CTRL1_REG,
(DPORT_PRO_CACHE_MASK_IRAM0) | (DPORT_PRO_CACHE_MASK_IRAM1 & 0) |
(DPORT_PRO_CACHE_MASK_IROM0 & 0) | DPORT_PRO_CACHE_MASK_DROM0 |
DPORT_PRO_CACHE_MASK_DRAM1 );
DPORT_REG_CLR_BIT( DPORT_APP_CACHE_CTRL1_REG,
(DPORT_APP_CACHE_MASK_IRAM0) | (DPORT_APP_CACHE_MASK_IRAM1 & 0) |
(DPORT_APP_CACHE_MASK_IROM0 & 0) | DPORT_APP_CACHE_MASK_DROM0 |
DPORT_APP_CACHE_MASK_DRAM1 );
Cache_Read_Enable( 0 );
// Application will need to do Cache_Flush(1) and Cache_Read_Enable(1)

View File

@ -15,6 +15,7 @@
#include "esp_log.h"
#include <string.h>
#include "bootloader_random.h"
#include "soc/apb_ctrl_reg.h"
#define EFUSE_CONF_WRITE 0x5A5A /* efuse_pgm_op_ena, force no rd/wr disable */
#define EFUSE_CONF_READ 0x5AA5 /* efuse_read_op_ena, release force */
@ -112,3 +113,32 @@ void esp_efuse_write_random_key(uint32_t blk_wdata0_reg)
bzero(buf, sizeof(buf));
bzero(raw, sizeof(raw));
}
// Returns chip version from efuse
uint8_t esp_efuse_get_chip_ver(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;
}

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

@ -163,7 +163,7 @@ static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_cry
/* If the last flash_crypt_cnt bit is burned or write-disabled, the
device can't re-encrypt itself. */
if (flash_crypt_wr_dis || flash_crypt_cnt == 0xFF) {
if (flash_crypt_wr_dis) {
ESP_LOGE(TAG, "Cannot re-encrypt data (FLASH_CRYPT_CNT 0x%02x write disabled %d", flash_crypt_cnt, flash_crypt_wr_dis);
return ESP_FAIL;
}
@ -200,11 +200,19 @@ static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_cry
ESP_LOGD(TAG, "All flash regions checked for encryption pass");
/* Set least significant 0-bit in flash_crypt_cnt */
int ffs_inv = __builtin_ffs((~flash_crypt_cnt) & 0xFF);
/* ffs_inv shouldn't be zero, as zero implies flash_crypt_cnt == 0xFF */
int ffs_inv = __builtin_ffs((~flash_crypt_cnt) & EFUSE_RD_FLASH_CRYPT_CNT);
/* ffs_inv shouldn't be zero, as zero implies flash_crypt_cnt == EFUSE_RD_FLASH_CRYPT_CNT (0x7F) */
uint32_t new_flash_crypt_cnt = flash_crypt_cnt + (1 << (ffs_inv - 1));
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 "hwcrypto/sha.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 esp-idf SHA function */
esp_sha(SHA2_256, data, length, digest);
#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

@ -11,6 +11,7 @@ if(CONFIG_BT_ENABLED)
bluedroid/bta/av/include
bluedroid/bta/dm/include
bluedroid/bta/gatt/include
bluedroid/bta/hf_client/include
bluedroid/bta/hh/include
bluedroid/bta/jv/include
bluedroid/bta/sdp/include
@ -93,6 +94,14 @@ if(CONFIG_BT_ENABLED)
"bluedroid/bta/jv/bta_jv_api.c"
"bluedroid/bta/jv/bta_jv_cfg.c"
"bluedroid/bta/jv/bta_jv_main.c"
"bluedroid/bta/hf_client/bta_hf_client_act.c"
"bluedroid/bta/hf_client/bta_hf_client_api.c"
"bluedroid/bta/hf_client/bta_hf_client_at.c"
"bluedroid/bta/hf_client/bta_hf_client_cmd.c"
"bluedroid/bta/hf_client/bta_hf_client_main.c"
"bluedroid/bta/hf_client/bta_hf_client_rfc.c"
"bluedroid/bta/hf_client/bta_hf_client_sco.c"
"bluedroid/bta/hf_client/bta_hf_client_sdp.c"
"bluedroid/bta/sdp/bta_sdp.c"
"bluedroid/bta/sdp/bta_sdp_act.c"
"bluedroid/bta/sdp/bta_sdp_api.c"
@ -122,6 +131,8 @@ if(CONFIG_BT_ENABLED)
"bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c"
"bluedroid/btc/profile/std/a2dp/btc_av.c"
"bluedroid/btc/profile/std/avrc/btc_avrc.c"
"bluedroid/btc/profile/std/hf_client/btc_hf_client.c"
"bluedroid/btc/profile/std/hf_client/bta_hf_client_co.c"
"bluedroid/btc/profile/std/gap/btc_gap_ble.c"
"bluedroid/btc/profile/std/gap/btc_gap_bt.c"
"bluedroid/btc/profile/std/gatt/btc_gatt_common.c"

View File

@ -53,6 +53,42 @@ config BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN
BR/EDR Synchronize maximum connections of bluetooth controller.
Each connection uses 2KB static DRAM whenever the BT controller is enabled.
choice BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH
prompt "BR/EDR Sync(SCO/eSCO) default data path"
depends on BTDM_CONTROLLER_MODE_BR_EDR_ONLY || BTDM_CONTROLLER_MODE_BTDM
default BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_PCM
help
SCO data path, i.e. HCI or PCM.
SCO data can be sent/received through HCI synchronous packets, or the data
can be routed to on-chip PCM module on ESP32. PCM input/output signals can
be "matrixed" to GPIOs. The default data path can also be set using API
"esp_bredr_sco_datapath_set"
config BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI
bool "HCI"
config BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_PCM
bool "PCM"
endchoice
config BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_EFF
int
default 0 if BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI
default 1 if BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_PCM
default 0
config BTDM_CONTROLLER_AUTO_LATENCY
bool "Auto latency"
depends on BTDM_CONTROLLER_MODE_BTDM
default n
help
BLE auto latency, used to enhance classic BT performance
while classic BT and BLE are enabled at the same time.
config BTDM_CONTROLLER_AUTO_LATENCY_EFF
bool
default BTDM_CONTROLLER_AUTO_LATENCY if BTDM_CONTROLLER_MODE_BTDM
default n
config BTDM_CONTROLLER_BLE_MAX_CONN_EFF
int
default BTDM_CONTROLLER_BLE_MAX_CONN if BTDM_CONTROLLER_MODE_BLE_ONLY || BTDM_CONTROLLER_MODE_BTDM
@ -135,7 +171,6 @@ config BTDM_CONTROLLER_MODEM_SLEEP
default y
help
Enable/disable bluetooth controller low power mode.
Note that currently there is problem in the combination use of bluetooth modem sleep and Dynamic Frequency Scaling(DFS). So do not enable DFS if bluetooth modem sleep is in use.
choice BTDM_MODEM_SLEEP_MODE
prompt "Bluetooth Modem sleep mode"
@ -146,11 +181,13 @@ choice BTDM_MODEM_SLEEP_MODE
config BTDM_MODEM_SLEEP_MODE_ORIG
bool "ORIG Mode(sleep with low power clock)"
help
ORIG mode is a deep sleep mode that can be used for dual mode controller. In this mode, bluetooth controller sleeps between BR/EDR frames and BLE events. A low power clock is used to maintain bluetooth reference clock.
ORIG mode is a bluetooth sleep mode that can be used for dual mode controller. In this mode, bluetooth controller
sleeps between BR/EDR frames and BLE events. A low power clock is used to maintain bluetooth reference clock.
config BTDM_MODEM_SLEEP_MODE_EVED
bool "EVED Mode "
bool "EVED Mode(For internal test only)"
help
This mode is for BLE only.
EVED mode is for BLE only and is only for internal test. Do not use it for production. this mode is not compatible
with DFS nor light sleep
endchoice
choice BTDM_LOW_POWER_CLOCK
@ -161,11 +198,14 @@ choice BTDM_LOW_POWER_CLOCK
config BTDM_LPCLK_SEL_MAIN_XTAL
bool "Main crystal"
help
Main crystal can be used as low power clock for bluetooth modem sleep. If this option is selected, bluetooth
modem sleep can work under Dynamic Frequency Scaling(DFS) enabled, but cannot work when light sleep is enabled.
Main crystal has a relatively better performance than other bluetooth low power clock sources.
config BTDM_LPCLK_SEL_EXT_32K_XTAL
bool "External 32kHz crystal"
depends on ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
endchoice
endmenu
config BLE_SCAN_DUPLICATE
@ -180,16 +220,16 @@ choice SCAN_DUPLICATE_TYPE
default SCAN_DUPLICATE_BY_DEVICE_ADDR
depends on BLE_SCAN_DUPLICATE
help
Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use advertiser address
filtering. The adv packet of the same address is only allowed to be reported once. Another way is "Scan Duplicate
By Device Address And Advertising Data". This way is to use advertising data and device address filtering. All
different adv packets with the same address are allowed to be reported. The last way is "Scan Duplicate By Advertising
Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use advertiser address
filtering. The adv packet of the same address is only allowed to be reported once. Another way is "Scan Duplicate
By Device Address And Advertising Data". This way is to use advertising data and device address filtering. All
different adv packets with the same address are allowed to be reported. The last way is "Scan Duplicate By Advertising
Data". This way is to use advertising data filtering. All same advertising data only allow to be reported once even though
they are from different devices.
config SCAN_DUPLICATE_BY_DEVICE_ADDR
bool "Scan Duplicate By Device Address"
help
help
This way is to use advertiser address filtering. The adv packet of the same address is only allowed to be reported once
config SCAN_DUPLICATE_BY_ADV_DATA
@ -201,7 +241,7 @@ config SCAN_DUPLICATE_BY_ADV_DATA
config SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR
bool "Scan Duplicate By Device Address And Advertising Data"
help
This way is to use advertising data and device address filtering. All different adv packets with the same address are
This way is to use advertising data and device address filtering. All different adv packets with the same address are
allowed to be reported.
endchoice
@ -238,7 +278,54 @@ config MESH_DUPLICATE_SCAN_CACHE_SIZE
Maximum number of adv packets which can be recorded in duplicate scan cache for BLE Mesh.
When the maximum amount of device in the filter is reached, the cache will be refreshed.
config BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
bool "BLE adv report flow control supported"
depends on (BTDM_CONTROLLER_MODE_BTDM || BTDM_CONTROLLER_MODE_BLE_ONLY)
default y
help
The function is mainly used to enable flow control for advertising reports. When it is enabled,
advertising reports will be discarded by the controller if the number of unprocessed advertising
reports exceeds the size of BLE adv report flow control.
config BLE_ADV_REPORT_FLOW_CONTROL_NUM
int "BLE adv report flow control number"
depends on BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
range 50 1000
default 100
help
The number of unprocessed advertising report that Bluedroid can save.If you set
`BLE_ADV_REPORT_FLOW_CONTROL_NUM` to a small value, this may cause adv packets lost.
If you set `BLE_ADV_REPORT_FLOW_CONTROL_NUM` to a large value, Bluedroid may cache a
lot of adv packets and this may cause system memory run out. For example, if you set
it to 50, the maximum memory consumed by host is 35 * 50 bytes. Please set
`BLE_ADV_REPORT_FLOW_CONTROL_NUM` according to your system free memory and handle adv
packets as fast as possible, otherwise it will cause adv packets lost.
config BLE_ADV_REPORT_DISCARD_THRSHOLD
int "BLE adv lost event threshold value"
depends on BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
range 1 1000
default 20
help
When adv report flow control is enabled, The ADV lost event will be generated when the number
of ADV packets lost in the controller reaches this threshold. It is better to set a larger value.
If you set `BLE_ADV_REPORT_DISCARD_THRSHOLD` to a small value or printf every adv lost event, it
may cause adv packets lost more.
menuconfig BTDM_COEX_BT_OPTIONS
bool "Coexistence Bluetooth Side Options"
depends on SW_COEXIST_ENABLE
default n
help
Options of Bluetooth Side of WiFi and bluetooth coexistence.
config BTDM_COEX_BLE_ADV_HIGH_PRIORITY
bool "Improve BLE ADV priority for WiFi & BLE coexistence"
depends on BTDM_COEX_BT_OPTIONS
default n
help
Improve BLE ADV coexistence priority to make it better performance.
For example, BLE mesh need to enable this option to improve BLE adv performance.
endmenu
@ -277,6 +364,13 @@ config BTC_TASK_STACK_SIZE
help
This select btc task stack size
config BTU_TASK_STACK_SIZE
int "Bluetooth Bluedroid Host Stack task stack size"
depends on BLUEDROID_ENABLED
default 4096
help
This select btu task stack size
config BLUEDROID_MEM_DEBUG
bool "Bluedroid memory debug"
depends on BLUEDROID_ENABLED
@ -331,15 +425,15 @@ endchoice
choice HFP_AUDIO_DATA_PATH
prompt "audio(SCO) data path"
depends on HFP_ENABLE
help
SCO data path, i.e. HCI or PCM. This option is set using API
"esp_bredr_sco_datapath_set" in Bluetooth host. Default SCO data
path can also be set in Bluetooth Controller.
config HFP_AUDIO_DATA_PATH_PCM
bool "PCM"
help
This enables the Serial Port Profile
config HFP_AUDIO_DATA_PATH_HCI
bool "HCI"
help
This enables the Serial Port Profile
endchoice
config GATTS_ENABLE
@ -396,6 +490,13 @@ config BLE_SMP_ENABLE
help
This option can be close when the app not used the ble security connect.
config SMP_SLAVE_CON_PARAMS_UPD_ENABLE
bool "Slave enable connection parameters update during pairing"
depends on BLE_SMP_ENABLE
default n
help
In order to reduce the pairing time, slave actively initiates connection parameters update during pairing.
config BT_STACK_NO_LOG
bool "Disable BT debug logs (minimize bin size)"
depends on BLUEDROID_ENABLED
@ -1180,7 +1281,26 @@ config SMP_ENABLE
depends on BLUEDROID_ENABLED
default CLASSIC_BT_ENABLED || BLE_SMP_ENABLE
config BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY
bool "Report adv data and scan response individually when BLE active scan"
depends on BLUEDROID_ENABLED && (BTDM_CONTROLLER_MODE_BTDM || BTDM_CONTROLLER_MODE_BLE_ONLY)
default n
help
Originally, when doing BLE active scan, Bluedroid will not report adv to application layer
until receive scan response. This option is used to disable the behavior. When enable this option,
Bluedroid will report adv data or scan response to application layer immediately.
# Memory reserved at start of DRAM for Bluetooth stack
config BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT
int "Timeout of BLE connection establishment"
depends on BLUEDROID_ENABLED
range 1 60
default 30
help
Bluetooth Connection establishment maximum time, if connection time exceeds this value, the connection
establishment fails, ESP_GATTC_OPEN_EVT or ESP_GATTS_OPEN_EVT is triggered.
config BT_RESERVE_DRAM
hex
default 0xdb5c if BT_ENABLED

View File

@ -449,6 +449,73 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
}
esp_err_t esp_ble_gap_add_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info)
{
btc_msg_t msg;
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (!device_info && type <= ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID) {
return ESP_ERR_INVALID_SIZE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST;
arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_ADD;
arg.update_duplicate_exceptional_list.info_type = type;
if (device_info) {
memcpy(arg.update_duplicate_exceptional_list.device_info, device_info, sizeof(esp_bd_addr_t));
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_remove_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info)
{
btc_msg_t msg;
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (!device_info && type <= ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID) {
return ESP_ERR_INVALID_SIZE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST;
arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_REMOVE;
arg.update_duplicate_exceptional_list.info_type = type;
if (device_info) {
memcpy(arg.update_duplicate_exceptional_list.device_info, device_info, sizeof(esp_bd_addr_t));
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_exceptional_list_type_t list_type)
{
btc_msg_t msg;
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST;
arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN;
arg.update_duplicate_exceptional_list.info_type = list_type;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#if (SMP_INCLUDED == TRUE)
esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
void *value, uint8_t len)

View File

@ -46,4 +46,13 @@ 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);
uint16_t esp_ble_get_sendable_packets_num ()
{
return L2CA_GetFreePktBufferNum_LE();
}
#endif

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;

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

@ -161,6 +161,7 @@ typedef enum {
ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT, /*!< When get the bond device list complete, the event comes */
ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT, /*!< When read the rssi complete, the event comes */
ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT, /*!< When add or remove whitelist complete, the event comes */
ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT, /*!< When update duplicate exceptional list complete, the event comes */
ESP_GAP_BLE_EVT_MAX,
} esp_gap_ble_cb_event_t;
/// This is the old name, just for backwards compatibility
@ -262,13 +263,23 @@ 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,
ESP_BLE_SM_MAX_PARAM,
} esp_ble_sm_param_t;
@ -286,7 +297,7 @@ typedef struct {
esp_ble_adv_type_t adv_type; /*!< Advertising type */
esp_ble_addr_type_t own_addr_type; /*!< Owner bluetooth device address type */
esp_bd_addr_t peer_addr; /*!< Peer device bluetooth device address */
esp_ble_addr_type_t peer_addr_type; /*!< Peer device bluetooth device address type */
esp_ble_addr_type_t peer_addr_type; /*!< Peer device bluetooth device address type, only support public address type and random address type */
esp_ble_adv_channel_t channel_map; /*!< Advertising channel map */
esp_ble_adv_filter_t adv_filter_policy; /*!< Advertising filter policy */
} esp_ble_adv_params_t;
@ -303,9 +314,9 @@ typedef struct {
Value of 0xFFFF indicates no specific minimum.
Values not defined above are reserved for future use.*/
int max_interval; /*!< Advertising data show slave preferred connection max interval.
int max_interval; /*!< Advertising data show slave preferred connection max interval.
The connection interval in the following manner:
connIntervalmax = Conn_Interval_Max * 1.25 ms
connIntervalmax = Conn_Interval_Max * 1.25 ms
Conn_Interval_Max range: 0x0006 to 0x0C80
Conn_Interval_Max shall be equal to or greater than the Conn_Interval_Min.
Value of 0xFFFF indicates no specific maximum.
@ -366,8 +377,8 @@ typedef struct {
Range: 0x0004 to 0x4000 Default: 0x0010 (10 ms)
Time = N * 0.625 msec
Time Range: 2.5 msec to 10240 msec */
esp_ble_scan_duplicate_t scan_duplicate; /*!< The Scan_Duplicates parameter controls whether the Link Layer should filter out
duplicate advertising reports (BLE_SCAN_DUPLICATE_ENABLE) to the Host, or if the Link Layer should generate
esp_ble_scan_duplicate_t scan_duplicate; /*!< The Scan_Duplicates parameter controls whether the Link Layer should filter out
duplicate advertising reports (BLE_SCAN_DUPLICATE_ENABLE) to the Host, or if the Link Layer should generate
advertising reports for each packet received */
} esp_ble_scan_params_t;
@ -552,6 +563,7 @@ typedef enum {
ESP_GAP_SEARCH_DISC_CMPL_EVT = 4, /*!< Discovery complete. */
ESP_GAP_SEARCH_DI_DISC_CMPL_EVT = 5, /*!< Discovery complete. */
ESP_GAP_SEARCH_SEARCH_CANCEL_CMPL_EVT = 6, /*!< Search cancelled */
ESP_GAP_SEARCH_INQ_DISCARD_NUM_EVT = 7, /*!< The number of pkt discarded by flow control */
} esp_gap_search_evt_t;
/**
@ -570,6 +582,34 @@ typedef enum{
ESP_BLE_WHITELIST_REMOVE = 0X00, /*!< remove mac from whitelist */
ESP_BLE_WHITELIST_ADD = 0X01, /*!< add address to whitelist */
}esp_ble_wl_opration_t;
typedef enum {
ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_ADD = 0, /*!< Add device info into duplicate scan exceptional list */
ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_REMOVE, /*!< Remove device info from duplicate scan exceptional list */
ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN, /*!< Clean duplicate scan exceptional list */
} esp_bt_duplicate_exceptional_subcode_type_t;
#define BLE_BIT(n) (1UL<<(n))
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_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;
typedef enum {
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST = BLE_BIT(0), /*!< duplicate scan exceptional addr list */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST = BLE_BIT(1), /*!< duplicate scan exceptional mesh link ID list */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_BEACON_TYPE_LIST = BLE_BIT(2), /*!< duplicate scan exceptional mesh beacon type list */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROV_SRV_ADV_LIST = BLE_BIT(3), /*!< duplicate scan exceptional mesh adv with provisioning service uuid */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROXY_SRV_ADV_LIST = BLE_BIT(4), /*!< duplicate scan exceptional mesh adv with provisioning service uuid */
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ALL_LIST = 0xFFFF, /*!< duplicate scan exceptional all list */
} esp_duplicate_scan_exceptional_list_type_t;
typedef uint8_t esp_duplicate_info_t[ESP_BD_ADDR_LEN];
/**
* @brief Gap callback parameters union
*/
@ -607,6 +647,7 @@ typedef union {
int num_resps; /*!< Scan result number */
uint8_t adv_data_len; /*!< Adv data length */
uint8_t scan_rsp_len; /*!< Scan response length */
uint32_t num_dis; /*!< The number of discard packets */
} scan_rst; /*!< Event parameter of ESP_GAP_BLE_SCAN_RESULT_EVT */
/**
* @brief ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT
@ -715,6 +756,15 @@ typedef union {
esp_bt_status_t status; /*!< Indicate the add or remove whitelist operation success status */
esp_ble_wl_opration_t wl_opration; /*!< The value is ESP_BLE_WHITELIST_ADD if add address to whitelist operation success, ESP_BLE_WHITELIST_REMOVE if remove address from the whitelist operation success */
} update_whitelist_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT
*/
struct ble_update_duplicate_exceptional_list_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate update duplicate scan exceptional list operation success status */
uint8_t subcode; /*!< Define in esp_bt_duplicate_exceptional_subcode_type_t */
uint16_t length; /*!< The length of device_info */
esp_duplicate_info_t device_info; /*!< device information, when subcode is ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN, the value is invalid */
} update_duplicate_exceptional_list_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT */
} esp_ble_gap_cb_param_t;
/**
@ -962,8 +1012,7 @@ esp_err_t esp_ble_gap_get_local_used_addr(esp_bd_addr_t local_used_addr, uint8_t
* @param[in] type - finding ADV data type
* @param[out] length - return the length of ADV data not including type
*
* @return - ESP_OK : success
* - other : failed
* @return pointer of ADV data
*
*/
uint8_t *esp_ble_resolve_adv_data(uint8_t *adv_data, uint8_t type, uint8_t *length);
@ -1008,6 +1057,45 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
*/
esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr);
/**
* @brief This function is called to add a device info into the duplicate scan exceptional list.
*
*
* @param[in] type: device info type, it is defined in esp_ble_duplicate_exceptional_info_type_t
* when type is MESH_BEACON_TYPE, MESH_PROV_SRV_ADV or MESH_PROXY_SRV_ADV , device_info is invalid.
* @param[in] device_info: the device information.
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_add_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info);
/**
* @brief This function is called to remove a device info from the duplicate scan exceptional list.
*
*
* @param[in] type: device info type, it is defined in esp_ble_duplicate_exceptional_info_type_t
* when type is MESH_BEACON_TYPE, MESH_PROV_SRV_ADV or MESH_PROXY_SRV_ADV , device_info is invalid.
* @param[in] device_info: the device information.
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_remove_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info);
/**
* @brief This function is called to clean the duplicate scan exceptional list.
* This API will delete all device information in the duplicate scan exceptional list.
*
*
* @param[in] list_type: duplicate scan exceptional list type, the value can be one or more of esp_duplicate_scan_exceptional_list_type_t.
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_exceptional_list_type_t list_type);
#if (SMP_INCLUDED == TRUE)
/**
* @brief Set a GAP security parameter value. Overrides the default value.

View File

@ -44,6 +44,10 @@ 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);
#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

@ -251,9 +251,9 @@ typedef union {
} esp_hf_client_cb_param_t;
/**
* @brief HFP client incoming data callback function, the callback is useful in case of
* @brief HFP client incoming data callback function, the callback is useful in case of
* Voice Over HCI.
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
* buffer is allocated inside bluetooth protocol stack and will be released after
* invoke of the callback is finished.
* @param[in] len : size(in bytes) in buf
@ -261,13 +261,13 @@ typedef union {
typedef void (* esp_hf_client_incoming_data_cb_t)(const uint8_t *buf, uint32_t len);
/**
* @brief HFP client outgoing data callback function, the callback is useful in case of
* Voice Over HCI. Once audio connection is set up and the application layer has
* prepared data to send, the lower layer will call this function to read data
* @brief HFP client outgoing data callback function, the callback is useful in case of
* Voice Over HCI. Once audio connection is set up and the application layer has
* prepared data to send, the lower layer will call this function to read data
* and then send. This callback is supposed to be implemented as non-blocking,
* and if data is not enough, return value 0 is supposed.
*
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
*
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
* buffer is allocated inside bluetooth protocol stack and will be released after
* invoke of the callback is finished.
* @param[in] len : size(in bytes) in buf
@ -326,7 +326,7 @@ esp_err_t esp_hf_client_deinit(void);
/**
*
* @brief Connect to remote bluetooth HFP audio gateway(AG) device, must after esp_a2d_hf_client_init()
* @brief Connect to remote bluetooth HFP audio gateway(AG) device, must after esp_hf_client_init()
*
* @param[in] remote_bda: remote bluetooth device address
*
@ -606,7 +606,7 @@ void esp_hf_client_outgoing_data_ready(void);
/**
* @brief Initialize the down sampling converter. This is a utility function that can
* only be used in the case that Voice Over HCI is enabled.
* only be used in the case that Voice Over HCI is enabled.
*
* @param[in] src_sps: original samples per second(source audio data, i.e. 48000, 32000,
* 16000, 44100, 22050, 11025)

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*/
@ -190,8 +190,7 @@ esp_err_t esp_spp_register_callback(esp_spp_cb_t callback);
/**
* @brief This function is called to init SPP.
*
* @param[in] mode: Choose the mode of SPP, ESP_SPP_MODE_CB or ESP_SPP_MODE_CB.
* Now only supports ESP_SPP_MODE_CB mode, we will continue to update.
* @param[in] mode: Choose the mode of SPP, ESP_SPP_MODE_CB or ESP_SPP_MODE_VFS.
*
* @return
* - ESP_OK: success
@ -230,7 +229,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.
@ -261,7 +260,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.

View File

@ -1293,9 +1293,10 @@ void bta_av_setconfig_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
/* if SBC is used by the SNK as INT, discover req is not sent in bta_av_config_ind.
* call disc_res now */
/* this is called in A2DP SRC path only, In case of SINK we don't need it */
if (local_sep == AVDT_TSEP_SRC)
if (local_sep == AVDT_TSEP_SRC) {
p_scb->p_cos->disc_res(p_scb->hndl, num, num, 0, p_scb->peer_addr,
UUID_SERVCLASS_AUDIO_SOURCE);
}
} else {
/* we do not know the peer device and it is using non-SBC codec
* we need to know all the SEPs on SNK */

View File

@ -829,10 +829,11 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
if (p_data->rc_msg.msg.pass.op_id == AVRC_ID_VENDOR) {
p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_NOT_IMPL;
#if (AVRC_METADATA_INCLUDED == TRUE)
if (p_cb->features & BTA_AV_FEAT_METADATA)
if (p_cb->features & BTA_AV_FEAT_METADATA) {
p_data->rc_msg.msg.hdr.ctype =
bta_av_group_navi_supported(p_data->rc_msg.msg.pass.pass_len,
p_data->rc_msg.msg.pass.p_pass_data, is_inquiry);
}
#endif
} else {
p_data->rc_msg.msg.hdr.ctype = bta_av_op_supported(p_data->rc_msg.msg.pass.op_id, is_inquiry);
@ -890,7 +891,9 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
evt = bta_av_proc_meta_cmd (&rc_rsp, &p_data->rc_msg, &ctype);
} else
#endif
{
evt = BTA_AV_VENDOR_CMD_EVT;
}
}
/* else if configured to support vendor specific and it's a response */
else if ((p_cb->features & BTA_AV_FEAT_VENDOR) &&
@ -902,7 +905,9 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
evt = BTA_AV_META_MSG_EVT;
} else
#endif
{
evt = BTA_AV_VENDOR_RSP_EVT;
}
}
/* else if not configured to support vendor specific and it's a command */

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
}
}
@ -1268,7 +1276,7 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg)
** Returns char *
**
*******************************************************************************/
static char *bta_av_st_code(UINT8 state)
UNUSED_ATTR static char *bta_av_st_code(UINT8 state)
{
switch (state) {
case BTA_AV_INIT_ST: return "INIT";

View File

@ -28,6 +28,7 @@
#include <string.h>
#include "bta/bta_av_co.h"
#include "bta_av_int.h"
#include "osi/osi.h"
/*****************************************************************************
** Constants and types
@ -564,7 +565,7 @@ void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb)
** Returns char *
**
*******************************************************************************/
static char *bta_av_sst_code(UINT8 state)
UNUSED_ATTR static char *bta_av_sst_code(UINT8 state)
{
switch (state) {
case BTA_AV_INIT_SST: return "INIT";

View File

@ -127,6 +127,7 @@ static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr);
#endif ///SMP_INCLUDED == TRUE
static void bta_dm_observe_results_cb(tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_observe_cmpl_cb(void *p_result);
static void bta_dm_observe_discard_cb (uint32_t num_dis);
static void bta_dm_delay_role_switch_cback(TIMER_LIST_ENT *p_tle);
extern void sdpu_uuid16_to_uuid128(UINT16 uuid16, UINT8 *p_uuid128);
static void bta_dm_disable_timer_cback(TIMER_LIST_ENT *p_tle);
@ -322,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 */
}
/*******************************************************************************
@ -635,13 +639,15 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
/* set modes for Discoverability and connectability if not ignore */
if (p_data->set_visibility.disc_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
if ((p_data->set_visibility.disc_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
if ((p_data->set_visibility.disc_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE) {
p_data->set_visibility.disc_mode =
((p_data->set_visibility.disc_mode & ~BTA_DM_LE_IGNORE) | le_disc_mode);
}
if ((p_data->set_visibility.disc_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
if ((p_data->set_visibility.disc_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE) {
p_data->set_visibility.disc_mode =
((p_data->set_visibility.disc_mode & ~BTA_DM_IGNORE) | disc_mode);
}
BTM_SetDiscoverability(p_data->set_visibility.disc_mode,
bta_dm_cb.inquiry_scan_window,
@ -649,13 +655,15 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
}
if (p_data->set_visibility.conn_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
if ((p_data->set_visibility.conn_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
if ((p_data->set_visibility.conn_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE) {
p_data->set_visibility.conn_mode =
((p_data->set_visibility.conn_mode & ~BTA_DM_LE_IGNORE) | le_conn_mode);
}
if ((p_data->set_visibility.conn_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
if ((p_data->set_visibility.conn_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE) {
p_data->set_visibility.conn_mode =
((p_data->set_visibility.conn_mode & ~BTA_DM_IGNORE) | conn_mode);
}
BTM_SetConnectability(p_data->set_visibility.conn_mode,
bta_dm_cb.page_scan_window,
@ -1664,7 +1672,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;
@ -1805,8 +1813,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;
@ -1832,8 +1839,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;
@ -1885,10 +1891,12 @@ void bta_dm_disc_result (tBTA_DM_MSG *p_data)
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
/* if any BR/EDR service discovery has been done, report the event */
if ((bta_dm_search_cb.services & ((BTA_ALL_SERVICE_MASK | BTA_USER_SERVICE_MASK ) & ~BTA_BLE_SERVICE_MASK)))
#endif
if ((bta_dm_search_cb.services & ((BTA_ALL_SERVICE_MASK | BTA_USER_SERVICE_MASK ) & ~BTA_BLE_SERVICE_MASK))) {
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_RES_EVT, &p_data->disc_result.result);
}
#else
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_RES_EVT, &p_data->disc_result.result);
#endif
tBTA_DM_MSG *p_msg = (tBTA_DM_MSG *) osi_malloc(sizeof(tBTA_DM_MSG));
/* send a message to change state */
@ -2154,9 +2162,10 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
}
/* last one? clear the BLE service bit if all discovery has been done */
if (bta_dm_search_cb.uuid_to_search == 0)
if (bta_dm_search_cb.uuid_to_search == 0) {
bta_dm_search_cb.services_to_search &=
(tBTA_SERVICE_MASK)(~(BTA_SERVICE_ID_TO_SERVICE_MASK(bta_dm_search_cb.service_index)));
}
} else
#endif
@ -2214,8 +2223,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;
@ -2400,8 +2408,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;
@ -2545,7 +2552,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);
@ -2588,7 +2595,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);
@ -2601,7 +2608,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;
@ -2633,7 +2640,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;
@ -2666,9 +2673,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
}
}
#if (BT_SSP_INCLUDED == TRUE)
/*******************************************************************************
**
** Function bta_dm_pinname_cback
@ -2725,6 +2730,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
bta_dm_cb.p_sec_cback(event, &sec_event);
}
}
#endif /// BT_SSP_INCLUDED == TRUE
/*******************************************************************************
**
@ -2744,21 +2750,9 @@ static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_
return BTM_NOT_AUTHORIZED;
}
/* If the device name is not known, save bdaddr and devclass and initiate a name request */
if (bd_name[0] == 0) {
bta_dm_cb.pin_evt = BTA_DM_PIN_REQ_EVT;
bdcpy(bta_dm_cb.pin_bd_addr, bd_addr);
BTA_COPY_DEVICE_CLASS(bta_dm_cb.pin_dev_class, dev_class);
if ((BTM_ReadRemoteDeviceName(bd_addr, bta_dm_pinname_cback, BT_TRANSPORT_BR_EDR)) == BTM_CMD_STARTED) {
return BTM_CMD_STARTED;
}
APPL_TRACE_WARNING(" bta_dm_pin_cback() -> Failed to start Remote Name Request ");
}
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;
@ -2928,8 +2922,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;
}
}
@ -2950,8 +2943,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;
}
}
@ -2972,8 +2964,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;
}
}
@ -3002,7 +2993,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);
@ -3652,11 +3643,11 @@ static char *bta_dm_get_remname(void)
char *p_temp;
/* If the name isn't already stored, try retrieving from BTM */
if (*p_name == '\0')
if (*p_name == '\0') {
if ((p_temp = BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr)) != NULL) {
p_name = p_temp;
}
}
return p_name;
}
#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
@ -4271,6 +4262,28 @@ static void bta_dm_observe_cmpl_cb (void *p_result)
}
}
/*******************************************************************************
**
** Function bta_dm_observe_discard_cb
**
** Description Callback for BLE Observe lost
**
**
** Returns void
**
*******************************************************************************/
static void bta_dm_observe_discard_cb (uint32_t num_dis)
{
tBTA_DM_SEARCH data;
APPL_TRACE_DEBUG("bta_dm_observe_discard_cb");
data.inq_dis.num_dis = num_dis;
if (bta_dm_search_cb.p_scan_cback) {
bta_dm_search_cb.p_scan_cback(BTA_DM_INQ_DISCARD_NUM_EVT, &data);
}
}
#if (SMP_INCLUDED == TRUE)
/*******************************************************************************
**
@ -4316,8 +4329,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;
}
@ -4329,8 +4341,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;
}
@ -4351,7 +4362,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);
@ -4371,8 +4382,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;
}
@ -4475,7 +4485,8 @@ void bta_dm_add_ble_device (tBTA_DM_MSG *p_data)
{
if (!BTM_SecAddBleDevice (p_data->add_ble_device.bd_addr, NULL,
p_data->add_ble_device.dev_type ,
p_data->add_ble_device.addr_type)) {
p_data->add_ble_device.addr_type,
p_data->add_ble_device.auth_mode)) {
APPL_TRACE_ERROR ("BTA_DM: Error adding BLE Device for device %08x%04x",
(p_data->add_ble_device.bd_addr[0] << 24) + (p_data->add_ble_device.bd_addr[1] << 16) + \
(p_data->add_ble_device.bd_addr[2] << 8) + p_data->add_ble_device.bd_addr[3],
@ -4801,7 +4812,7 @@ void bta_dm_ble_scan (tBTA_DM_MSG *p_data)
bta_dm_search_cb.p_scan_cback = p_data->ble_scan.p_cback;
if ((status = BTM_BleScan(TRUE, p_data->ble_scan.duration,
bta_dm_observe_results_cb, bta_dm_observe_cmpl_cb)) != BTM_CMD_STARTED) {
bta_dm_observe_results_cb, bta_dm_observe_cmpl_cb, bta_dm_observe_discard_cb)) != BTM_CMD_STARTED) {
APPL_TRACE_WARNING(" %s start scan failed. status=0x%x\n", __FUNCTION__, status);
}
@ -4811,7 +4822,7 @@ void bta_dm_ble_scan (tBTA_DM_MSG *p_data)
}
} else {
bta_dm_search_cb.p_scan_cback = NULL;
status = BTM_BleScan(FALSE, 0, NULL, NULL);
status = BTM_BleScan(FALSE, 0, NULL, NULL, NULL);
if (status != BTM_CMD_STARTED){
APPL_TRACE_WARNING(" %s stop scan failed, status=0x%x\n", __FUNCTION__, status);
@ -4868,6 +4879,22 @@ void bta_dm_ble_set_adv_params_all (tBTA_DM_MSG *p_data)
}
}
/*******************************************************************************
**
** Function bta_dm_ble_update_duplicate_exceptional_list
**
** Description This function is to update duplicate scan exceptional list
**
**
*******************************************************************************/
void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data)
{
BTM_UpdateBleDuplicateExceptionalList(p_data->ble_duplicate_exceptional_list.subcode,
p_data->ble_duplicate_exceptional_list.type,
p_data->ble_duplicate_exceptional_list.device_info,
p_data->ble_duplicate_exceptional_list.exceptional_list_cb);
}
/*******************************************************************************
**
** Function bta_dm_ble_set_adv_config
@ -5154,9 +5181,10 @@ void bta_dm_ble_setup_storage (tBTA_DM_MSG *p_data)
p_data->ble_set_storage.ref_value);
}
if (BTM_CMD_STARTED != btm_status)
if (BTM_CMD_STARTED != btm_status) {
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_CFG_STRG_EVT, p_data->ble_set_storage.ref_value,
btm_status);
}
}
/*******************************************************************************
@ -5184,9 +5212,10 @@ void bta_dm_ble_enable_batch_scan (tBTA_DM_MSG *p_data)
p_data->ble_enable_scan.ref_value);
}
if (BTM_CMD_STARTED != btm_status)
if (BTM_CMD_STARTED != btm_status) {
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_ENABLE_EVT, p_data->ble_enable_scan.ref_value,
btm_status);
}
}
/*******************************************************************************
@ -5210,9 +5239,10 @@ void bta_dm_ble_disable_batch_scan (tBTA_DM_MSG *p_data)
btm_status = BTM_BleDisableBatchScan(p_data->ble_disable_scan.ref_value);
}
if (BTM_CMD_STARTED != btm_status)
if (BTM_CMD_STARTED != btm_status) {
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_DISABLE_EVT, p_data->ble_enable_scan.ref_value,
btm_status);
}
}
/*******************************************************************************
@ -5236,9 +5266,10 @@ void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data)
p_data->ble_read_reports.ref_value);
}
if (BTM_CMD_STARTED != btm_status)
if (BTM_CMD_STARTED != btm_status) {
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_READ_REPTS_EVT, p_data->ble_enable_scan.ref_value,
btm_status);
}
}
/*******************************************************************************
@ -5368,10 +5399,11 @@ void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data)
}
}
if (p_data->ble_cfg_filter_cond.p_filt_cfg_cback)
if (p_data->ble_cfg_filter_cond.p_filt_cfg_cback) {
p_data->ble_cfg_filter_cond.p_filt_cfg_cback(BTA_DM_BLE_PF_CONFIG_EVT,
p_data->ble_cfg_filter_cond.cond_type, 0, status,
p_data->ble_cfg_filter_cond.ref_value);
}
return;
}
@ -5402,9 +5434,10 @@ void bta_dm_enable_scan_filter(tBTA_DM_MSG *p_data)
return;
}
if (p_data->ble_enable_scan_filt.p_filt_status_cback)
if (p_data->ble_enable_scan_filt.p_filt_status_cback) {
p_data->ble_enable_scan_filt.p_filt_status_cback (BTA_DM_BLE_PF_ENABLE_EVT,
p_data->ble_enable_scan_filt.ref_value, status);
}
}
@ -5438,9 +5471,10 @@ void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data)
}
}
if (p_data->ble_scan_filt_param_setup.p_filt_param_cback)
if (p_data->ble_scan_filt_param_setup.p_filt_param_cback) {
p_data->ble_scan_filt_param_setup.p_filt_param_cback (BTA_DM_BLE_PF_ENABLE_EVT, 0,
p_data->ble_scan_filt_param_setup.ref_value, status);
}
return;
}
@ -5583,7 +5617,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));
@ -5625,8 +5659,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;
@ -5750,6 +5783,8 @@ void bta_dm_proc_open_evt(tBTA_GATTC_OPEN *p_data)
((p2[0]) << 24) + ((p2[1]) << 16) + ((p2[2]) << 8) + (p2[3]),
((p2[4]) << 8) + p2[5]);
UNUSED(p1);
UNUSED(p2);
APPL_TRACE_DEBUG("BTA_GATTC_OPEN_EVT conn_id = %d client_if=%d status = %d" ,
p_data->conn_id,
p_data->client_if,

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);
@ -797,12 +797,13 @@ void BTA_DmAddBleKey (BD_ADDR bd_addr, tBTA_LE_KEY_VALUE *p_le_key, tBTA_LE_KEY_
**
** Parameters: bd_addr - BD address of the peer
** dev_type - Remote device's device type.
** auth_mode - auth mode
** addr_type - LE device address type.
**
** Returns void
**
*******************************************************************************/
void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TYPE dev_type)
void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, int auth_mode, tBT_DEVICE_TYPE dev_type)
{
tBTA_DM_API_ADD_BLE_DEVICE *p_msg;
@ -812,6 +813,7 @@ void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TY
p_msg->hdr.event = BTA_DM_API_ADD_BLEDEVICE_EVT;
bdcpy(p_msg->bd_addr, bd_addr);
p_msg->addr_type = addr_type;
p_msg->auth_mode = auth_mode;
p_msg->dev_type = dev_type;
bta_sys_sendmsg(p_msg);
@ -1256,6 +1258,34 @@ void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len,
}
}
/*******************************************************************************
**
** Function BTA_DmUpdateDuplicateExceptionalList
**
** Description This function is called to update duplicate scan exceptional list
**
** Parameters subcode : add, remove or clean duplicate scan exceptional list.
** type : device info type.
** device_info: device info
** p_update_duplicate_ignore_list_cback : update complete callback.
**
** Returns None
**
*******************************************************************************/
void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type, BD_ADDR device_info, tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback)
{
tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST *p_msg;
if ((p_msg = (tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST *)osi_malloc(sizeof(tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST))) != NULL) {
p_msg->hdr.event = BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT;
p_msg->subcode = subcode;
p_msg->type = type;
p_msg->exceptional_list_cb = p_update_duplicate_exceptional_list_cback;
memcpy(p_msg->device_info, device_info, sizeof(BD_ADDR));
bta_sys_sendmsg(p_msg);
}
}
/*******************************************************************************
**
** Function BTA_DmBleSetStorageParams

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

@ -45,6 +45,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
};
#endif
@ -399,7 +400,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);
@ -407,6 +408,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

@ -157,6 +157,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_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_ble_update_duplicate_exceptional_list,/* BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT */
};

View File

@ -1038,9 +1038,10 @@ static void bta_dm_pm_hid_check(BOOLEAN bScoActive)
bta_dm_pm_set_sniff_policy( bta_dm_find_peer_device(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr), bScoActive);
/* if we had disabled link policy, seems like the hid device stop retrying SNIFF after a few tries. force sniff if needed */
if (!bScoActive)
if (!bScoActive) {
bta_dm_pm_set_mode(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr, BTA_DM_PM_NO_ACTION,
BTA_DM_PM_RESTART);
}
}
}

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,6 +155,7 @@ enum {
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_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT,
BTA_DM_MAX_EVT
};
@ -193,6 +194,14 @@ typedef struct {
tBTA_ADD_WHITELIST_CBACK *add_wl_cb;
}tBTA_DM_API_UPDATE_WHITE_LIST;
typedef struct {
BT_HDR hdr;
UINT8 subcode;
UINT32 type;
BD_ADDR device_info;
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *exceptional_list_cb;
}tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST;
typedef struct {
BT_HDR hdr;
tBTA_CMPL_CB *read_tx_power_cb;
@ -445,6 +454,7 @@ typedef struct {
BT_HDR hdr;
BD_ADDR bd_addr;
tBT_DEVICE_TYPE dev_type ;
UINT32 auth_mode;
tBLE_ADDR_TYPE addr_type;
} tBTA_DM_API_ADD_BLE_DEVICE;
@ -847,6 +857,7 @@ typedef union {
tBTA_DM_API_TRACK_ADVERTISER ble_track_advert;
tBTA_DM_API_ENERGY_INFO ble_energy_info;
tBTA_DM_API_BLE_DISCONNECT ble_disconnect;
tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST ble_duplicate_exceptional_list;
#endif
tBTA_DM_API_REMOVE_ACL remove_acl;
@ -1180,6 +1191,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);
@ -1242,7 +1254,7 @@ extern void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_scan_rsp_raw (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
extern void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data);
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
extern void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data);

View File

@ -531,7 +531,9 @@ void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg
if (bta_gattc_mark_bg_conn(p_data->client_if, p_data->remote_bda, TRUE, FALSE)) {
/* always call open to hold a connection */
if (!GATT_Connect(p_data->client_if, p_data->remote_bda, p_data->remote_addr_type, FALSE, p_data->transport)) {
#if (!CONFIG_BT_STACK_NO_LOG)
uint8_t *bda = (uint8_t *)p_data->remote_bda;
#endif
status = BTA_GATT_ERROR;
APPL_TRACE_ERROR("%s unable to connect to remote bd_addr:%02x:%02x:%02x:%02x:%02x:%02x",
__func__, bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);
@ -674,7 +676,7 @@ void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
bta_gattc_reset_discover_st(p_clcb->p_srcb, BTA_GATT_OK);
//register service change
bta_gattc_register_service_change_notify(p_clcb->bta_conn_id, p_clcb->bda);
} else
} else
#endif
{ /* cache is building */
p_clcb->p_srcb->state = BTA_GATTC_SERV_DISC;
@ -743,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,
@ -1071,8 +1075,9 @@ void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
*******************************************************************************/
void bta_gattc_read(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
{
if (!bta_gattc_enqueue(p_clcb, p_data))
if (!bta_gattc_enqueue(p_clcb, p_data)) {
return;
}
tGATT_READ_PARAM read_param;
memset (&read_param, 0 ,sizeof(tGATT_READ_PARAM));
@ -1140,8 +1145,9 @@ void bta_gattc_read_multi(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
*******************************************************************************/
void bta_gattc_write(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
{
if (!bta_gattc_enqueue(p_clcb, p_data))
if (!bta_gattc_enqueue(p_clcb, p_data)) {
return;
}
tBTA_GATT_STATUS status = BTA_GATT_OK;
tGATT_VALUE attr;
@ -1742,7 +1748,7 @@ void bta_gattc_process_api_cache_assoc(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_m
tBTA_GATTC gattc_cb = {0};
gattc_cb.set_assoc.client_if = p_msg->api_assoc.client_if;
BOOLEAN state = FALSE;
tBTA_GATTC_CLCB *p_assoc_clcb = bta_gattc_find_clcb_by_cif(p_msg->api_assoc.client_if,
tBTA_GATTC_CLCB *p_assoc_clcb = bta_gattc_find_clcb_by_cif(p_msg->api_assoc.client_if,
p_msg->api_assoc.assoc_addr, BTA_TRANSPORT_LE);
tBTA_GATTC_RCB *p_clrcb = bta_gattc_cl_get_regcb(p_msg->api_assoc.client_if);
if (p_assoc_clcb != NULL) {
@ -1783,7 +1789,7 @@ void bta_gattc_process_api_cache_assoc(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_m
}
return;
}
void bta_gattc_process_api_cache_get_addr_list(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
{

View File

@ -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
@ -333,13 +333,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,
@ -354,7 +354,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,
@ -369,7 +369,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,
@ -385,7 +385,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,
@ -400,7 +400,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,
@ -415,7 +415,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,
@ -429,13 +429,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);
}
@ -454,7 +454,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);
}

View File

@ -93,7 +93,7 @@ static char *bta_gattc_attr_type[] = {
};
/* utility functions */
bool display_cache_attribute(void *data, void *context)
bool display_cache_attribute(void *data, void *context)
{
//tBTA_GATTC_CACHE_ATTR *p_attr = data;
//APPL_TRACE_ERROR("\t Attr handle[%d] uuid[0x%04x] type[%s] prop[0x%1x]",
@ -102,7 +102,7 @@ bool display_cache_attribute(void *data, void *context)
return true;
}
bool display_cache_service(void *data, void *context)
bool display_cache_service(void *data, void *context)
{
tBTA_GATTC_SERVICE *p_cur_srvc = data;
APPL_TRACE_API("Service: handle[%d ~ %d] %s[0x%04x] inst[%d]",
@ -213,9 +213,9 @@ static void bta_gattc_free(void *ptr)
osi_free(ptr);
}
void bta_gattc_insert_sec_service_to_cache(list_t *services, tBTA_GATTC_SERVICE *p_new_srvc)
void bta_gattc_insert_sec_service_to_cache(list_t *services, tBTA_GATTC_SERVICE *p_new_srvc)
{
// services/p_new_srvc is NULL
// services/p_new_srvc is NULL
if (!services || !p_new_srvc) {
APPL_TRACE_ERROR("%s services/p_new_srvc is NULL", __func__);
return;
@ -243,7 +243,7 @@ void bta_gattc_insert_sec_service_to_cache(list_t *services, tBTA_GATTC_SERVICE
return;
}
}
}
}
}
}
@ -314,8 +314,9 @@ static tBTA_GATT_STATUS bta_gattc_add_char_to_cache(tBTA_GATTC_SERV *p_srvc_cb,
/* TODO(jpawlowski): We should use attribute handle, not value handle to refer to characteristic.
This is just a temporary workaround.
*/
if (service->e_handle < value_handle)
if (service->e_handle < value_handle) {
service->e_handle = value_handle;
}
tBTA_GATTC_CHARACTERISTIC *characteristic = osi_malloc(sizeof(tBTA_GATTC_CHARACTERISTIC));
if (!characteristic) {
@ -554,10 +555,10 @@ void bta_gattc_update_include_service(const list_t *services) {
if(include_service && !include_service->included_service) {
//update
include_service->included_service = bta_gattc_find_matching_service(services, include_service->incl_srvc_s_handle);
if(!include_service->included_service) {
if(!include_service->included_service) {
//not match, free it
list_remove(service->included_svc, include_service);
osi_free(include_service);
osi_free(include_service);
}
}
}
@ -980,12 +981,13 @@ void bta_gattc_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_
p_data->value.incl_service.e_handle,
p_data->value.incl_service.service_type);
if (!pri_srvc)
if (!pri_srvc) {
bta_gattc_add_srvc_to_list(p_srvc_cb,
p_data->value.incl_service.s_handle,
p_data->value.incl_service.e_handle,
p_data->value.incl_service.service_type,
FALSE);
}
/* add into database */
bta_gattc_add_attr_to_cache(p_srvc_cb,
p_data->handle,
@ -1007,8 +1009,8 @@ void bta_gattc_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_
case GATT_DISC_CHAR_DSCPT:
bta_gattc_add_attr_to_cache(p_srvc_cb,
p_data->handle,
&p_data->type,
p_data->handle,
&p_data->type,
0,
0 /* incl_srvc_s_handle */,
0 /* incl_srvc_e_handle */,
@ -1023,8 +1025,9 @@ void bta_gattc_disc_cmpl_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
if ( p_clcb && (status != GATT_SUCCESS || p_clcb->status != GATT_SUCCESS) ) {
if (status == GATT_SUCCESS)
if (status == GATT_SUCCESS) {
p_clcb->status = status;
}
bta_gattc_sm_execute(p_clcb, BTA_GATTC_DISCOVER_CMPL_EVT, NULL);
return;
}
@ -1071,15 +1074,17 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
{
tBTA_GATTC cb_data;
if (!p_clcb->p_srcb->p_srvc_cache || list_is_empty(p_clcb->p_srcb->p_srvc_cache))
if (!p_clcb->p_srcb->p_srvc_cache || list_is_empty(p_clcb->p_srcb->p_srvc_cache)) {
return;
}
for (list_node_t *sn = list_begin(p_clcb->p_srcb->p_srvc_cache);
sn != list_end(p_clcb->p_srcb->p_srvc_cache); sn = list_next(sn)) {
tBTA_GATTC_SERVICE *p_cache = list_node(sn);
if (!bta_gattc_uuid_compare(p_uuid, &p_cache->uuid, FALSE))
if (!bta_gattc_uuid_compare(p_uuid, &p_cache->uuid, FALSE)) {
continue;
}
#if (defined BTA_GATT_DEBUG && BTA_GATT_DEBUG == TRUE)
APPL_TRACE_DEBUG("found service [0x%04x], inst[%d] handle [%d]",
@ -1087,8 +1092,9 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
p_cache->handle,
p_cache->s_handle);
#endif
if (!p_clcb->p_rcb->p_cback)
if (!p_clcb->p_rcb->p_cback) {
continue;
}
memset(&cb_data, 0, sizeof(tBTA_GATTC));
@ -1103,8 +1109,9 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
}
list_t* bta_gattc_get_services_srcb(tBTA_GATTC_SERV *p_srcb) {
if (!p_srcb || !p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache))
if (!p_srcb || !p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache)) {
return NULL;
}
return p_srcb->p_srvc_cache;
}
@ -1112,8 +1119,9 @@ list_t* bta_gattc_get_services_srcb(tBTA_GATTC_SERV *p_srcb) {
const list_t* bta_gattc_get_services(UINT16 conn_id) {
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
if (p_clcb == NULL )
if (p_clcb == NULL ) {
return NULL;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
@ -1121,63 +1129,68 @@ const list_t* bta_gattc_get_services(UINT16 conn_id) {
}
tBTA_GATTC_SERVICE* bta_gattc_find_matching_service(const list_t *services, UINT16 handle) {
if (!services || list_is_empty(services))
if (!services || list_is_empty(services)) {
return NULL;
}
for (list_node_t *sn = list_begin(services);
sn != list_end(services); sn = list_next(sn)) {
tBTA_GATTC_SERVICE *service = list_node(sn);
if (handle >= service->s_handle && handle <= service->e_handle)
if (handle >= service->s_handle && handle <= service->e_handle) {
return service;
}
}
return NULL;
}
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
{
const list_t *services = bta_gattc_get_services_srcb(p_srcb);
return bta_gattc_find_matching_service(services, handle);
}
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id, UINT16 handle)
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id, UINT16 handle)
{
const list_t *services = bta_gattc_get_services(conn_id);
return bta_gattc_find_matching_service(services, handle);
}
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
{
const tBTA_GATTC_SERVICE* service = bta_gattc_get_service_for_handle_srcb(p_srcb, handle);
if (!service)
if (!service) {
return NULL;
}
for (list_node_t *cn = list_begin(service->characteristics);
cn != list_end(service->characteristics); cn = list_next(cn)) {
tBTA_GATTC_CHARACTERISTIC *p_char = list_node(cn);
if (handle == p_char->handle)
if (handle == p_char->handle) {
return p_char;
}
}
return NULL;
}
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle)
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle)
{
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
if (p_clcb == NULL )
if (p_clcb == NULL ) {
return NULL;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
return bta_gattc_get_characteristic_srcb(p_srcb, handle);
}
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
{
const tBTA_GATTC_SERVICE* service = bta_gattc_get_service_for_handle_srcb(p_srcb, handle);
@ -1191,20 +1204,22 @@ tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, U
for (list_node_t *dn = list_begin(p_char->descriptors);
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
tBTA_GATTC_DESCRIPTOR *p_desc = list_node(dn);
if (handle == p_desc->handle)
if (handle == p_desc->handle) {
return p_desc;
}
}
}
return NULL;
}
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
{
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
if (p_clcb == NULL )
if (p_clcb == NULL ) {
return NULL;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
return bta_gattc_get_descriptor_srcb(p_srcb, handle);
@ -1212,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) {
@ -1286,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);
@ -1443,7 +1458,7 @@ void bta_gattc_get_db_with_opration(UINT16 conn_id,
}
}
}
}
}
@ -1476,7 +1491,7 @@ static size_t bta_gattc_get_db_size_with_type(list_t *services,
}
if (type == BTGATT_DB_PRIMARY_SERVICE || type == BTGATT_DB_SECONDARY_SERVICE) {
if ((type == BTGATT_DB_PRIMARY_SERVICE && p_cur_srvc->is_primary) ||
if ((type == BTGATT_DB_PRIMARY_SERVICE && p_cur_srvc->is_primary) ||
(type == BTGATT_DB_SECONDARY_SERVICE && !p_cur_srvc->is_primary)) {
// if the current service is the last service in the db, need to ensure the current service start handle is not less than the start_handle.
if (!svc_length) {
@ -1572,10 +1587,11 @@ static size_t bta_gattc_get_db_size_with_type(list_t *services,
** Returns number of elements inside db from start_handle to end_handle
*******************************************************************************/
static size_t bta_gattc_get_db_size(list_t *services,
UINT16 start_handle, UINT16 end_handle)
UINT16 start_handle, UINT16 end_handle)
{
if (!services || list_is_empty(services))
if (!services || list_is_empty(services)) {
return 0;
}
size_t db_size = 0;
UINT16 svc_length = list_length(services) - 1;
@ -1598,9 +1614,10 @@ static size_t bta_gattc_get_db_size(list_t *services,
} else {
db_size++;
}
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics))
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics)) {
continue;
}
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
cn != list_end(p_cur_srvc->characteristics); cn = list_next(cn)) {
@ -1649,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);
@ -1657,7 +1674,7 @@ void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 en
*count = 0;
return;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
if (!p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache)) {
*count = 0;
@ -1668,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);
@ -1676,7 +1693,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
*count = 0;
return;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
if (!p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache)) {
*count = 0;
@ -1694,7 +1711,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
}
}
*count = bta_gattc_get_db_size_with_type(p_srcb->p_srvc_cache, type, NULL, start_handle, end_handle);
}
/*******************************************************************************
@ -1715,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);
@ -1786,8 +1803,9 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
p_char->properties);
curr_db_attr++;
if (!p_char->descriptors || list_is_empty(p_char->descriptors))
if (!p_char->descriptors || list_is_empty(p_char->descriptors)) {
continue;
}
for (list_node_t *dn = list_begin(p_char->descriptors);
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
@ -1815,8 +1833,9 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
}
}
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc))
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc)) {
continue;
}
for (list_node_t *isn = list_begin(p_cur_srvc->included_svc);
isn != list_end(p_cur_srvc->included_svc); isn = list_next(isn)) {
@ -1861,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);
@ -1983,8 +2002,9 @@ void bta_gattc_fill_nv_attr(tBTA_GATTC_NV_ATTR *p_attr, UINT8 type, UINT16 s_han
*******************************************************************************/
void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
{
if (!p_srvc_cb->p_srvc_cache || list_is_empty(p_srvc_cb->p_srvc_cache))
if (!p_srvc_cb->p_srvc_cache || list_is_empty(p_srvc_cb->p_srvc_cache)) {
return;
}
int i = 0;
size_t db_size = bta_gattc_get_db_size(p_srvc_cb->p_srvc_cache, 0x0000, 0xFFFF);
@ -2017,8 +2037,9 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
sn != list_end(p_srvc_cb->p_srvc_cache); sn = list_next(sn)) {
tBTA_GATTC_SERVICE *p_cur_srvc = list_node(sn);
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics))
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics)) {
continue;
}
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
cn != list_end(p_cur_srvc->characteristics); cn = list_next(cn)) {
@ -2034,8 +2055,9 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
0 /* incl_srvc_e_handle */,
FALSE);
if (!p_char->descriptors || list_is_empty(p_char->descriptors))
if (!p_char->descriptors || list_is_empty(p_char->descriptors)) {
continue;
}
for (list_node_t *dn = list_begin(p_char->descriptors);
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
@ -2053,8 +2075,9 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
}
}
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc))
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc)) {
continue;
}
for (list_node_t *an = list_begin(p_cur_srvc->included_svc);
an != list_end(p_cur_srvc->included_svc); an = list_next(an)) {

View File

@ -261,14 +261,18 @@ tBTA_GATT_STATUS bta_gattc_co_cache_open(BD_ADDR server_bda, BOOLEAN to_save, UI
*******************************************************************************/
tBTA_GATT_STATUS bta_gattc_co_cache_load(tBTA_GATTC_NV_ATTR *attr, UINT8 index)
{
#if (!CONFIG_BT_STACK_NO_LOG)
UINT16 num_attr = 0;
#endif
tBTA_GATT_STATUS status = BTA_GATT_ERROR;
size_t length = 0;
// Read the size of memory space required for blob
nvs_get_blob(cache_env.cache_addr[index].cache_fp, cache_key, NULL, &length);
// Read previously saved blob if available
esp_err_t err_code = nvs_get_blob(cache_env.cache_addr[index].cache_fp, cache_key, attr, &length);
#if (!CONFIG_BT_STACK_NO_LOG)
num_attr = length / sizeof(tBTA_GATTC_NV_ATTR);
#endif
status = (err_code == ESP_OK && length != 0) ? BTA_GATT_OK : BTA_GATT_ERROR;
APPL_TRACE_DEBUG("%s() - read=%d, status=%d, err_code = %d",
__func__, num_attr, status, err_code);
@ -323,6 +327,9 @@ void bta_gattc_co_cache_save (BD_ADDR server_bda, UINT16 num_attr,
status = BTA_GATT_ERROR;
}
#if CONFIG_BT_STACK_NO_LOG
(void) status;
#endif
APPL_TRACE_DEBUG("%s() wrote hash_key = %x%x%x%x, num_attr = %d, status = %d.", __func__, hash_key[0], hash_key[1], hash_key[2], hash_key[3], num_attr, status);
}

View File

@ -416,8 +416,9 @@ tBTA_GATTC_SERV *bta_gattc_srcb_alloc(BD_ADDR bda)
if (p_tcb != NULL)
{
if (p_tcb->p_srvc_cache != NULL)
if (p_tcb->p_srvc_cache != NULL) {
list_free(p_tcb->p_srvc_cache);
}
osi_free(p_tcb->p_srvc_list);
p_tcb->p_srvc_list = NULL;
//osi_free_and_reset((void **)&p_tcb->p_srvc_list);
@ -583,8 +584,9 @@ void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id,
* clear boundaries are always around service.
*/
handle = p_clrcb->notif_reg[i].handle;
if (handle >= start_handle && handle <= end_handle)
if (handle >= start_handle && handle <= end_handle) {
memset(&p_clrcb->notif_reg[i], 0, sizeof(tBTA_GATTC_NOTIF_REG));
}
}
}
}
@ -594,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
@ -637,8 +663,9 @@ BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda
}
if (!add) {
if (remote_bda_ptr) {
// bdstr_t bdstr = {0};
#if (!CONFIG_BT_STACK_NO_LOG)
char bdstr[18] = {0};
#endif
APPL_TRACE_ERROR("%s unable to find the bg connection mask for: %s", __func__,
bdaddr_to_string((bt_bdaddr_t *)remote_bda_ptr, bdstr, sizeof(bdstr)));
}
@ -936,8 +963,9 @@ void bta_to_btif_uuid(bt_uuid_t *p_dest, tBT_UUID *p_src)
if (p_src->len == LEN_UUID_16 || p_src->len == LEN_UUID_32)
{
for(i=0; i != 16; ++i)
for(i=0; i != 16; ++i) {
p_dest->uu[i] = base_uuid[i];
}
}
switch (p_src->len)

View File

@ -403,7 +403,7 @@ void bta_gatts_add_char(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg)
UINT16 attr_id = 0;
tBTA_GATTS cb_data;
tGATT_ATTR_VAL *p_attr_val = NULL;
tGATT_ATTR_VAL *p_attr_val = NULL;
tGATTS_ATTR_CONTROL *p_control = NULL;
if(p_msg->api_add_char.attr_val.attr_max_len != 0){
@ -665,17 +665,18 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
&gatt_if, remote_bda, &transport)) {
p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if);
if (p_msg->api_indicate.need_confirm)
if (p_msg->api_indicate.need_confirm) {
status = GATTS_HandleValueIndication (p_msg->api_indicate.hdr.layer_specific,
p_msg->api_indicate.attr_id,
p_msg->api_indicate.len,
p_msg->api_indicate.value);
else
} else {
status = GATTS_HandleValueNotification (p_msg->api_indicate.hdr.layer_specific,
p_msg->api_indicate.attr_id,
p_msg->api_indicate.len,
p_msg->api_indicate.value);
}
/* if over BR_EDR, inform PM for mode change */
if (transport == BTA_TRANSPORT_BR_EDR) {
@ -851,13 +852,13 @@ void bta_gatts_send_service_change_indication (tBTA_GATTS_DATA *p_msg)
memcpy(bd_addr, p_msg->api_send_service_change.remote_bda, BD_ADDR_LEN);
status = GATT_SendServiceChangeIndication(bd_addr);
} else {
status = GATT_SendServiceChangeIndication(NULL);
status = GATT_SendServiceChangeIndication(NULL);
}
if (p_rcb && p_rcb->p_cback) {
service_change.status = status;
service_change.server_if = p_msg->api_send_service_change.server_if;
(*p_rcb->p_cback)(BTA_GATTS_SEND_SERVICE_CHANGE_EVT, (tBTA_GATTS *)&service_change);
}
}
}
/*******************************************************************************
@ -932,6 +933,9 @@ static void bta_gatts_send_request_cback (UINT16 conn_id,
cb_data.req_data.trans_id = trans_id;
cb_data.req_data.p_data = (tBTA_GATTS_REQ_DATA *)p_data;
if(req_type == BTA_GATTS_CONF_EVT) {
cb_data.req_data.handle = p_data->handle;
}
(*p_rcb->p_cback)(req_type, &cb_data);
} else {
APPL_TRACE_ERROR("connection request on gatt_if[%d] is not interested", gatt_if);
@ -1003,22 +1007,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

@ -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;
}
@ -1159,6 +1161,7 @@ static char *bta_hf_client_skip_unknown(char *buffer)
buffer = tmp + 2;
APPL_TRACE_DEBUG("%s %.*s", __FUNCTION__, buffer - start - 2, start);
UNUSED(start);
return buffer;
}
@ -1256,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

@ -308,6 +308,7 @@ static void bta_hf_client_sco_disc_cback(UINT16 sco_idx)
#if (BTM_SCO_HCI_INCLUDED == TRUE )
tBTM_STATUS status = BTM_ConfigScoPath(BTM_SCO_ROUTE_PCM, NULL, NULL, TRUE);
APPL_TRACE_DEBUG("%s close config status = %d", __FUNCTION__, status);
UNUSED(status);
/* SCO clean up here */
bta_hf_client_sco_co_close();
#endif

View File

@ -101,8 +101,10 @@ void bta_hh_api_enable(tBTA_HH_DATA *p_data)
bta_hh_le_enable();
} else
#endif
{
/* signal BTA call back event */
(* bta_hh_cb.p_cback)(BTA_HH_ENABLE_EVT, (tBTA_HH *)&status);
}
}
/*******************************************************************************
**
@ -901,7 +903,9 @@ void bta_hh_get_dscp_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
bta_hh_le_get_dscp_act(p_cb);
} else
#endif
{
(*bta_hh_cb.p_cback)(BTA_HH_GET_DSCP_EVT, (tBTA_HH *)&p_cb->dscp_info);
}
}
/*******************************************************************************
@ -934,11 +938,10 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
dev_info.status = BTA_HH_OK;
} else
#endif
{
if (HID_HostAddDev(p_dev_info->bda, p_dev_info->attr_mask, &dev_handle)\
== HID_SUCCESS) {
dev_info.handle = dev_handle;
dev_info.status = BTA_HH_OK;
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
/* update DI information */
@ -966,6 +969,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
/* update cb_index[] map */
bta_hh_cb.cb_index[dev_handle] = p_cb->index;
}
}
} else { /* device already been added */
dev_info.handle = p_cb->hid_handle;
dev_info.status = BTA_HH_OK;

View File

@ -2183,9 +2183,10 @@ void bta_hh_le_write_char_descr_cmpl(tBTA_HH_DEV_CB *p_dev_cb, tBTA_HH_DATA *p_b
case GATT_UUID_HID_BT_KB_INPUT:
case GATT_UUID_HID_BT_MOUSE_INPUT:
case GATT_UUID_HID_REPORT:
if (p_data->status == BTA_GATT_OK)
if (p_data->status == BTA_GATT_OK) {
p_dev_cb->hid_srvc[hid_inst_id].report[p_dev_cb->clt_cfg_idx].client_cfg_value =
BTA_GATT_CLT_CONFIG_NOTIFICATION;
}
p_dev_cb->clt_cfg_idx ++;
bta_hh_le_write_rpt_clt_cfg(p_dev_cb, hid_inst_id);

View File

@ -75,11 +75,12 @@ UINT8 bta_hh_find_cb(BD_ADDR bda)
return xx;
}
#if BTA_HH_DEBUG
else
else {
APPL_TRACE_DEBUG("in_use ? [%d] kdev[%d].hid_handle = %d state = [%d]",
bta_hh_cb.kdev[xx].in_use, xx,
bta_hh_cb.kdev[xx].hid_handle,
bta_hh_cb.kdev[xx].state);
}
#endif
}
@ -123,7 +124,9 @@ void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB *p_cb)
bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = BTA_HH_IDX_INVALID;
} else
#endif
{
bta_hh_cb.cb_index[p_cb->hid_handle] = BTA_HH_IDX_INVALID;
}
}
/* reset device control block */
@ -486,11 +489,12 @@ UINT8 bta_hh_dev_handle_to_cb_idx(UINT8 dev_handle)
#endif
} else
#endif
{
/* regular HID device checking */
if (dev_handle < BTA_HH_MAX_KNOWN ) {
index = bta_hh_cb.cb_index[dev_handle];
}
}
return index;
}

View File

@ -399,6 +399,8 @@ typedef struct {
UINT8 tx_power;
} tBTA_BLE_ADV_DATA;
typedef void (tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info);
typedef void (tBTA_SET_ADV_DATA_CMPL_CBACK) (tBTA_STATUS status);
typedef tBTM_START_ADV_CMPL_CBACK tBTA_START_ADV_CMPL_CBACK;
@ -1022,6 +1024,7 @@ typedef struct {
#define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */
#define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */
#define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */
#define BTA_DM_INQ_DISCARD_NUM_EVT 7 /* The number of inquiry discarded packets */
typedef UINT8 tBTA_DM_SEARCH_EVT;
@ -1053,6 +1056,11 @@ typedef struct {
UINT8 num_resps; /* Number of inquiry responses. */
} tBTA_DM_INQ_CMPL;
/* Structure associated with BTA_DM_INQ_DISCARD_NUM_EVT */
typedef struct {
UINT32 num_dis; /* The number of inquiry discarded packets. */
} tBTA_DM_INQ_DISCARD;
/* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */
typedef struct {
BD_ADDR bd_addr; /* BD address peer device. */
@ -1090,6 +1098,7 @@ typedef union {
tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */
tBTA_DM_DISC_BLE_RES disc_ble_res; /* Discovery result for GATT based service */
tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */
tBTA_DM_INQ_DISCARD inq_dis; /* the discarded packets information of inquiry */
} tBTA_DM_SEARCH;
/* Structure of search callback event and structures */
@ -1870,12 +1879,13 @@ extern void BTA_DmBleConfirmReply(BD_ADDR bd_addr, BOOLEAN accept);
**
** Parameters: bd_addr - BD address of the peer
** dev_type - Remote device's device type.
** auth_mode - auth mode
** addr_type - LE device address type.
**
** Returns void
**
*******************************************************************************/
extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type,
extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, int auth_mode,
tBT_DEVICE_TYPE dev_type);
@ -2236,6 +2246,24 @@ extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask,
extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len,
tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback);
/*******************************************************************************
**
** Function BTA_DmUpdateDuplicateExceptionalList
**
** Description This function is called to update duplicate scan exceptional list
**
** Parameters subcode : add, remove or clean duplicate scan exceptional list.
** type : device info type.
** device_info: device info
** p_update_duplicate_ignore_list_cback : update complete callback.
**
** Returns None
**
*******************************************************************************/
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);
/*******************************************************************************
**
** Function BTA_DmBleBroadcast

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

@ -26,6 +26,7 @@
#include <stdlib.h>
#include "osi/allocator.h"
#include "osi/osi.h"
#include "stack/bt_types.h"
#include "bta/utl.h"
#include "bta/bta_sys.h"
@ -137,7 +138,7 @@ UINT8 bta_jv_alloc_sec_id(void)
return ret;
}
static int get_sec_id_used(void)
UNUSED_ATTR static int get_sec_id_used(void)
{
int i;
int used = 0;
@ -146,12 +147,13 @@ static int get_sec_id_used(void)
used++;
}
}
if (used == BTA_JV_NUM_SERVICE_ID)
if (used == BTA_JV_NUM_SERVICE_ID) {
APPL_TRACE_ERROR("get_sec_id_used, sec id exceeds the limit:%d",
BTA_JV_NUM_SERVICE_ID);
}
return used;
}
static int get_rfc_cb_used(void)
UNUSED_ATTR static int get_rfc_cb_used(void)
{
int i;
int used = 0;
@ -160,9 +162,10 @@ static int get_rfc_cb_used(void)
used++;
}
}
if (used == BTA_JV_MAX_RFC_CONN)
if (used == BTA_JV_MAX_RFC_CONN) {
APPL_TRACE_ERROR("get_sec_id_used, rfc ctrl block exceeds the limit:%d",
BTA_JV_MAX_RFC_CONN);
}
return used;
}
@ -474,19 +477,21 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
< BTA_JV_MAX_RFC_SR_SESSION && bta_jv_cb.rfc_cb[hi].rfc_hdl[si]) {
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)
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);
}
p_cb = &p_pcb->p_pm_cb;
}
}
} 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)
if (NULL == p_l2c_cb->p_pm_cb) {
APPL_TRACE_WARNING("%s(jv_handle: "
"0x%x): p_pm_cb: %d: no link to pm_cb?", __func__, jv_handle, i);
}
p_cb = &p_l2c_cb->p_pm_cb;
}
}
@ -742,9 +747,10 @@ void bta_jv_get_channel_id(tBTA_JV_MSG *p_data)
bta_jv_cb.scn[channel - 1] = TRUE;
scn = (UINT8) channel;
}
if (bta_jv_cb.p_dm_cback)
if (bta_jv_cb.p_dm_cback) {
bta_jv_cb.p_dm_cback(BTA_JV_GET_SCN_EVT, (tBTA_JV *)&scn,
p_data->alloc_channel.user_data);
}
return;
}
case BTA_JV_CONN_TYPE_L2CAP:
@ -998,6 +1004,9 @@ static bool create_base_record(const uint32_t sdp_handle, const char *name, cons
APPL_TRACE_DEBUG("create_base_record: successfully created base service "
"record, handle: 0x%08x, scn: %d, name: %s, with_obex: %d",
sdp_handle, channel, name, with_obex);
UNUSED(stage);
return TRUE;
}
@ -1031,6 +1040,8 @@ static int add_spp_sdp(const char *name, const int channel) {
APPL_TRACE_DEBUG("add_spp_sdp: service registered successfully, "
"service_name: %s, handle 0x%08x)", name, handle);
UNUSED(stage);
return handle;
}
@ -1523,6 +1534,7 @@ static int bta_jv_port_data_co_cback(UINT16 port_handle, UINT8 *buf, UINT16 len,
tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(port_handle);
int ret = 0;
APPL_TRACE_DEBUG("%s, p_cb:%p, p_pcb:%p, len:%d, type:%d", __func__, p_cb, p_pcb, len, type);
UNUSED(p_cb);
if (p_pcb != NULL) {
switch (type) {
case DATA_CO_CALLBACK_TYPE_INCOMING:

View File

@ -553,6 +553,91 @@ bt_status_t btc_storage_remove_ble_dev_type(bt_bdaddr_t *remote_bd_addr, bool fl
return ret;
}
static bt_status_t _btc_storage_set_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, uint8_t auth_mode, bool flush)
{
int ret;
bdstr_t bdstr;
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr_t));
ret = btc_config_set_int(bdstr, BTC_BLE_STORAGE_LE_AUTH_MODE_STR, (int)auth_mode);
if (ret == false) {
return BT_STATUS_FAIL;
}
if (flush) {
_btc_storage_save();
}
return BT_STATUS_SUCCESS;
}
bt_status_t btc_storage_set_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, uint8_t auth_mode, bool flush)
{
bt_status_t ret;
btc_config_lock();
ret = _btc_storage_set_ble_dev_auth_mode(remote_bd_addr, auth_mode, flush);
btc_config_unlock();
return ret;
}
static bt_status_t _btc_storage_get_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, int* auth_mode)
{
bdstr_t bdstr;
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
int ret = btc_config_get_int(bdstr, BTC_BLE_STORAGE_LE_AUTH_MODE_STR, auth_mode);
return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
}
bt_status_t btc_storage_get_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, int* auth_mode)
{
bt_status_t ret;
btc_config_lock();
ret = _btc_storage_get_ble_dev_auth_mode(remote_bd_addr, auth_mode);
btc_config_unlock();
return ret;
}
static bt_status_t _btc_storage_remove_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, bool flush)
{
bool ret = true;
bdstr_t bdstr;
uint32_t auth_mode = 0;
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
ret = btc_config_get_int(bdstr, BTC_BLE_STORAGE_LE_AUTH_MODE_STR, (int *)&auth_mode);
if (ret == false) {
//cannot find the key, just return SUCCESS, indicate already removed
return BT_STATUS_SUCCESS;
}
ret = btc_config_remove(bdstr, BTC_BLE_STORAGE_LE_AUTH_MODE_STR);
if (ret == false) {
return BT_STATUS_FAIL;
}
if (flush) {
_btc_storage_save();
}
return BT_STATUS_SUCCESS;
}
bt_status_t btc_storage_remove_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, bool flush)
{
bt_status_t ret;
btc_config_lock();
ret = _btc_storage_remove_ble_dev_auth_mode(remote_bd_addr, flush);
btc_config_unlock();
return ret;
}
static bt_status_t _btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr, uint8_t addr_type, bool flush)
{
int ret;
@ -657,11 +742,17 @@ static void _btc_read_le_key(const uint8_t key_type, const size_t key_len, bt_bd
bdcpy(bta_bd_addr, bd_addr.address);
if (!*device_added) {
BTA_DmAddBleDevice(bta_bd_addr, addr_type, BT_DEVICE_TYPE_BLE);
int auth_mode = 0;
if(_btc_storage_get_ble_dev_auth_mode(&bd_addr, &auth_mode) != BT_STATUS_SUCCESS) {
BTC_TRACE_WARNING("%s Failed to get auth mode from flash, please erase flash and download the firmware again", __func__);
}
BTA_DmAddBleDevice(bta_bd_addr, addr_type, auth_mode, BT_DEVICE_TYPE_BLE);
*device_added = true;
}
#if (!CONFIG_BT_STACK_NO_LOG)
char bd_str[20] = {0};
#endif
BTC_TRACE_DEBUG("%s() Adding key type %d for %s", __func__,
key_type, bdaddr_to_string(&bd_addr, bd_str, sizeof(bd_str)));
BTA_DmAddBleKey(bta_bd_addr, (tBTA_LE_KEY_VALUE *)buffer, key_type);

View File

@ -176,6 +176,7 @@ static void btc_dm_remove_ble_bonding_keys(void)
bdcpy(bd_addr.address, pairing_cb.bd_addr);
btc_storage_remove_remote_addr_type(&bd_addr, false);
btc_storage_remove_ble_dev_auth_mode(&bd_addr, false);
btc_storage_remove_ble_dev_type(&bd_addr, false);
btc_storage_remove_ble_bonding_keys(&bd_addr);
}
@ -261,9 +262,14 @@ static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
BTC_TRACE_DEBUG ("%s, - pairing_cb.bd_addr: %08x%04x", __func__,
(pairing_cb.bd_addr[0] << 24) + (pairing_cb.bd_addr[1] << 16) + (pairing_cb.bd_addr[2] << 8) + pairing_cb.bd_addr[3],
(pairing_cb.bd_addr[4] << 8) + pairing_cb.bd_addr[5]);
// Check if need to save BLE keys
if((p_auth_cmpl->auth_mode & SMP_AUTH_GEN_BOND) == 0) {
return;
}
if (btc_storage_get_remote_addr_type(&bdaddr, &addr_type) != BT_STATUS_SUCCESS) {
btc_storage_set_remote_addr_type(&bdaddr, p_auth_cmpl->addr_type, true);
}
btc_storage_set_ble_dev_auth_mode(&bdaddr, p_auth_cmpl->auth_mode, true);
btc_dm_save_ble_bonding_keys();
} else {
/*Map the HCI fail reason to bt status */
@ -284,6 +290,9 @@ static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
}
#if (CONFIG_BT_STACK_NO_LOG)
(void) status;
#endif
BTC_TRACE_DEBUG("%s, authentication status = %x", __func__, status);
return;
@ -638,6 +647,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
//remove the bonded key in the config and nvs flash.
btc_storage_remove_ble_dev_type(&bd_addr, false);
btc_storage_remove_remote_addr_type(&bd_addr, false);
btc_storage_remove_ble_dev_auth_mode(&bd_addr, false);
param.remove_bond_dev_cmpl.status = btc_storage_remove_ble_bonding_keys(&bd_addr);
}
ble_msg.act = ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT;

View File

@ -64,14 +64,21 @@ static void btc_init_bluetooth(void)
bte_main_boot_entry(btc_init_callback);
#if (SMP_INCLUDED)
btc_config_init();
//load the ble local key whitch has been store in the flash
//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

@ -32,6 +32,7 @@
#define BTC_BLE_STORAGE_LE_KEY_LENC_STR "LE_KEY_LENC"
#define BTC_BLE_STORAGE_LE_KEY_LID_STR "LE_KEY_LID"
#define BTC_BLE_STORAGE_LE_KEY_LCSRK_STR "LE_KEY_LCSRK"
#define BTC_BLE_STORAGE_LE_AUTH_MODE_STR "AuthMode"
#define BTC_BLE_STORAGE_LOCAL_ADAPTER_STR "Adapter"
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_IR_STR "LE_LOCAL_KEY_IR"
@ -66,6 +67,12 @@ bt_status_t btc_storage_remove_ble_local_keys(void);
bt_status_t btc_storage_get_ble_local_key(uint8_t key_type, char *key_value, int key_len);
bt_status_t btc_storage_set_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, uint8_t auth_mode, bool flush);
bt_status_t btc_storage_get_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, int* auth_mode);
bt_status_t btc_storage_remove_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, bool flush);
bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr, int *addr_type);
bt_status_t btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr, uint8_t addr_type, bool flush);

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;
@ -170,6 +171,15 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
BTA_GATTS_SendRsp(p_data->req_data.conn_id, p_data->req_data.trans_id,
status, &rsp);
if(status != GATT_SUCCESS) {
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;
}
memcpy(blufi_env.prepare_buf + p_data->req_data.p_data->write_req.offset,
p_data->req_data.p_data->write_req.value,
p_data->req_data.p_data->write_req.len);
@ -194,13 +204,14 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
BTA_GATTS_SendRsp(p_data->req_data.conn_id, p_data->req_data.trans_id,
GATT_SUCCESS, NULL);
if (p_data->req_data.p_data->exec_write == GATT_PREP_WRITE_EXEC) {
if (blufi_env.prepare_buf && p_data->req_data.p_data->exec_write == GATT_PREP_WRITE_EXEC) {
btc_blufi_recv_handler(blufi_env.prepare_buf, blufi_env.prepare_len);
}
if (blufi_env.prepare_buf) {
osi_free(blufi_env.prepare_buf);
blufi_env.prepare_buf = NULL;
blufi_env.prepare_len = 0;
}
break;
@ -418,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);

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;
}
@ -179,6 +179,11 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
/* local suspend */
if (btc_av_stream_started_ready()) {
btc_dispatch_sm_event(BTC_AV_SUSPEND_STREAM_REQ_EVT, NULL, 0);
#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 {
/* we are not in started state; just ack back ok. This can happen if we are
remotely suspended; clear REMOTE SUSPEND Flag */

View File

@ -143,9 +143,21 @@ static inline void btc_a2d_data_cb_to_app(const uint8_t *data, uint32_t len)
}
}
OI_CODEC_SBC_DECODER_CONTEXT context;
OI_UINT32 contextData[CODEC_DATA_WORDS(2, SBC_CODEC_FAST_FILTER_BUFFERS)];
OI_INT16 pcmData[15 * SBC_MAX_SAMPLES_PER_FRAME * SBC_MAX_CHANNELS];
#define BTC_SBC_DEC_CONTEXT_DATA_LEN (CODEC_DATA_WORDS(2, SBC_CODEC_FAST_FILTER_BUFFERS))
#define BTC_SBC_DEC_PCM_DATA_LEN (15 * SBC_MAX_SAMPLES_PER_FRAME * SBC_MAX_CHANNELS)
#if BTC_SBC_DEC_DYNAMIC_MEMORY == FALSE
static OI_CODEC_SBC_DECODER_CONTEXT btc_sbc_decoder_context;
static OI_UINT32 btc_sbc_decoder_context_data[BTC_SBC_DEC_CONTEXT_DATA_LEN];
static OI_INT16 btc_sbc_pcm_data[BTC_SBC_DEC_PCM_DATA_LEN];
#else
static OI_CODEC_SBC_DECODER_CONTEXT *btc_sbc_decoder_context_ptr;
static OI_UINT32 *btc_sbc_decoder_context_data;
static OI_INT16 *btc_sbc_pcm_data;
#define btc_sbc_decoder_context (*btc_sbc_decoder_context_ptr)
#endif /* BTC_SBC_DEC_DYNAMIC_MEMORY == FALSE */
/*****************************************************************************
** Misc helper functions
@ -235,6 +247,16 @@ bool btc_a2dp_sink_startup(void)
APPL_TRACE_EVENT("## A2DP SINK START MEDIA THREAD ##");
#if (BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE)
btc_sbc_decoder_context_ptr = osi_calloc(sizeof(OI_CODEC_SBC_DECODER_CONTEXT));
btc_sbc_decoder_context_data = osi_calloc(BTC_SBC_DEC_CONTEXT_DATA_LEN * sizeof(OI_UINT32));
btc_sbc_pcm_data = osi_calloc(BTC_SBC_DEC_PCM_DATA_LEN * sizeof(OI_INT16));
if (!btc_sbc_decoder_context_ptr || !btc_sbc_decoder_context_data || !btc_sbc_pcm_data) {
APPL_TRACE_ERROR("failed to allocate SBC decoder");
goto error_exit;
}
#endif /* BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE */
btc_aa_snk_queue_set = xQueueCreateSet(BTC_A2DP_SINK_TASK_QUEUE_SET_LEN);
configASSERT(btc_aa_snk_queue_set);
btc_aa_snk_data_queue = xQueueCreate(BTC_A2DP_SINK_DATA_QUEUE_LEN, sizeof(int32_t));
@ -280,6 +302,21 @@ error_exit:;
vQueueDelete(btc_aa_snk_queue_set);
btc_aa_snk_queue_set = NULL;
}
#if (BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE)
if (btc_sbc_decoder_context_ptr) {
osi_free(btc_sbc_decoder_context_ptr);
btc_sbc_decoder_context_ptr = NULL;
}
if (btc_sbc_decoder_context_data) {
osi_free(btc_sbc_decoder_context_data);
btc_sbc_decoder_context_data = NULL;
}
if (btc_sbc_pcm_data) {
osi_free(btc_sbc_pcm_data);
btc_sbc_pcm_data = NULL;
}
#endif /* BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE */
return false;
}
@ -306,6 +343,17 @@ void btc_a2dp_sink_shutdown(void)
vQueueDelete(btc_aa_snk_queue_set);
btc_aa_snk_queue_set = NULL;
#if (BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE)
osi_free(btc_sbc_decoder_context_ptr);
btc_sbc_decoder_context_ptr = NULL;
osi_free(btc_sbc_decoder_context_data);
btc_sbc_decoder_context_data = NULL;
osi_free(btc_sbc_pcm_data);
btc_sbc_pcm_data = NULL;
#endif /* BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE */
}
/*****************************************************************************
@ -467,7 +515,8 @@ static void btc_a2dp_sink_handle_decoder_reset(tBTC_MEDIA_SINK_CFG_UPDATE *p_msg
btc_aa_snk_cb.rx_flush = FALSE;
APPL_TRACE_EVENT("Reset to sink role");
status = OI_CODEC_SBC_DecoderReset(&context, contextData, sizeof(contextData), 2, 2, FALSE);
status = OI_CODEC_SBC_DecoderReset(&btc_sbc_decoder_context, btc_sbc_decoder_context_data,
BTC_SBC_DEC_CONTEXT_DATA_LEN * sizeof(OI_UINT32), 2, 2, FALSE);
if (!OI_SUCCESS(status)) {
APPL_TRACE_ERROR("OI_CODEC_SBC_DecoderReset failed with error code %d\n", status);
}
@ -566,6 +615,7 @@ static void btc_a2dp_sink_handle_decoder_reset(tBTC_MEDIA_SINK_CFG_UPDATE *p_msg
int frames_to_process = ((freq_multiple) / (num_blocks * num_subbands)) + 1;
APPL_TRACE_EVENT(" Frames to be processed in 20 ms %d\n", frames_to_process);
UNUSED(frames_to_process);
}
/*******************************************************************************
@ -582,11 +632,11 @@ static void btc_a2dp_sink_handle_inc_media(tBT_SBC_HDR *p_msg)
UINT8 *sbc_start_frame = ((UINT8 *)(p_msg + 1) + p_msg->offset + 1);
int count;
UINT32 pcmBytes, availPcmBytes;
OI_INT16 *pcmDataPointer = pcmData; /*Will be overwritten on next packet receipt*/
OI_INT16 *pcmDataPointer = btc_sbc_pcm_data; /*Will be overwritten on next packet receipt*/
OI_STATUS status;
int num_sbc_frames = p_msg->num_frames_to_be_processed;
UINT32 sbc_frame_len = p_msg->len - 1;
availPcmBytes = sizeof(pcmData);
availPcmBytes = BTC_SBC_DEC_PCM_DATA_LEN * sizeof(OI_INT16);
/* XXX: Check if the below check is correct, we are checking for peer to be sink when we are sink */
if (btc_av_get_peer_sep() == AVDT_TSEP_SNK || (btc_aa_snk_cb.rx_flush)) {
@ -603,7 +653,7 @@ static void btc_a2dp_sink_handle_inc_media(tBT_SBC_HDR *p_msg)
for (count = 0; count < num_sbc_frames && sbc_frame_len != 0; count ++) {
pcmBytes = availPcmBytes;
status = OI_CODEC_SBC_DecodeFrame(&context, (const OI_BYTE **)&sbc_start_frame,
status = OI_CODEC_SBC_DecodeFrame(&btc_sbc_decoder_context, (const OI_BYTE **)&sbc_start_frame,
(OI_UINT32 *)&sbc_frame_len,
(OI_INT16 *)pcmDataPointer,
(OI_UINT32 *)&pcmBytes);
@ -617,7 +667,7 @@ static void btc_a2dp_sink_handle_inc_media(tBT_SBC_HDR *p_msg)
p_msg->len = sbc_frame_len + 1;
}
btc_a2d_data_cb_to_app((uint8_t *)pcmData, (sizeof(pcmData) - availPcmBytes));
btc_a2d_data_cb_to_app((uint8_t *)btc_sbc_pcm_data, (BTC_SBC_DEC_PCM_DATA_LEN * sizeof(OI_INT16) - availPcmBytes));
}
/*******************************************************************************
@ -778,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

@ -156,7 +156,6 @@ typedef struct {
tBTC_AV_FEEDING_MODE feeding_mode;
tBTC_AV_MEDIA_FEEDINGS_STATE media_feeding_state;
tBTC_AV_MEDIA_FEEDINGS media_feeding;
SBC_ENC_PARAMS encoder;
osi_alarm_t *media_alarm;
} tBTC_A2DP_SOURCE_CB;
@ -187,6 +186,13 @@ static QueueSetHandle_t btc_aa_src_queue_set;
static esp_a2d_source_data_cb_t btc_aa_src_data_cb = NULL;
static UINT64 last_frame_us = 0;
#if BTC_SBC_ENC_DYNAMIC_MEMORY == FALSE
static SBC_ENC_PARAMS btc_sbc_encoder;
#else
static SBC_ENC_PARAMS *btc_sbc_encoder_ptr;
#define btc_sbc_encoder (*btc_sbc_encoder_ptr)
#endif /* BTC_SBC_ENC_DYNAMIC_MEMORY == FALSE */
void btc_a2dp_src_reg_data_cb(esp_a2d_source_data_cb_t callback)
{
// todo: critical section protection
@ -310,6 +316,14 @@ bool btc_a2dp_source_startup(void)
APPL_TRACE_EVENT("## A2DP SOURCE START MEDIA THREAD ##");
#if BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE
btc_sbc_encoder_ptr = osi_calloc(sizeof(SBC_ENC_PARAMS));
if (!btc_sbc_encoder_ptr) {
APPL_TRACE_ERROR("failed to allocate SBC encoder");
goto error_exit;
}
#endif /* #if BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE */
btc_aa_src_queue_set = xQueueCreateSet(BTC_A2DP_SOURCE_TASK_QUEUE_SET_LEN);
configASSERT(btc_aa_src_queue_set);
btc_aa_src_data_queue = xQueueCreate(BTC_A2DP_SOURCE_DATA_QUEUE_LEN, sizeof(void *));
@ -355,6 +369,12 @@ error_exit:;
vQueueDelete(btc_aa_src_queue_set);
btc_aa_src_queue_set = NULL;
}
#if (BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE)
if (btc_sbc_encoder_ptr) {
osi_free(btc_sbc_encoder_ptr);
btc_sbc_encoder_ptr = NULL;
}
#endif /* #if BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE */
return false;
}
@ -381,6 +401,11 @@ void btc_a2dp_source_shutdown(void)
vQueueDelete(btc_aa_src_queue_set);
btc_aa_src_queue_set = NULL;
#if (BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE)
osi_free(btc_sbc_encoder_ptr);
btc_sbc_encoder_ptr = NULL;
#endif /* #if BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE */
}
/*****************************************************************************
@ -470,10 +495,11 @@ static UINT64 time_now_us()
static void log_tstamps_us(char *comment)
{
static UINT64 prev_us = 0;
const UINT64 now_us = time_now_us();
UINT64 now_us = time_now_us();
APPL_TRACE_DEBUG("[%s] ts %08llu, diff : %08llu, queue sz %d", comment, now_us, now_us - prev_us,
fixed_queue_length(btc_aa_src_cb.TxAaQ));
prev_us = now_us;
UNUSED(prev_us);
}
/* when true media task discards any tx frames */
@ -794,13 +820,14 @@ static void btc_a2dp_source_enc_init(BT_HDR *p_msg)
btc_aa_src_cb.timestamp = 0;
/* SBC encoder config (enforced even if not used) */
btc_aa_src_cb.encoder.s16ChannelMode = pInitAudio->ChannelMode;
btc_aa_src_cb.encoder.s16NumOfSubBands = pInitAudio->NumOfSubBands;
btc_aa_src_cb.encoder.s16NumOfBlocks = pInitAudio->NumOfBlocks;
btc_aa_src_cb.encoder.s16AllocationMethod = pInitAudio->AllocationMethod;
btc_aa_src_cb.encoder.s16SamplingFreq = pInitAudio->SamplingFreq;
btc_aa_src_cb.encoder.u16BitRate = btc_a2dp_source_get_sbc_rate();
btc_sbc_encoder.s16ChannelMode = pInitAudio->ChannelMode;
btc_sbc_encoder.s16NumOfSubBands = pInitAudio->NumOfSubBands;
btc_sbc_encoder.s16NumOfBlocks = pInitAudio->NumOfBlocks;
btc_sbc_encoder.s16AllocationMethod = pInitAudio->AllocationMethod;
btc_sbc_encoder.s16SamplingFreq = pInitAudio->SamplingFreq;
btc_sbc_encoder.u16BitRate = btc_a2dp_source_get_sbc_rate();
/* Default transcoding is PCM to SBC, modified by feeding configuration */
btc_aa_src_cb.TxTranscoding = BTC_MEDIA_TRSCD_PCM_2_SBC;
@ -811,14 +838,14 @@ static void btc_a2dp_source_enc_init(BT_HDR *p_msg)
APPL_TRACE_EVENT("btc_a2dp_source_enc_init mtu %d, peer mtu %d",
btc_aa_src_cb.TxAaMtuSize, pInitAudio->MtuSize);
APPL_TRACE_EVENT(" ch mode %d, subnd %d, nb blk %d, alloc %d, rate %d, freq %d",
btc_aa_src_cb.encoder.s16ChannelMode, btc_aa_src_cb.encoder.s16NumOfSubBands,
btc_aa_src_cb.encoder.s16NumOfBlocks,
btc_aa_src_cb.encoder.s16AllocationMethod, btc_aa_src_cb.encoder.u16BitRate,
btc_aa_src_cb.encoder.s16SamplingFreq);
btc_sbc_encoder.s16ChannelMode, btc_sbc_encoder.s16NumOfSubBands,
btc_sbc_encoder.s16NumOfBlocks,
btc_sbc_encoder.s16AllocationMethod, btc_sbc_encoder.u16BitRate,
btc_sbc_encoder.s16SamplingFreq);
/* Reset entirely the SBC encoder */
SBC_Encoder_Init(&(btc_aa_src_cb.encoder));
APPL_TRACE_DEBUG("btc_a2dp_source_enc_init bit pool %d", btc_aa_src_cb.encoder.s16BitPool);
SBC_Encoder_Init(&(btc_sbc_encoder));
APPL_TRACE_DEBUG("btc_a2dp_source_enc_init bit pool %d", btc_sbc_encoder.s16BitPool);
}
@ -835,7 +862,7 @@ static void btc_a2dp_source_enc_init(BT_HDR *p_msg)
static void btc_a2dp_source_enc_update(BT_HDR *p_msg)
{
tBTC_MEDIA_UPDATE_AUDIO *pUpdateAudio = (tBTC_MEDIA_UPDATE_AUDIO *) p_msg;
SBC_ENC_PARAMS *pstrEncParams = &btc_aa_src_cb.encoder;
SBC_ENC_PARAMS *pstrEncParams = &btc_sbc_encoder;
UINT16 s16SamplingFreq;
SINT16 s16BitPool = 0;
SINT16 s16BitRate;
@ -928,19 +955,19 @@ static void btc_a2dp_source_enc_update(BT_HDR *p_msg)
if (s16BitPool > pUpdateAudio->MaxBitPool) {
APPL_TRACE_DEBUG("%s computed bitpool too large (%d)", __FUNCTION__, s16BitPool);
/* Decrease bitrate */
btc_aa_src_cb.encoder.u16BitRate -= BTC_MEDIA_BITRATE_STEP;
btc_sbc_encoder.u16BitRate -= BTC_MEDIA_BITRATE_STEP;
/* Record that we have decreased the bitrate */
protect |= 1;
} else if (s16BitPool < pUpdateAudio->MinBitPool) {
APPL_TRACE_WARNING("%s computed bitpool too small (%d)", __FUNCTION__, s16BitPool);
/* Increase bitrate */
UINT16 previous_u16BitRate = btc_aa_src_cb.encoder.u16BitRate;
btc_aa_src_cb.encoder.u16BitRate += BTC_MEDIA_BITRATE_STEP;
UINT16 previous_u16BitRate = btc_sbc_encoder.u16BitRate;
btc_sbc_encoder.u16BitRate += BTC_MEDIA_BITRATE_STEP;
/* Record that we have increased the bitrate */
protect |= 2;
/* Check over-flow */
if (btc_aa_src_cb.encoder.u16BitRate < previous_u16BitRate) {
if (btc_sbc_encoder.u16BitRate < previous_u16BitRate) {
protect |= 3;
}
} else {
@ -957,10 +984,10 @@ static void btc_a2dp_source_enc_update(BT_HDR *p_msg)
pstrEncParams->s16BitPool = s16BitPool;
APPL_TRACE_DEBUG("%s final bit rate %d, final bit pool %d", __FUNCTION__,
btc_aa_src_cb.encoder.u16BitRate, btc_aa_src_cb.encoder.s16BitPool);
btc_sbc_encoder.u16BitRate, btc_sbc_encoder.s16BitPool);
/* make sure we reinitialize encoder with new settings */
SBC_Encoder_Init(&(btc_aa_src_cb.encoder));
SBC_Encoder_Init(&(btc_sbc_encoder));
}
}
@ -991,10 +1018,10 @@ static void btc_a2dp_source_pcm2sbc_init(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_feedin
case 32000:
case 48000:
/* For these sampling_freq the AV connection must be 48000 */
if (btc_aa_src_cb.encoder.s16SamplingFreq != SBC_sf48000) {
if (btc_sbc_encoder.s16SamplingFreq != SBC_sf48000) {
/* Reconfiguration needed at 48000 */
APPL_TRACE_DEBUG("SBC Reconfiguration needed at 48000");
btc_aa_src_cb.encoder.s16SamplingFreq = SBC_sf48000;
btc_sbc_encoder.s16SamplingFreq = SBC_sf48000;
reconfig_needed = TRUE;
}
break;
@ -1003,10 +1030,10 @@ static void btc_a2dp_source_pcm2sbc_init(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_feedin
case 22050:
case 44100:
/* For these sampling_freq the AV connection must be 44100 */
if (btc_aa_src_cb.encoder.s16SamplingFreq != SBC_sf44100) {
if (btc_sbc_encoder.s16SamplingFreq != SBC_sf44100) {
/* Reconfiguration needed at 44100 */
APPL_TRACE_DEBUG("SBC Reconfiguration needed at 44100");
btc_aa_src_cb.encoder.s16SamplingFreq = SBC_sf44100;
btc_sbc_encoder.s16SamplingFreq = SBC_sf44100;
reconfig_needed = TRUE;
}
break;
@ -1016,21 +1043,21 @@ static void btc_a2dp_source_pcm2sbc_init(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_feedin
}
/* Some AV Headsets do not support Mono => always ask for Stereo */
if (btc_aa_src_cb.encoder.s16ChannelMode == SBC_MONO) {
if (btc_sbc_encoder.s16ChannelMode == SBC_MONO) {
APPL_TRACE_DEBUG("SBC Reconfiguration needed in Stereo");
btc_aa_src_cb.encoder.s16ChannelMode = SBC_JOINT_STEREO;
btc_sbc_encoder.s16ChannelMode = SBC_JOINT_STEREO;
reconfig_needed = TRUE;
}
if (reconfig_needed != FALSE) {
APPL_TRACE_DEBUG("%s :: mtu %d", __FUNCTION__, btc_aa_src_cb.TxAaMtuSize);
APPL_TRACE_DEBUG("ch mode %d, nbsubd %d, nb %d, alloc %d, rate %d, freq %d",
btc_aa_src_cb.encoder.s16ChannelMode,
btc_aa_src_cb.encoder.s16NumOfSubBands, btc_aa_src_cb.encoder.s16NumOfBlocks,
btc_aa_src_cb.encoder.s16AllocationMethod, btc_aa_src_cb.encoder.u16BitRate,
btc_aa_src_cb.encoder.s16SamplingFreq);
btc_sbc_encoder.s16ChannelMode,
btc_sbc_encoder.s16NumOfSubBands, btc_sbc_encoder.s16NumOfBlocks,
btc_sbc_encoder.s16AllocationMethod, btc_sbc_encoder.u16BitRate,
btc_sbc_encoder.s16SamplingFreq);
SBC_Encoder_Init(&(btc_aa_src_cb.encoder));
SBC_Encoder_Init(&(btc_sbc_encoder));
} else {
APPL_TRACE_DEBUG("%s no SBC reconfig needed", __FUNCTION__);
}
@ -1105,8 +1132,8 @@ static UINT8 btc_get_num_aa_frame(void)
switch (btc_aa_src_cb.TxTranscoding) {
case BTC_MEDIA_TRSCD_PCM_2_SBC: {
UINT32 pcm_bytes_per_frame = btc_aa_src_cb.encoder.s16NumOfSubBands *
btc_aa_src_cb.encoder.s16NumOfBlocks *
UINT32 pcm_bytes_per_frame = btc_sbc_encoder.s16NumOfSubBands *
btc_sbc_encoder.s16NumOfBlocks *
btc_aa_src_cb.media_feeding.cfg.pcm.num_channel *
btc_aa_src_cb.media_feeding.cfg.pcm.bit_per_sample / 8;
@ -1129,10 +1156,16 @@ static UINT8 btc_get_num_aa_frame(void)
/* calculate nbr of frames pending for this media tick */
result = btc_aa_src_cb.media_feeding_state.pcm.counter / pcm_bytes_per_frame;
if (result > MAX_PCM_FRAME_NUM_PER_TICK) {
APPL_TRACE_WARNING("%s() - Limiting frames to be sent from %d to %d"
, __FUNCTION__, result, MAX_PCM_FRAME_NUM_PER_TICK);
result = MAX_PCM_FRAME_NUM_PER_TICK;
/* limit the frames to be sent */
UINT32 frm_nb_threshold = MAX_OUTPUT_A2DP_SRC_FRAME_QUEUE_SZ - fixed_queue_length(btc_aa_src_cb.TxAaQ);
if (frm_nb_threshold > MAX_PCM_FRAME_NUM_PER_TICK) {
frm_nb_threshold = MAX_PCM_FRAME_NUM_PER_TICK;
}
if (result > frm_nb_threshold) {
APPL_TRACE_EVENT("Limit frms to send from %d to %d", result, frm_nb_threshold);
result = frm_nb_threshold;
}
btc_aa_src_cb.media_feeding_state.pcm.counter -= result * pcm_bytes_per_frame;
@ -1162,12 +1195,12 @@ static UINT8 btc_get_num_aa_frame(void)
BOOLEAN btc_media_aa_read_feeding(void)
{
UINT16 blocm_x_subband = btc_aa_src_cb.encoder.s16NumOfSubBands * \
btc_aa_src_cb.encoder.s16NumOfBlocks;
UINT16 blocm_x_subband = btc_sbc_encoder.s16NumOfSubBands * \
btc_sbc_encoder.s16NumOfBlocks;
UINT32 read_size;
UINT16 sbc_sampling = 48000;
UINT32 src_samples;
UINT16 bytes_needed = blocm_x_subband * btc_aa_src_cb.encoder.s16NumOfChannels * \
UINT16 bytes_needed = blocm_x_subband * btc_sbc_encoder.s16NumOfChannels * \
btc_aa_src_cb.media_feeding.cfg.pcm.bit_per_sample / 8;
static UINT16 up_sampled_buffer[SBC_MAX_NUM_FRAME * SBC_MAX_NUM_OF_BLOCKS
* SBC_MAX_NUM_OF_CHANNELS * SBC_MAX_NUM_OF_SUBBANDS * 2];
@ -1181,7 +1214,7 @@ BOOLEAN btc_media_aa_read_feeding(void)
UINT32 nb_byte_read = 0;
/* Get the SBC sampling rate */
switch (btc_aa_src_cb.encoder.s16SamplingFreq) {
switch (btc_sbc_encoder.s16SamplingFreq) {
case SBC_sf48000:
sbc_sampling = 48000;
break;
@ -1199,7 +1232,7 @@ BOOLEAN btc_media_aa_read_feeding(void)
if (sbc_sampling == btc_aa_src_cb.media_feeding.cfg.pcm.sampling_freq) {
read_size = bytes_needed - btc_aa_src_cb.media_feeding_state.pcm.aa_feed_residue;
nb_byte_read = btc_aa_src_data_read(
((uint8_t *)btc_aa_src_cb.encoder.as16PcmBuffer) +
((uint8_t *)btc_sbc_encoder.as16PcmBuffer) +
btc_aa_src_cb.media_feeding_state.pcm.aa_feed_residue,
read_size);
if (nb_byte_read == read_size) {
@ -1293,7 +1326,7 @@ BOOLEAN btc_media_aa_read_feeding(void)
/* only copy the pcm sample when we have up-sampled enough PCM */
if (btc_aa_src_cb.media_feeding_state.pcm.aa_feed_residue >= bytes_needed) {
/* Copy the output pcm samples in SBC encoding buffer */
memcpy((UINT8 *)btc_aa_src_cb.encoder.as16PcmBuffer,
memcpy((UINT8 *)btc_sbc_encoder.as16PcmBuffer,
(UINT8 *)up_sampled_buffer,
bytes_needed);
/* update the residue */
@ -1322,8 +1355,8 @@ BOOLEAN btc_media_aa_read_feeding(void)
static void btc_media_aa_prep_sbc_2_send(UINT8 nb_frame)
{
BT_HDR *p_buf;
UINT16 blocm_x_subband = btc_aa_src_cb.encoder.s16NumOfSubBands *
btc_aa_src_cb.encoder.s16NumOfBlocks;
UINT16 blocm_x_subband = btc_sbc_encoder.s16NumOfSubBands *
btc_sbc_encoder.s16NumOfBlocks;
while (nb_frame) {
if (NULL == (p_buf = osi_malloc(BTC_MEDIA_AA_BUF_SIZE))) {
@ -1339,27 +1372,27 @@ static void btc_media_aa_prep_sbc_2_send(UINT8 nb_frame)
do {
/* Write @ of allocated buffer in encoder.pu8Packet */
btc_aa_src_cb.encoder.pu8Packet = (UINT8 *) (p_buf + 1) + p_buf->offset + p_buf->len;
btc_sbc_encoder.pu8Packet = (UINT8 *) (p_buf + 1) + p_buf->offset + p_buf->len;
/* Fill allocated buffer with 0 */
memset(btc_aa_src_cb.encoder.as16PcmBuffer, 0, blocm_x_subband
* btc_aa_src_cb.encoder.s16NumOfChannels);
memset(btc_sbc_encoder.as16PcmBuffer, 0, blocm_x_subband
* btc_sbc_encoder.s16NumOfChannels);
/* Read PCM data and upsample them if needed */
if (btc_media_aa_read_feeding()) {
/* SBC encode and descramble frame */
SBC_Encoder(&(btc_aa_src_cb.encoder));
A2D_SbcChkFrInit(btc_aa_src_cb.encoder.pu8Packet);
A2D_SbcDescramble(btc_aa_src_cb.encoder.pu8Packet, btc_aa_src_cb.encoder.u16PacketLength);
SBC_Encoder(&(btc_sbc_encoder));
A2D_SbcChkFrInit(btc_sbc_encoder.pu8Packet);
A2D_SbcDescramble(btc_sbc_encoder.pu8Packet, btc_sbc_encoder.u16PacketLength);
/* Update SBC frame length */
p_buf->len += btc_aa_src_cb.encoder.u16PacketLength;
p_buf->len += btc_sbc_encoder.u16PacketLength;
nb_frame--;
p_buf->layer_specific++;
} else {
APPL_TRACE_WARNING("btc_media_aa_prep_sbc_2_send underflow %d, %d",
nb_frame, btc_aa_src_cb.media_feeding_state.pcm.aa_feed_residue);
btc_aa_src_cb.media_feeding_state.pcm.counter += nb_frame *
btc_aa_src_cb.encoder.s16NumOfSubBands *
btc_aa_src_cb.encoder.s16NumOfBlocks *
btc_sbc_encoder.s16NumOfSubBands *
btc_sbc_encoder.s16NumOfBlocks *
btc_aa_src_cb.media_feeding.cfg.pcm.num_channel *
btc_aa_src_cb.media_feeding.cfg.pcm.bit_per_sample / 8;
/* no more pcm to read */
@ -1372,7 +1405,7 @@ static void btc_media_aa_prep_sbc_2_send(UINT8 nb_frame)
}
}
} while (((p_buf->len + btc_aa_src_cb.encoder.u16PacketLength) < btc_aa_src_cb.TxAaMtuSize)
} while (((p_buf->len + btc_sbc_encoder.u16PacketLength) < btc_aa_src_cb.TxAaMtuSize)
&& (p_buf->layer_specific < 0x0F) && nb_frame);
if (p_buf->len) {
@ -1631,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

@ -1199,10 +1199,13 @@ static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
BTC_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d\n", a2d_status);
}
}
UNUSED(que_len);
}
#else
static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
{
UNUSED(event);
UNUSED(p_data);
BTC_TRACE_WARNING("%s : event %u\n", __func__, event);
}
#endif

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;
}
}
@ -335,6 +335,8 @@ static void handle_rc_passthrough_rsp ( tBTA_AV_REMOTE_RSP *p_remote_rsp)
} else {
BTC_TRACE_ERROR("%s DUT does not support AVRCP controller role", __FUNCTION__);
}
UNUSED(status);
#else
BTC_TRACE_ERROR("%s AVRCP controller role is not enabled", __FUNCTION__);
#endif

View File

@ -426,6 +426,35 @@ static void btc_stop_adv_callback(uint8_t status)
}
}
void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT;
param.update_duplicate_exceptional_list_cmpl.status = status;
param.update_duplicate_exceptional_list_cmpl.subcode = subcode;
if(length > sizeof(param.update_duplicate_exceptional_list_cmpl.device_info)) {
length = sizeof(param.update_duplicate_exceptional_list_cmpl.device_info);
}
param.update_duplicate_exceptional_list_cmpl.length = length;
memcpy(param.update_duplicate_exceptional_list_cmpl.device_info, device_info, length);
ret = btc_transfer_context(&msg, &param, sizeof(esp_ble_gap_cb_param_t), NULL);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
static void btc_ble_update_duplicate_exceptional_list(uint8_t subcode, uint32_t info_type, BD_ADDR device_info,
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_ignore_list_cback)
{
BTA_DmUpdateDuplicateExceptionalList(subcode, info_type, device_info, p_update_duplicate_ignore_list_cback);
}
static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBTA_START_ADV_CMPL_CBACK start_adv_cback)
{
tBLE_BD_ADDR peer_addr;
@ -452,6 +481,10 @@ static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBT
status = ESP_BT_STATUS_PARM_INVALID;
BTC_TRACE_ERROR("Invalid advertisting channel map parameters.\n");
}
if (!BLE_ISVALID_PARAM(ble_adv_params->peer_addr_type, BLE_ADDR_TYPE_PUBLIC, BLE_ADDR_TYPE_RANDOM)) {
status = ESP_BT_STATUS_PARM_INVALID;
BTC_TRACE_ERROR("Invalid advertisting peer address type parameters.\n");
}
if(status != ESP_BT_STATUS_SUCCESS) {
if(start_adv_cback) {
start_adv_cback(status);
@ -571,6 +604,9 @@ static void btc_search_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data
case BTA_DM_SEARCH_CANCEL_CMPL_EVT:
BTC_TRACE_DEBUG("BTA_DM_SEARCH_CANCEL_CMPL_EVT\n");
break;
case BTA_DM_INQ_DISCARD_NUM_EVT:
param.scan_rst.num_dis = p_data->inq_dis.num_dis;
break;
default:
BTC_TRACE_ERROR("%s : Unknown event 0x%x\n", __FUNCTION__, event);
return;
@ -831,7 +867,7 @@ static void btc_ble_set_rand_addr (BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *
BTA_DmSetRandAddress(rand_addr, btc_set_rand_addr_callback);
} else {
btc_set_rand_addr_callback(BTM_INVALID_STATIC_RAND_ADDR);
BTC_TRACE_ERROR("Invalid random address, the high bit should be 0b11, all bits of the random part shall not be to 1 or 0");
BTC_TRACE_ERROR("Invalid random address, the high bit should be 0b11, bits of the random part shall not be all 1 or 0");
}
} else {
btc_set_rand_addr_callback(BTM_INVALID_STATIC_RAND_ADDR);
@ -1082,6 +1118,12 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
arg->cfg_scan_rsp_data_raw.raw_scan_rsp_len,
btc_scan_rsp_data_raw_callback);
break;
case BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST:
btc_ble_update_duplicate_exceptional_list(arg->update_duplicate_exceptional_list.subcode,
arg->update_duplicate_exceptional_list.info_type,
arg->update_duplicate_exceptional_list.device_info,
btc_update_duplicate_exceptional_list_callback);
break;
#if (SMP_INCLUDED == TRUE)
case BTC_GAP_BLE_SET_ENCRYPTION_EVT: {
BD_ADDR bd_addr;
@ -1125,6 +1167,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

@ -750,7 +750,7 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
break;
#endif ///BT_SSP_INCLUDED == TRUE
default:
BTC_TRACE_ERROR("Unhandled deep copy %d\n", msg->act);
BTC_TRACE_ERROR("Unhandled deep copy %d, arg: %p\n", msg->act, arg);
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

@ -364,7 +364,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;
@ -424,7 +430,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;
@ -690,10 +696,13 @@ void btc_gatts_call_handler(btc_msg_t *msg)
#else
//BTA_DmAddBleDevice(p_cb->bd_addr.address, addr_type, device_type);
#endif
/*
not support background connection
// Mark background connections
if (!arg->open.is_direct) {
BTA_DmBleSetBgConnType(BTM_BLE_CONN_AUTO, NULL);
}
*/
transport = BTA_GATT_TRANSPORT_LE;
@ -933,4 +942,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

@ -195,8 +195,9 @@ bt_status_t btc_hf_client_init(void)
*******************************************************************************/
static bt_status_t connect_int( bt_bdaddr_t *bd_addr, uint16_t uuid )
{
if (is_connected(bd_addr))
if (is_connected(bd_addr)) {
return BT_STATUS_BUSY;
}
btc_hf_client_cb.state = ESP_HF_CLIENT_CONNECTION_STATE_CONNECTING;
bdcpy(btc_hf_client_cb.connected_bda.address, bd_addr->address);
@ -713,14 +714,14 @@ static void process_ind_evt(tBTA_HF_CLIENT_IND *ind)
{
esp_hf_client_cb_param_t param;
memset(&param, 0, sizeof(esp_hf_client_cb_param_t));
switch (ind->type)
{
case BTA_HF_CLIENT_IND_CALL:
param.call.status = ind->value;
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CIND_CALL_EVT, &param);
break;
case BTA_HF_CLIENT_IND_CALLSETUP:
param.call_setup.status = ind->value;
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CIND_CALL_SETUP_EVT, &param);
@ -787,6 +788,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
{
BTC_TRACE_WARNING("%s: HF CLient open failed, but another device connected. status=%d state=%d connected device=%s",
__FUNCTION__, p_data->open.status, btc_hf_client_cb.state, bdaddr_to_string(&btc_hf_client_cb.connected_bda, bdstr, sizeof(bdstr)));
UNUSED(bdstr);
break;
}
@ -795,18 +797,20 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
param.conn_stat.state = btc_hf_client_cb.state;
param.conn_stat.peer_feat = 0;
param.conn_stat.chld_feat = 0;
memcpy(param.conn_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CONNECTION_STATE_EVT, &param);
} while (0);
if (btc_hf_client_cb.state == ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED)
bdsetany(btc_hf_client_cb.connected_bda.address);
if (p_data->open.status != BTA_HF_CLIENT_SUCCESS)
if (btc_hf_client_cb.state == ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED) {
bdsetany(btc_hf_client_cb.connected_bda.address);
}
if (p_data->open.status != BTA_HF_CLIENT_SUCCESS) {
btc_queue_advance();
}
break;
@ -820,13 +824,13 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
param.conn_stat.state = btc_hf_client_cb.state;
param.conn_stat.peer_feat = btc_hf_client_cb.peer_feat;
param.conn_stat.chld_feat = btc_hf_client_cb.chld_feat;
memcpy(param.conn_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CONNECTION_STATE_EVT, &param);
} while (0);
/* Inform the application about in-band ringtone */
if (btc_hf_client_cb.peer_feat & BTA_HF_CLIENT_PEER_INBAND)
{
@ -839,7 +843,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
btc_queue_advance();
break;
case BTA_HF_CLIENT_CLOSE_EVT:
btc_hf_client_cb.state = ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED;
do {
@ -847,7 +851,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
param.conn_stat.state = ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED;
param.conn_stat.peer_feat = 0;
param.conn_stat.chld_feat = 0;
memcpy(param.conn_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
@ -980,7 +984,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
memset(&param, 0, sizeof(esp_hf_client_cb_param_t));
param.audio_stat.state = ESP_HF_CLIENT_AUDIO_STATE_CONNECTED;
memcpy(param.audio_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
sizeof(esp_bd_addr_t));
btc_hf_client_cb_to_app(ESP_HF_CLIENT_AUDIO_STATE_EVT, &param);
} while (0);
break;
@ -989,7 +993,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
memset(&param, 0, sizeof(esp_hf_client_cb_param_t));
param.audio_stat.state = ESP_HF_CLIENT_AUDIO_STATE_CONNECTED_MSBC;
memcpy(param.audio_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
sizeof(esp_bd_addr_t));
btc_hf_client_cb_to_app(ESP_HF_CLIENT_AUDIO_STATE_EVT, &param);
} while (0);
break;

View File

@ -46,6 +46,7 @@ typedef enum {
BTC_GAP_BLE_CONFIRM_REPLY_EVT,
BTC_GAP_BLE_DISCONNECT_EVT,
BTC_GAP_BLE_REMOVE_BOND_DEV_EVT,
BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST,
} btc_gap_ble_act_t;
/* btc_ble_gap_args_t */
@ -94,6 +95,12 @@ typedef union {
bool add_remove;
esp_bd_addr_t remote_bda;
}update_white_list;
//BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST
struct update_duplicate_exceptional_list_args {
uint8_t subcode;
uint32_t info_type;
esp_duplicate_info_t device_info;
}update_duplicate_exceptional_list;
//BTC_GAP_BLE_ACT_SET_CONN_PARAMS
struct set_conn_params_args {
esp_bd_addr_t bd_addr;

View File

@ -315,6 +315,7 @@ static void btc_spp_init(btc_spp_args_t *arg)
{
if (osi_mutex_new(&spp_local_param.spp_slot_mutex) != 0) {
BTC_TRACE_ERROR("%s osi_mutex_new failed\n", __func__);
return;
}
spp_local_param.spp_mode = arg->init.mode;
spp_local_param.spp_slot_id = 0;
@ -323,6 +324,10 @@ static void btc_spp_init(btc_spp_args_t *arg)
static void btc_spp_uninit(void)
{
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);
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) {

View File

@ -95,6 +95,10 @@
#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 */
@ -130,11 +134,45 @@
#define BLE_PRIVACY_SPT FALSE
#endif /* CONFIG_SMP_ENABLE */
#ifdef CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE
#if(CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE)
#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE TRUE
#else
#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE FALSE
#endif
#else
#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE FALSE
#endif
#ifndef CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
#define BLE_ADV_REPORT_FLOW_CONTROL FALSE
#else
#define BLE_ADV_REPORT_FLOW_CONTROL CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
#endif /* CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED */
#ifndef CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM
#define BLE_ADV_REPORT_FLOW_CONTROL_NUM 100
#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
#define BLE_ADV_REPORT_DISCARD_THRSHOLD CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD
#endif /* CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD */
#if (CONFIG_BT_ACL_CONNECTIONS)
#define MAX_ACL_CONNECTIONS CONFIG_BT_ACL_CONNECTIONS
#define GATT_MAX_PHY_CHANNEL CONFIG_BT_ACL_CONNECTIONS
#endif /* CONFIG_BT_ACL_CONNECTIONS */
#if(CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT)
#define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT
#else
#define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT 30
#endif
//------------------Added from bdroid_buildcfg.h---------------------
#ifndef L2CAP_EXTFEA_SUPPORTED_MASK
#define L2CAP_EXTFEA_SUPPORTED_MASK (L2CAP_EXTFEA_ENH_RETRANS | L2CAP_EXTFEA_STREAM_MODE | L2CAP_EXTFEA_NO_CRC | L2CAP_EXTFEA_FIXED_CHNLS)
@ -324,6 +362,12 @@
#define GATTS_SEND_SERVICE_CHANGE_MODE CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE
#endif
#ifndef CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY
#define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY FALSE
#else
#define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY
#endif
/* This feature is used to eanble interleaved scan*/
#ifndef BTA_HOST_INTERLEAVE_SEARCH
#define BTA_HOST_INTERLEAVE_SEARCH FALSE//FALSE

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;
#endif
@ -47,4 +48,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

@ -100,7 +100,11 @@ static void start_up(void)
response = AWAIT_COMMAND(packet_factory->make_set_c2h_flow_control(HCI_HOST_FLOW_CTRL_ACL_ON));
packet_parser->parse_generic_command_complete(response);
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
// Enable adv flow control
response = AWAIT_COMMAND(packet_factory->make_set_adv_report_flow_control(HCI_HOST_FLOW_CTRL_ADV_REPORT_ON, (uint16_t)BLE_ADV_REPORT_FLOW_CONTROL_NUM, (uint16_t)BLE_ADV_REPORT_DISCARD_THRSHOLD));
packet_parser->parse_generic_command_complete(response);
#endif
// Tell the controller about our buffer sizes and buffer counts next
// TODO(zachoverflow): factor this out. eww l2cap contamination. And why just a hardcoded 10?
response = AWAIT_COMMAND(
@ -250,10 +254,10 @@ static void start_up(void)
}
#endif
if (simple_pairing_supported) {
response = AWAIT_COMMAND(packet_factory->make_set_event_mask(&CLASSIC_EVENT_MASK));
packet_parser->parse_generic_command_complete(response);
}
response = AWAIT_COMMAND(packet_factory->make_set_event_mask(&CLASSIC_EVENT_MASK));
packet_parser->parse_generic_command_complete(response);
#if (BTM_SCO_HCI_INCLUDED == TRUE)
response = AWAIT_COMMAND(packet_factory->make_write_sync_flow_control_enable(1));

View File

@ -27,6 +27,7 @@
#define CASE_RETURN_STR(const) case const: return #const;
#if (SMP_INCLUDED == TRUE)
#if (!CONFIG_BT_STACK_NO_LOG)
static const char *interop_feature_string(const interop_feature_t feature)
{
switch (feature) {
@ -36,7 +37,7 @@ static const char *interop_feature_string(const interop_feature_t feature)
return "UNKNOWN";
}
#endif // (!CONFIG_BT_STACK_NO_LOG)
// Interface functions
bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr)
{
@ -47,7 +48,9 @@ bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr)
for (size_t i = 0; i != db_size; ++i) {
if (feature == interop_database[i].feature &&
memcmp(addr, &interop_database[i].addr, interop_database[i].len) == 0) {
#if (!CONFIG_BT_STACK_NO_LOG)
char bdstr[20] = {0};
#endif
LOG_WARN("%s() Device %s is a match for interop workaround %s", __func__,
bdaddr_to_string(addr, bdstr, sizeof(bdstr)), interop_feature_string(feature));
return true;

View File

@ -145,9 +145,10 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
if (*(ps16GenBufPtr) < s32BitSlice + 2) {
*(ps16GenArrPtr) = 0;
} else
} else {
*(ps16GenArrPtr) = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
}
ps16GenBufPtr++;
ps16GenArrPtr++;

View File

@ -132,9 +132,10 @@ void sbc_enc_bit_alloc_ste(SBC_ENC_PARAMS *pstrCodecParams)
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
if (*ps16GenBufPtr < s32BitSlice + 2) {
*ps16GenArrPtr = 0;
} else
} else {
*ps16GenArrPtr = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
}
ps16GenBufPtr++;
ps16GenArrPtr++;
}

View File

@ -55,6 +55,7 @@ static const uint16_t outbound_event_types[] = {
typedef struct {
size_t buffer_size;
fixed_queue_t *rx_q;
uint16_t adv_free_num;
} hci_hal_env_t;
@ -81,6 +82,7 @@ static void hci_hal_env_init(
assert(max_buffer_count > 0);
hci_hal_env.buffer_size = buffer_size;
hci_hal_env.adv_free_num = 0;
hci_hal_env.rx_q = fixed_queue_new(max_buffer_count);
if (hci_hal_env.rx_q) {
@ -102,8 +104,11 @@ static bool hal_open(const hci_hal_callbacks_t *upper_callbacks)
{
assert(upper_callbacks != NULL);
callbacks = upper_callbacks;
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_hal_env_init(HCI_HAL_SERIAL_BUFFER_SIZE, BLE_ADV_REPORT_FLOW_CONTROL_NUM + L2CAP_HOST_FC_ACL_BUFS + QUEUE_SIZE_MAX); // adv flow control num + ACL flow control num + hci cmd numeber
#else
hci_hal_env_init(HCI_HAL_SERIAL_BUFFER_SIZE, QUEUE_SIZE_MAX);
#endif
xHciH4Queue = xQueueCreate(HCI_H4_QUEUE_LEN, sizeof(BtTaskEvt_t));
xTaskCreatePinnedToCore(hci_hal_h4_rx_handler, HCI_H4_TASK_NAME, HCI_H4_TASK_STACK_SIZE, NULL, HCI_H4_TASK_PRIO, &xHciH4TaskHandle, HCI_H4_TASK_PINNED_TO_CORE);
@ -184,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)
@ -223,12 +228,37 @@ static void hci_packet_complete(BT_HDR *packet){
bool host_recv_adv_packet(BT_HDR *packet)
{
assert(packet);
if(packet->data[0] == DATA_TYPE_EVENT && packet->data[1] == HCI_BLE_EVENT && packet->data[3] == HCI_BLE_ADV_PKT_RPT_EVT) {
return true;
if(packet->data[0] == DATA_TYPE_EVENT && packet->data[1] == HCI_BLE_EVENT) {
if(packet->data[3] == HCI_BLE_ADV_PKT_RPT_EVT
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|| packet->data[3] == HCI_BLE_ADV_DISCARD_REPORT_EVT
#endif
) {
return true;
}
}
return false;
}
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
static void hci_update_adv_report_flow_control(BT_HDR *packet)
{
// this is adv packet
if(host_recv_adv_packet(packet)) {
// update adv free number
hci_hal_env.adv_free_num ++;
if (esp_vhci_host_check_send_available()){
// send hci cmd
btsnd_hcic_ble_update_adv_report_flow_control(hci_hal_env.adv_free_num);
hci_hal_env.adv_free_num = 0;
} else {
//do nothing
}
}
}
#endif
static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
{
uint8_t type, hdr_size;
@ -247,8 +277,10 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
packet->offset++;
packet->len--;
if (type == HCI_BLE_EVENT) {
#if (!CONFIG_BT_STACK_NO_LOG)
uint8_t len = 0;
STREAM_TO_UINT8(len, stream);
#endif
HCI_TRACE_ERROR("Workround stream corrupted during LE SCAN: pkt_len=%d ble_event_len=%d\n",
packet->len, len);
osi_free(packet);
@ -282,6 +314,11 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
osi_free(packet);
return;
}
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_update_adv_report_flow_control(packet);
#endif
#if SCAN_QUEUE_CONGEST_CHECK
if(BTU_check_queue_is_congest() && host_recv_adv_packet(packet)) {
HCI_TRACE_ERROR("BtuQueue is congested");
@ -289,7 +326,6 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
return;
}
#endif
packet->event = outbound_event_types[PACKET_TYPE_TO_INDEX(type)];
callbacks->packet_ready(packet);
}

View File

@ -317,7 +317,11 @@ static void event_command_ready(fixed_queue_t *queue)
wait_entry = fixed_queue_dequeue(queue);
if(wait_entry->opcode == HCI_HOST_NUM_PACKETS_DONE){
if(wait_entry->opcode == HCI_HOST_NUM_PACKETS_DONE
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|| wait_entry->opcode == HCI_VENDOR_BLE_ADV_REPORT_FLOW_CONTROL
#endif
){
packet_fragmenter->fragment_and_dispatch(wait_entry->command);
osi_free(wait_entry->command);
osi_free(wait_entry);

View File

@ -53,6 +53,18 @@ static BT_HDR *make_set_c2h_flow_control(uint8_t enable)
return packet;
}
static BT_HDR *make_set_adv_report_flow_control(uint8_t enable, uint16_t num, uint16_t lost_threshold)
{
uint8_t *stream;
const uint8_t parameter_size = 1 + 2 + 2;
BT_HDR *packet = make_command(HCI_VENDOR_BLE_SET_ADV_FLOW_CONTROL, parameter_size, &stream);
UINT8_TO_STREAM(stream, enable);
UINT16_TO_STREAM(stream, num);
UINT16_TO_STREAM(stream, lost_threshold);
return packet;
}
static BT_HDR *make_host_buffer_size(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count)
{
uint8_t *stream;
@ -239,6 +251,7 @@ static const hci_packet_factory_t interface = {
make_reset,
make_read_buffer_size,
make_set_c2h_flow_control,
make_set_adv_report_flow_control,
make_host_buffer_size,
make_read_local_version_info,
make_read_bd_addr,

View File

@ -26,6 +26,7 @@ typedef struct {
BT_HDR *(*make_reset)(void);
BT_HDR *(*make_read_buffer_size)(void);
BT_HDR *(*make_set_c2h_flow_control)(uint8_t enable);
BT_HDR *(*make_set_adv_report_flow_control)(uint8_t enable, uint16_t num, uint16_t lost_threshold);
BT_HDR *(*make_host_buffer_size)(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count);
BT_HDR *(*make_read_local_version_info)(void);
BT_HDR *(*make_read_bd_addr)(void);

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
}

View File

@ -389,7 +389,7 @@ bool config_save(const config_t *config, const char *filename)
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
char *keyname = osi_calloc(keyname_bufsz);
int config_size = get_config_size(config);
char *buf = osi_calloc(config_size + 100);
char *buf = osi_calloc(config_size);
if (!line || !buf || !keyname) {
err_code |= 0x01;
goto error;
@ -409,6 +409,16 @@ bool config_save(const config_t *config, const char *filename)
for (const list_node_t *node = list_begin(config->sections); node != list_end(config->sections); node = list_next(node)) {
const section_t *section = (const section_t *)list_node(node);
w_cnt = snprintf(line, 1024, "[%s]\n", section->name);
if(w_cnt < 0) {
OSI_TRACE_ERROR("snprintf error w_cnt %d.",w_cnt);
err_code |= 0x10;
goto error;
}
if(w_cnt_total + w_cnt > config_size) {
OSI_TRACE_ERROR("%s, memcpy size (w_cnt + w_cnt_total = %d) is larger than buffer size (config_size = %d).", __func__, (w_cnt + w_cnt_total), config_size);
err_code |= 0x20;
goto error;
}
OSI_TRACE_DEBUG("section name: %s, w_cnt + w_cnt_total = %d\n", section->name, w_cnt + w_cnt_total);
memcpy(buf + w_cnt_total, line, w_cnt);
w_cnt_total += w_cnt;
@ -417,6 +427,16 @@ bool config_save(const config_t *config, const char *filename)
const entry_t *entry = (const entry_t *)list_node(enode);
OSI_TRACE_DEBUG("(key, val): (%s, %s)\n", entry->key, entry->value);
w_cnt = snprintf(line, 1024, "%s = %s\n", entry->key, entry->value);
if(w_cnt < 0) {
OSI_TRACE_ERROR("snprintf error w_cnt %d.",w_cnt);
err_code |= 0x10;
goto error;
}
if(w_cnt_total + w_cnt > config_size) {
OSI_TRACE_ERROR("%s, memcpy size (w_cnt + w_cnt_total = %d) is larger than buffer size.(config_size = %d)", __func__, (w_cnt + w_cnt_total), config_size);
err_code |= 0x20;
goto error;
}
OSI_TRACE_DEBUG("%s, w_cnt + w_cnt_total = %d", __func__, w_cnt + w_cnt_total);
memcpy(buf + w_cnt_total, line, w_cnt);
w_cnt_total += w_cnt;
@ -523,7 +543,10 @@ static void config_parse(nvs_handle fp, config_t *config)
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
char *keyname = osi_calloc(keyname_bufsz);
int buf_size = get_config_size_from_flash(fp);
char *buf = osi_calloc(buf_size + 100);
char *buf = osi_calloc(buf_size);
if(buf_size == 0) { //First use nvs
goto error;
}
if (!line || !section || !buf || !keyname) {
err_code |= 0x01;
goto error;

View File

@ -131,17 +131,19 @@ size_t fixed_queue_capacity(fixed_queue_t *queue)
void fixed_queue_enqueue(fixed_queue_t *queue, void *data)
{
bool status=false; //Flag whether enqueued success
assert(queue != NULL);
assert(data != NULL);
osi_sem_take(&queue->enqueue_sem, OSI_SEM_MAX_TIMEOUT);
osi_mutex_lock(&queue->lock, OSI_MUTEX_MAX_TIMEOUT);
list_append(queue->list, data);
status = list_append(queue->list, data); //Check whether enqueued success
osi_mutex_unlock(&queue->lock);
osi_sem_give(&queue->dequeue_sem);
if(status == true)
osi_sem_give(&queue->dequeue_sem);
}
void *fixed_queue_dequeue(fixed_queue_t *queue)
@ -189,7 +191,7 @@ void *fixed_queue_try_dequeue(fixed_queue_t *queue)
return NULL;
}
if (osi_sem_take(queue->dequeue_sem, 0) != 0) {
if (osi_sem_take(&queue->dequeue_sem, 0) != 0) {
return NULL;
}
@ -243,14 +245,14 @@ void *fixed_queue_try_remove_from_queue(fixed_queue_t *queue, void *data)
osi_mutex_lock(&queue->lock, OSI_MUTEX_MAX_TIMEOUT);
if (list_contains(queue->list, data) &&
osi_sem_take(queue->dequeue_sem, 0) == 0) {
osi_sem_take(&queue->dequeue_sem, 0) == 0) {
removed = list_remove(queue->list, data);
assert(removed);
}
osi_mutex_unlock(&queue->lock);
if (removed) {
osi_sem_give(queue->enqueue_sem);
osi_sem_give(&queue->enqueue_sem);
return data;
}

View File

@ -72,7 +72,7 @@ typedef enum {
#define HCI_H4_QUEUE_LEN 1
#define BTU_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
#define BTU_TASK_STACK_SIZE (4096 + BT_TASK_EXTRA_STACK_SIZE)
#define BTU_TASK_STACK_SIZE (CONFIG_BTU_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE)
#define BTU_TASK_PRIO (configMAX_PRIORITIES - 5)
#define BTU_TASK_NAME "btuT"
#define BTU_QUEUE_LEN 50
@ -95,7 +95,7 @@ typedef enum {
#define BTC_A2DP_SOURCE_TASK_STACK_SIZE (CONFIG_A2DP_SOURCE_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
#define BTC_A2DP_SOURCE_TASK_NAME "BtA2dSourceT"
#define BTC_A2DP_SOURCE_TASK_PRIO (configMAX_PRIORITIES - 3)
#define BTC_A2DP_SOURCE_DATA_QUEUE_LEN (3)
#define BTC_A2DP_SOURCE_DATA_QUEUE_LEN (1)
#define BTC_A2DP_SOURCE_CTRL_QUEUE_LEN (5)
#define BTC_A2DP_SOURCE_TASK_QUEUE_SET_LEN (BTC_A2DP_SOURCE_DATA_QUEUE_LEN + BTC_A2DP_SOURCE_CTRL_QUEUE_LEN)

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