Compare commits

...

180 Commits

Author SHA1 Message Date
Laiwen-Li
0e2d6cb68e
Merge 69c2b3e731 into 46acfdce96 2024-09-30 19:48:03 -07:00
Rahul Tank
46acfdce96 Merge branch 'feat/send_data_len_afer_conn' into 'master'
Some checks failed
docker / docker (push) Has been cancelled
Vulnerability scan / Vulnerability scan (push) Has been cancelled
Sync remain PRs to Jira / Sync PRs to Jira (push) Has been cancelled
feat(nimble): Set data length after connection

See merge request espressif/esp-idf!32655
2024-09-21 21:24:54 +08:00
Jiang Jiang Jian
945af68d74 Merge branch 'feature/esp32c61_light_sleep_support_stage_3' into 'master'
feat(esp_hw_support): esp32c61 sleep support (Stage 3:  support system peripheral sleep retention)

Closes IDF-10384, IDF-10382, and IDF-11004

See merge request espressif/esp-idf!33298
2024-09-21 16:09:36 +08:00
Kapil Gupta
5d792910be Merge branch 'bugfix/wps_timer_causing_disconnect' into 'master'
fix(esp_wifi): Disable WPS timers once WPS succeed

Closes WIFIBUG-393

See merge request espressif/esp-idf!33240
2024-09-21 15:03:19 +08:00
David Čermák
82a29b7d21 Merge branch 'fix/lwip_drop_ipv6_if_no_ll' into 'master'
fix(lwip): Add default IPv6 input filter to drop traffic if ipv6 not assigned

Closes IDF-10472

See merge request espressif/esp-idf!32165
2024-09-20 23:33:49 +08:00
Kapil Gupta
0c9d7c9dd0 Merge branch 'bugfix/2g_5g_wnm_scan' into 'master'
fix(esp_wifi): Add changes to enable 5ghz scan

Closes WIFIBUG-773

See merge request espressif/esp-idf!33657
2024-09-20 22:20:26 +08:00
Kapil Gupta
3629909b11 fix(esp_wifi): Mask some error conditions in WPS
Mask some error conditions in WPS to increase the probability of
WPS success.
2024-09-20 22:08:01 +08:00
Kapil Gupta
3a35b26de1 fix(esp_wifi): Disable WPS timers once WPS succeed 2024-09-20 22:08:01 +08:00
Mahavir Jain
2a6be654cd Merge branch 'ci/enable_memprot_tests_for_esp32c61' into 'master'
Clear PMA entries before usage and enable tests for ESP32-C61

Closes IDF-10932

See merge request espressif/esp-idf!33438
2024-09-20 21:32:18 +08:00
Island
3000402fcf Merge branch 'bugfix/fix_ble_scan_assert_1728' into 'master'
fix(bt): Update bt lib for ESP32-C3 and ESP32-S3(e9ae856)

Closes IDFCI-2222 and BLERP-1037

See merge request espressif/esp-idf!33643
2024-09-20 20:12:00 +08:00
Kapil Gupta
b0712b6a2b Merge branch 'bugfix/deinitialize_wps_registrar' into 'master'
fix(esp_wifi): Deinit WPS registrar during hostapd deinit

Closes WIFIBUG-786 and WIFIBUG-695

See merge request espressif/esp-idf!33658
2024-09-20 17:40:57 +08:00
Liu Xiao Yu
e051b921b8 Merge branch 'feat/lp_spinlock' into 'master'
feat(ulp): implement inter-hp-lp-cpu spinlock/critical section

Closes IDF-10206

See merge request espressif/esp-idf!32775
2024-09-20 17:09:50 +08:00
David Cermak
98fdb1a97f fix(lwip): Add default IPv6 input filter to drop traffic if ipv6 not assigned
* Makes LWIP_HOOK_IP6_INPUT default to LWIP_HOOK_IP6_INPUT_DEFAULT
* Updated the stub hook implementation to actually filter out all IPv6
packets if the input netif has no link local address.
2024-09-20 10:36:43 +02:00
Sudeep Mohanty
c01512f4b0 Merge branch 'fix/assert_fail_in_xtaskdeletewithcaps' into 'master'
Some checks failed
docker / docker (push) Has been cancelled
Fixed occational assert failure in vTaskDeleteWithCaps()

Closes IDFGH-13294

See merge request espressif/esp-idf!33468
2024-09-20 16:19:40 +08:00
Guillaume Souchere
19d512ebee Merge branch 'feat/heap-support-esp32c61' into 'master'
feat(heap): Add support for esp32c61

Closes IDF-9858 and IDF-10989

See merge request espressif/esp-idf!33556
2024-09-20 16:01:20 +08:00
Lou Tian Hao
9be8822b61 Merge branch 'feature/esp32c61_light_sleep_support_stage_deepsleep' into 'master'
feat(esp_hw_support): support esp32c61 deepsleep

Closes PM-203 and IDF-9245

See merge request espressif/esp-idf!33301
2024-09-20 15:30:30 +08:00
Kapil Gupta
1d7241acc1 fix(esp_wifi): Add changes to enable 5ghz scan 2024-09-20 12:58:14 +05:30
Kapil Gupta
903c11ff1a Merge branch 'bugfix/dpp_5ghz_chan_support' into 'master'
fix(esp_wifi): Add support for 5ghz channel list for easy connect

Closes WIFI-6420

See merge request espressif/esp-idf!32146
2024-09-20 14:46:05 +08:00
Kapil Gupta
e24005c8db fix(esp_wifi): Add support for 5ghz channel list for easy connect 2024-09-20 14:46:05 +08:00
Kapil Gupta
1ac6043bce Merge branch 'bugfix/wps_wpa_connection' into 'master'
fix(esp_wifi): Allow connection with WPA mode in WPS

See merge request espressif/esp-idf!32360
2024-09-20 14:16:26 +08:00
Kapil Gupta
52002bf92d fix(esp_wifi): Allow connection with WPA mode in WPS 2024-09-20 14:16:01 +08:00
Lou Tianhao
bc0404ae03 fix(ci): some actions taken to pass CI 2024-09-20 14:10:45 +08:00
Lou Tianhao
46350e362e fix(esp_hw_support): add clock retention contents for esp32c61 & esp32c5 2024-09-20 14:09:29 +08:00
Lou Tianhao
6be09eb5b8 change(pm): replace SOC_CLK_RC32K_NOT_TO_USE with CONFIG_ESP_CLK_RC32K_NOT_TO_USE 2024-09-20 14:07:18 +08:00
Li Shuai
3b6f8b1f3d fix(esp32c61): enable soc caps macro to fix regdma wait compare bug 2024-09-20 14:07:18 +08:00
Lou Tianhao
9529c4ece4 fix(esp_hw_support): fix mmu memory powered down issue by software backup and restore mmu table content
squash! fix(esp_hw_support): fix mmu memory powered down issue by software backup and restore mmu table content
2024-09-20 14:07:18 +08:00
Lou Tianhao
a30ed69f69 feat(pm): support top retention for esp32c61 2024-09-20 14:07:18 +08:00
Jaroslav Burian
180bc4bd8c Merge branch 'feat/enable_esp32c5_stub' into 'master'
feat: Enable ESP32-C5 stub

Closes IDF-8631

See merge request espressif/esp-idf!33115
2024-09-20 14:01:20 +08:00
Li Shuai
3edbd0741a Merge branch 'feat/esp32c5_wifi_sleep' into 'master'
esp32c5 wifi legacy sleep and modem state support

Closes WIFI-6424, WIFI-6425, PM-185, IDF-10597, and IDF-10601

See merge request espressif/esp-idf!33225
2024-09-20 13:53:07 +08:00
Mahavir Jain
a71e0fc028 Merge branch 'feature/enable_sha_support_for_esp32c61' into 'master'
feat: enable support for sha peripheral in esp32c61

Closes IDF-9234

See merge request espressif/esp-idf!32830
2024-09-20 13:22:14 +08:00
Mahavir Jain
f5b55b2967 Merge branch 'fix/ecdsa_verify_check_hash_len' into 'master'
Wrap some mbedtls' ECDSA verification related APIs

See merge request espressif/esp-idf!33349
2024-09-20 12:38:10 +08:00
Marius Vikhammer
564d777018 Merge branch 'feature/lp_core_40_mhz' into 'master'
feat(system): support choosing xtal as rtc-fast clock src on P4 and C5

Closes IDF-10203

See merge request espressif/esp-idf!32450
2024-09-20 10:57:15 +08:00
Lou Tianhao
d9c15bb772 fix(ci): some actions taken to pass CI 2024-09-20 10:53:05 +08:00
Lou Tianhao
d70f24e414 feat(pm): support example deepsleep for esp32c61 2024-09-20 10:53:05 +08:00
Shen Wei Long
8320e4281b Merge branch 'bugfix/fixed_ble_get_started_issue_for_esp32c5' into 'master'
fix(ble): correct gpio pin in examples/bluetooth/ble_get_started for ESP32-C5

See merge request espressif/esp-idf!33654
2024-09-20 10:44:18 +08:00
Island
db8ffcacf4 Merge branch 'bugfix/fixed_c5_ble_cache_error_240919' into 'master'
Bugfix/fixed c5 ble cache error 240919

Closes BLERP-1038, BLERP-1039, BLERP-1040, BLERP-1041, BLERP-1042, BLERP-1043, BLERP-1044, BLERP-1045, BLERP-1046, BLERP-1047, BLERP-1048, BLERP-1049, and BLERP-1036

See merge request espressif/esp-idf!33645
2024-09-20 10:37:36 +08:00
Island
ae67021e1e Merge branch 'feat/ble_mesh_lib_flash_size_optimized' into 'master'
feat(ble_mesh): ble mesh lib flash size optimized

Closes BLERP-1012

See merge request espressif/esp-idf!33476
2024-09-20 10:34:30 +08:00
Xiaoyu Liu
446528d40f feat(ulp): implement ulp lp core spinlock 2024-09-20 10:22:45 +08:00
morris
c44e7dcb14 Merge branch 'feat/adapt_spi_lcd_to_lvgl_v9' into 'master'
feat(spi_lcd): adapt spi_lcd example to LVGL v9

Closes IDF-10953 and IDFGH-13741

See merge request espressif/esp-idf!33620
2024-09-20 10:11:43 +08:00
Kapil Gupta
28f12bfb47 fix(esp_wifi): Deinit WPS registrar during hostapd deinit 2024-09-19 23:10:08 +05:30
Rahul Tank
675fac1a6c feat(nimble): Set data length after connection 2024-09-19 20:20:47 +05:30
Li Shuai
072ea6bb44 fix(ci): some modify for ci pass 2024-09-19 20:04:44 +08:00
Li Shuai
9588953e07 change(esp_phy): some fix for phy sleep 2024-09-19 20:04:44 +08:00
Li Shuai
d57ee7d87e refactor(esp_hw_support): seperate sleep modem state support for each target 2024-09-19 20:04:44 +08:00
Li Shuai
dad039e27f change(esp_hw_support): support wifi modem state for esp32c5 2024-09-19 20:04:44 +08:00
Li Shuai
eeb55c3f04 change(example/power_save): modify to support dfs min frequency select to 48 MHz xtal 2024-09-19 20:04:44 +08:00
Lou Tianhao
1604cef916 chanage(example/power_save): add wifi band (2.4 GHz and 5 GHz) menuconfig option for esp32c5 2024-09-19 20:04:44 +08:00
Li Shuai
d63beec095 change(esp_wifi): support legacy wifi power save for esp32c5 2024-09-19 20:04:41 +08:00
Shen Weilong
a30edf60eb fix(ble): correct gpio pin in examples/bluetooth/ble_get_started for ESP32-C5 2024-09-19 20:04:02 +08:00
Sudeep Mohanty
13d4235d73 Merge branch 'fix/lp_uart_garbled_print' into 'master'
fix(lp_uart): Added lp_uart_tx_flush API

Closes IDFGH-13650

See merge request espressif/esp-idf!33487
2024-09-19 19:54:36 +08:00
Yin Qing Zhao
ca331a2521 Merge branch 'feature/add_channel_bit_definition' into 'master'
feat(wifi):wifi add channel bit definition

Closes FCW-280 and FCW-281

See merge request espressif/esp-idf!32916
2024-09-19 19:51:06 +08:00
Peter Marcisovsky
c2366d5df6 Merge branch 'fix/usb_device_msc_example_fix_console' into 'master'
fix(usb_device): Fix console selection in MSC Device example

Closes IDF-11136

See merge request espressif/esp-idf!33517
2024-09-19 19:29:33 +08:00
Peter Marcisovsky
67c5d37e75 Merge branch 'feat/usb_host_create_usb_cmock' into 'master'
feat(usb_host): Create USB Host mock for CMock host tests

Closes IDF-11234

See merge request espressif/esp-idf!33619
2024-09-19 19:26:03 +08:00
Peter Marcisovsky
70ff700f56 Merge branch 'ci/usb_device_enable_p4_tests' into 'master'
ci(usb_device): Enable USB device tests in CI for esp32p4

See merge request espressif/esp-idf!33287
2024-09-19 19:17:40 +08:00
Guillaume Souchere
80eee8214e Merge branch 'feat/support-ringbuffer-esp32c61' into 'master'
feat(ringbuffer): Enable tests for esp32c61

Closes IDF-9266

See merge request espressif/esp-idf!33551
2024-09-19 17:56:00 +08:00
Guillaume Souchere
8ff8b520f3 Merge branch 'feat/update-to-latest-tlsf' into 'master'
feat(heap): Update component to latest TLSF

See merge request espressif/esp-idf!33193
2024-09-19 17:55:38 +08:00
Roland Dobai
fe29994924 Merge branch 'fix/specify_shell_in_exports' into 'master'
fix: explicitly set shell type in export.sh for bash and zsh

Closes IDF-11137, IDF-11138, and IDFGH-13713

See merge request espressif/esp-idf!33558
2024-09-19 17:47:01 +08:00
Sachin Billore
c843c2c4fe Merge branch 'feat/apm_api_esp32c61' into 'master'
feat(APM): Add APM APIs for ESP32-C61

See merge request espressif/esp-idf!33567
2024-09-19 17:46:40 +08:00
Marius Vikhammer
00eb97725b feat(system): support choosing xtal as rtc-fast clock src on P4 and C5
With xtal as rtc-fast clock source the LP-Core can run at twice the default
clock frequency. 40 MHz as opposed to 20 MHz.
2024-09-19 17:30:44 +08:00
Sudeep Mohanty
9b3eda0974 Merge branch 'fix/ringbuf_receives_item_not_yet_sent' into 'master'
Some checks failed
docker / docker (push) Has been cancelled
fix(esp_ringbuf): Fixed a bug where in a no-split buffer received items prematurely

Closes IDFGH-13694

See merge request espressif/esp-idf!33555
2024-09-19 17:07:20 +08:00
Jiang Jiang Jian
6b9242b5c7 Merge branch 'bugfix/fix_some_issues_of_cert_test' into 'master'
fix(phy): update cert_test docs

See merge request espressif/esp-idf!33635
2024-09-19 16:45:38 +08:00
Sudeep Mohanty
86c1ad216c Merge branch 'task/enable_freertos_tests_for_h2' into 'master'
test(freertos): Enabled FreeRTOS unit tests for esp32h2

See merge request espressif/esp-idf!33571
2024-09-19 16:42:22 +08:00
zwl
3c72084932 feat(ble): update bt cmakelists file for ESP32-C61 2024-09-19 16:06:46 +08:00
Guillaume Souchere
f0903aef6b feat(heap): Add test support for esp32c61 2024-09-19 09:53:45 +02:00
zwl
8e4cc79a27 fix(ble): unified ble memory allocation method 2024-09-19 15:49:23 +08:00
Sudeep Mohanty
3c65f1b654 fix(lp_uart): Added lp_uart flush feature
This commit adds the lp_core_uart_flush() API to flush the LP UART Tx
FIFO. This API is automatically called once the program returns from the
main function().

Closes https://github.com/espressif/esp-idf/issues/14530
2024-09-19 09:36:04 +02:00
zhanghaipeng
32c7694f56 fix(bt): Update bt lib for ESP32-C3 and ESP32-S3(e9ae856)
- Fixed BLE scan assert in lld_scan.c 1728
2024-09-19 15:22:04 +08:00
Wan Lei
115dec68ae Merge branch 'fix/p4_twai_enable_test' into 'master'
test(twai): p4 twai enable ci test

Closes IDF-8966

See merge request espressif/esp-idf!33428
2024-09-19 15:17:28 +08:00
muhaidong
da4a0798f4 fix(phy): update cert_test docs 2024-09-19 15:13:15 +08:00
Marius Vikhammer
4c7d9f9859 Merge branch 'contrib/github_pr_14384' into 'master'
fix(pthread): Add esp_pthread function implementations for linux target (GitHub PR)

Closes IDFGH-13485

See merge request espressif/esp-idf!33278
2024-09-19 14:42:59 +08:00
Island
c62555d132 Merge branch 'bugfix/fixed_c6_crash_c2_crash_issue' into 'master'
Bugfix/fixed c6 crash c2 crash issue

Closes BLERP-1024, BLERP-1009, BLERP-1010, IDFCI-2365, and IDFCI-2338

See merge request espressif/esp-idf!33575
2024-09-19 14:34:04 +08:00
Chen Jichang
5bef0f5664 docs(spi_lcd): update supported spi mode description
Closes https://github.com/espressif/esp-idf/issues/14605
2024-09-19 14:29:41 +08:00
Chen Jichang
7e2a7bd5b2 feat(spi_lcd): adapt spi_lcd example to LVGL v9 2024-09-19 14:29:41 +08:00
Armando (Dou Yiwen)
bff2f9b2dd Merge branch 'change/camera_example_readme_change' into 'master'
example(camera): update some info about camera related examples

See merge request espressif/esp-idf!33637
2024-09-19 14:15:42 +08:00
Armando
79da963c62 example(camera): update some info about camera related examples 2024-09-19 14:09:23 +08:00
Rahul Tank
2a12872d0a Merge branch 'fix/added_a_change_to_print_address_of_advertising_instance' into 'master'
fix(nimble): Added a change to print address of an advertising instance

Closes BLERP-1033

See merge request espressif/esp-idf!33550
2024-09-19 14:08:47 +08:00
Sachin Billore
b4749b88d9 feat(APM): Add APM APIs for ESP32-C61 2024-09-19 11:07:42 +05:30
luoxu
fde00f570a feat(ble_mesh): ble mesh lib flash size optimized 2024-09-19 12:14:32 +08:00
Jiang Jiang Jian
b01fd6b026 Merge branch 'feat/bringup_esp32c2_rom_mbedtls_to_formal_feature' into 'master'
feat(mbedtls): bringup esp32c2 rom mbedtls feature to formal

See merge request espressif/esp-idf!33434
2024-09-19 11:18:27 +08:00
Michael (XIAO Xufeng)
534c3288ae Merge branch 'docs/update_examples_in_sdio_slave' into 'master'
docs: Update the application examples in sdio_slave

Closes DOC-8319

See merge request espressif/esp-idf!31994
2024-09-19 11:14:49 +08:00
Armando (Dou Yiwen)
cba8c5d7ca Merge branch 'feat/supported_camera_sc2336_lcd_ek79007' into 'master'
camera: supported camera related example using sc2336 and ek79007

Closes IDFGH-13634

See merge request espressif/esp-idf!33518
2024-09-19 11:10:57 +08:00
Armando
b3ccc09ec3 feat(camera): supported camera related example using sc2336 and ek79007
Closes https://github.com/espressif/esp-idf/issues/14517
2024-09-19 10:47:56 +08:00
Alexey Gerenkov
81f4ef73c3 Merge branch 'feature/update-esp-clang-to-esp-18.1.2_20240815' into 'master'
Some checks are pending
docker / docker (push) Waiting to run
feat(tools): update esp-clang version to esp-18.1.2_20240912

Closes LLVM-333

See merge request espressif/esp-idf!32895
2024-09-19 03:49:46 +08:00
Alexey Gerenkov
391dd7b9ad fix(build): Fix declaration of linker labels for ROM reserved regions
It looks like as a part of optimization for inlined functions like 'mmu_ll_vaddr_to_laddr' Clang aligns constant value
used for bitwise AND operation with the pointer to external symbol passed to the function as parameter.
That led to assertion failures because boundaries can be unaligned to 4 bytes.
2024-09-18 21:40:39 +03:00
Alexey Gerenkov
b8d23b334b change(build): Enable 'xesppie' for esp32p4 Clang builds 2024-09-18 21:40:39 +03:00
Alexey Gerenkov
9ca231e76e change(build): Use integrated assembler with Clang for RISCV chips 2024-09-18 21:40:39 +03:00
Alexey Gerenkov
64203d1403 feat(tools): update esp-clang version to esp-18.1.2_20240912 2024-09-18 21:40:34 +03:00
Konstantin Kondrashov
dcd433e62c Merge branch 'bugfix/werror_hint' into 'master'
fix(tools): Fix a regular expression in hints.yml for Werror=

See merge request espressif/esp-idf!33625
2024-09-19 01:30:27 +08:00
Michael (XIAO Xufeng)
ed92c2c226 Merge branch 'test/add_cache2phys_xip_tests' into 'master'
fix(mmap): fixed spi_flash_phys2cache return addr in PSRAM issue

See merge request espressif/esp-idf!31083
2024-09-18 23:53:47 +08:00
Konstantin Kondrashov
d1a00f5808 fix(tools): Fix a regular expression in hints.yml for Werror= 2024-09-18 16:33:47 +03:00
Peter Marcisovsky
d071bb4c56 feat(usb_host): Create USB Host mock for CMock host tests 2024-09-18 15:04:03 +02:00
wanckl
bf9d01bf2a test(twai): p4 twai enable ci test 2024-09-18 20:56:55 +08:00
David Čermák
22facff58c Merge branch 'fix/ws_transport_linux_signed_promotions' into 'master'
fix(ws_transport): Fix incorrect packet-len on linux due to int promotions of char (GitHub PR)

Closes IDFGH-13642 and IDFGH-13657

See merge request espressif/esp-idf!33595
2024-09-18 20:56:51 +08:00
Lou Tian Hao
3415ff27d6 Merge branch 'fix/regdma_wait_node_issue' into 'master'
fix(pm): fix the issue of regdma wait node to immediately return to done caused by regdma wait mode comparator for esp32c6, esp32h2 and esp32p4

Closes PM-202

See merge request espressif/esp-idf!33547
2024-09-18 20:52:59 +08:00
yinqingzhao
97e42349aa feat(wifi):wifi add channel bit definition 2024-09-18 20:19:39 +08:00
Erhan Kurubas
2dbb811747 Merge branch 'fix/apptrace_print_lock' into 'master'
fix(apptrace): fix build error when print lock is enabled

See merge request espressif/esp-idf!33368
2024-09-18 19:50:21 +08:00
Sudeep Mohanty
6a82497bdc fix(esp_ringbuf): Fixed a bug where in a no-split buffer received items prematurely
This commit fixes a bug in the no-split buffer which could receive an
item prematurely if the space on the buffer is acquired until the buffer
is full. The commit also adds a unit test for this scenario.

Closes https://github.com/espressif/esp-idf/issues/14568
2024-09-18 13:39:52 +02:00
Alexey Gerenkov
5c43055e3e Merge branch 'esp32c61_jtag_doc_update' into 'master'
docs(jtag): update esp32c61 jtag debugging guide

Closes IDF-10168

See merge request espressif/esp-idf!33546
2024-09-18 19:36:23 +08:00
Frantisek Hrbata
6f3241a34b fix(tools): Upgrade shell detection & simplify autocompletion
Explicitly set shell type in export.sh for bash and zsh

-Most of the issues reported with the updated export scripts are related
 to shell detection. Since we already know the shell type for commonly
 used ones like bash or zsh, we can pass the shell type directly to the
 activate script. This should hopefully resolve the shell detection
 problems for most users.

 This update also modifies the shell type detection to rely solely on
 psutil.Process().cmdline() rather than psutil.Process().exe(). This
 change aims to resolve permission issues that may occur if, for example,
 the Python binary has certain capabilities assigned.

Move shell completion to the init script

- Currently we are expanding the autocompletion in the activate script and
 adding the expanded commands into the init script. To avoid
 concerns about shell versions, move the entire expansion to the init
 script.
2024-09-18 13:03:26 +02:00
Frantisek Hrbata
2109f81102 fix(tools): do not include rc scripts in export script
The rc scripts should be included only when a new shell is started. At
present, for bash and zsh, we are also including them in the export
scripts, which is incorrect and may cause recursion.

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

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2024-09-18 13:03:26 +02:00
Sudeep Mohanty
01f521f3a0 test(freertos): Enabled FreeRTOS unit tests for esp32h2 2024-09-18 12:51:24 +02:00
Roland Dobai
eb606b9777 Merge branch 'feat/add_constraint_files' into 'master'
add a note regarding separate constraint files

Closes IDF-10232

See merge request espressif/esp-idf!33230
2024-09-18 18:48:06 +08:00
Sudeep Mohanty
eb676c0afc Merge branch 'task/enable_freertos_tests_for_c61' into 'master'
test(freertos): Enabled FreeRTOS unit tests for esp32c61

Closes IDF-10988

See merge request espressif/esp-idf!33568
2024-09-18 18:40:29 +08:00
Ren Peiying
91ad4bcbce Merge branch 'add_application_examples_peripherals' into 'master'
Add application examples for i2c, jpeg, temp_sensor and usb_serial-jtag-console

See merge request espressif/esp-idf!33274
2024-09-18 17:31:59 +08:00
Ren Peiying
fb1b91c8d7 Add application examples for i2c, jpeg, temp_sensor and usb_serial-jtag-console 2024-09-18 17:31:59 +08:00
Sudeep Mohanty
c36674eaa8 fix(freertos): Fixed assert failure in vTaskDeleteWithCaps
This commit fixes an assert failure in vTaskDeleteWithCaps() when
multiple un-pinned tasks are created with stack in the external memory
and such tasks delete themselves.

Closes https://github.com/espressif/esp-idf/issues/14222
2024-09-18 11:11:04 +02:00
Frantisek Hrbata
7a03ac385d change: add a note regarding separate constraint files
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2024-09-18 16:56:04 +08:00
Sudeep Mohanty
02cd0253a1 test(freertos): Added a test for vTaskDeleteWithCaps when stack is in ext RAM
This commit adds a stress tests for creating multiple tasks with
xTaskCreateWithCaps such that the stack is allocated in external SPIRAM.
Then the tasks self-delete. This is done iteratively as stress test.
2024-09-18 10:39:24 +02:00
Jiang Jiang Jian
f8894140ee Merge branch 'bugfix/11kv_prints' into 'master'
fix(esp_wifi): Added prints in btm roam for error condition

See merge request espressif/esp-idf!32658
2024-09-18 16:19:45 +08:00
Erhan Kurubas
6ade64eb05 docs(jtag): update esp32c61 jtag debugging guide 2024-09-18 10:44:41 +03:00
zwl
4d2c44f511 fix(ble): fixed memory leak issue when using uart hci 2024-09-18 15:39:26 +08:00
zwl
0ef9ecb715 fix(ble): fixed occasional assertion issue when enabling logging on ESP32-C2 2024-09-18 15:39:26 +08:00
zwl
c929a01931 fix(ble): fixed occasional acl data packet loss issue when using UHCI on ESP32-H2 2024-09-18 15:39:26 +08:00
zwl
afe08638a0 fix(ble): fixed occasional crash issue in multi-connect scenarios on ESP32-C6 2024-09-18 15:39:26 +08:00
Sudeep Mohanty
453850eff2 Merge branch 'contrib/github_pr_14593' into 'master'
feat(advanced_console): Add ESP32-P4 ESP32-C5 model support in 'version' command output (GitHub PR)

Closes IDFGH-13722

See merge request espressif/esp-idf!33565
2024-09-18 15:37:33 +08:00
Shu Chen
28a92e56db Merge branch 'feature/add_ot_nat64_curl_ci_case' into 'master'
feat(openthread): add thread curl https ci case

See merge request espressif/esp-idf!33486
2024-09-18 15:36:25 +08:00
Kapil Gupta
27cf5267a1 fix(esp_wifi): Added prints in btm roam for error condition 2024-09-18 14:44:24 +08:00
Guillaume Souchere
a1b8fc9635 feat(ringbuffer): Enable tests for esp32c61
Add ring buffer support for esp32c61
2024-09-18 08:39:17 +02:00
Zhang Shu Xian
6a0ec48b11 Merge branch 'docs/fix_wrong_statement' into 'master'
docs: Fix wrong statement about set/get gptimer raw count

Closes DOC-8882

See merge request espressif/esp-idf!33574
2024-09-18 14:28:32 +08:00
yiwenxiu
26be72307b feat(openthread): add thread curl https ci case 2024-09-18 14:04:08 +08:00
harshal.patil
7667d9ebbe
fix(cpu_region_protect): Reset PMA entries before using them
- ROM uses some PMA entries so we clear such PMA entries before using them in ESP-IDF
2024-09-18 10:25:18 +05:30
harshal.patil
fcd751e79c
ci(memprot): enable memory protection tests for ESP32-C61 2024-09-18 10:25:18 +05:30
Ren Peiying
84791fce2f Merge branch 'docs/add_app_examples_for_spi_master_twai_etc' into 'master'
docs: Update application examples for spi master, twai, and spi_slave

See merge request espressif/esp-idf!33276
2024-09-18 12:01:16 +08:00
Ren Peiying
a360c737ea Merge branch 'docs/update_app_examples_to_usb_host_device' into 'master'
docs: Add or update application examples for usb_host and usb_device

See merge request espressif/esp-idf!33275
2024-09-18 11:59:36 +08:00
Zhang Xiao Yan
40892b67c5 Merge branch 'docs/update_description_improve_io_performance' into 'master'
docs: update descriptions about improve I/O performance

See merge request espressif/esp-idf!33367
2024-09-18 11:48:05 +08:00
Wang Meng Yang
4b74e4e595 Merge branch 'bugfix/fix_sdp_compatibility' into 'master'
Bugfix/fix sdp compatibility

See merge request espressif/esp-idf!33442
2024-09-18 11:31:27 +08:00
Island
030470efa6 Merge branch 'ble_dev/esp32c61_chip_20240903' into 'master'
feat(ble): added ble support on esp32c61

Closes IDF-10360, IDF-10362, IDF-10363, and IDF-10365

See merge request espressif/esp-idf!33286
2024-09-18 11:17:58 +08:00
Island
1a065dc37a Merge branch 'feat/support_blecrt_242' into 'master'
fix(bt/bluedroid): Fixed access fault when reading BLE controller information fails

Closes BLERP-1019 and BLERP-1020

See merge request espressif/esp-idf!33406
2024-09-18 10:56:47 +08:00
Island
5f865a81b9 Merge branch 'refactor/ble_example_print_on_bluedroid' into 'master'
refactor(bt/bluedroid): Refactor the print for BLE examples

Closes BLERP-904, BLERP-910, BLERP-1026, and BLERP-1031

See merge request espressif/esp-idf!33296
2024-09-18 10:56:42 +08:00
Island
cb2624fb3f Merge branch 'bugfix/fix_ble_max_tx_power_on_esp32c3' into 'master'
fix(bt/controller): Change the max TX power to +20dBm on ESP32-C3 and ESP32-S3

Closes BLERP-1022

See merge request espressif/esp-idf!33264
2024-09-18 10:56:37 +08:00
Linda
ef1bffa937 docs: update descriptions about improve I/O performance 2024-09-18 10:53:42 +08:00
Zhang Shuxian
0244f7a9b5 docs: Fix wrong statement about set/get gptimer raw count 2024-09-18 10:14:55 +08:00
Sudeep Mohanty
812fbb7874 test(freertos): Enabled FreeRTOS unit tests for esp32c61 2024-09-17 14:17:01 +02:00
Sudeep Mohanty
328de495de fix(console): Fixed a typing error in the console advanced example 2024-09-17 09:16:06 +02:00
rudi ;-)
4281f58229 feat(advanced_console): Add support for ESP32-P4 and ESP32-C5 models in 'version' command output
The model ESP32P4 and ESP32C5 was unknown on version command in iperf example

add model ESP32P4 and ESP32C5
which prints out model names now by the knowed model
ESP32P4 = "ESP32-P4"
ESP32C5 = "ESP32-C5"

example app: iperf

before:
iperf> version
IDF Version:v5.4-dev-2744-g59e1838270-dirty
Chip info:
        model:Unknown
        cores:1
        feature:/802.11bgn/BLE/External-Flash:8 MB
        revision number:0
iperf>

after this add model is knowed now

iperf> version
IDF Version:v5.4-dev-2744-g59e1838270-dirty
Chip info:
        model:ESP32-C5
        cores:1
        feature:/802.11bgn/BLE/External-Flash:8 MB
        revision number:0
iperf>

Merges https://github.com/espressif/esp-idf/pull/14593
2024-09-17 09:04:52 +02:00
Aditya Patwardhan
fe47676a8b Merge branch 'feature/add_api_to_get_last_status_code_logged_during_ota' into 'master'
feat(esp_https_ota): added API to get last status code logged from http resonse

Closes IDFGH-13394

See merge request espressif/esp-idf!33356
2024-09-17 12:27:22 +08:00
Aditya Patwardhan
794c60411b Merge branch 'feat/update_random_number_docs_for_esp32c61' into 'master'
docs(systems): Updated the random number generator docs for esp32c61

Closes IDF-10153

See merge request espressif/esp-idf!33405
2024-09-17 11:58:03 +08:00
Rahul Tank
f68d16e7ad Merge branch 'bugfix/nimble_coverity_fixes' into 'master'
fix(nimble): Fix for coverity issues

Closes IDF-9419 and IDF-9425

See merge request espressif/esp-idf!33432
2024-09-16 22:26:42 +08:00
Guillaume Souchere
200241b9aa feat(heap): Add support for esp32c61 2024-09-16 14:44:57 +02:00
Jaroslav Burian
82c8973add feat: Enable ESP32-C5 stub 2024-09-16 20:27:25 +08:00
Roland Dobai
75fec0bdff Merge branch 'feat/move_sample_project' into 'master'
feat(tools): Move sample_project from examples to tools

Closes IDF-9812

See merge request espressif/esp-idf!33515
2024-09-16 20:00:07 +08:00
Tomas Borcin
4e4fb3a57b Merge branch 'docs/roadmap' into 'master'
docs: Adding ESP-IDF Project Roadmap

Closes RDT-668

See merge request espressif/esp-idf!31339
2024-09-16 19:02:31 +08:00
Rahul Tank
2113e99aeb fix(nimble): Fix for coverity issues 2024-09-16 14:24:32 +05:30
Rahul Tank
cfb78587f3 Merge branch 'bugfix/add_dummy_cb_during_deinit' into 'master'
fix(nimble): De-register host cb in stack deinit

See merge request espressif/esp-idf!33251
2024-09-16 16:40:19 +08:00
shreeyash
9725f3af74 fix(nimble): Added a change to print address of an advertising instance 2024-09-16 14:00:21 +05:30
Marek Fiala
6ec1e9107f feat(tools): Move sample_project from examples to tools
Extended example readme.md by further development options.
2024-09-16 09:12:50 +02:00
Guillaume Souchere
ccd8486462 feat(heap): Update component to latest TLSF
The new TLSF architecture has changed. tlsf.h public API
header is now moved into an include folder. tlsf_common.h
is removed from the repo.

This commit updates the heap component and respective
esp_rom patches to take into account this new
architecture.
2024-09-16 09:02:44 +02:00
Rahul Tank
2512588884 fix(nimble): De-register host cb in stack deinit 2024-09-16 10:35:47 +05:30
Jiang Jiang Jian
5a5c004691 Merge branch 'feature/optimize_coex_connectionless_pwr' into 'master'
feat(coex): optimize connectionless coexist pwr, optimize wifi pwr with BLE IDLE

Closes WIFI-6693 and WIFI-6645

See merge request espressif/esp-idf!33437
2024-09-15 23:41:21 +08:00
Jakob Hasse
f9e7305efd fix(pthread): configuration functions check for null pointer 2024-09-14 16:42:47 +02:00
Jakob Hasse
7834519af8 refactor(pthread): added esp_pthread unit tests for linux target 2024-09-14 16:42:41 +02:00
Jakob Hasse
0b70e296a0 refactor(pthread): avoid conflict due to two PTHREAD_STACK_MIN declarations 2024-09-14 16:34:20 +02:00
liuning
83809910d2 feat(coex): optimize connectionless coexist pwr, optimize wifi pwr with bt idle 2024-09-14 19:28:09 +08:00
Lou Tianhao
dd3d5f1598 fix(ci): :fix the issue of regdma wait node to immediately return to done caused by regdma wait mode comparator for esp32c6 & esp32h2 &esp32p4 2024-09-14 19:21:51 +08:00
liqigan
205e66c9fd fix(bt/bluedroid): Fixed not deep copy service_name and user1_ptr in RAW SDP search event 2024-09-14 14:37:50 +08:00
liqigan
1cfb537813 fix(bt/bluedroid): Fixed the SDP API compatibility bug 2024-09-14 14:37:50 +08:00
Shen Weilong
bf52e37fa8 feat(ble): added ble support on esp32c61 2024-09-14 12:22:04 +08:00
Xiao Xufeng
436bcd6c06 ci(app_update): move test_apps to subfolder with a name 2024-09-14 10:19:30 +08:00
Xiao Xufeng
cdb9f2b098 ci(spi_flash): add tests for cache2phys with XIP 2024-09-14 10:19:30 +08:00
Xiao Xufeng
8bf68ff07b fix(mmap): fixed spi_flash_phys2cache return addr in PSRAM issue
When SPIRAM_FETCH_INSTRUCTIONS or SPIRAM_RODATA enabled
2024-09-14 10:19:30 +08:00
renpeiying
5fe1f22b34 docs: Update application examples for spi master, twai, and spi_slave 2024-09-13 17:05:02 +08:00
JiangGuangMing
ee9a072c82 feat(mbedtls): bringup rom mbedtls feature to formal 2024-09-13 16:40:20 +08:00
Peter Marcisovsky
2da0f66e9a fix(usb_device): Fix console periheral, enable USJ Console on P4 2024-09-13 10:28:43 +02:00
renpeiying
27a88b83fb docs: Add or update application examples for usb_host and usb_device 2024-09-13 16:12:21 +08:00
chenjianhua
53a8345e60 refactor(bt/bluedroid): Refactor the print for BLE examples 2024-09-12 19:30:45 +08:00
Tomas Borcin
83393cdec8 docs: Adding ESP-IDF Project Roadmap 2024-09-12 12:51:22 +02:00
Erhan Kurubas
8fd3e8c0d3 fix(apptrace): fix build error when print lock is enabled 2024-09-11 23:02:11 +03:00
Cristian Funes
08a1e1350c fix(pthread): Add esp_pthread function implementations for linux target 2024-09-11 12:20:32 +02:00
nilesh.kale
12fc7a677e feat: enable support for sha peripheral in esp32c61 2024-09-11 14:49:01 +05:30
chenjianhua
e4e23087ee fix(bt/bluedroid): Fixed access fault when reading BLE controller information fails 2024-09-11 10:26:45 +08:00
chenjianhua
e4a372ab76 feat(bt/bluedroid): Add BLE connection id param for ESP_GATTS_RESPONSE_EVT 2024-09-11 10:26:45 +08:00
Sean DuBois
58775cce6e fix(ws_transport): Fix crash when reading
When parsing WS framing protocol integer promotion would cause
invalid values to be read. Acting upon these values would eventually
cause a crash

Fixes esp-protocols#645
2024-09-09 12:32:37 -04:00
hrushikesh.bhosale
952533bee3 docs(systems): Updated the random number generator docs for esp32c61
Udpated the non_updated_docs for esp32c61 for random number geneartor
2024-09-09 17:20:35 +05:30
chenjianhua
fe43c8f1b5 fix(bt/controller): Change the max TX power to +20dBm on ESP32-C3 and ESP32-S3 2024-09-09 11:25:10 +08:00
nilesh.kale
70d4414eeb feat(esp_https_ota): added API to get last status code logged from http resonse
Closes https://github.com/espressif/esp-idf/issues/14302
2024-09-06 15:09:42 +05:30
harshal.patil
c4f60d91f1
feat(mbedtls): Wrap mbedtls_ecdsa_read_signature to use ECDSA hardware when possible 2024-09-05 16:27:58 +05:30
harshal.patil
331fd7f79f
fix(mbedtls/port): Check signature hash length before using ECDSA hardware 2024-09-05 16:27:58 +05:30
Peter Marcisovsky
67a8480aec ci(usb_device): Enable USB device tests in CI for esp32p4 2024-09-03 16:43:49 +02:00
shenmengjing
04168efcaf docs: Update the application examples in sdio_slave 2024-08-29 16:00:13 +08:00
Laiwen-Li
69c2b3e731 feat(example): Add a power management example 2023-09-01 11:52:58 +08:00
507 changed files with 7778 additions and 2384 deletions

View File

@ -59,6 +59,7 @@
/CONTRIBUTING.md @esp-idf-codeowners/docs
/Kconfig @esp-idf-codeowners/build-config
/README*.md @esp-idf-codeowners/docs
/ROADMAP*.md @esp-idf-codeowners/docs
/SUPPORT_POLICY*.md @esp-idf-codeowners/docs
/add_path.sh @esp-idf-codeowners/tools
/conftest.py @esp-idf-codeowners/ci

View File

@ -156,11 +156,12 @@ build_clang_test_apps_esp32s3:
extends:
- .build_cmake_clang_template
variables:
# For RISCV clang generates '.linker-options' sections of type 'llvm_linker_options' in asm files.
# See (https://llvm.org/docs/Extensions.html#linker-options-section-linker-options).
# Binutils gas ignores them with warning.
# TODO: LLVM-333, Use integrated assembler.
TEST_BUILD_OPTS_EXTRA: "--ignore-warning-str 'Warning: unrecognized section type'"
# https://reviews.llvm.org/D90108.
# GNU 'as' lets .weak override .globl since binutils-gdb
# https://github.com/bminor/binutils-gdb/commit/5ca547dc2399a0a5d9f20626d4bf5547c3ccfddd (1996)
# while MC lets the last directive win (PR38921).
# For RISCV chips we use integrated assembler by default, so suppress this warning to pass CI pipeline.
TEST_BUILD_OPTS_EXTRA: "--ignore-warning-str 'changed binding to STB_WEAK'"
build_clang_test_apps_esp32c3:
extends:

View File

@ -676,6 +676,5 @@ mainmenu "Espressif IoT Development Framework Configuration"
- CONFIG_ESPTOOLPY_FLASHFREQ_120M && CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_DTR
- CONFIG_SPIRAM_SPEED_120M && CONFIG_SPIRAM_MODE_OCT
- CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
- CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL
- CONFIG_ESP_WIFI_EAP_TLS1_3
- CONFIG_ESP_WIFI_ENABLE_ROAMING_APP

123
ROADMAP.md Normal file
View File

@ -0,0 +1,123 @@
# ESP-IDF Project Roadmap2024
This document outlines the goals of ESP-IDF project and is shared for the convenience of our customers. It is important to clarify that this document is not a binding commitment to our customers. Instead, its primary purpose is to offer a clear roadmap and direction for the project's development. By openly sharing this information, we aim to enhance our customers' understanding, promote transparency and ensure alignment with the overarching objectives of the ESP-IDF project.
## Project Overview
### Project Goals
In both minor and major releases, we integrate new chip support to enhance our product range. By expanding the chip matrix, we broaden the scope of our offerings, catering to a wider audience with diverse needs. This proactive approach ensures that our products remain at the forefront of technological advancements, consistently meeting and exceeding customer expectations.
Furthermore, we prioritize bugfix releases for active branches, focusing on improving the stability and performance of products already in production. By addressing bugs promptly, we aim to enhance the overall user experience and provide tangible benefits to customers relying on our solutions. This proactive maintenance strategy reflects our commitment to delivering reliable, high-quality products to our valued customer base.
Below are the main objectives that ESP-IDF project/teams would like to implement in 2024.
- New Chip Support
- Add support for ESP32-P4
- Add support for ESP32-C5
- Add support for ESP32-C61
- More Minor Releases
- Release IDF v5.3 in 2024
- Release IDF v5.4 at the start of 2025
- More Bugfix Releases
- Release v4.4.8 for IDF v4.4 before ESP-IDF v4.4 goes End of Life in July 2024
- Do more bugfix releases for IDF v5.1 before release/5.1 enters maintenance period in June 2024
- Do more bug fixes releases for release/5.2 and release/5.3, and push the two releases to be more stable and production-ready
- Updates of Libraries
- Update GDB to 14.2
- Update LLVM to 18.1.2
- Update MbedTLS to 3.6 (LTS)
- Update LWIP to 2.2.0
- Change minimal Python requirement to 3.9
Please note that support status of previous silicones could be found on [ESP-IDF Release and SoC Compatibility](https://github.com/espressif/esp-idf#esp-idf-release-and-soc-compatibility).
### Roadmap Details
The ESP-IDF project prioritizes consistent maintenance and updates to ensure our customers remain at the forefront of technological advancements. Our commitment to ongoing development ensures that customers continuously benefit from the latest innovations in the field.
Moreover, we are dedicated to empowering our customers to leverage newly implemented features and enhanced functionalities through iterative improvements. Our steadfast commitment to pushing boundaries ensures that clients not only keep pace with evolving technology but also extract optimal value from the cutting-edge capabilities of our products.
Below are the main roadmap details for functional areas inside ESP-IDF.
- New Chip Support
- Add full support for ESP32-P4 in ESP-IDF v5.3, refer to [ESP32-P4 Support Status](https://github.com/espressif/esp-idf/issues/12996)
- Add preview support for ESP32-C5 in ESP-IDF v5.3 and full support for ESP32-C5 in ESP-IDF v5.4, refer to [ESP32-C5 Support Status](https://github.com/espressif/esp-idf/issues/14021)
- Add preview support for the early samples of ESP32-C61 in ESP-IDF v5.4 and full support for mass production version in ESP-IDF v5.4.x. Refer to [ESP32-C61 Support Status](https://developer.espressif.com/pages/chip-support-status/esp32c61/#esp-idf)
- Bugfix releases
- Do bugfix release IDF v4.4.8 and stop maintaining ESP-IDF v4.4 in July 2024
- Release bugfix IDF v5.0.6 and IDF v5.0.7 in 2024 (maintenance period)
- Release bugfix IDF v5.1.3 and IDF v5.1.4 in H1 of 2024, and release IDF v5.1.5 in H2 of 2024
- Push release/5.1 to maintenance period from June 2024
- Do more bug fixes releases for release/5.2 (IDF v5.2.1, IDF v5.2.2, IDF v5.2.3) and release/5.3 (IDF v5.3.1, IDF v5.3.2), and push releases to be more stable and more production-ready
## ESP-IDF Planning information
For the full list of ESP-IDF releases, please visit https://github.com/espressif/esp-idf/releases
### ESP-IDF Major Releases
No Major Releases planned
### ESP-IDF Minor Releases
#### Quarter One
- v5.2-RC1, estimate release date: 2024/02/02
- v5.2 final release, estimate release date: 2024/02/08
#### Quarter Two
- v5.3-beta1, estimate release date:: 2024/05/13
- v5.3-beta2, estimate release date:: 2024/05/31
- v5.3-RC1, estimate release date:: 2024/07/08
#### Quarter Three
- v5.3-RC2, estimate release date:: 2024/07/26
- v5.3 final release, estimate release date:: 2024/08/02
#### Quarter Four
- v5.4-beta1, estimate release date:: 2024/11/08
- v5.4-beta2, estimate release date:: 2024/11/29
- v5.4-RC1, estimate release date:: 2025/01/09
- v5.4-RC2, estimate release date:: 2025/01/29
- v5.4 final release, estimate release date: 2025/02/05
### ESP-IDF Bugfix Releases
#### Quarter One
- v5.1.3, estimate release date: 2024/02/08
- v5.0.6, estimate release date: 2024/02/18
- v4.4.7, estimate release date:: 2024/03/19
- v5.2.1, estimate release date:: 2024/03/31
#### Quarter Two
- v5.1.4, estimate release date:: 2024/05/06
- v5.2.2, estimate release date:: 2024/06/17
- v4.4.8, estimate release date:: 2024/07/19
#### Quarter Three
- v5.0.7, estimate release date: 2024/08/22
- v5.3.1, estimate release date: 2024/09/16
- v5.2.3, estimate release date: 2024/10/10
#### Quarter Four
- v5.1.5, estimate release date: 2024/11/04 (Maintenance period since June 2024)
- v5.3.2, estimate release date: 2024/12/31
- v5.2.4, estimate release date: 2025/02/20 (Service period ends Feb. 2025)

View File

@ -26,8 +26,6 @@
#define ESP_APPTRACE_MAX_VPRINTF_ARGS 256
#define ESP_APPTRACE_HOST_BUF_SIZE 256
#define ESP_APPTRACE_PRINT_LOCK 0
const static char *TAG = "esp_apptrace";
/** tracing module internal data */
@ -90,7 +88,7 @@ void esp_apptrace_down_buffer_config(uint8_t *buf, uint32_t size)
return;
}
// currently down buffer is supported for JTAG interface only
// TODO: one more argument should be added to this function to specify HW inteface: JTAG, UART0 etc
// TODO: one more argument should be added to this function to specify HW interface: JTAG, UART0 etc
ch = &s_trace_channels[ESP_APPTRACE_DEST_JTAG];
if (ch->hw != NULL) {
if (ch->hw->down_buffer_config != NULL) {

View File

@ -9,12 +9,14 @@
#include "esp_app_trace_util.h"
#include "sdkconfig.h"
#define ESP_APPTRACE_PRINT_LOCK 0
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Locks /////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#if ESP_APPTRACE_PRINT_LOCK
static esp_apptrace_lock_t s_log_lock = {.irq_stat = 0, .portmux = portMUX_INITIALIZER_UNLOCKED};
static esp_apptrace_lock_t s_log_lock = { .mux = portMUX_INITIALIZER_UNLOCKED };
#endif
int esp_apptrace_log_lock(void)
@ -31,7 +33,7 @@ int esp_apptrace_log_lock(void)
void esp_apptrace_log_unlock(void)
{
#if ESP_APPTRACE_PRINT_LOCK
#if ESP_APPTRACE_PRINT_LOCK
esp_apptrace_lock_give(&s_log_lock);
#endif
}
@ -87,7 +89,7 @@ esp_err_t esp_apptrace_lock_give(esp_apptrace_lock_t *lock)
uint8_t *esp_apptrace_rb_produce(esp_apptrace_rb_t *rb, uint32_t size)
{
uint8_t *ptr = rb->data + rb->wr;
// check for avalable space
// check for available space
if (rb->rd <= rb->wr) {
// |?R......W??|
if (rb->wr + size >= rb->size) {

View File

@ -1,7 +0,0 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
components/app_update/test_apps:
disable:
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: target esp32c61 is not supported yet # TODO: [ESP32C61] IDF-9245

View File

@ -1,2 +0,0 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |

View File

@ -1,26 +0,0 @@
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import re
import pytest
from pytest_embedded import Dut
DEFAULT_TIMEOUT = 20
TEST_SUBMENU_PATTERN_PYTEST = re.compile(rb'\s+\((\d+)\)\s+"([^"]+)"\r?\n')
def run_multiple_stages(dut: Dut, test_case_num: int, stages: int) -> None:
for stage in range(1, stages + 1):
dut.write(str(test_case_num))
dut.expect(TEST_SUBMENU_PATTERN_PYTEST, timeout=DEFAULT_TIMEOUT)
dut.write(str(stage))
if stage != stages:
dut.expect_exact('Press ENTER to see the list of tests.')
@pytest.mark.supported_targets
# TODO: [ESP32C61] IDF-9245, IDF-9247, IDF-10983
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='C61 has not supported deep sleep')
@pytest.mark.generic
def test_app_update(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=90)

View File

@ -0,0 +1,12 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
components/app_update/test_apps:
enable:
- if: CONFIG_NAME == "defaults" and IDF_TARGET != "linux"
- if: CONFIG_NAME == "xip_psram" and IDF_TARGET in ["esp32s2", "esp32s3", "esp32p4"]
# S2 doesn't have ROM for flash
- if: CONFIG_NAME == "xip_psram_with_rom_impl" and IDF_TARGET in ["esp32s3", "esp32p4"]
disable:
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: target esp32c61 is not supported yet # TODO: [ESP32C61] IDF-9245

View File

@ -0,0 +1,2 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- |

View File

@ -1,4 +1,4 @@
idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES cmock test_utils app_update bootloader_support nvs_flash driver spi_flash
PRIV_REQUIRES cmock test_utils app_update bootloader_support nvs_flash driver spi_flash esp_psram
WHOLE_ARCHIVE)

View File

@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "esp_log.h"
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <freertos/semphr.h>
@ -113,3 +114,11 @@ TEST_CASE("esp_ota_get_partition_description", "[ota]")
};
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, bootloader_common_get_partition_description(&not_app_pos, &app_desc1));
}
TEST_CASE("esp_ota_get_running_partition points to correct address", "[spi_flash]")
{
const esp_partition_t *factory = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_ANY, "factory");
const esp_partition_t* part = esp_ota_get_running_partition();
ESP_LOGI("running bin", "0x%p", (void*)part->address);
TEST_ASSERT_EQUAL_HEX32(factory->address, part->address);
}

View File

@ -0,0 +1,52 @@
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import re
import pytest
from pytest_embedded import Dut
DEFAULT_TIMEOUT = 20
TEST_SUBMENU_PATTERN_PYTEST = re.compile(rb'\s+\((\d+)\)\s+"([^"]+)"\r?\n')
@pytest.mark.supported_targets
@pytest.mark.temp_skip_ci(targets=['esp32c5'], reason='C5 has not supported deep sleep') # TODO: [ESP32C5] IDF-8640, IDF-10317
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
[
'defaults',
],
indirect=True,
)
def test_app_update(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=90)
@pytest.mark.supported_targets
# TODO: [ESP32C61] IDF-9245, IDF-10983
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='C61 has not supported deep sleep')
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
[
'xip_psram',
],
indirect=True,
)
def test_app_update_xip_psram(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=90)
@pytest.mark.supported_targets
@pytest.mark.temp_skip_ci(targets=['esp32c5'], reason='C5 has not supported deep sleep') # TODO: [ESP32C5] IDF-8640, IDF-10317
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
[
'xip_psram_with_rom_impl',
],
indirect=True,
)
def test_app_update_xip_psram_rom_impl(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=90)

View File

@ -0,0 +1,2 @@
# don't delete.
# used for CI to compile a default config when 'sdkconfig.ci.xxxx' is exist

View File

@ -1,2 +1,2 @@
CONFIG_IDF_TARGET="esp32c5"
CONFIG_SPIRAM=y
CONFIG_SPIRAM_XIP_FROM_PSRAM=y

View File

@ -0,0 +1,3 @@
CONFIG_SPIRAM=y
CONFIG_SPIRAM_XIP_FROM_PSRAM=y
CONFIG_SPI_FLASH_ROM_IMPL=y

View File

@ -16,12 +16,6 @@
#include "hal/apm_hal.h"
#endif
#if CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-9230 Remove the workaround when APM supported on C61!
#include "soc/hp_apm_reg.h"
#include "soc/lp_apm_reg.h"
#endif
void bootloader_init_mem(void)
{
@ -38,13 +32,6 @@ void bootloader_init_mem(void)
#endif
#endif
#if CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-9230 Remove the workaround when APM supported on C61!
// disable apm filter
REG_WRITE(LP_APM_FUNC_CTRL_REG, 0);
REG_WRITE(HP_APM_FUNC_CTRL_REG, 0);
#endif
#ifdef CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE
// protect memory region
esp_cpu_configure_region_protection();

View File

@ -13,8 +13,6 @@
static SHA_CTX ctx;
//TODO: [ESP32C61] IDF-9234
bootloader_sha256_handle_t bootloader_sha256_start()
{
// Enable SHA hardware

View File

@ -6,6 +6,8 @@ endif()
if(CONFIG_IDF_TARGET_ESP32S3)
set(target_name "esp32c3")
elseif(CONFIG_IDF_TARGET_ESP32C61)
set(target_name "esp32c6")
else()
set(target_name "${idf_target}")
endif()
@ -854,7 +856,16 @@ if(CONFIG_BT_ENABLED)
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
elseif(CONFIG_BT_CONTROLLER_ENABLED)
add_prebuilt_library(libble_app "controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a")
if(CONFIG_IDF_TARGET_ESP32C6)
add_prebuilt_library(libble_app
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c6/esp32c6-bt-lib/esp32c6/libble_app.a")
elseif(CONFIG_IDF_TARGET_ESP32C61)
add_prebuilt_library(libble_app
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c6/esp32c6-bt-lib/esp32c61/libble_app.a")
else()
add_prebuilt_library(libble_app
"controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a")
endif()
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
endif()

View File

@ -200,8 +200,8 @@ choice BT_CTRL_DFT_TX_POWER_LEVEL
bool "+15dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_P18
bool "+18dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_P21
bool "+21dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_P20
bool "+20dBm"
endchoice
config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
@ -221,7 +221,7 @@ config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
default 12 if BT_CTRL_DFT_TX_POWER_LEVEL_P12
default 13 if BT_CTRL_DFT_TX_POWER_LEVEL_P15
default 14 if BT_CTRL_DFT_TX_POWER_LEVEL_P18
default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P21
default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P20
default 0
config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP

View File

@ -0,0 +1 @@
source "$IDF_PATH/components/bt/controller/esp32c6/Kconfig.in"

@ -1 +1 @@
Subproject commit e652624750341aca124e9f850e261b0c1ac63529
Subproject commit e5c7ef0bf701d02c2203e26081fdd348d45935e5

@ -1 +1 @@
Subproject commit b8ef2c474d392a88ea7e6626f89acf1fa5f30e4a
Subproject commit 5c913171361dac0821e15e83cc0cf604149e1b84

@ -1 +1 @@
Subproject commit f95513f22be7b21429b01ba05dbfbc98097b5e67
Subproject commit 3f15aa1d602aedf510dd9c686b3f7e5ea8a44002

@ -1 +1 @@
Subproject commit 58a293a2b4c305157723908ea29c2776f5803bbc
Subproject commit 50f567fff506f63b4d06ebea80d0405fe9e39568

@ -1 +1 @@
Subproject commit 8312e0e0d5390d04fd282e8005528d2b5c351c08
Subproject commit cba99c5a2e7f5d4bccb04e8f3f968dc888bb5667

View File

@ -126,6 +126,7 @@ config BT_L2CAP_ENABLED
config BT_SDP_COMMON_ENABLED
bool "BT SDP COMMON"
depends on BT_CLASSIC_ENABLED
default y if BT_L2CAP_ENABLED
default n
help
This enables common SDP operation, such as SDP record creation and deletion.

View File

@ -242,6 +242,7 @@ typedef union {
*/
struct gatts_rsp_evt_param {
esp_gatt_status_t status; /*!< Operation status */
uint16_t conn_id; /*!< Connection id */
uint16_t handle; /*!< Attribute handle which send response */
} rsp; /*!< Gatt server callback param of ESP_GATTS_RESPONSE_EVT */

View File

@ -65,64 +65,66 @@ typedef enum {
/**
* @brief SDP header structure
*/
typedef struct {
esp_bluetooth_sdp_types_t type; /*!< SDP type */
uint32_t service_name_length; /*!< Service name length */
char *service_name; /*!< Service name */
int32_t rfcomm_channel_number; /*!< RFCOMM channel number, if not used set to -1*/
int32_t l2cap_psm; /*!< L2CAP psm, if not used set to -1 */
int32_t profile_version; /*!< Profile version */
} esp_bluetooth_sdp_hdr_t;
typedef struct bluetooth_sdp_hdr_overlay {
esp_bluetooth_sdp_types_t type; /*!< SDP type */
esp_bt_uuid_t uuid; /*!< UUID type, include uuid and uuid length, only needed to be set for RAW record creation */
uint32_t service_name_length; /*!< Service name length */
char *service_name; /*!< Service name */
int32_t rfcomm_channel_number; /*!< RFCOMM channel number, if not used set to -1*/
int32_t l2cap_psm; /*!< L2CAP psm, if not used set to -1 */
int32_t profile_version; /*!< Profile version */
int user1_ptr_len; /*!< User data1 length, only used for searching RAW record */
uint8_t *user1_ptr; /*!< User data1 pointer to the raw SDP response data, only used for searching RAW record */
int user2_ptr_len __attribute__((deprecated)); /*!< User data2 length, only used for searching RAW record */
uint8_t *user2_ptr __attribute__((deprecated)); /*!< User data2 pointer, only used for searching RAW record */
} esp_bluetooth_sdp_hdr_overlay_t;
/**
* @brief Raw SDP record
*/
typedef struct {
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
esp_bt_uuid_t uuid; /*!< UUID type include uuid and uuid length */
int user1_ptr_len; /*!< Length of raw SDP data */
uint8_t *user1_ptr; /*!< Raw SDP data */
typedef struct bluetooth_sdp_raw_record {
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
} esp_bluetooth_sdp_raw_record_t;
/**
* @brief Message Access Profile - Server parameters
*/
typedef struct {
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
uint32_t mas_instance_id; /*!< MAS Instance ID */
uint32_t supported_features; /*!< Map supported features */
uint32_t supported_message_types; /*!< Supported message types */
typedef struct bluetooth_sdp_mas_record {
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
uint32_t mas_instance_id; /*!< MAS Instance ID */
uint32_t supported_features; /*!< Map supported features */
uint32_t supported_message_types; /*!< Supported message types */
} esp_bluetooth_sdp_mas_record_t;
/**
* @brief Message Access Profile - Client (Notification Server) parameters
*/
typedef struct {
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
uint32_t supported_features; /*!< Supported features */
typedef struct bluetooth_sdp_mns_record {
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
uint32_t supported_features; /*!< Supported features */
} esp_bluetooth_sdp_mns_record_t;
/**
* @brief Phone Book Profile - Server parameters
*/
typedef struct {
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
uint32_t supported_features; /*!< PBAP Supported Features */
uint32_t supported_repositories; /*!< Supported Repositories */
typedef struct bluetooth_sdp_pse_record {
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
uint32_t supported_features; /*!< PBAP Supported Features */
uint32_t supported_repositories; /*!< Supported Repositories */
} esp_bluetooth_sdp_pse_record_t;
/**
* @brief Phone Book Profile - Client parameters
*/
typedef struct {
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
typedef struct bluetooth_sdp_pce_record {
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
} esp_bluetooth_sdp_pce_record_t;
/**
* @brief Object Push Profile parameters
*/
typedef struct {
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
typedef struct bluetooth_sdp_ops_record {
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
int supported_formats_list_len; /*!< Supported formats list length */
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH]; /*!< Supported formats list */
} esp_bluetooth_sdp_ops_record_t;
@ -130,8 +132,8 @@ typedef struct {
/**
* @brief SIM Access Profile parameters
*/
typedef struct {
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
typedef struct bluetooth_sdp_sap_record {
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
} esp_bluetooth_sdp_sap_record_t;
/**
@ -148,21 +150,21 @@ typedef enum {
* @note Only one primary Device Identification service record can be added in the SDP database. If primary
* Device Identification service is created multiple times, only the last one will take effect.
*/
typedef struct {
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
uint16_t vendor; /*!< Vendor ID */
uint16_t vendor_id_source; /*!< Vendor ID source, 0x0001 for Bluetooth, 0x0002 for USB, other values reserved, see `esp_sdp_vendor_id_source_t` */
uint16_t product; /*!< Product ID */
uint16_t version; /*!< Release version in format 0xJJMN(JJ major number, M minor number, N sub-minor number) */
bool primary_record; /*!< Indicate if the record is primary, shall set to true if there is a only single device
record, others shall be set to false */
typedef struct bluetooth_sdp_dip_record {
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
uint16_t vendor; /*!< Vendor ID */
uint16_t vendor_id_source; /*!< Vendor ID source, 0x0001 for Bluetooth, 0x0002 for USB, other values reserved, see `esp_sdp_vendor_id_source_t` */
uint16_t product; /*!< Product ID */
uint16_t version; /*!< Release version in format 0xJJMN(JJ major number, M minor number, N sub-minor number) */
bool primary_record; /*!< Indicate if the record is primary, shall set to true if there is a only single device
record, others shall be set to false */
} esp_bluetooth_sdp_dip_record_t;
/**
* @brief SDP record parameters union
*/
typedef union {
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
esp_bluetooth_sdp_raw_record_t raw; /*!< Raw SDP search data for unknown UUIDs */
esp_bluetooth_sdp_mas_record_t mas; /*!< Message Access Profile - Server */
esp_bluetooth_sdp_mns_record_t mns; /*!< Message Access Profile - Client (Notification Server) */
@ -205,7 +207,7 @@ typedef union {
/**
* @brief ESP_SDP_CREATE_RECORD_COMP_EVT
*/
struct sdp_crate_record_evt_param {
struct sdp_create_record_evt_param {
esp_sdp_status_t status; /*!< Status */
int record_handle; /*!< SDP record handle */
} create_record; /*!< SDP callback param of ESP_SDP_CREATE_RECORD_COMP_EVT */

View File

@ -85,9 +85,11 @@ typedef void (tBTA_SDP_DM_CBACK)(tBTA_SDP_EVT event, tBTA_SDP *p_data, void *use
/* MCE configuration structure */
typedef struct {
UINT16 sdp_db_size; /* The size of p_sdp_db */
UINT16 sdp_raw_size; /* The size of p_sdp_raw_data */
UINT16 sdp_db_size; /* The size of p_sdp_db */
#if (SDP_INCLUDED == TRUE)
tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */
UINT8 *p_sdp_raw_data; /* The data buffer to keep raw data */
tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */
#endif ///SDP_INCLUDED == TRUE
} tBTA_SDP_CFG;

View File

@ -395,29 +395,29 @@ static void bta_create_raw_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE
tSDP_DISC_ATTR *p_attr;
tSDP_PROTOCOL_ELEM pe;
record->hdr.type = SDP_TYPE_RAW;
record->hdr.service_name_length = 0;
record->hdr.service_name = NULL;
record->hdr.rfcomm_channel_number = -1;
record->hdr.l2cap_psm = -1;
record->hdr.profile_version = -1;
record->raw.hdr.type = SDP_TYPE_RAW;
record->raw.hdr.service_name_length = 0;
record->raw.hdr.service_name = NULL;
record->raw.hdr.rfcomm_channel_number = -1;
record->raw.hdr.l2cap_psm = -1;
record->raw.hdr.profile_version = -1;
/* Try to extract a service name */
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SERVICE_NAME)) != NULL) {
record->pse.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
record->pse.hdr.service_name = (char *)p_attr->attr_value.v.array;
record->raw.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
record->raw.hdr.service_name = (char *)p_attr->attr_value.v.array;
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_GOEP_L2CAP_PSM)) != NULL) {
record->hdr.l2cap_psm = p_attr->attr_value.v.u16;
record->raw.hdr.l2cap_psm = p_attr->attr_value.v.u16;
}
/* Try to extract an RFCOMM channel */
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe)) {
record->pse.hdr.rfcomm_channel_number = pe.params[0];
record->raw.hdr.rfcomm_channel_number = pe.params[0];
}
record->raw.user1_ptr_len = p_bta_sdp_cfg->p_sdp_db->raw_size;
record->raw.user1_ptr = p_bta_sdp_cfg->p_sdp_db->raw_data;
record->raw.hdr.user1_ptr_len = p_bta_sdp_cfg->p_sdp_db->raw_used;
record->raw.hdr.user1_ptr = p_bta_sdp_cfg->p_sdp_db->raw_data;
}
@ -570,6 +570,10 @@ void bta_sdp_search(tBTA_SDP_MSG *p_data)
SDP_InitDiscoveryDb (p_bta_sdp_cfg->p_sdp_db, p_bta_sdp_cfg->sdp_db_size, 1,
bta_sdp_search_uuid, 0, NULL);
/* tell SDP to keep the raw data */
p_bta_sdp_cfg->p_sdp_db->raw_size = p_bta_sdp_cfg->sdp_raw_size;
p_bta_sdp_cfg->p_sdp_db->raw_data = p_bta_sdp_cfg->p_sdp_raw_data;
if (!SDP_ServiceSearchAttributeRequest2(p_data->get_search.bd_addr, p_bta_sdp_cfg->p_sdp_db,
bta_sdp_search_cback, (void *)bta_sdp_search_uuid)) {
bta_sdp_cb.sdp_active = BTA_SDP_ACTIVE_NONE;

View File

@ -65,7 +65,9 @@ tBTA_SDP_STATUS BTA_SdpEnable(tBTA_SDP_DM_CBACK *p_cback)
#if BTA_DYNAMIC_MEMORY == TRUE
/* Malloc buffer for SDP configuration structure */
p_bta_sdp_cfg->p_sdp_db = (tSDP_DISCOVERY_DB *)osi_malloc(p_bta_sdp_cfg->sdp_db_size);
if (p_bta_sdp_cfg->p_sdp_db == NULL) {
p_bta_sdp_cfg->p_sdp_raw_data = (UINT8 *)osi_malloc(p_bta_sdp_cfg->sdp_raw_size);
if (p_bta_sdp_cfg->p_sdp_db == NULL || p_bta_sdp_cfg->p_sdp_raw_data == NULL) {
BTA_SdpCleanup();
return BTA_SDP_FAILURE;
}
#endif
@ -118,8 +120,15 @@ tBTA_SDP_STATUS BTA_SdpCleanup(void)
bta_sys_deregister(BTA_ID_SDP);
#if BTA_DYNAMIC_MEMORY == TRUE
/* Free buffer for SDP configuration structure */
osi_free(p_bta_sdp_cfg->p_sdp_db);
p_bta_sdp_cfg->p_sdp_db = NULL;
if (p_bta_sdp_cfg->p_sdp_db) {
osi_free(p_bta_sdp_cfg->p_sdp_db);
p_bta_sdp_cfg->p_sdp_db = NULL;
}
if (p_bta_sdp_cfg->p_sdp_raw_data) {
osi_free(p_bta_sdp_cfg->p_sdp_raw_data);
p_bta_sdp_cfg->p_sdp_raw_data = NULL;
}
#endif
return BTA_SDP_SUCCESS;
}

View File

@ -30,16 +30,24 @@
#define BTA_SDP_DB_SIZE 1500
#endif
#ifndef BTA_SDP_RAW_DATA_SIZE
#define BTA_SDP_RAW_DATA_SIZE 1024
#endif
#if BTA_DYNAMIC_MEMORY == FALSE
static UINT8 bta_sdp_raw_data[BTA_SDP_RAW_DATA_SIZE];
static UINT8 __attribute__ ((aligned(4))) bta_sdp_db_data[BTA_SDP_DB_SIZE];
#endif
/* SDP configuration structure */
tBTA_SDP_CFG bta_sdp_cfg = {
BTA_SDP_RAW_DATA_SIZE,
BTA_SDP_DB_SIZE,
#if BTA_DYNAMIC_MEMORY == FALSE
bta_sdp_raw_data,
(tSDP_DISCOVERY_DB *)bta_sdp_db_data /* The data buffer to keep SDP database */
#else
NULL,
NULL
#endif
};

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -469,7 +469,7 @@ static esp_gatt_status_t btc_gatts_check_valid_attr_tab(esp_gatts_attr_db_t *gat
if(gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_16 &&
gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_32 &&
gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_128) {
BTC_TRACE_ERROR("%s, The Charateristic uuid length = %d is invalid", __func__,\
BTC_TRACE_ERROR("%s, The Characteristic uuid length = %d is invalid", __func__,\
gatts_attr_db[i+1].att_desc.uuid_length);
return ESP_GATT_INVALID_ATTR_LEN;
}
@ -481,7 +481,7 @@ static esp_gatt_status_t btc_gatts_check_valid_attr_tab(esp_gatts_attr_db_t *gat
uuid == ESP_GATT_UUID_CHAR_SRVR_CONFIG || uuid == ESP_GATT_UUID_CHAR_PRESENT_FORMAT ||
uuid == ESP_GATT_UUID_CHAR_AGG_FORMAT || uuid == ESP_GATT_UUID_CHAR_VALID_RANGE ||
uuid == ESP_GATT_UUID_EXT_RPT_REF_DESCR || uuid == ESP_GATT_UUID_RPT_REF_DESCR) {
BTC_TRACE_ERROR("%s, The charateristic value uuid = %d is invalid", __func__, uuid);
BTC_TRACE_ERROR("%s, The characteristic value uuid = %d is invalid", __func__, uuid);
return ESP_GATT_INVALID_PDU;
}
}
@ -694,6 +694,7 @@ void btc_gatts_call_handler(btc_msg_t *msg)
}
param.rsp.status = 0;
param.rsp.conn_id = BTC_GATT_GET_CONN_ID(arg->send_rsp.conn_id);
btc_gatts_cb_to_app(ESP_GATTS_RESPONSE_EVT, BTC_GATT_GET_GATT_IF(arg->send_rsp.conn_id), &param);
break;
}

View File

@ -38,73 +38,79 @@ typedef enum {
SDP_TYPE_DIP_SERVER, // Device Identification Profile
} bluetooth_sdp_types;
typedef struct _bluetooth_sdp_hdr {
/**
* Some signals need additional pointers, hence we introduce a
* generic way to handle these pointers.
*/
typedef struct _bluetooth_sdp_hdr_overlay {
bluetooth_sdp_types type;
esp_bt_uuid_t uuid;
uint32_t service_name_length;
char *service_name;
int32_t rfcomm_channel_number;
int32_t l2cap_psm;
int32_t profile_version;
} bluetooth_sdp_hdr;
int user1_ptr_len;
uint8_t *user1_ptr;
int user2_ptr_len; // not used
uint8_t *user2_ptr; // not used
} bluetooth_sdp_hdr_overlay;
typedef struct _bluetooth_sdp_raw_record {
bluetooth_sdp_hdr hdr;
esp_bt_uuid_t uuid;
int user1_ptr_len;
uint8_t *user1_ptr;
bluetooth_sdp_hdr_overlay hdr;
} bluetooth_sdp_raw_record;
typedef struct _bluetooth_sdp_mas_record {
bluetooth_sdp_hdr hdr;
uint32_t mas_instance_id;
uint32_t supported_features;
uint32_t supported_message_types;
bluetooth_sdp_hdr_overlay hdr;
uint32_t mas_instance_id;
uint32_t supported_features;
uint32_t supported_message_types;
} bluetooth_sdp_mas_record;
typedef struct _bluetooth_sdp_mns_record {
bluetooth_sdp_hdr hdr;
uint32_t supported_features;
bluetooth_sdp_hdr_overlay hdr;
uint32_t supported_features;
} bluetooth_sdp_mns_record;
typedef struct _bluetooth_sdp_pse_record {
bluetooth_sdp_hdr hdr;
uint32_t supported_features;
uint32_t supported_repositories;
bluetooth_sdp_hdr_overlay hdr;
uint32_t supported_features;
uint32_t supported_repositories;
} bluetooth_sdp_pse_record;
typedef struct _bluetooth_sdp_pce_record {
bluetooth_sdp_hdr hdr;
bluetooth_sdp_hdr_overlay hdr;
} bluetooth_sdp_pce_record;
typedef struct _bluetooth_sdp_ops_record {
bluetooth_sdp_hdr hdr;
int supported_formats_list_len;
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH];
bluetooth_sdp_hdr_overlay hdr;
int supported_formats_list_len;
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH];
} bluetooth_sdp_ops_record;
typedef struct _bluetooth_sdp_sap_record {
bluetooth_sdp_hdr hdr;
bluetooth_sdp_hdr_overlay hdr;
} bluetooth_sdp_sap_record;
typedef struct _bluetooth_sdp_dip_record {
bluetooth_sdp_hdr hdr;
uint16_t vendor;
uint16_t vendor_id_source;
uint16_t product;
uint16_t version;
bool primary_record;
bluetooth_sdp_hdr_overlay hdr;
uint16_t vendor;
uint16_t vendor_id_source;
uint16_t product;
uint16_t version;
bool primary_record;
} bluetooth_sdp_dip_record;
typedef union {
bluetooth_sdp_hdr hdr;
bluetooth_sdp_raw_record raw;
bluetooth_sdp_mas_record mas;
bluetooth_sdp_mns_record mns;
bluetooth_sdp_pse_record pse;
bluetooth_sdp_pce_record pce;
bluetooth_sdp_ops_record ops;
bluetooth_sdp_sap_record sap;
bluetooth_sdp_dip_record dip;
bluetooth_sdp_hdr_overlay hdr;
bluetooth_sdp_raw_record raw;
bluetooth_sdp_mas_record mas;
bluetooth_sdp_mns_record mns;
bluetooth_sdp_pse_record pse;
bluetooth_sdp_pce_record pce;
bluetooth_sdp_ops_record ops;
bluetooth_sdp_sap_record sap;
bluetooth_sdp_dip_record dip;
} bluetooth_sdp_record;
#endif /* __BT_SDP_H__ */

View File

@ -91,11 +91,6 @@ static int get_sdp_record_size(bluetooth_sdp_record* in_record)
records_size = sizeof(bluetooth_sdp_record);
break;
case SDP_TYPE_RAW:
if (record->raw.user1_ptr != NULL) {
records_size += record->raw.user1_ptr_len;
}
/* fall through */
default:
records_size += sizeof(bluetooth_sdp_record);
records_size += record->hdr.service_name_length;
@ -254,12 +249,6 @@ static void copy_sdp_record_common(bluetooth_sdp_record* in_record, bluetooth_sd
*(free_ptr) = '\0'; // Set '\0' termination of string
free_ptr++;
}
if (in_record->hdr.type == SDP_TYPE_RAW && in_record->raw.user1_ptr != NULL) {
out_record->raw.user1_ptr = (UINT8 *)free_ptr; // Update pointer
memcpy(free_ptr, in_record->raw.user1_ptr, in_record->raw.user1_ptr_len); // Copy content
free_ptr += in_record->raw.user1_ptr_len;
}
}
static void copy_sdp_record(bluetooth_sdp_record* in_record, bluetooth_sdp_record* out_record)
@ -402,6 +391,7 @@ static int add_raw_sdp(const bluetooth_sdp_raw_record *rec)
UINT8 temp[LEN_UUID_128];
UINT8* p_temp = temp;
UINT32 sdp_handle = 0;
const esp_bt_uuid_t *p_uuid = &rec->hdr.uuid;
BTC_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__,
rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name);
@ -411,15 +401,15 @@ static int add_raw_sdp(const bluetooth_sdp_raw_record *rec)
return sdp_handle;
}
if (rec->uuid.len == ESP_UUID_LEN_16) {
if (p_uuid->len == ESP_UUID_LEN_16) {
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES);
UINT16_TO_BE_STREAM (p_temp, rec->uuid.uuid.uuid16);
} else if (rec->uuid.len == ESP_UUID_LEN_32) {
UINT16_TO_BE_STREAM (p_temp, p_uuid->uuid.uuid16);
} else if (p_uuid->len == ESP_UUID_LEN_32) {
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES);
UINT32_TO_BE_STREAM (p_temp, rec->uuid.uuid.uuid32);
} else if (rec->uuid.len == ESP_UUID_LEN_128) {
UINT32_TO_BE_STREAM (p_temp, p_uuid->uuid.uuid32);
} else if (p_uuid->len == ESP_UUID_LEN_128) {
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
ARRAY_TO_BE_STREAM (p_temp, rec->uuid.uuid.uuid128, LEN_UUID_128);
ARRAY_TO_BE_STREAM (p_temp, p_uuid->uuid.uuid128, LEN_UUID_128);
} else {
SDP_DeleteRecord(sdp_handle);
sdp_handle = 0;
@ -466,12 +456,12 @@ static int add_raw_sdp(const bluetooth_sdp_raw_record *rec)
sdp_handle = 0;
BTC_TRACE_ERROR("%s() FAILED, status = %d", __func__, status);
} else {
if (rec->uuid.len == ESP_UUID_LEN_16) {
bta_sys_add_uuid(rec->uuid.uuid.uuid16);
} else if (rec->uuid.len == ESP_UUID_LEN_32) {
bta_sys_add_uuid_32(rec->uuid.uuid.uuid32);
} else if (rec->uuid.len == ESP_UUID_LEN_128) {
bta_sys_add_uuid_128((UINT8 *)&rec->uuid.uuid.uuid128);
if (p_uuid->len == ESP_UUID_LEN_16) {
bta_sys_add_uuid(p_uuid->uuid.uuid16);
} else if (p_uuid->len == ESP_UUID_LEN_32) {
bta_sys_add_uuid_32(p_uuid->uuid.uuid32);
} else if (p_uuid->len == ESP_UUID_LEN_128) {
bta_sys_add_uuid_128((UINT8 *)&p_uuid->uuid.uuid128);
}
BTC_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
}
@ -943,7 +933,7 @@ static int btc_handle_create_record_event(int id)
switch (record->hdr.type) {
case SDP_TYPE_RAW:
sdp_handle = add_raw_sdp(&record->raw);
memcpy(&service_uuid, &record->raw.uuid, sizeof(esp_bt_uuid_t));
memcpy(&service_uuid, &record->hdr.uuid, sizeof(esp_bt_uuid_t));
break;
case SDP_TYPE_MAP_MAS:
sdp_handle = add_maps_sdp(&record->mas);
@ -1041,6 +1031,83 @@ static bool btc_sdp_remove_record_event(int id, int *p_sdp_handle)
return result;
}
static void btc_sdp_cb_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
switch (msg->act) {
case BTA_SDP_SEARCH_COMP_EVT: {
tBTA_SDP_SEARCH_COMP *src_search_comp = (tBTA_SDP_SEARCH_COMP *)p_src;
tBTA_SDP_SEARCH_COMP *dest_search_comp = (tBTA_SDP_SEARCH_COMP *)p_dest;
int record_count = src_search_comp->record_count;
for (int i = 0; i < record_count; i++) {
bluetooth_sdp_record *src_record = &src_search_comp->records[i];
bluetooth_sdp_record *dest_record = &dest_search_comp->records[i];
// deep copy service name
uint32_t src_service_name_length = src_record->hdr.service_name_length;
char *src_service_name = src_record->hdr.service_name;
dest_record->hdr.service_name_length = 0;
dest_record->hdr.service_name = NULL;
if (src_service_name && src_service_name_length) {
char *service_name = (char *)osi_malloc(src_service_name_length + 1);
if (service_name) {
memcpy(service_name, src_service_name, src_service_name_length);
service_name[src_service_name_length] = '\0';
dest_record->hdr.service_name_length = src_service_name_length;
dest_record->hdr.service_name = service_name;
} else {
BTC_TRACE_ERROR("%s malloc service name failed, orig service name:%s", __func__, src_service_name);
}
}
// deep copy user1_ptr fow RAW type
int src_user1_ptr_len = src_record->hdr.user1_ptr_len;
uint8_t *src_user1_ptr = src_record->hdr.user1_ptr;
dest_record->hdr.user1_ptr_len = 0;
dest_record->hdr.user1_ptr = NULL;
if (src_record->hdr.type == SDP_TYPE_RAW && src_user1_ptr && src_user1_ptr_len) {
uint8_t *user1_ptr = (uint8_t *)osi_malloc(src_user1_ptr_len);
if (user1_ptr) {
memcpy(user1_ptr, src_user1_ptr, src_user1_ptr_len);
dest_record->hdr.user1_ptr_len = src_user1_ptr_len;
dest_record->hdr.user1_ptr = user1_ptr;
} else {
BTC_TRACE_ERROR("%s malloc user1_ptr failed", __func__);
}
}
}
break;
}
default:
break;
}
}
static void btc_sdp_cb_arg_deep_free(btc_msg_t *msg)
{
switch (msg->act) {
case BTA_SDP_SEARCH_COMP_EVT: {
tBTA_SDP_SEARCH_COMP *search_comp = (tBTA_SDP_SEARCH_COMP *)msg->arg;
for (size_t i = 0; i < search_comp->record_count; i++) {
bluetooth_sdp_record *record = &search_comp->records[i];
if (record->hdr.service_name) {
osi_free(record->hdr.service_name);
}
if (record->hdr.user1_ptr) {
osi_free(record->hdr.user1_ptr);
}
}
break;
}
default:
break;
}
}
static void btc_sdp_dm_cback(tBTA_SDP_EVT event, tBTA_SDP* p_data, void* user_data)
{
btc_msg_t msg;
@ -1072,7 +1139,7 @@ static void btc_sdp_dm_cback(tBTA_SDP_EVT event, tBTA_SDP* p_data, void* user_da
msg.pid = BTC_PID_SDP;
msg.act = event;
status = btc_transfer_context(&msg, p_data, sizeof(tBTA_SDP), NULL, NULL);
status = btc_transfer_context(&msg, p_data, sizeof(tBTA_SDP), btc_sdp_cb_arg_deep_copy, btc_sdp_cb_arg_deep_free);
if (status != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed", __func__);
@ -1244,11 +1311,10 @@ static void btc_sdp_search(btc_sdp_args_t *arg)
void btc_sdp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
bluetooth_sdp_record **dst_record = &((btc_sdp_args_t *)p_dest)->create_record.record;
bluetooth_sdp_record *src_record = ((btc_sdp_args_t *)p_src)->create_record.record;
switch (msg->act) {
case BTC_SDP_ACT_CREATE_RECORD:
case BTC_SDP_ACT_CREATE_RECORD: {
bluetooth_sdp_record **dst_record = &((btc_sdp_args_t *)p_dest)->create_record.record;
bluetooth_sdp_record *src_record = ((btc_sdp_args_t *)p_src)->create_record.record;
bluetooth_sdp_record *record = (bluetooth_sdp_record *)osi_calloc(get_sdp_record_size(src_record));
if (record) {
copy_sdp_record(src_record, record);
@ -1259,6 +1325,7 @@ void btc_sdp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
*dst_record = record;
break;
}
default:
break;
}
@ -1266,15 +1333,15 @@ void btc_sdp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
void btc_sdp_arg_deep_free(btc_msg_t *msg)
{
btc_sdp_args_t *arg = (btc_sdp_args_t *)msg->arg;
bluetooth_sdp_record *record = arg->create_record.record;
switch (msg->act) {
case BTC_SDP_ACT_CREATE_RECORD:
case BTC_SDP_ACT_CREATE_RECORD: {
btc_sdp_args_t *arg = (btc_sdp_args_t *)msg->arg;
bluetooth_sdp_record *record = arg->create_record.record;
if (record) {
osi_free(record);
}
break;
}
default:
break;
}
@ -1331,23 +1398,11 @@ void btc_sdp_cb_handler(btc_msg_t *msg)
sdp_local_param.search_allowed = true;
param.search.status = p_data->sdp_search_comp.status;
if (param.search.status == ESP_SDP_SUCCESS) {
memcpy(param.search.remote_addr, p_data->sdp_search_comp.remote_addr, sizeof(BD_ADDR));
memcpy(&param.search.sdp_uuid, &p_data->sdp_search_comp.uuid, sizeof(tSDP_UUID));
param.search.record_count = p_data->sdp_search_comp.record_count;
param.search.records = osi_malloc(sizeof(esp_bluetooth_sdp_record_t)*p_data->sdp_search_comp.record_count);
if (param.search.records != NULL) {
memcpy(param.search.records, p_data->sdp_search_comp.records,
sizeof(esp_bluetooth_sdp_record_t)*p_data->sdp_search_comp.record_count);
} else {
BTC_TRACE_ERROR("%s %d osi_malloc failed\n", __func__, event);
param.search.status = ESP_SDP_NO_RESOURCE;
}
}
memcpy(param.search.remote_addr, p_data->sdp_search_comp.remote_addr, sizeof(BD_ADDR));
memcpy(&param.search.sdp_uuid, &p_data->sdp_search_comp.uuid, sizeof(tSDP_UUID));
param.search.record_count = p_data->sdp_search_comp.record_count;
param.search.records = (esp_bluetooth_sdp_record_t *)p_data->sdp_search_comp.records;
btc_sdp_cb_to_app(ESP_SDP_SEARCH_COMP_EVT, &param);
if (param.search.records != NULL) {
osi_free(param.search.records);
}
break;
case BTA_SDP_CREATE_RECORD_USER_EVT:
param.create_record.status = p_data->sdp_create_record.status;
@ -1372,6 +1427,8 @@ void btc_sdp_cb_handler(btc_msg_t *msg)
BTC_TRACE_DEBUG("%s: Unhandled event (%d)!", __func__, msg->act);
break;
}
btc_sdp_cb_arg_deep_free(msg);
}
#endif ///defined BTC_SDP_COMMON_INCLUDED && BTC_SDP_COMMON_INCLUDED == TRUE

View File

@ -1310,7 +1310,7 @@
#ifdef CONFIG_IDF_TARGET_ESP32
#define BTM_BLE_ADV_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9}
#else
#define BTM_BLE_ADV_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21}
#define BTM_BLE_ADV_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 20}
#endif
#endif
@ -1318,7 +1318,7 @@
#ifdef CONFIG_IDF_TARGET_ESP32
#define BTM_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9}
#else
#define BTM_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21}
#define BTM_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 20}
#endif
#endif

View File

@ -269,7 +269,7 @@ static void start_up(void)
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
if (HCI_LE_ENHANCED_PRIVACY_SUPPORTED(controller_param.features_ble.as_array)) {
if (HCI_LE_EXT_ADV_SUPPORTED(controller_param.features_ble.as_array)) {
response = AWAIT_COMMAND(controller_param.packet_factory->make_read_max_adv_data_len());
controller_param.packet_parser->parse_ble_read_adv_max_len_response(
response,

View File

@ -186,7 +186,9 @@ static void parse_ble_read_resolving_list_size_response(
{
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_RESOLVING_LIST_SIZE, 1 /* bytes after */);
STREAM_TO_UINT8(*resolving_list_size_ptr, stream);
if (stream) {
STREAM_TO_UINT8(*resolving_list_size_ptr, stream);
}
osi_free(response);
}
@ -198,10 +200,14 @@ static void parse_ble_read_suggested_default_data_length_response(
{
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_DEFAULT_DATA_LENGTH, 2 /* bytes after */);
STREAM_TO_UINT16(*ble_default_packet_length_ptr, stream);
STREAM_TO_UINT16(*ble_default_packet_txtime_ptr, stream);
if (stream) {
STREAM_TO_UINT16(*ble_default_packet_length_ptr, stream);
STREAM_TO_UINT16(*ble_default_packet_txtime_ptr, stream);
}
osi_free(response);
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
static void parse_ble_read_adv_max_len_response(
BT_HDR *response,
@ -209,8 +215,10 @@ static void parse_ble_read_adv_max_len_response(
{
uint8_t *stream = read_command_complete_header(response, HCI_BLE_RD_MAX_ADV_DATA_LEN, 1 /* bytes after */);
// Size: 2 Octets ; Value: 0x001F 0x0672 ; Maximum supported advertising data length
STREAM_TO_UINT16(*adv_max_len_ptr, stream);
if (stream) {
// Size: 2 Octets ; Value: 0x001F 0x0672 ; Maximum supported advertising data length
STREAM_TO_UINT16(*adv_max_len_ptr, stream);
}
osi_free(response);
}
@ -254,6 +262,7 @@ static uint8_t *read_command_complete_header(
STREAM_TO_UINT8(status, stream);
if (status != HCI_SUCCESS) {
HCI_TRACE_ERROR("%s failed: opcode 0x%04x, status 0x%02x", __func__, opcode, status);
return NULL;
}

View File

@ -1871,42 +1871,50 @@ typedef struct {
#define HCI_PING_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_PING_OFF] & HCI_EXT_FEATURE_PING_MASK)
/*
** LE features encoding - page 0 (the only page for now)
** LE features encoding - page 0
*/
/* LE Encryption */
/* LE Encryption: bit 0 */
#define HCI_LE_FEATURE_LE_ENCRYPTION_MASK 0x01
#define HCI_LE_FEATURE_LE_ENCRYPTION_OFF 0
#define HCI_LE_ENCRYPTION_SUPPORTED(x) ((x)[HCI_LE_FEATURE_LE_ENCRYPTION_OFF] & HCI_LE_FEATURE_LE_ENCRYPTION_MASK)
/* Connection Parameters Request Procedure */
/* Connection Parameters Request Procedure: bit 1 */
#define HCI_LE_FEATURE_CONN_PARAM_REQ_MASK 0x02
#define HCI_LE_FEATURE_CONN_PARAM_REQ_OFF 0
#define HCI_LE_CONN_PARAM_REQ_SUPPORTED(x) ((x)[HCI_LE_FEATURE_CONN_PARAM_REQ_OFF] & HCI_LE_FEATURE_CONN_PARAM_REQ_MASK)
/* Extended Reject Indication */
/* Extended Reject Indication: bit 2 */
#define HCI_LE_FEATURE_EXT_REJ_IND_MASK 0x04
#define HCI_LE_FEATURE_EXT_REJ_IND_OFF 0
#define HCI_LE_EXT_REJ_IND_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_REJ_IND_OFF] & HCI_LE_FEATURE_EXT_REJ_IND_MASK)
/* Slave-initiated Features Exchange */
/* Slave-initiated Features Exchange: bit 3 */
#define HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_MASK 0x08
#define HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_OFF 0
#define HCI_LE_SLAVE_INIT_FEAT_EXC_SUPPORTED(x) ((x)[HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_OFF] & HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_MASK)
/* LE Data Packet Length Extension: bit 5 */
#define HCI_LE_FEATURE_DATA_LEN_EXT_MASK 0x20
#define HCI_LE_FEATURE_DATA_LEN_EXT_OFF 0
#define HCI_LE_DATA_LEN_EXT_SUPPORTED(x) ((x)[HCI_LE_FEATURE_DATA_LEN_EXT_OFF] & HCI_LE_FEATURE_DATA_LEN_EXT_MASK)
/* Enhanced privacy Feature: bit 6 */
#define HCI_LE_FEATURE_ENHANCED_PRIVACY_MASK 0x40
#define HCI_LE_FEATURE_ENHANCED_PRIVACY_OFF 0
#define HCI_LE_ENHANCED_PRIVACY_SUPPORTED(x) ((x)[HCI_LE_FEATURE_ENHANCED_PRIVACY_OFF] & HCI_LE_FEATURE_ENHANCED_PRIVACY_MASK)
/* Extended scanner filter policy : 7 */
/* Extended scanner filter policy: bit 7 */
#define HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_MASK 0x80
#define HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_OFF 0
#define HCI_LE_EXT_SCAN_FILTER_POLICY_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_OFF] & HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_MASK)
/* Slave-initiated Features Exchange */
#define HCI_LE_FEATURE_DATA_LEN_EXT_MASK 0x20
#define HCI_LE_FEATURE_DATA_LEN_EXT_OFF 0
#define HCI_LE_DATA_LEN_EXT_SUPPORTED(x) ((x)[HCI_LE_FEATURE_DATA_LEN_EXT_OFF] & HCI_LE_FEATURE_DATA_LEN_EXT_MASK)
/*
** LE features encoding - page 1
*/
/* LE Extended Advertising: bit 12 */
#define HCI_LE_FEATURE_EXT_ADV_MASK 0x10
#define HCI_LE_FEATURE_EXT_ADV_OFF 1
#define HCI_LE_EXT_ADV_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_ADV_OFF] & HCI_LE_FEATURE_EXT_ADV_MASK)
/*
** Local Supported Commands encoding

View File

@ -65,7 +65,7 @@ config BT_NIMBLE_LOG_LEVEL
config BT_NIMBLE_MAX_CONNECTIONS
int "Maximum number of concurrent connections"
range 1 2 if IDF_TARGET_ESP32C2
range 1 70 if IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32C5
range 1 70 if IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32C5 || IDF_TARGET_ESP32C61
range 1 35 if IDF_TARGET_ESP32H2
range 1 9
default 2 if IDF_TARGET_ESP32C2

View File

@ -190,6 +190,11 @@ static void controller_rcv_pkt_ready(void)
}
}
static void dummy_controller_rcv_pkt_ready(void)
{
/* Dummy function */
}
void bt_record_hci_data(uint8_t *data, uint16_t len)
{
#if (BT_HCI_LOG_INCLUDED == TRUE)
@ -203,6 +208,12 @@ void bt_record_hci_data(uint8_t *data, uint16_t len)
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
}
static int dummy_host_rcv_pkt(uint8_t *data, uint16_t len)
{
/* Dummy function */
return 0;
}
/*
* @brief: BT controller callback function, to transfer data packet to the host
*/
@ -264,6 +275,11 @@ static const esp_vhci_host_callback_t vhci_host_cb = {
.notify_host_recv = host_rcv_pkt,
};
static const esp_vhci_host_callback_t dummy_vhci_host_cb = {
.notify_host_send_available = dummy_controller_rcv_pkt_ready,
.notify_host_recv = dummy_host_rcv_pkt,
};
extern void ble_transport_init(void);
extern esp_err_t ble_buf_alloc(void);
@ -313,6 +329,8 @@ esp_err_t esp_nimble_hci_deinit(void)
}
ble_transport_deinit();
esp_vhci_host_register_callback(&dummy_vhci_host_cb);
ble_buf_free();
#if MYNEWT_VAL(BLE_QUEUE_CONG_CHECK)

@ -1 +1 @@
Subproject commit 6b890f81c0db10ae4757e27eb1312f4232d8fb56
Subproject commit 62b04f185717f31c57b802d5059e13b0d4d12b0c

View File

@ -376,17 +376,18 @@ typedef enum {
ESP_PWR_LVL_N18 = 2, /*!< Corresponding to -18dbm */
ESP_PWR_LVL_N15 = 3, /*!< Corresponding to -15dbm */
ESP_PWR_LVL_N12 = 4, /*!< Corresponding to -12dbm */
ESP_PWR_LVL_N9 = 5, /*!< Corresponding to -9dbm */
ESP_PWR_LVL_N6 = 6, /*!< Corresponding to -6dbm */
ESP_PWR_LVL_N3 = 7, /*!< Corresponding to -3dbm */
ESP_PWR_LVL_N0 = 8, /*!< Corresponding to 0dbm */
ESP_PWR_LVL_P3 = 9, /*!< Corresponding to +3dbm */
ESP_PWR_LVL_P6 = 10, /*!< Corresponding to +6dbm */
ESP_PWR_LVL_P9 = 11, /*!< Corresponding to +9dbm */
ESP_PWR_LVL_P12 = 12, /*!< Corresponding to +12dbm */
ESP_PWR_LVL_P15 = 13, /*!< Corresponding to +15dbm */
ESP_PWR_LVL_P18 = 14, /*!< Corresponding to +18dbm */
ESP_PWR_LVL_P21 = 15, /*!< Corresponding to +21dbm */
ESP_PWR_LVL_N9 = 5, /*!< Corresponding to -9dbm */
ESP_PWR_LVL_N6 = 6, /*!< Corresponding to -6dbm */
ESP_PWR_LVL_N3 = 7, /*!< Corresponding to -3dbm */
ESP_PWR_LVL_N0 = 8, /*!< Corresponding to 0dbm */
ESP_PWR_LVL_P3 = 9, /*!< Corresponding to +3dbm */
ESP_PWR_LVL_P6 = 10, /*!< Corresponding to +6dbm */
ESP_PWR_LVL_P9 = 11, /*!< Corresponding to +9dbm */
ESP_PWR_LVL_P12 = 12, /*!< Corresponding to +12dbm */
ESP_PWR_LVL_P15 = 13, /*!< Corresponding to +15dbm */
ESP_PWR_LVL_P18 = 14, /*!< Corresponding to +18dbm */
ESP_PWR_LVL_P20 = 15, /*!< Corresponding to +20dbm */
ESP_PWR_LVL_P21 = 15, /*!< Corresponding to +20dbm, this enum variable has been deprecated */
ESP_PWR_LVL_INVALID = 0xFF, /*!< Indicates an invalid value */
} esp_power_level_t;

View File

@ -206,7 +206,9 @@ typedef struct {
uint8_t cca_drop_mode; /*!< CCA drop mode */
int8_t cca_low_tx_pwr; /*!< CCA low transmit power */
uint8_t main_xtal_freq; /*!< Main crystal frequency */
#if CONFIG_IDF_TARGET_ESP32C6
uint32_t version_num; /*!< Controller configuration version number */
#endif //CONFIG_IDF_TARGET_ESP32C6
uint8_t cpu_freq_mhz; /*!< CPU frequency in megahertz (MHz) */
uint8_t ignore_wl_for_direct_adv; /*!< Ignore the whitelist for direct advertising */
uint8_t enable_pcl; /*!< Enable power control */
@ -214,6 +216,7 @@ typedef struct {
uint32_t config_magic; /*!< Magic number for configuration validation */
} esp_bt_controller_config_t;
#if CONFIG_IDF_TARGET_ESP32C6
#define BT_CONTROLLER_INIT_CONFIG_DEFAULT() { \
.config_version = CONFIG_VERSION, \
.ble_ll_resolv_list_size = CONFIG_BT_LE_LL_RESOLV_LIST_SIZE, \
@ -261,6 +264,54 @@ typedef struct {
.csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \
.config_magic = CONFIG_MAGIC, \
}
#elif CONFIG_IDF_TARGET_ESP32C61
#define BT_CONTROLLER_INIT_CONFIG_DEFAULT() { \
.config_version = CONFIG_VERSION, \
.ble_ll_resolv_list_size = CONFIG_BT_LE_LL_RESOLV_LIST_SIZE, \
.ble_hci_evt_hi_buf_count = DEFAULT_BT_LE_HCI_EVT_HI_BUF_COUNT, \
.ble_hci_evt_lo_buf_count = DEFAULT_BT_LE_HCI_EVT_LO_BUF_COUNT, \
.ble_ll_sync_list_cnt = DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST, \
.ble_ll_sync_cnt = DEFAULT_BT_LE_MAX_PERIODIC_SYNCS, \
.ble_ll_rsp_dup_list_count = CONFIG_BT_LE_LL_DUP_SCAN_LIST_COUNT, \
.ble_ll_adv_dup_list_count = CONFIG_BT_LE_LL_DUP_SCAN_LIST_COUNT, \
.ble_ll_tx_pwr_dbm = BLE_LL_TX_PWR_DBM_N, \
.rtc_freq = RTC_FREQ_N, \
.ble_ll_sca = CONFIG_BT_LE_LL_SCA, \
.ble_ll_scan_phy_number = BLE_LL_SCAN_PHY_NUMBER_N, \
.ble_ll_conn_def_auth_pyld_tmo = BLE_LL_CONN_DEF_AUTH_PYLD_TMO_N, \
.ble_ll_jitter_usecs = BLE_LL_JITTER_USECS_N, \
.ble_ll_sched_max_adv_pdu_usecs = BLE_LL_SCHED_MAX_ADV_PDU_USECS_N, \
.ble_ll_sched_direct_adv_max_usecs = BLE_LL_SCHED_DIRECT_ADV_MAX_USECS_N, \
.ble_ll_sched_adv_max_usecs = BLE_LL_SCHED_ADV_MAX_USECS_N, \
.ble_scan_rsp_data_max_len = DEFAULT_BT_LE_SCAN_RSP_DATA_MAX_LEN_N, \
.ble_ll_cfg_num_hci_cmd_pkts = BLE_LL_CFG_NUM_HCI_CMD_PKTS_N, \
.ble_ll_ctrl_proc_timeout_ms = BLE_LL_CTRL_PROC_TIMEOUT_MS_N, \
.nimble_max_connections = DEFAULT_BT_LE_MAX_CONNECTIONS, \
.ble_whitelist_size = DEFAULT_BT_NIMBLE_WHITELIST_SIZE, \
.ble_acl_buf_size = DEFAULT_BT_LE_ACL_BUF_SIZE, \
.ble_acl_buf_count = DEFAULT_BT_LE_ACL_BUF_COUNT, \
.ble_hci_evt_buf_size = DEFAULT_BT_LE_HCI_EVT_BUF_SIZE, \
.ble_multi_adv_instances = DEFAULT_BT_LE_MAX_EXT_ADV_INSTANCES, \
.ble_ext_adv_max_size = DEFAULT_BT_LE_EXT_ADV_MAX_SIZE, \
.controller_task_stack_size = NIMBLE_LL_STACK_SIZE, \
.controller_task_prio = ESP_TASK_BT_CONTROLLER_PRIO, \
.controller_run_cpu = 0, \
.enable_qa_test = RUN_QA_TEST, \
.enable_bqb_test = RUN_BQB_TEST, \
.enable_tx_cca = DEFAULT_BT_LE_TX_CCA_ENABLED, \
.cca_rssi_thresh = 256 - DEFAULT_BT_LE_CCA_RSSI_THRESH, \
.sleep_en = NIMBLE_SLEEP_ENABLE, \
.coex_phy_coded_tx_rx_time_limit = DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF, \
.dis_scan_backoff = NIMBLE_DISABLE_SCAN_BACKOFF, \
.ble_scan_classify_filter_enable = 1, \
.main_xtal_freq = CONFIG_XTAL_FREQ, \
.cpu_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ, \
.ignore_wl_for_direct_adv = 0, \
.enable_pcl = DEFAULT_BT_LE_POWER_CONTROL_ENABLED, \
.csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \
.config_magic = CONFIG_MAGIC, \
}
#endif
/**
* @brief Initialize BT controller to allocate task and other resource.

View File

@ -21,6 +21,7 @@
#include "esp_log.h"
#include "soc/soc_caps.h"
#include "esp_bt.h"
#include "bt_osi_mem.h"
portMUX_TYPE ble_port_mutex = portMUX_INITIALIZER_UNLOCKED;
@ -95,7 +96,7 @@ IRAM_ATTR npl_freertos_event_init(struct ble_npl_event *ev, ble_npl_event_fn *fn
}
#else
if(!ev->event) {
ev->event = malloc(sizeof(struct ble_npl_event_freertos));
ev->event = bt_osi_mem_malloc_internal(sizeof(struct ble_npl_event_freertos));
}
#endif
event = (struct ble_npl_event_freertos *)ev->event;
@ -113,7 +114,7 @@ IRAM_ATTR npl_freertos_event_deinit(struct ble_npl_event *ev)
#if OS_MEM_ALLOC
os_memblock_put(&ble_freertos_ev_pool,ev->event);
#else
free(ev->event);
bt_osi_mem_free(ev->event);
#endif
ev->event = NULL;
}
@ -144,7 +145,7 @@ npl_freertos_eventq_init(struct ble_npl_eventq *evq)
}
#else
if(!evq->eventq) {
evq->eventq = malloc(sizeof(struct ble_npl_eventq_freertos));
evq->eventq = bt_osi_mem_malloc_internal(sizeof(struct ble_npl_eventq_freertos));
eventq = (struct ble_npl_eventq_freertos*)evq->eventq;
BLE_LL_ASSERT(eventq);
memset(eventq, 0, sizeof(*eventq));
@ -167,7 +168,7 @@ npl_freertos_eventq_deinit(struct ble_npl_eventq *evq)
#if OS_MEM_ALLOC
os_memblock_put(&ble_freertos_evq_pool,eventq);
#else
free((void *)eventq);
bt_osi_mem_free((void *)eventq);
#endif
evq->eventq = NULL;
}
@ -357,7 +358,7 @@ npl_freertos_mutex_init(struct ble_npl_mutex *mu)
}
#else
if(!mu->mutex) {
mu->mutex = malloc(sizeof(struct ble_npl_mutex_freertos));
mu->mutex = bt_osi_mem_malloc_internal(sizeof(struct ble_npl_mutex_freertos));
mutex = (struct ble_npl_mutex_freertos *)mu->mutex;
if (!mutex) {
@ -388,7 +389,7 @@ npl_freertos_mutex_deinit(struct ble_npl_mutex *mu)
#if OS_MEM_ALLOC
os_memblock_put(&ble_freertos_mutex_pool,mutex);
#else
free((void *)mutex);
bt_osi_mem_free((void *)mutex);
#endif
mu->mutex = NULL;
@ -494,7 +495,7 @@ npl_freertos_sem_init(struct ble_npl_sem *sem, uint16_t tokens)
}
#else
if(!sem->sem) {
sem->sem = malloc(sizeof(struct ble_npl_sem_freertos));
sem->sem = bt_osi_mem_malloc_internal(sizeof(struct ble_npl_sem_freertos));
semaphore = (struct ble_npl_sem_freertos *)sem->sem;
if (!semaphore) {
@ -525,7 +526,7 @@ npl_freertos_sem_deinit(struct ble_npl_sem *sem)
#if OS_MEM_ALLOC
os_memblock_put(&ble_freertos_sem_pool,semaphore);
#else
free((void *)semaphore);
bt_osi_mem_free((void *)semaphore);
#endif
sem->sem = NULL;
@ -684,7 +685,7 @@ npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq
#else
if(!co->co) {
co->co = malloc(sizeof(struct ble_npl_callout_freertos));
co->co = bt_osi_mem_malloc_internal(sizeof(struct ble_npl_callout_freertos));
callout = (struct ble_npl_callout_freertos *)co->co;
if (!callout) {
return -1;
@ -704,7 +705,7 @@ npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq
if (esp_timer_create(&create_args, &callout->handle) != ESP_OK) {
ble_npl_event_deinit(&callout->ev);
free((void *)callout);
bt_osi_mem_free((void *)callout);
co->co = NULL;
return -1;
}
@ -713,7 +714,7 @@ npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq
if (!callout->handle) {
ble_npl_event_deinit(&callout->ev);
free((void *)callout);
bt_osi_mem_free((void *)callout);
co->co = NULL;
return -1;
}
@ -761,7 +762,7 @@ npl_freertos_callout_deinit(struct ble_npl_callout *co)
#if OS_MEM_ALLOC
os_memblock_put(&ble_freertos_co_pool,callout);
#else
free((void *)callout);
bt_osi_mem_free((void *)callout);
#endif // OS_MEM_ALLOC
co->co = NULL;
memset(co, 0, sizeof(struct ble_npl_callout));
@ -1089,7 +1090,7 @@ struct npl_funcs_t * npl_freertos_funcs_get(void)
void npl_freertos_funcs_init(void)
{
npl_funcs = (struct npl_funcs_t *)malloc(sizeof(struct npl_funcs_t));
npl_funcs = (struct npl_funcs_t *)bt_osi_mem_malloc_internal(sizeof(struct npl_funcs_t));
if(!npl_funcs) {
printf("npl funcs init failed\n");
assert(0);
@ -1123,7 +1124,7 @@ int npl_freertos_mempool_init(void)
ble_freertos_total_event_cnt = ble_total_evt_count;
if (ble_total_evt_count) {
ble_freertos_ev_buf = malloc(OS_MEMPOOL_SIZE(ble_total_evt_count,
ble_freertos_ev_buf = bt_osi_mem_malloc_internal(OS_MEMPOOL_SIZE(ble_total_evt_count,
sizeof (struct ble_npl_event_freertos)) *
sizeof(os_membuf_t));
if (!ble_freertos_ev_buf) {
@ -1138,7 +1139,7 @@ int npl_freertos_mempool_init(void)
}
if (ble_total_evtq_count) {
ble_freertos_evq_buf = malloc(OS_MEMPOOL_SIZE(ble_total_evtq_count,
ble_freertos_evq_buf = bt_osi_mem_malloc_internal(OS_MEMPOOL_SIZE(ble_total_evtq_count,
sizeof (struct ble_npl_eventq_freertos)) *
sizeof(os_membuf_t));
if (!ble_freertos_evq_buf) {
@ -1153,7 +1154,7 @@ int npl_freertos_mempool_init(void)
}
if (ble_total_co_count) {
ble_freertos_co_buf = malloc(OS_MEMPOOL_SIZE(ble_total_co_count,
ble_freertos_co_buf = bt_osi_mem_malloc_internal(OS_MEMPOOL_SIZE(ble_total_co_count,
sizeof (struct ble_npl_callout_freertos)) *
sizeof(os_membuf_t));
if (!ble_freertos_co_buf) {
@ -1168,7 +1169,7 @@ int npl_freertos_mempool_init(void)
}
if (ble_total_sem_count) {
ble_freertos_sem_buf = malloc(OS_MEMPOOL_SIZE(ble_total_sem_count,
ble_freertos_sem_buf = bt_osi_mem_malloc_internal(OS_MEMPOOL_SIZE(ble_total_sem_count,
sizeof (struct ble_npl_sem_freertos)) *
sizeof(os_membuf_t));
if (!ble_freertos_sem_buf) {
@ -1183,7 +1184,7 @@ int npl_freertos_mempool_init(void)
}
if (ble_total_mutex_count) {
ble_freertos_mutex_buf = malloc(OS_MEMPOOL_SIZE(ble_total_mutex_count,
ble_freertos_mutex_buf = bt_osi_mem_malloc_internal(OS_MEMPOOL_SIZE(ble_total_mutex_count,
sizeof (struct ble_npl_mutex_freertos)) *
sizeof(os_membuf_t));
if (!ble_freertos_mutex_buf) {
@ -1200,27 +1201,27 @@ int npl_freertos_mempool_init(void)
return 0;
_error:
if (ble_freertos_ev_buf) {
free(ble_freertos_ev_buf);
bt_osi_mem_free(ble_freertos_ev_buf);
ble_freertos_ev_buf = NULL;
}
if (ble_freertos_evq_buf) {
free(ble_freertos_evq_buf);
bt_osi_mem_free(ble_freertos_evq_buf);
ble_freertos_evq_buf = NULL;
}
if (ble_freertos_co_buf) {
free(ble_freertos_co_buf);
bt_osi_mem_free(ble_freertos_co_buf);
ble_freertos_co_buf = NULL;
}
if (ble_freertos_sem_buf) {
free(ble_freertos_sem_buf);
bt_osi_mem_free(ble_freertos_sem_buf);
ble_freertos_sem_buf = NULL;
}
if (ble_freertos_mutex_buf) {
free(ble_freertos_mutex_buf);
bt_osi_mem_free(ble_freertos_mutex_buf);
ble_freertos_mutex_buf = NULL;
}
return -1;
@ -1229,23 +1230,23 @@ _error:
void npl_freertos_mempool_deinit(void)
{
if (ble_freertos_ev_buf) {
free(ble_freertos_ev_buf);
bt_osi_mem_free(ble_freertos_ev_buf);
ble_freertos_ev_buf = NULL;
}
if (ble_freertos_evq_buf) {
free(ble_freertos_evq_buf);
bt_osi_mem_free(ble_freertos_evq_buf);
ble_freertos_evq_buf = NULL;
}
if (ble_freertos_co_buf) {
free(ble_freertos_co_buf);
bt_osi_mem_free(ble_freertos_co_buf);
ble_freertos_co_buf = NULL;
}
if (ble_freertos_sem_buf) {
free(ble_freertos_sem_buf);
bt_osi_mem_free(ble_freertos_sem_buf);
ble_freertos_sem_buf = NULL;
}
if (ble_freertos_mutex_buf) {
free(ble_freertos_mutex_buf);
bt_osi_mem_free(ble_freertos_mutex_buf);
ble_freertos_mutex_buf = NULL;
}
}
@ -1253,7 +1254,7 @@ void npl_freertos_mempool_deinit(void)
void npl_freertos_funcs_deinit(void)
{
if (npl_funcs) {
free(npl_funcs);
bt_osi_mem_free(npl_funcs);
}
npl_funcs = NULL;
}

View File

@ -154,7 +154,7 @@ hci_driver_uart_deinit(void)
ESP_ERROR_CHECK(uart_driver_delete(s_hci_driver_uart_env.hci_uart_params->hci_uart_port));
if (!s_hci_driver_uart_env.tx_sem) {
if (s_hci_driver_uart_env.tx_sem) {
vSemaphoreDelete(s_hci_driver_uart_env.tx_sem);
}

View File

@ -86,10 +86,6 @@ components/driver/test_apps/touch_sensor_v2:
components/driver/test_apps/twai:
disable:
- if: SOC_TWAI_SUPPORTED != 1
disable_test:
- if: IDF_TARGET == "esp32p4"
temporary: true
reason: test not pass, should be re-enable # TODO: IDF-8966
depends_filepatterns:
- components/driver/twai/**/*
depends_components:

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -16,6 +16,9 @@
#include "soc/soc_caps.h"
#include "esp_log.h"
#define TEST_TWAI_TX_PIN 4
#define TEST_TWAI_RX_PIN 5
#if CONFIG_TWAI_ISR_IN_IRAM
static void IRAM_ATTR test_delay_post_cache_disable(void *args)
{
@ -27,7 +30,7 @@ TEST_CASE("twai_listen_only", "[twai]")
{
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(4, 5, TWAI_MODE_LISTEN_ONLY);
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(TEST_TWAI_TX_PIN, TEST_TWAI_RX_PIN, TWAI_MODE_LISTEN_ONLY);
#if CONFIG_TWAI_ISR_IN_IRAM
g_config.intr_flags |= ESP_INTR_FLAG_IRAM;
#endif
@ -60,8 +63,8 @@ TEST_CASE("twai_remote_request", "[twai]")
twai_handle_t bus_handle;
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(4, 5, TWAI_MODE_NORMAL);
#if CONFIG_IDF_TARGET_ESP32C6
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(TEST_TWAI_TX_PIN, TEST_TWAI_RX_PIN, TWAI_MODE_NORMAL);
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4
g_config.controller_id = 1;
#endif
TEST_ESP_OK(twai_driver_install_v2(&g_config, &t_config, &f_config, &bus_handle));

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -99,25 +99,27 @@ TEST_CASE("twai_mode_ext_no_ack_250kbps", "[twai-loop-back]")
.extd = true, // Extended Frame Format (29bit ID)
};
printf("install twai driver\r\n");
for (int i = 0; i < SOC_TWAI_CONTROLLER_NUM; i++) {
g_config.controller_id = i;
g_config.tx_io = i;
g_config.rx_io = i;
printf("install twai driver %d\r\n", g_config.controller_id);
TEST_ESP_OK(twai_driver_install_v2(&g_config, &t_config, &f_config, &twai_buses[i]));
TEST_ESP_OK(twai_start_v2(twai_buses[i]));
}
printf("transmit message\r\n");
for (int i = 0; i < SOC_TWAI_CONTROLLER_NUM; i++) {
printf("transmit message from %d\r\n", i);
tx_msg.data[5] = SOC_TWAI_CONTROLLER_NUM - i;
TEST_ESP_OK(twai_transmit_v2(twai_buses[i], &tx_msg, pdMS_TO_TICKS(1000)));
}
printf("receive message\r\n");
twai_message_t rx_msg;
for (int i = 0; i < SOC_TWAI_CONTROLLER_NUM; i++) {
printf("receive message from %d\r\n", i);
TEST_ESP_OK(twai_receive_v2(twai_buses[i], &rx_msg, pdMS_TO_TICKS(1000)));
TEST_ASSERT_TRUE(rx_msg.data_length_code == 6);
tx_msg.data[5] = SOC_TWAI_CONTROLLER_NUM - i;
for (int i = 0; i < 6; i++) {
TEST_ASSERT_EQUAL(tx_msg.data[i], rx_msg.data[i]);
}

View File

@ -1,12 +1,12 @@
# SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import logging
import subprocess
from time import sleep
import pytest
from can import Bus, Message
from can import Bus
from can import Message
from pytest_embedded import Dut
@ -16,6 +16,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32h2
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.esp32p4
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
@ -46,6 +47,7 @@ def fixture_create_socket_can() -> Bus:
@pytest.mark.esp32h2
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.esp32p4
@pytest.mark.twai_std
@pytest.mark.parametrize(
'config',
@ -79,6 +81,7 @@ def test_twai_listen_only(dut: Dut, socket_can: Bus) -> None:
@pytest.mark.esp32h2
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.esp32p4
@pytest.mark.twai_std
@pytest.mark.parametrize(
'config',

View File

@ -28,6 +28,16 @@ typedef enum {
COEX_SCHM_CALLBACK_TYPE_I154,
} coex_schm_callback_type_t;
typedef enum {
COEX_SCHM_ST_TYPE_WIFI = 0,
COEX_SCHM_ST_TYPE_BLE,
COEX_SCHM_ST_TYPE_BT,
} coex_schm_st_type_t;
#define COEX_STATUS_GET_WIFI_BITMAP (1 << COEX_SCHM_ST_TYPE_WIFI)
#define COEX_STATUS_GET_BLE_BITMAP (1 << COEX_SCHM_ST_TYPE_BLE)
#define COEX_STATUS_GET_BT_BITMAP (1 << COEX_SCHM_ST_TYPE_BT)
typedef void (* coex_func_cb_t)(uint32_t event, int sched_cnt);
typedef esp_err_t (* coex_set_lpclk_source_callback_t)(void);
typedef void (* coex_wifi_channel_change_cb_t)(uint8_t primary, uint8_t secondary);
@ -94,9 +104,11 @@ esp_err_t coex_preference_set(coex_prefer_t prefer);
/**
* @brief Get software coexist status.
*
* @param bitmap : bitmap of the module getting status.
* @return : software coexist status
*/
uint32_t coex_status_get(void);
uint32_t coex_status_get(uint8_t bitmap);
/**
* @brief WiFi requests coexistence.

@ -1 +1 @@
Subproject commit bf7cda7b17a4fd22c123d39748565a68c021e562
Subproject commit e15e7a161fc1a48e8fb4fd0b3da74623c30ba1cb

View File

@ -469,6 +469,11 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# endif
# ifdef ESP_ERR_DPP_AUTH_TIMEOUT
ERR_TBL_IT(ESP_ERR_DPP_AUTH_TIMEOUT), /* 12442 0x309a DPP Auth response was not received in time */
# endif
# ifdef ESP_ERR_DPP_INVALID_LIST
ERR_TBL_IT(ESP_ERR_DPP_INVALID_LIST), /* 12443 0x309b Channel list given in
esp_supp_dpp_bootstrap_gen() is not
valid or too big */
# endif
// components/esp_common/include/esp_err.h
# ifdef ESP_ERR_MESH_BASE

View File

@ -239,6 +239,21 @@ esp_err_t esp_https_ota_get_img_desc(esp_https_ota_handle_t https_ota_handle, es
int esp_https_ota_get_image_len_read(esp_https_ota_handle_t https_ota_handle);
/**
* @brief This function returns the HTTP status code of the last HTTP response.
*
* @note This API should be called only after esp_https_ota_begin() has been called.
* This can be used to check the HTTP status code of the OTA download process.
*
* @param[in] https_ota_handle pointer to esp_https_ota_handle_t structure
*
* @return
* - -1 On failure
* - HTTP status code
*/
int esp_https_ota_get_status_code(esp_https_ota_handle_t https_ota_handle);
/**
* @brief This function returns OTA image total size.
*

View File

@ -724,6 +724,15 @@ esp_err_t esp_https_ota_abort(esp_https_ota_handle_t https_ota_handle)
return err;
}
int esp_https_ota_get_status_code(esp_https_ota_handle_t https_ota_handle)
{
esp_https_ota_t *handle = (esp_https_ota_t *) https_ota_handle;
if (handle == NULL || handle->http_client == NULL) {
return -1;
}
return esp_http_client_get_status_code(handle->http_client);
}
int esp_https_ota_get_image_len_read(esp_https_ota_handle_t https_ota_handle)
{
esp_https_ota_t *handle = (esp_https_ota_t *)https_ota_handle;

View File

@ -273,4 +273,13 @@ menu "Hardware Settings"
config ESP_SPI_BUS_LOCK_FUNCS_IN_IRAM
bool
default n
config ESP_CLK_RC32K_NOT_TO_USE
bool
default y if IDF_TARGET_ESP32C5 || IDF_TARGET_ESP32C61
default n
help
Due to the poor low-temperature characteristics of
RC32K (it cannot operate below -40 degrees Celsius),
please avoid using it whenever possible
endmenu

View File

@ -44,7 +44,7 @@ void esp_crypto_ds_lock_acquire(void);
void esp_crypto_ds_lock_release(void);
#endif /* SOC_DIG_SIGN_SUPPORTED */
#if defined(SOC_SHA_SUPPORTED) && defined(SOC_AES_SUPPORTED)
#if defined(SOC_SHA_SUPPORTED) || defined(SOC_AES_SUPPORTED)
/**
* @brief Acquire lock for the SHA and AES cryptography peripheral.
*
@ -56,9 +56,9 @@ void esp_crypto_sha_aes_lock_acquire(void);
*
*/
void esp_crypto_sha_aes_lock_release(void);
#endif /* defined(SOC_SHA_SUPPORTED) && defined(SOC_AES_SUPPORTED) */
#endif /* defined(SOC_SHA_SUPPORTED) || defined(SOC_AES_SUPPORTED) */
#if defined(SOC_SHA_CRYPTO_DMA) && defined(SOC_AES_CRYPTO_DMA)
#if defined(SOC_SHA_CRYPTO_DMA) || defined(SOC_AES_CRYPTO_DMA)
/**
* This API should be used by all components which use the SHA, AES, HMAC and DS crypto hardware on the ESP32S2.
* They can not be used in parallel because they use the same DMA or are calling each other.
@ -76,7 +76,7 @@ void esp_crypto_dma_lock_acquire(void);
* Release lock for the AES and SHA cryptography peripherals, which both use the crypto DMA.
*/
void esp_crypto_dma_lock_release(void);
#endif /* defined(SOC_SHA_CRYPTO_DMA) && defined(SOC_AES_CRYPTO_DMA) */
#endif /* defined(SOC_SHA_CRYPTO_DMA) || defined(SOC_AES_CRYPTO_DMA) */
#ifdef SOC_MPI_SUPPORTED
/**

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -120,7 +120,7 @@ bool modem_domain_pd_allowed(void);
uint32_t sleep_modem_reject_triggers(void);
/**
* @brief Configure the parameters of the modem subsytem during the sleep process
* @brief Configure the parameters of the modem subsystem during the sleep process
*
* In light sleep mode, the wake-up early time of the WiFi module and the TBTT
* interrupt early time (trigger enabling RF) are determined by the maximum and
@ -132,7 +132,7 @@ uint32_t sleep_modem_reject_triggers(void);
*
* @param max_freq_mhz the maximum frequency of system
* @param min_freq_mhz the minimum frequency of system
* @param light_sleep_enable ture or false for enable or disable light sleep mode, respectively
* @param light_sleep_enable true or false for enable or disable light sleep mode, respectively
*
* @return
* - ESP_OK on success
@ -225,6 +225,27 @@ void sleep_modem_wifi_modem_state_deinit(void);
* - false not skip light sleep
*/
bool sleep_modem_wifi_modem_state_skip_light_sleep(void);
/**
* @brief Function to initialize and create the modem state phy link
* @param link_head the pointer that point to the head of the created phy link
* @return
* - ESP_OK on success
* - ESP_ERR_NO_MEM if no memory for link
* - ESP_ERR_INVALID_ARG if value is out of range
* - ESP_ERR_INVALID_STATE if the phy module retention state is invalid
*/
esp_err_t sleep_modem_state_phy_link_init(void **link_head);
/**
* @brief Function to destroy and de-initialize modem state phy link
* @param link_head the phy link head will be destroyed
* @return
* - ESP_OK on success
* - ESP_ERR_INVALID_ARG if value is out of range
* - ESP_ERR_INVALID_STATE if the phy module retention state is invalid
*/
esp_err_t sleep_modem_state_phy_link_deinit(void *link_head);
#endif
#ifdef __cplusplus

View File

@ -24,6 +24,10 @@ if((CONFIG_SOC_PM_SUPPORT_MODEM_PD OR CONFIG_SOC_PM_SUPPORT_TOP_PD) AND CONFIG_S
list(APPEND srcs "port/${target}/sleep_clock.c")
endif()
if(CONFIG_SOC_PM_SUPPORT_PMU_MODEM_STATE)
list(APPEND srcs "port/${target}/sleep_modem_state.c")
endif()
add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}")
target_sources(${COMPONENT_LIB} PRIVATE "${srcs}")

View File

@ -6,6 +6,7 @@
#include "esp_private/sleep_clock.h"
#include "soc/pcr_reg.h"
#include "soc/rtc.h"
#include "modem/modem_syscon_reg.h"
#include "modem/modem_lpcon_reg.h"
#include "soc/i2c_ana_mst_reg.h"
@ -14,13 +15,43 @@ static const char *TAG = "sleep_clock";
esp_err_t sleep_clock_system_retention_init(void *arg)
{
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const static sleep_retention_entries_config_t pcr_regs_retention[] = {
[0] = { .config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_PCR_LINK(0), DR_REG_PCR_BASE, DR_REG_PCR_BASE, 74, 0, 0, 0xffffffff, 0xffffffff, 0x7f7, 0x0), .owner = ENTRY(0) | ENTRY(1) },
[0] = { .config = REGDMA_LINK_WRITE_INIT (REGDMA_PCR_LINK(0), PCR_AHB_FREQ_CONF_REG, 0, PCR_AHB_DIV_NUM, 1, 0), .owner = ENTRY(0) | ENTRY(1) }, /* Set AHB bus frequency to XTAL frequency */
[1] = { .config = REGDMA_LINK_WRITE_INIT (REGDMA_PCR_LINK(1), PCR_BUS_CLK_UPDATE_REG, 1, PCR_BUS_CLOCK_UPDATE, 1, 0), .owner = ENTRY(0) | ENTRY(1) },
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
[2] = { .config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_PCR_LINK(2), DR_REG_PCR_BASE, DR_REG_PCR_BASE, 75, 0, 0, 0xffffffff, 0xffffffff, 0x200007f7, 0x0), .owner = ENTRY(0) | ENTRY(1) },
#endif
};
esp_err_t err = sleep_retention_entries_create(pcr_regs_retention, ARRAY_SIZE(pcr_regs_retention), REGDMA_LINK_PRI_SYS_CLK, SLEEP_RETENTION_MODULE_CLOCK_SYSTEM);
ESP_RETURN_ON_ERROR(err, TAG, "failed to allocate memory for system (PCR) retention");
const static sleep_retention_entries_config_t modem_ahb_config[] = {
[0] = { .config = REGDMA_LINK_WRITE_INIT (REGDMA_PCR_LINK(3), PCR_AHB_FREQ_CONF_REG, 3, PCR_AHB_DIV_NUM, 1, 0), .owner = ENTRY(1) }, /* Set AHB bus frequency to 40 MHz under PMU MODEM state */
[1] = { .config = REGDMA_LINK_WRITE_INIT (REGDMA_PCR_LINK(4), PCR_BUS_CLK_UPDATE_REG, 1, PCR_BUS_CLOCK_UPDATE, 1, 0), .owner = ENTRY(1) },
};
err = sleep_retention_entries_create(modem_ahb_config, ARRAY_SIZE(modem_ahb_config), REGDMA_LINK_PRI_4, SLEEP_RETENTION_MODULE_CLOCK_SYSTEM);
ESP_RETURN_ON_ERROR(err, TAG, "failed to allocate memory for system (PCR) retention, 4 level priority");
#if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP && CONFIG_XTAL_FREQ_AUTO
uint32_t xtal_freq_mhz = (uint32_t)rtc_clk_xtal_freq_get();
if (xtal_freq_mhz == SOC_XTAL_FREQ_48M) {
/* For the 48 MHz main XTAL, we need regdma to configured BBPLL by exec
* the PHY_I2C_MST_CMD_TYPE_BBPLL_CFG command from PHY i2c master
* command memory */
sleep_retention_entries_config_t bbpll_config[] = {
[0] = { .config = REGDMA_LINK_WRITE_INIT (REGDMA_PCR_LINK(5), MODEM_LPCON_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_EN, MODEM_LPCON_CLK_I2C_MST_EN_M, 1, 0), .owner = ENTRY(1) }, /* I2C MST enable */
[1] = { .config = REGDMA_LINK_WRITE_INIT (REGDMA_PCR_LINK(6), I2C_ANA_MST_I2C_BURST_CONF_REG, 0, 0xffffffff, 1, 0), .owner = ENTRY(1) },
[2] = { .config = REGDMA_LINK_WAIT_INIT (REGDMA_PCR_LINK(7), I2C_ANA_MST_I2C_BURST_STATUS_REG, I2C_ANA_MST_BURST_DONE, 0x1, 1, 0), .owner = ENTRY(1) },
[3] = { .config = REGDMA_LINK_WRITE_INIT (REGDMA_PCR_LINK(8), MODEM_LPCON_CLK_CONF_REG, 0, MODEM_LPCON_CLK_I2C_MST_EN_M, 1, 0), .owner = ENTRY(1) }, /* I2C MST disable */
};
extern uint32_t phy_ana_i2c_master_burst_bbpll_config(void);
bbpll_config[1].config.write_wait.value = phy_ana_i2c_master_burst_bbpll_config();
err = sleep_retention_entries_create(bbpll_config, ARRAY_SIZE(bbpll_config), REGDMA_LINK_PRI_SYS_CLK, SLEEP_RETENTION_MODULE_CLOCK_SYSTEM);
ESP_RETURN_ON_ERROR(err, TAG, "failed to allocate memory for bbpll configure, 0 level priority");
}
#endif
ESP_LOGI(TAG, "System Power, Clock and Reset sleep retention initialization");
return ESP_OK;
}

View File

@ -0,0 +1,120 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "esp_log.h"
#include "esp_check.h"
#include "soc/soc_caps.h"
#include "soc/i2c_ana_mst_reg.h"
#include "soc/pmu_reg.h"
#include "modem/modem_syscon_reg.h"
#include "modem/modem_lpcon_reg.h"
#include "esp_private/sleep_modem.h"
#include "esp_private/sleep_retention.h"
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
#define SARADC_TSENS_REG (0x6000e058)
#define SARADC_TSENS_PU (BIT(22))
#define PMU_RF_PWR_REG (0x600b0158)
#define FECOEX_SET_FREQ_SET_CHAN_REG (0x600a001c)
#define FECOEX_SET_CHAN_EN (BIT(17))
#define FECOEX_SET_FREQ_SET_CHAN_ST_REG (0x600a0028)
#define FECOEX_SET_CHAN_DONE (BIT(8))
#define FECOEX_AGC_CONF_REG (0x600a7030)
#define FECOEX_AGC_DIS (BIT(29))
#define WDEVTXQ_BLOCK (0x600A4ca8)
#define WDEV_RXBLOCK (BIT(12))
#define MODEM_FE_DATA_BASE (0x600a0400)
#define MODEM_FE_CTRL_BASE (0x600a0800)
static __attribute__((unused)) const char *TAG = "sleep";
#if SOC_PM_PAU_REGDMA_LINK_IDX_WIFIMAC
static esp_err_t sleep_modem_state_phy_wifi_init(void *arg)
{
#define WIFIMAC_ENTRY() (BIT(SOC_PM_PAU_REGDMA_LINK_IDX_WIFIMAC))
static sleep_retention_entries_config_t wifi_modem_config[] = {
[0] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x00), MODEM_LPCON_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_EN, MODEM_LPCON_CLK_I2C_MST_EN_M, 1, 0), .owner = WIFIMAC_ENTRY() }, /* I2C MST enable */
/* PMU or software to trigger enable RF PHY */
[1] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x01), I2C_ANA_MST_ANA_CONF0_REG, 0x8, 0xc, 1, 0), .owner = WIFIMAC_ENTRY() }, /* BBPLL calibration enable */
[2] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x02), PMU_RF_PWR_REG, 0xf3800000, 0xf3800000, 1, 0), .owner = WIFIMAC_ENTRY() },
[3] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x03), SARADC_TSENS_REG, SARADC_TSENS_PU, 0x400000, 1, 0), .owner = WIFIMAC_ENTRY() },
[4] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x04), I2C_ANA_MST_I2C_BURST_CONF_REG, 0, 0xffffffff, 1, 0), .owner = WIFIMAC_ENTRY() },
[5] = { .config = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x05), I2C_ANA_MST_I2C_BURST_STATUS_REG, I2C_ANA_MST_BURST_DONE, 0x1, 1, 0), .owner = WIFIMAC_ENTRY() },
[6] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x06), FECOEX_SET_FREQ_SET_CHAN_REG, FECOEX_SET_CHAN_EN, 0x20000, 1, 0), .owner = WIFIMAC_ENTRY() },
[7] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x07), FECOEX_SET_FREQ_SET_CHAN_REG, 0, 0x20000, 1, 0), .owner = WIFIMAC_ENTRY() },
[8] = { .config = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x08), FECOEX_SET_FREQ_SET_CHAN_ST_REG, FECOEX_SET_CHAN_DONE, 0x100, 1, 0), .owner = WIFIMAC_ENTRY() },
[9] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x09), MODEM_SYSCON_WIFI_BB_CFG_REG, BIT(1), 0x2, 1, 0), .owner = WIFIMAC_ENTRY() },
[10] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0a), FECOEX_AGC_CONF_REG, 0, 0x20000000, 1, 0), .owner = WIFIMAC_ENTRY() },
/* PMU to trigger enable RXBLOCK */
[11] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0b), WDEVTXQ_BLOCK, 0, 0x1000, 1, 0), .owner = WIFIMAC_ENTRY() },
/* PMU or software to trigger disable RF PHY */
[12] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0c), FECOEX_AGC_CONF_REG, FECOEX_AGC_DIS, 0x20000000, 0, 1), .owner = WIFIMAC_ENTRY() },
[13] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0d), MODEM_SYSCON_WIFI_BB_CFG_REG, 0, 0x2, 0, 1), .owner = WIFIMAC_ENTRY() },
[14] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0e), FECOEX_SET_FREQ_SET_CHAN_REG, 0, 0x20000, 0, 1), .owner = WIFIMAC_ENTRY() },
[15] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0f), I2C_ANA_MST_I2C_BURST_CONF_REG, 0, 0xffffffff, 1, 1), .owner = WIFIMAC_ENTRY() },
[16] = { .config = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x10), I2C_ANA_MST_I2C_BURST_STATUS_REG, I2C_ANA_MST_BURST_DONE, 0x1, 1, 1), .owner = WIFIMAC_ENTRY() },
[17] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x11), SARADC_TSENS_REG, 0, 0x400000, 0, 1), .owner = WIFIMAC_ENTRY() },
[18] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x12), PMU_RF_PWR_REG, 0, 0xf3800000, 0, 1), .owner = WIFIMAC_ENTRY() },
[19] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x13), I2C_ANA_MST_ANA_CONF0_REG, 0x4, 0xc, 0, 1), .owner = WIFIMAC_ENTRY() }, /* BBPLL calibration disable */
[20] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x14), MODEM_LPCON_CLK_CONF_REG, 0, MODEM_LPCON_CLK_I2C_MST_EN_M, 0, 1), .owner = WIFIMAC_ENTRY() }, /* I2C MST disable */
/* PMU to trigger disable RXBLOCK */
[21] = { .config = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x15), WDEVTXQ_BLOCK, 0, 0x6000, 0, 1), .owner = WIFIMAC_ENTRY() },
[22] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x16), WDEVTXQ_BLOCK, WDEV_RXBLOCK, 0x1000, 0, 1), .owner = WIFIMAC_ENTRY() },
[23] = { .config = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x17), WDEVTXQ_BLOCK, 0, 0x6000, 0, 1), .owner = WIFIMAC_ENTRY() },
[24] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x18), PMU_SLP_WAKEUP_CNTL7_REG, 0x200000, 0xffff0000, 1, 0), .owner = WIFIMAC_ENTRY() },
[25] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x19), PMU_SLP_WAKEUP_CNTL7_REG, 0x9730000, 0xffff0000, 0, 1), .owner = WIFIMAC_ENTRY() }
};
extern uint32_t phy_ana_i2c_master_burst_rf_onoff(bool on);
wifi_modem_config[4].config.write_wait.value = phy_ana_i2c_master_burst_rf_onoff(true);
wifi_modem_config[15].config.write_wait.value = phy_ana_i2c_master_burst_rf_onoff(false);
esp_err_t err = sleep_retention_entries_create(wifi_modem_config, ARRAY_SIZE(wifi_modem_config), 7, SLEEP_RETENTION_MODULE_MODEM_PHY);
ESP_RETURN_ON_ERROR(err, TAG, "failed to allocate modem phy link for wifi modem state");
return ESP_OK;
}
#endif
esp_err_t sleep_modem_state_phy_link_init(void **link_head)
{
esp_err_t err = ESP_OK;
#if SOC_PM_PAU_REGDMA_LINK_IDX_WIFIMAC
sleep_retention_module_init_param_t init_param = { .cbs = { .create = { .handle = sleep_modem_state_phy_wifi_init, .arg = NULL } } };
err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_MODEM_PHY, &init_param);
if (err == ESP_OK) {
err = sleep_retention_module_allocate(SLEEP_RETENTION_MODULE_MODEM_PHY);
if (err == ESP_OK) {
*link_head = sleep_retention_find_link_by_id(REGDMA_PHY_LINK(0x00));
}
}
#endif
return err;
}
esp_err_t sleep_modem_state_phy_link_deinit(void *link_head)
{
esp_err_t err = ESP_OK;
#if SOC_PM_PAU_REGDMA_LINK_IDX_WIFIMAC
err = sleep_retention_module_free(SLEEP_RETENTION_MODULE_MODEM_PHY);
if (err == ESP_OK) {
sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_MODEM_PHY);
}
#endif
return err;
}
#endif /* SOC_PM_SUPPORT_PMU_MODEM_STATE */

View File

@ -0,0 +1,122 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/soc_caps.h"
#include "soc/i2c_ana_mst_reg.h"
#include "soc/pmu_reg.h"
#include "modem/modem_syscon_reg.h"
#include "modem/modem_lpcon_reg.h"
#include "esp_private/esp_pau.h"
#include "esp_private/sleep_modem.h"
#include "esp_private/sleep_retention.h"
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
#define SARADC_TSENS_REG (0x6000e058)
#define SARADC_TSENS_PU (BIT(22))
#define PMU_RF_PWR_REG (0x600b0154)
#define FECOEX_SET_FREQ_SET_CHAN_REG (0x600a00c0)
#define FECOEX_SET_CHAN_EN (BIT(14))
#define FECOEX_SET_FREQ_SET_CHAN_ST_REG (0x600a00cc)
#define FECOEX_SET_CHAN_DONE (BIT(8))
#define FECOEX_AGC_CONF_REG (0x600a7030)
#define FECOEX_AGC_DIS (BIT(29))
#define WDEVTXQ_BLOCK (0x600A4ca8)
#define WDEV_RXBLOCK (BIT(12))
#define MODEM_FE_DATA_BASE (0x600a0400)
#define MODEM_FE_CTRL_BASE (0x600a0800)
esp_err_t sleep_modem_state_phy_link_init(void **link_head)
{
esp_err_t err = ESP_OK;
#if SOC_PM_PAU_REGDMA_LINK_WIFIMAC
static regdma_link_config_t wifi_modem_config[] = {
[0] = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(0), MODEM_FE_DATA_BASE, MODEM_FE_DATA_BASE, 41, 0, 0),
[1] = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(1), MODEM_FE_CTRL_BASE, MODEM_FE_CTRL_BASE, 87, 0, 0),
[2] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x00), MODEM_LPCON_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_EN, MODEM_LPCON_CLK_I2C_MST_EN_M, 1, 0), /* I2C MST enable */
[3] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x01), MODEM_LPCON_I2C_MST_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_SEL_160M, MODEM_LPCON_CLK_I2C_MST_SEL_160M_M, 1, 0), /* I2C MST sel 160m enable */
/* PMU or software to trigger enable RF PHY */
[4] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x02), I2C_ANA_MST_ANA_CONF0_REG, 0x8, 0xc, 1, 0), /* BBPLL calibration enable */
[5] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x03), PMU_RF_PWR_REG, 0xf0000000, 0xf0000000, 1, 0),
[6] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x04), SARADC_TSENS_REG, SARADC_TSENS_PU, 0x400000, 1, 0),
[7] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x05), I2C_ANA_MST_I2C_BURST_CONF_REG, 0, 0xffffffff, 1, 0),
[8] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x06), PMU_DATE_REG, ~I2C_ANA_MST_BURST_DONE, 0x1, 1, 0),
[9] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x07), PMU_DATE_REG, ~I2C_ANA_MST_BURST_DONE, 0x1, 1, 0),
[10] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x08), I2C_ANA_MST_I2C_BURST_STATUS_REG, I2C_ANA_MST_BURST_DONE, 0x1, 1, 0),
[11] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x09), FECOEX_SET_FREQ_SET_CHAN_REG, FECOEX_SET_CHAN_EN, 0x4000, 1, 0),
[12] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0a), FECOEX_SET_FREQ_SET_CHAN_REG, 0, 0x4000, 1, 0),
[13] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0b), PMU_DATE_REG, ~FECOEX_SET_CHAN_DONE, 0x100, 1, 0),
[14] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x0c), PMU_DATE_REG, ~FECOEX_SET_CHAN_DONE, 0x100, 1, 0),
[15] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x0d), FECOEX_SET_FREQ_SET_CHAN_ST_REG, FECOEX_SET_CHAN_DONE, 0x100, 1, 0),
[16] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0e), MODEM_SYSCON_WIFI_BB_CFG_REG, BIT(1), 0x2, 1, 0),
[17] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0f), FECOEX_AGC_CONF_REG, 0, 0x20000000, 1, 0),
/* PMU to trigger enable RXBLOCK */
[18] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x10), WDEVTXQ_BLOCK, 0, 0x1000, 1, 0),
/* PMU or software to trigger disable RF PHY */
[19] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x11), FECOEX_AGC_CONF_REG, FECOEX_AGC_DIS, 0x20000000, 0, 1),
[20] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x12), MODEM_SYSCON_WIFI_BB_CFG_REG, 0, 0x2, 0, 1),
[21] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x13), FECOEX_SET_FREQ_SET_CHAN_REG, 0, 0x4000, 0, 1),
[22] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x14), I2C_ANA_MST_I2C_BURST_CONF_REG, 0, 0xffffffff, 0, 1),
[23] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x15), PMU_DATE_REG, ~I2C_ANA_MST_BURST_DONE, 0x1, 0, 1),
[24] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x16), PMU_DATE_REG, ~I2C_ANA_MST_BURST_DONE, 0x1, 0, 1),
[25] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x17), I2C_ANA_MST_I2C_BURST_STATUS_REG, I2C_ANA_MST_BURST_DONE, 0x1, 0, 1),
[26] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x18), SARADC_TSENS_REG, 0, 0x400000, 0, 1),
[27] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x19), PMU_RF_PWR_REG, 0, 0xf0000000, 0, 1),
[28] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x1a), I2C_ANA_MST_ANA_CONF0_REG, 0x4, 0xc, 0, 1), /* BBPLL calibration disable */
[29] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x1b), MODEM_LPCON_CLK_CONF_REG, 0, MODEM_LPCON_CLK_I2C_MST_EN_M, 0, 1), /* I2C MST disable */
/* PMU to trigger disable RXBLOCK */
[30] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x1c), PMU_DATE_REG, ~0, 0x6000, 0, 1),
[31] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x1d), PMU_DATE_REG, ~0, 0x6000, 0, 1),
[32] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x1e), WDEVTXQ_BLOCK, 0, 0x6000, 0, 1),
[33] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x1f), WDEVTXQ_BLOCK, WDEV_RXBLOCK, 0x1000, 0, 1),
[34] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x20), PMU_DATE_REG, ~0, 0x6000, 0, 1),
[35] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x21), PMU_DATE_REG, ~0, 0x6000, 0, 1),
[36] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x22), WDEVTXQ_BLOCK, 0, 0x6000, 0, 1),
[37] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x23), PMU_SLP_WAKEUP_CNTL7_REG, 0x200000, 0xffff0000, 1, 0),
[38] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x24), PMU_SLP_WAKEUP_CNTL7_REG, 0x9730000, 0xffff0000, 0, 1)
};
extern uint32_t phy_ana_i2c_master_burst_rf_onoff(bool on);
wifi_modem_config[7].write_wait.value = phy_ana_i2c_master_burst_rf_onoff(true);
wifi_modem_config[22].write_wait.value = phy_ana_i2c_master_burst_rf_onoff(false);
void *link = NULL;
for (int i = ARRAY_SIZE(wifi_modem_config) - 1; (err == ESP_OK) && (i >= 0); i--) {
void *next = regdma_link_init_safe(&wifi_modem_config[i], false, 0, link);
if (next) {
link = next;
} else {
regdma_link_destroy(link, 0);
err = ESP_ERR_NO_MEM;
}
}
if (err == ESP_OK) {
pau_regdma_set_modem_link_addr(link);
*link_head = link;
}
#endif
return err;
}
esp_err_t sleep_modem_state_phy_link_deinit(void *link_head)
{
#if SOC_PM_PAU_REGDMA_LINK_WIFIMAC
regdma_link_destroy(link_head, 0);
#endif
return ESP_OK;
}
#endif /* SOC_PM_SUPPORT_PMU_MODEM_STATE */

View File

@ -0,0 +1,91 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "esp_private/sleep_clock.h"
#include "soc/pcr_reg.h"
#include "modem/modem_syscon_reg.h"
static const char *TAG = "sleep_clock";
esp_err_t sleep_clock_system_retention_init(void *arg)
{
const static sleep_retention_entries_config_t pcr_regs_retention[] = {
[0] = { .config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_PCR_LINK(0), DR_REG_PCR_BASE, DR_REG_PCR_BASE, 63, 0, 0, 0xfd73ffff, 0xfdffffff, 0xe001, 0x0), .owner = ENTRY(0) | ENTRY(1) },
};
esp_err_t err = sleep_retention_entries_create(pcr_regs_retention, ARRAY_SIZE(pcr_regs_retention), REGDMA_LINK_PRI_SYS_CLK, SLEEP_RETENTION_MODULE_CLOCK_SYSTEM);
ESP_RETURN_ON_ERROR(err, TAG, "failed to allocate memory for system (PCR) retention");
ESP_LOGI(TAG, "System Power, Clock and Reset sleep retention initialization");
return ESP_OK;
}
#if CONFIG_MAC_BB_PD || CONFIG_BT_LE_SLEEP_ENABLE || CONFIG_IEEE802154_SLEEP_ENABLE
esp_err_t sleep_clock_modem_retention_init(void *arg)
{
#define N_REGS_SYSCON() (((MODEM_SYSCON_MEM_CONF_REG - MODEM_SYSCON_TEST_CONF_REG) / 4) + 1)
const static sleep_retention_entries_config_t modem_regs_retention[] = {
[0] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEMSYSCON_LINK(0), MODEM_SYSCON_TEST_CONF_REG, MODEM_SYSCON_TEST_CONF_REG, N_REGS_SYSCON(), 0, 0), .owner = ENTRY(0) | ENTRY(1) }, /* MODEM SYSCON */
};
esp_err_t err = sleep_retention_entries_create(modem_regs_retention, ARRAY_SIZE(modem_regs_retention), REGDMA_LINK_PRI_MODEM_CLK, SLEEP_RETENTION_MODULE_CLOCK_MODEM);
ESP_RETURN_ON_ERROR(err, TAG, "failed to allocate memory for modem (SYSCON) retention, 1 level priority");
ESP_LOGI(TAG, "Modem Power, Clock and Reset sleep retention initialization");
return ESP_OK;
}
#endif
bool clock_domain_pd_allowed(void)
{
const uint32_t inited_modules = sleep_retention_get_inited_modules();
const uint32_t created_modules = sleep_retention_get_created_modules();
const uint32_t sys_clk_dep_modules = (const uint32_t) (BIT(SLEEP_RETENTION_MODULE_SYS_PERIPH));
/* The clock and reset of MODEM (WiFi, BLE and 15.4) modules are managed
* through MODEM_SYSCON, when one or more MODEMs are initialized, it is
* necessary to check the state of CLOCK_MODEM to determine MODEM domain on
* or off. The clock and reset of digital peripherals are managed through
* PCR, with TOP domain similar to MODEM domain. */
uint32_t modem_clk_dep_modules = 0;
#if SOC_WIFI_SUPPORTED
modem_clk_dep_modules |= BIT(SLEEP_RETENTION_MODULE_WIFI_MAC) | BIT(SLEEP_RETENTION_MODULE_WIFI_BB);
#endif
#if SOC_BT_SUPPORTED
modem_clk_dep_modules |= BIT(SLEEP_RETENTION_MODULE_BLE_MAC) | BIT(SLEEP_RETENTION_MODULE_BT_BB);
#endif
#if SOC_IEEE802154_SUPPORTED
modem_clk_dep_modules |= BIT(SLEEP_RETENTION_MODULE_802154_MAC) | BIT(SLEEP_RETENTION_MODULE_BT_BB);
#endif
uint32_t mask = 0;
if (inited_modules & sys_clk_dep_modules) {
mask |= BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM);
}
if (inited_modules & modem_clk_dep_modules) {
#if SOC_WIFI_SUPPORTED || SOC_BT_SUPPORTED || SOC_IEEE802154_SUPPORTED
mask |= BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM);
#endif
}
return ((inited_modules & mask) == (created_modules & mask));
}
ESP_SYSTEM_INIT_FN(sleep_clock_startup_init, SECONDARY, BIT(0), 106)
{
sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_clock_system_retention_init, .arg = NULL } },
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE
};
sleep_retention_module_init(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM, &init_param);
#if CONFIG_MAC_BB_PD || CONFIG_BT_LE_SLEEP_ENABLE || CONFIG_IEEE802154_SLEEP_ENABLE
init_param = (sleep_retention_module_init_param_t) {
.cbs = { .create = { .handle = sleep_clock_modem_retention_init, .arg = NULL } },
.attribute = SLEEP_RETENTION_MODULE_ATTR_PASSIVE
};
sleep_retention_module_init(SLEEP_RETENTION_MODULE_CLOCK_MODEM, &init_param);
#endif
return ESP_OK;
}

View File

@ -0,0 +1,162 @@
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stddef.h>
#include <string.h>
#include <inttypes.h>
#include "esp_attr.h"
#include "esp_check.h"
#include "esp_sleep.h"
#include "esp_log.h"
#include "esp_heap_caps.h"
#include "soc/soc_caps.h"
#include "sdkconfig.h"
#include "soc/spi_mem_reg.h"
#include "esp_private/startup_internal.h"
static const char *TAG = "sleep_mmu";
typedef struct {
uint32_t start;
uint32_t end;
} mmu_domain_dev_regs_region_t;
typedef struct {
mmu_domain_dev_regs_region_t *region;
int region_num;
uint32_t *regs_frame;
} mmu_domain_dev_sleep_frame_t;
/**
* Internal structure which holds all requested light sleep mmu retention parameters
*/
typedef struct {
struct {
mmu_domain_dev_sleep_frame_t *mmu_table_frame;
} retent;
} sleep_mmu_retention_t;
static DRAM_ATTR __attribute__((unused)) sleep_mmu_retention_t s_mmu_retention;
static void * mmu_domain_dev_sleep_frame_alloc_and_init(const mmu_domain_dev_regs_region_t *regions, const int region_num)
{
const int region_sz = sizeof(mmu_domain_dev_regs_region_t) * region_num;
int regs_frame_sz = 0;
for (int num = 0; num < region_num; num++) {
regs_frame_sz += regions[num].end - regions[num].start;
}
void *frame = heap_caps_malloc(sizeof(mmu_domain_dev_sleep_frame_t) + region_sz + regs_frame_sz, MALLOC_CAP_32BIT|MALLOC_CAP_INTERNAL);
if (frame) {
mmu_domain_dev_regs_region_t *region = (mmu_domain_dev_regs_region_t *)(frame + sizeof(mmu_domain_dev_sleep_frame_t));
memcpy(region, regions, region_num * sizeof(mmu_domain_dev_regs_region_t));
void *regs_frame = frame + sizeof(mmu_domain_dev_sleep_frame_t) + region_sz;
memset(regs_frame, 0, regs_frame_sz);
*(mmu_domain_dev_sleep_frame_t *)frame = (mmu_domain_dev_sleep_frame_t) {
.region = region,
.region_num = region_num,
.regs_frame = (uint32_t *)regs_frame
};
}
return frame;
}
static inline void * mmu_domain_mmu_table_sleep_frame_alloc_and_init(void)
{
#define MMU_TABLE_SIZE (512 * 4)
const static mmu_domain_dev_regs_region_t regions[] = {
{ .start = SPI_MEM_MMU_ITEM_CONTENT_REG(0), .end = SPI_MEM_MMU_ITEM_CONTENT_REG(0) + MMU_TABLE_SIZE}
};
return mmu_domain_dev_sleep_frame_alloc_and_init(regions, sizeof(regions) / sizeof(regions[0]));
}
static IRAM_ATTR void mmu_domain_dev_regs_save(mmu_domain_dev_sleep_frame_t *frame)
{
assert(frame);
mmu_domain_dev_regs_region_t *region = frame->region;
uint32_t *regs_frame = frame->regs_frame;
int offset = 0;
for (int i = 0; i < frame->region_num; i++) {
for (uint32_t addr = region[i].start; addr < region[i].end; addr+=4) {
REG_WRITE(SPI_MEM_MMU_ITEM_INDEX_REG(0), offset);
regs_frame[offset++] = REG_READ(SPI_MEM_MMU_ITEM_CONTENT_REG(0));
}
}
}
static IRAM_ATTR void mmu_domain_dev_regs_restore(mmu_domain_dev_sleep_frame_t *frame)
{
assert(frame);
mmu_domain_dev_regs_region_t *region = frame->region;
uint32_t *regs_frame = frame->regs_frame;
int offset = 0;
for (int i = 0; i < frame->region_num; i++) {
for (uint32_t addr = region[i].start; addr < region[i].end; addr+=4) {
REG_WRITE(SPI_MEM_MMU_ITEM_INDEX_REG(0), offset);
REG_WRITE(SPI_MEM_MMU_ITEM_CONTENT_REG(0),regs_frame[offset++]);
}
}
}
IRAM_ATTR void esp_sleep_mmu_retention(bool backup_or_restore)
{
if (backup_or_restore) {
mmu_domain_dev_regs_save(s_mmu_retention.retent.mmu_table_frame);
} else {
mmu_domain_dev_regs_restore(s_mmu_retention.retent.mmu_table_frame);
}
}
static esp_err_t esp_sleep_mmu_retention_deinit_impl(void)
{
if (s_mmu_retention.retent.mmu_table_frame) {
heap_caps_free((void *)s_mmu_retention.retent.mmu_table_frame);
s_mmu_retention.retent.mmu_table_frame = NULL;
}
return ESP_OK;
}
static esp_err_t esp_sleep_mmu_retention_init_impl(void)
{
if (s_mmu_retention.retent.mmu_table_frame == NULL) {
void *frame = mmu_domain_mmu_table_sleep_frame_alloc_and_init();
if (frame == NULL) {
goto err;
}
s_mmu_retention.retent.mmu_table_frame = (mmu_domain_dev_sleep_frame_t *)frame;
}
return ESP_OK;
err:
esp_sleep_mmu_retention_deinit();
return ESP_ERR_NO_MEM;
}
esp_err_t esp_sleep_mmu_retention_init(void)
{
return esp_sleep_mmu_retention_init_impl();
}
esp_err_t esp_sleep_mmu_retention_deinit(void)
{
return esp_sleep_mmu_retention_deinit_impl();
}
bool mmu_domain_pd_allowed(void)
{
return (s_mmu_retention.retent.mmu_table_frame != NULL);
}
ESP_SYSTEM_INIT_FN(sleep_mmu_startup_init, SECONDARY, BIT(0), 108)
{
esp_err_t ret;
ret = esp_sleep_mmu_retention_init();
if (ret != ESP_OK) {
ESP_EARLY_LOGW(TAG, "Failed to enable TOP power down during light sleep.");
}
return ESP_OK;
}

View File

@ -423,7 +423,7 @@ void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpcl
esp_sleep_pd_domain_t pd_domain = (esp_sleep_pd_domain_t) (
(last_src == MODEM_CLOCK_LPCLK_SRC_RC_FAST) ? ESP_PD_DOMAIN_RC_FAST :
(last_src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) ? ESP_PD_DOMAIN_XTAL :
#if !SOC_CLK_RC32K_NOT_TO_USE
#if !CONFIG_ESP_CLK_RC32K_NOT_TO_USE
(last_src == MODEM_CLOCK_LPCLK_SRC_RC32K) ? ESP_PD_DOMAIN_RC32K :
#endif
(last_src == MODEM_CLOCK_LPCLK_SRC_XTAL32K) ? ESP_PD_DOMAIN_XTAL32K :
@ -431,7 +431,7 @@ void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpcl
esp_sleep_pd_domain_t pu_domain = (esp_sleep_pd_domain_t) (
(src == MODEM_CLOCK_LPCLK_SRC_RC_FAST) ? ESP_PD_DOMAIN_RC_FAST :
(src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) ? ESP_PD_DOMAIN_XTAL :
#if !SOC_CLK_RC32K_NOT_TO_USE
#if !CONFIG_ESP_CLK_RC32K_NOT_TO_USE
(src == MODEM_CLOCK_LPCLK_SRC_RC32K) ? ESP_PD_DOMAIN_RC32K :
#endif
(src == MODEM_CLOCK_LPCLK_SRC_XTAL32K) ? ESP_PD_DOMAIN_XTAL32K :
@ -486,7 +486,7 @@ void modem_clock_deselect_lp_clock_source(periph_module_t module)
esp_sleep_pd_domain_t pd_domain = (esp_sleep_pd_domain_t) (
(last_src == MODEM_CLOCK_LPCLK_SRC_RC_FAST) ? ESP_PD_DOMAIN_RC_FAST :
(last_src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) ? ESP_PD_DOMAIN_XTAL :
#if !SOC_CLK_RC32K_NOT_TO_USE
#if !CONFIG_ESP_CLK_RC32K_NOT_TO_USE
(last_src == MODEM_CLOCK_LPCLK_SRC_RC32K) ? ESP_PD_DOMAIN_RC32K :
#endif
(last_src == MODEM_CLOCK_LPCLK_SRC_XTAL32K) ? ESP_PD_DOMAIN_XTAL32K :

View File

@ -35,3 +35,24 @@ config RTC_CLK_CAL_CYCLES
- 32768 Hz if the 32k crystal oscillator is used. For this use value 3000 or more.
In case more value will help improve the definition of the launch of the crystal.
If the crystal could not start, it will be switched to internal RC.
choice RTC_FAST_CLK_SRC
depends on SOC_CLK_LP_FAST_SUPPORT_XTAL
prompt "RTC fast clock source"
default RTC_FAST_CLK_SRC_RC_FAST
help
Choose which clock is used as RTC fast clock source.
Choosing the faster 48 MHz external crystal clock (XTAL) can allow modules which depend on RTC_FAST
to work at a higher clock frequency. With this the ULP LP-Core will run with a
CPU frequency of 48 Mhz instead of the default 20 Mhz.
The drawback is that the XTAL is usually powered down during sleep, as
it draw a lot of power. Choosing this option will cause the XTAL to stay
powered on, increasing sleep power consumption.
config RTC_FAST_CLK_SRC_RC_FAST
bool "20 Mhz RC Fast Clock"
config RTC_FAST_CLK_SRC_XTAL
bool "48 Mhz crystal (increased power consumption during sleep)"
endchoice

View File

@ -34,44 +34,44 @@ static void esp_cpu_configure_invalid_regions(void)
__attribute__((unused)) const unsigned PMA_RX = PMA_L | PMA_EN | PMA_R | PMA_X;
__attribute__((unused)) const unsigned PMA_RWX = PMA_L | PMA_EN | PMA_R | PMA_W | PMA_X;
// ROM uses some PMA entries, so we need to clear them before using them in ESP-IDF
// 0. Gap at bottom of address space
PMA_ENTRY_SET_NAPOT(0, 0, SOC_CPU_SUBSYSTEM_LOW, PMA_NAPOT | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_NAPOT(0, 0, SOC_CPU_SUBSYSTEM_LOW, PMA_NAPOT | PMA_NONE);
// 1. Gap between debug region & IROM
PMA_ENTRY_SET_TOR(1, SOC_CPU_SUBSYSTEM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(2, SOC_IROM_MASK_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(1, SOC_CPU_SUBSYSTEM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(2, SOC_IROM_MASK_LOW, PMA_TOR | PMA_NONE);
// 2. ROM has configured the ROM region to be cacheable, so we just need to lock the configuration
PMA_ENTRY_SET_TOR(3, SOC_IROM_MASK_LOW, PMA_NONE);
PMA_ENTRY_SET_TOR(4, SOC_DROM_MASK_HIGH, PMA_TOR | PMA_RX);
PMA_RESET_AND_ENTRY_SET_TOR(3, SOC_IROM_MASK_LOW, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(4, SOC_DROM_MASK_HIGH, PMA_TOR | PMA_RX);
// 3. Gap between ROM & RAM
PMA_ENTRY_SET_TOR(5, SOC_DROM_MASK_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(6, SOC_IRAM_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(5, SOC_DROM_MASK_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(6, SOC_IRAM_LOW, PMA_TOR | PMA_NONE);
// 4. Gap between DRAM and I_Cache
PMA_ENTRY_SET_TOR(7, SOC_IRAM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(8, SOC_IROM_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(7, SOC_IRAM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(8, SOC_IROM_LOW, PMA_TOR | PMA_NONE);
// 5. ROM has configured the MSPI region with RX permission, we should add W attribute for psram and lock the configuration
// This function sets invalid regions but this is a valid memory region configuration that could have
// been configured using PMP as well, but due to insufficient PMP entries we are configuring this using PMA.
// This entry is also required to be set using PMA because the region needs to be configured as cacheable.
PMA_ENTRY_SET_NAPOT(9, SOC_IROM_LOW, (SOC_IROM_HIGH - SOC_IROM_LOW), PMA_NAPOT | PMA_RWX);
PMA_RESET_AND_ENTRY_SET_NAPOT(9, SOC_IROM_LOW, (SOC_IROM_HIGH - SOC_IROM_LOW), PMA_NAPOT | PMA_RWX);
// 6. Gap between D_Cache & LP_RAM
PMA_ENTRY_SET_TOR(10, SOC_DROM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(11, SOC_RTC_IRAM_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(10, SOC_DROM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(11, SOC_RTC_IRAM_LOW, PMA_TOR | PMA_NONE);
// 7. Gap between LP memory & peripheral addresses
PMA_ENTRY_SET_TOR(12, SOC_RTC_IRAM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(13, SOC_PERIPHERAL_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(12, SOC_RTC_IRAM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(13, SOC_PERIPHERAL_LOW, PMA_TOR | PMA_NONE);
// 8. End of address space
PMA_ENTRY_SET_TOR(14, SOC_PERIPHERAL_HIGH, PMA_NONE);
PMA_ENTRY_CFG_RESET(15);
PMA_ENTRY_SET_TOR(15, UINT32_MAX, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(14, SOC_PERIPHERAL_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(15, UINT32_MAX, PMA_TOR | PMA_NONE);
}
void esp_cpu_configure_region_protection(void)

View File

@ -17,7 +17,7 @@ if(NOT BOOTLOADER_BUILD)
endif()
# TODO: [ESP32C61] IDF-9250
# TODO: [ESP32C61] IDF-9304
if(CONFIG_IDF_TARGET_ESP32C61)
list(REMOVE_ITEM srcs
"sar_periph_ctrl.c"

View File

@ -35,34 +35,41 @@ static void esp_cpu_configure_invalid_regions(void)
__attribute__((unused)) const unsigned PMA_RX = PMA_L | PMA_EN | PMA_R | PMA_X;
__attribute__((unused)) const unsigned PMA_RWX = PMA_L | PMA_EN | PMA_R | PMA_W | PMA_X;
// ROM uses some PMA entries, so we need to clear them before using them in ESP-IDF
// 0. Gap at bottom of address space
PMA_ENTRY_SET_NAPOT(0, 0, SOC_CPU_SUBSYSTEM_LOW, PMA_NAPOT | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_NAPOT(0, 0, SOC_CPU_SUBSYSTEM_LOW, PMA_NAPOT | PMA_NONE);
// 1. Gap between debug region & IROM
PMA_ENTRY_SET_TOR(1, SOC_CPU_SUBSYSTEM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(2, SOC_IROM_MASK_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(1, SOC_CPU_SUBSYSTEM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(2, SOC_IROM_MASK_LOW, PMA_TOR | PMA_NONE);
// 3. Gap between ROM & RAM
PMA_ENTRY_SET_TOR(3, SOC_DROM_MASK_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(4, SOC_IRAM_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(3, SOC_DROM_MASK_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(4, SOC_IRAM_LOW, PMA_TOR | PMA_NONE);
// 4. Gap between DRAM and I_Cache
PMA_ENTRY_SET_TOR(5, SOC_IRAM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(6, SOC_IROM_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(5, SOC_IRAM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(6, SOC_IROM_LOW, PMA_TOR | PMA_NONE);
// 5. ROM has configured the MSPI region with RX permission, we should add W attribute for psram and lock the configuration
// This function sets invalid regions but this is a valid memory region configuration that could have
// been configured using PMP as well, but due to insufficient PMP entries we are configuring this using PMA.
// This entry is also required to be set using PMA because the region needs to be configured as cacheable.
PMA_ENTRY_SET_NAPOT(7, SOC_IROM_LOW, (SOC_IROM_HIGH - SOC_IROM_LOW), PMA_NAPOT | PMA_RWX);
PMA_RESET_AND_ENTRY_SET_NAPOT(7, SOC_IROM_LOW, (SOC_IROM_HIGH - SOC_IROM_LOW), PMA_NAPOT | PMA_RWX);
// 6. Gap between D_Cache & peripheral addresses
PMA_ENTRY_SET_TOR(8, SOC_DROM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(9, SOC_PERIPHERAL_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(8, SOC_DROM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(9, SOC_PERIPHERAL_LOW, PMA_TOR | PMA_NONE);
// 7. End of address space
PMA_ENTRY_SET_TOR(10, SOC_PERIPHERAL_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(11, UINT32_MAX, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(10, SOC_PERIPHERAL_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(11, UINT32_MAX, PMA_TOR | PMA_NONE);
PMA_ENTRY_CFG_RESET(12);
PMA_ENTRY_CFG_RESET(13);
PMA_ENTRY_CFG_RESET(14);
PMA_ENTRY_CFG_RESET(15);
}
void esp_cpu_configure_region_protection(void)

View File

@ -10,8 +10,6 @@
extern "C" {
#endif
// TODO: IDF-9247
#define PMU_EXT0_WAKEUP_EN BIT(0)
#define PMU_EXT1_WAKEUP_EN BIT(1)
#define PMU_GPIO_WAKEUP_EN BIT(2)

View File

@ -476,12 +476,12 @@ typedef struct pmu_sleep_machine_constant {
.reset_wait_time_us = 1, \
.power_supply_wait_time_us = 20, \
.power_up_wait_time_us = 2, \
.regdma_s2m_work_time_us = 172, \
.regdma_s2a_work_time_us = 480, \
.regdma_m2a_work_time_us = 278, \
.regdma_a2s_work_time_us = 382, \
.regdma_rf_on_work_time_us = 70, \
.regdma_rf_off_work_time_us = 23, \
.regdma_s2m_work_time_us = 270, \
.regdma_s2a_work_time_us = 666, \
.regdma_m2a_work_time_us = 296, \
.regdma_a2s_work_time_us = 586, \
.regdma_rf_on_work_time_us = 138, \
.regdma_rf_off_work_time_us = 28, \
.xtal_wait_stable_time_us = 250, \
.pll_wait_stable_time_us = 1 \
} \

View File

@ -37,3 +37,24 @@ config RTC_CLK_CAL_CYCLES
- 32768 Hz if the 32k crystal oscillator is used. For this use value 3000 or more.
In case more value will help improve the definition of the launch of the crystal.
If the crystal could not start, it will be switched to internal RC.
choice RTC_FAST_CLK_SRC
depends on SOC_CLK_LP_FAST_SUPPORT_XTAL
prompt "RTC fast clock source"
default RTC_FAST_CLK_SRC_RC_FAST
help
Choose which clock is used as RTC fast clock source.
Choosing the faster 40 MHz XTAL can allow modules which depend on RTC_FAST
to work at a higher clock frequency. With this the ULP LP-Core will run with a
CPU frequency of 40 Mhz instead of the default 20 Mhz.
The drawback is that the XTAL is usually powered down during sleep, as
it draw a lot of power. Choosing this option will cause the XTAL to stay
powered on, increasing sleep power consumption.
config RTC_FAST_CLK_SRC_RC_FAST
bool "20 Mhz RC Fast Clock"
config RTC_FAST_CLK_SRC_XTAL
bool "40 Mhz crystal (increased power consumption during sleep)"
endchoice

View File

@ -38,42 +38,44 @@ static void esp_cpu_configure_invalid_regions(void)
__attribute__((unused)) const unsigned PMA_RX = PMA_L | PMA_EN | PMA_R | PMA_X;
__attribute__((unused)) const unsigned PMA_RWX = PMA_L | PMA_EN | PMA_R | PMA_W | PMA_X;
// ROM uses some PMA entries, so we need to clear them before using them in ESP-IDF
// 0. Gap at bottom of address space
PMA_ENTRY_SET_NAPOT(0, 0, SOC_CPU_SUBSYSTEM_LOW, PMA_NAPOT | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_NAPOT(0, 0, SOC_CPU_SUBSYSTEM_LOW, PMA_NAPOT | PMA_NONE);
// 1. Gap between CPU subsystem region & HP TCM
PMA_ENTRY_SET_TOR(1, SOC_CPU_SUBSYSTEM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(2, SOC_TCM_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(1, SOC_CPU_SUBSYSTEM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(2, SOC_TCM_LOW, PMA_TOR | PMA_NONE);
// 2. Gap between HP TCM and CPU Peripherals
PMA_ENTRY_SET_TOR(3, SOC_TCM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(4, CPU_PERIPH_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(3, SOC_TCM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(4, CPU_PERIPH_LOW, PMA_TOR | PMA_NONE);
// 3. Gap between CPU Peripherals and I_Cache
PMA_ENTRY_SET_TOR(5, CPU_PERIPH_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(6, SOC_IROM_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(5, CPU_PERIPH_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(6, SOC_IROM_LOW, PMA_TOR | PMA_NONE);
// 4. Gap between I_Cache and external memory range
PMA_ENTRY_SET_NAPOT(7, SOC_DROM_HIGH, SOC_EXTRAM_LOW - SOC_DROM_HIGH, PMA_NAPOT | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_NAPOT(7, SOC_DROM_HIGH, SOC_EXTRAM_LOW - SOC_DROM_HIGH, PMA_NAPOT | PMA_NONE);
// 5. Gap between external memory and ROM
PMA_ENTRY_SET_TOR(8, SOC_EXTRAM_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(9, SOC_IROM_MASK_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(8, SOC_EXTRAM_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(9, SOC_IROM_MASK_LOW, PMA_TOR | PMA_NONE);
// 6. Gap between ROM and internal memory
PMA_ENTRY_SET_TOR(10, SOC_IROM_MASK_HIGH, PMA_NONE);
PMA_ENTRY_SET_TOR(11, SOC_IRAM_LOW, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(10, SOC_IROM_MASK_HIGH, PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(11, SOC_IRAM_LOW, PMA_TOR | PMA_NONE);
// 7. Gap between internal memory and HP peripherals
PMA_ENTRY_SET_NAPOT(12, SOC_DRAM_HIGH, SOC_PERIPHERAL_LOW - SOC_DRAM_HIGH, PMA_NAPOT | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_NAPOT(12, SOC_DRAM_HIGH, SOC_PERIPHERAL_LOW - SOC_DRAM_HIGH, PMA_NAPOT | PMA_NONE);
// 8. Special case - This whitelists the External flash/RAM, HP ROM and HP L2MEM regions and make them cacheable.
// At the startup, this is done using PMA entry 15 by the ROM code.
PMA_ENTRY_SET_NAPOT(13, SOC_IROM_LOW, SOC_PERIPHERAL_LOW - SOC_IROM_LOW, PMA_NAPOT | PMA_RWX);
PMA_RESET_AND_ENTRY_SET_NAPOT(13, SOC_IROM_LOW, SOC_PERIPHERAL_LOW - SOC_IROM_LOW, PMA_NAPOT | PMA_RWX);
// 9. Gap between Uncacheable L2 Mem and end of address space
PMA_ENTRY_SET_TOR(14, CACHE_LL_L2MEM_NON_CACHE_ADDR(SOC_DRAM_HIGH), PMA_NONE);
PMA_ENTRY_SET_TOR(15, UINT32_MAX, PMA_TOR | PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(14, CACHE_LL_L2MEM_NON_CACHE_ADDR(SOC_DRAM_HIGH), PMA_NONE);
PMA_RESET_AND_ENTRY_SET_TOR(15, UINT32_MAX, PMA_TOR | PMA_NONE);
}
void esp_cpu_configure_region_protection(void)

View File

@ -191,7 +191,7 @@ uint32_t esp_clk_tree_lp_fast_get_freq_hz(esp_clk_tree_src_freq_precision_t prec
case SOC_RTC_FAST_CLK_SRC_LP_PLL:
return clk_ll_lp_pll_get_freq_mhz() * MHZ;
#endif
#if SOC_CLK_LP_FAST_SUPPORT_XTAL
#if SOC_CLK_LP_FAST_SUPPORT_XTAL && !CONFIG_IDF_TARGET_ESP32P4 // On P4 SOC_RTC_FAST_CLK_SRC_XTAL is an alias for SOC_RTC_FAST_CLK_SRC_XTAL_DIV
case SOC_RTC_FAST_CLK_SRC_XTAL:
return clk_hal_xtal_get_freq_mhz() * MHZ;
#endif

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -12,24 +12,19 @@
#include "esp_log.h"
#include "esp_attr.h"
#include "esp_sleep.h"
#include "esp_check.h"
#include "soc/soc_caps.h"
#include "esp_private/pm_impl.h"
#include "esp_private/sleep_modem.h"
#include "esp_private/sleep_retention.h"
#include "sdkconfig.h"
#if SOC_PM_MODEM_RETENTION_BY_REGDMA
#include "modem/modem_syscon_reg.h"
#include "modem/modem_lpcon_reg.h"
#include "soc/i2c_ana_mst_reg.h"
#include "esp_pau.h"
#endif
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
#include "soc/pmu_reg.h"
#include "esp_private/esp_pau.h"
#include "esp_private/esp_pmu.h"
#endif
#if SOC_PM_MODEM_RETENTION_BY_REGDMA
#include "esp_pau.h"
#endif
static __attribute__((unused)) const char *TAG = "sleep_modem";
@ -136,29 +131,6 @@ void IRAM_ATTR mac_bb_power_up_cb_execute(void)
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
#define PMU_RF_PWR_REG (0x600b0154)
#define SARADC_TSENS_REG (0x6000e058)
#define SARADC_TSENS_PU (BIT(22))
#define FECOEX_SET_FREQ_SET_CHAN_REG (0x600a00c0)
#define FECOEX_SET_CHAN_EN (BIT(14))
#define FECOEX_SET_FREQ_SET_CHAN_ST_REG (0x600a00cc)
#define FECOEX_SET_CHAN_DONE (BIT(8))
#define FECOEX_AGC_CONF_REG (0x600a7030)
#define FECOEX_AGC_DIS (BIT(29))
#define WDEVTXQ_BLOCK (0x600A4ca8)
#define WDEV_RXBLOCK (BIT(12))
#define MODEM_FE_DATA_BASE (0x600a0400)
#define MODEM_FE_CTRL_BASE (0x600a0800)
#define I2C_BURST_VAL(host, start, end) (((host) << 31) | ((end) << 22) | ((start) << 16))
typedef struct {
struct {
uint8_t start, end; /* the start and end index of phy i2c master command memory */
uint8_t host_id; /* phy i2c master host id */
} config[2];
} phy_i2c_master_command_attribute_t;
typedef struct sleep_modem_config {
struct {
void *phy_link;
@ -174,76 +146,15 @@ typedef struct sleep_modem_config {
static sleep_modem_config_t s_sleep_modem = { .wifi.phy_link = NULL, .wifi.flags = 0 };
esp_err_t sleep_modem_wifi_modem_state_init(void)
{
esp_err_t err = ESP_OK;
phy_i2c_master_command_attribute_t cmd;
/* get RF on or off configuration info of i2c master command memory */
extern void phy_i2c_master_mem_cfg(phy_i2c_master_command_attribute_t *);
phy_i2c_master_mem_cfg(&cmd);
ESP_LOGD(TAG, "Modem link i2c master configuration: (%d,%d,%d), (%d,%d,%d)", cmd.config[0].host_id, cmd.config[0].start,
cmd.config[0].end, cmd.config[1].host_id, cmd.config[1].start, cmd.config[1].end);
static regdma_link_config_t wifi_modem_config[] = {
[0] = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(0), MODEM_FE_DATA_BASE, MODEM_FE_DATA_BASE, 41, 0, 0),
[1] = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(1), MODEM_FE_CTRL_BASE, MODEM_FE_CTRL_BASE, 87, 0, 0),
[2] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x00), MODEM_LPCON_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_EN, MODEM_LPCON_CLK_I2C_MST_EN_M, 1, 0), /* I2C MST enable */
[3] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x01), MODEM_LPCON_I2C_MST_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_SEL_160M, MODEM_LPCON_CLK_I2C_MST_SEL_160M_M, 1, 0), /* I2C MST sel 160m enable */
/* PMU or software to trigger enable RF PHY */
[4] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x02), I2C_ANA_MST_ANA_CONF0_REG, 0x8, 0xc, 1, 0), /* BBPLL calibration enable */
[5] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x03), PMU_RF_PWR_REG, 0xf0000000, 0xf0000000, 1, 0),
[6] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x04), SARADC_TSENS_REG, SARADC_TSENS_PU, 0x400000, 1, 0),
[7] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x05), I2C_ANA_MST_I2C_BURST_CONF_REG, 0, 0xffffffff, 1, 0),
[8] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x06), I2C_ANA_MST_I2C_BURST_STATUS_REG, I2C_ANA_MST_BURST_DONE, 0x1, 1, 0),
[9] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x07), FECOEX_SET_FREQ_SET_CHAN_REG, FECOEX_SET_CHAN_EN, 0x4000, 1, 0),
[10] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x08), FECOEX_SET_FREQ_SET_CHAN_REG, 0, 0x4000, 1, 0),
[11] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x09), FECOEX_SET_FREQ_SET_CHAN_ST_REG, FECOEX_SET_CHAN_DONE, 0x100, 1, 0),
[12] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0a), MODEM_SYSCON_WIFI_BB_CFG_REG, BIT(1), 0x2, 1, 0),
[13] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0b), FECOEX_AGC_CONF_REG, 0, 0x20000000, 1, 0),
/* PMU to trigger enable RXBLOCK */
[14] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0c), WDEVTXQ_BLOCK, 0, 0x1000, 1, 0),
/* PMU or software to trigger disable RF PHY */
[15] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0d), FECOEX_AGC_CONF_REG, FECOEX_AGC_DIS, 0x20000000, 0, 1),
[16] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0e), MODEM_SYSCON_WIFI_BB_CFG_REG, 0, 0x2, 0, 1),
[17] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x0f), FECOEX_SET_FREQ_SET_CHAN_REG, 0, 0x4000, 0, 1),
[18] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x10), I2C_ANA_MST_I2C_BURST_CONF_REG, 0, 0xffffffff, 0, 1),
[19] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x11), I2C_ANA_MST_I2C_BURST_STATUS_REG, I2C_ANA_MST_BURST_DONE, 0x1, 0, 1),
[20] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x12), SARADC_TSENS_REG, 0, 0x400000, 0, 1),
[21] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x13), PMU_RF_PWR_REG, 0, 0xf0000000, 0, 1),
[22] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x14), I2C_ANA_MST_ANA_CONF0_REG, 0x4, 0xc, 0, 1), /* BBPLL calibration disable */
[23] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x15), MODEM_LPCON_CLK_CONF_REG, 0, MODEM_LPCON_CLK_I2C_MST_EN_M, 0, 1), /* I2C MST disable */
/* PMU to trigger disable RXBLOCK */
[24] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x17), WDEVTXQ_BLOCK, 0, 0x6000, 0, 1),
[25] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x18), WDEVTXQ_BLOCK, WDEV_RXBLOCK, 0x1000, 0, 1),
[26] = REGDMA_LINK_WAIT_INIT (REGDMA_PHY_LINK(0x19), WDEVTXQ_BLOCK, 0, 0x6000, 0, 1),
[27] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x1a), PMU_SLP_WAKEUP_CNTL7_REG, 0x200000, 0xffff0000, 1, 0),
[28] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x1b), PMU_SLP_WAKEUP_CNTL7_REG, 0x9730000, 0xffff0000, 0, 1)
};
wifi_modem_config[7].write_wait.value = I2C_BURST_VAL(cmd.config[1].host_id, cmd.config[1].start, cmd.config[1].end);
wifi_modem_config[18].write_wait.value = I2C_BURST_VAL(cmd.config[0].host_id, cmd.config[0].start, cmd.config[0].end);
void *link = NULL;
if (s_sleep_modem.wifi.phy_link == NULL) {
for (int i = ARRAY_SIZE(wifi_modem_config) - 1; (err == ESP_OK) && (i >= 0); i--) {
void *next = regdma_link_init_safe(&wifi_modem_config[i], false, 0, link);
if (next) {
link = next;
} else {
regdma_link_destroy(link, 0);
err = ESP_ERR_NO_MEM;
}
}
err = sleep_modem_state_phy_link_init(&link);
if (err == ESP_OK) {
pau_regdma_set_modem_link_addr(link);
s_sleep_modem.wifi.phy_link = link;
s_sleep_modem.wifi.flags = 0;
}
@ -254,7 +165,7 @@ esp_err_t sleep_modem_wifi_modem_state_init(void)
__attribute__((unused)) void sleep_modem_wifi_modem_state_deinit(void)
{
if (s_sleep_modem.wifi.phy_link) {
regdma_link_destroy(s_sleep_modem.wifi.phy_link, 0);
sleep_modem_state_phy_link_deinit(s_sleep_modem.wifi.phy_link);
s_sleep_modem.wifi.phy_link = NULL;
s_sleep_modem.wifi.flags = 0;
}

View File

@ -157,8 +157,8 @@
#define DEFAULT_SLEEP_OUT_OVERHEAD_US (318)
#define DEFAULT_HARDWARE_OUT_OVERHEAD_US (56)
#elif CONFIG_IDF_TARGET_ESP32C61
#define DEFAULT_SLEEP_OUT_OVERHEAD_US (318)
#define DEFAULT_HARDWARE_OUT_OVERHEAD_US (56)
#define DEFAULT_SLEEP_OUT_OVERHEAD_US (1148) //TODO: PM-231
#define DEFAULT_HARDWARE_OUT_OVERHEAD_US (107)
#elif CONFIG_IDF_TARGET_ESP32H2
#define DEFAULT_SLEEP_OUT_OVERHEAD_US (118)
#define DEFAULT_HARDWARE_OUT_OVERHEAD_US (9)
@ -189,8 +189,12 @@
#endif
#if SOC_PM_MMU_TABLE_RETENTION_WHEN_TOP_PD
#if CONFIG_IDF_TARGET_ESP32C61
#define SLEEP_MMU_TABLE_RETENTION_OVERHEAD_US (1232)
#elif CONFIG_IDF_TARGET_ESP32C5
#define SLEEP_MMU_TABLE_RETENTION_OVERHEAD_US (1220)
#endif
#endif
// Minimal amount of time we can sleep for
#define LIGHT_SLEEP_MIN_TIME_US 200
@ -705,7 +709,7 @@ FORCE_INLINE_ATTR void misc_modules_wake_prepare(uint32_t pd_flags)
#if SOC_USB_SERIAL_JTAG_SUPPORTED && !SOC_USB_SERIAL_JTAG_SUPPORT_LIGHT_SLEEP
sleep_console_usj_pad_restore();
#endif
#if !CONFIG_IDF_TARGET_ESP32C61
#if !CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-9304
sar_periph_ctrl_power_enable();
#endif
#if CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP && SOC_PM_CPU_RETENTION_BY_RTCCNTL
@ -2359,7 +2363,7 @@ static uint32_t get_power_down_flags(void)
}
#endif
#if SOC_PM_SUPPORT_RC32K_PD
#if !SOC_CLK_RC32K_NOT_TO_USE
#if !CONFIG_ESP_CLK_RC32K_NOT_TO_USE
if (s_config.domain[ESP_PD_DOMAIN_RC32K].pd_option != ESP_PD_OPTION_ON) {
pd_flags |= PMU_SLEEP_PD_RC32K;
}

View File

@ -21,7 +21,7 @@
#include "sdkconfig.h"
#include "esp_pmu.h"
#if SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE && CONFIG_IDF_TARGET_ESP32C5 // TODO: PM-202
#if SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE
#include "soc/pmu_reg.h" // for PMU_DATE_REG, it can provide full 32 bit read and write access
#endif
#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
@ -506,7 +506,7 @@ static esp_err_t sleep_retention_entries_create_impl(const sleep_retention_entri
return ESP_ERR_NOT_SUPPORTED;
}
#endif
#if SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE && CONFIG_IDF_TARGET_ESP32C5 // TODO: PM-202
#if SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE
/* There is a bug in REGDMA wait mode, when two wait nodes need to wait for the
* same value (_val & _mask), the second wait node will immediately return to
* wait done, The reason is that the wait mode comparison output logic immediate

View File

@ -52,7 +52,3 @@ components/esp_lcd/test_apps/spi_lcd:
- esp_driver_spi
disable:
- if: SOC_GPSPI_SUPPORTED != 1
disable_test:
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: test failed # TODO: ESP32C61 IDF-10953

View File

@ -28,6 +28,13 @@ extern "C" {
#define TEST_LCD_DC_GPIO 1
#define TEST_LCD_PCLK_GPIO 2
#define TEST_LCD_DATA0_GPIO 4
#elif CONFIG_IDF_TARGET_ESP32C61
#define TEST_LCD_BK_LIGHT_GPIO 3
#define TEST_LCD_RST_GPIO 5
#define TEST_LCD_CS_GPIO 0
#define TEST_LCD_DC_GPIO 1
#define TEST_LCD_PCLK_GPIO 2
#define TEST_LCD_DATA0_GPIO 4
#elif CONFIG_IDF_TARGET_ESP32P4
#define TEST_LCD_BK_LIGHT_GPIO 23
#define TEST_LCD_RST_GPIO 6

View File

@ -5,7 +5,6 @@ from pytest_embedded import Dut
@pytest.mark.supported_targets
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='test case fail') # TODO: [ESP32C61] IDF-10953
@pytest.mark.generic
@pytest.mark.parametrize(
'config',

View File

@ -134,8 +134,8 @@ static void s_reserve_irom_region(mem_region_t *hw_mem_regions, int region_nums)
* - Now IBUS addresses (between `_instruction_reserved_start` and `_instruction_reserved_end`) are consecutive on all chips,
* we strongly rely on this to calculate the .text length
*/
extern int _instruction_reserved_start;
extern int _instruction_reserved_end;
extern char _instruction_reserved_start;
extern char _instruction_reserved_end;
size_t irom_len_to_reserve = (uint32_t)&_instruction_reserved_end - (uint32_t)&_instruction_reserved_start;
assert((mmu_ll_vaddr_to_laddr((uint32_t)&_instruction_reserved_end) - mmu_ll_vaddr_to_laddr((uint32_t)&_instruction_reserved_start)) == irom_len_to_reserve);
@ -162,8 +162,8 @@ static void s_reserve_drom_region(mem_region_t *hw_mem_regions, int region_nums)
/**
* Similarly, we follow the way how 1st bootloader load flash .rodata:
*/
extern int _rodata_reserved_start;
extern int _rodata_reserved_end;
extern char _rodata_reserved_start;
extern char _rodata_reserved_end;
size_t drom_len_to_reserve = (uint32_t)&_rodata_reserved_end - (uint32_t)&_rodata_reserved_start;
assert((mmu_ll_vaddr_to_laddr((uint32_t)&_rodata_reserved_end) - mmu_ll_vaddr_to_laddr((uint32_t)&_rodata_reserved_start)) == drom_len_to_reserve);

View File

@ -13,17 +13,12 @@ extern "C" {
#define ESP_CAL_DATA_CHECK_FAIL 1
typedef enum {
PHY_I2C_MST_CMD_TYPE_OFF = 0,
PHY_I2C_MST_CMD_TYPE_ON,
PHY_I2C_MST_CMD_TYPE_MAX
} phy_i2c_master_command_type_t;
typedef struct {
uint8_t cmd_type; /* the command type of the current phy i2c master command memory config */
struct {
uint8_t start, end; /* the start and end index of phy i2c master command memory */
uint8_t host_id; /* phy i2c master host id */
} config[PHY_I2C_MST_CMD_TYPE_MAX];
} config;
} phy_i2c_master_command_attribute_t;
/**
@ -88,13 +83,14 @@ void phy_xpd_tsens(void);
void phy_init_flag(void);
#endif
#if CONFIG_IDF_TARGET_ESP32C6
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
/**
* @brief Get the configuration info of PHY i2c master command memory.
*
* @param attr the configuration info of PHY i2c master command memory
* @param[out] attr the configuration info of PHY i2c master command memory
* @param[out] size the count of PHY i2c master command memory configuration
*/
void phy_i2c_master_mem_cfg(phy_i2c_master_command_attribute_t *attr);
void phy_i2c_master_command_mem_cfg(phy_i2c_master_command_attribute_t *attr, int *size);
#endif
/**
@ -217,6 +213,23 @@ void phy_ant_clr_update_flag(void);
*/
void phy_ant_update(void);
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
/**
* @brief Get the REGDMA config value of the BBPLL in analog i2c master burst mode
*
* @return the BBPLL REGDMA configure value of i2c master burst mode
*/
uint32_t phy_ana_i2c_master_burst_bbpll_config(void);
/**
* @brief Get the REGDMA config value of the RF PHY on or off in analog i2c master burst mode
*
* @param[in] on true for enable RF PHY, false for disable RF PHY.
*
* @return the RF on or off configure value of i2c master burst mode
*/
uint32_t phy_ana_i2c_master_burst_rf_onoff(bool on);
#endif
#ifdef __cplusplus
}

@ -1 +1 @@
Subproject commit 8608fcf54d51e81f2e74ebf335fa33f61953f7c8
Subproject commit 1f551c5367daa87a29e0c4f724d6cf809a1841ad

View File

@ -294,3 +294,57 @@ esp_err_t esp_phy_get_ant(esp_phy_ant_config_t *config)
memcpy(config, &s_phy_ant_config, sizeof(esp_phy_ant_config_t));
return ESP_OK;
}
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
typedef enum {
PHY_I2C_MST_CMD_TYPE_RF_OFF = 0,
PHY_I2C_MST_CMD_TYPE_RF_ON,
PHY_I2C_MST_CMD_TYPE_BBPLL_CFG,
PHY_I2C_MST_CMD_TYPE_MAX
} phy_i2c_master_command_type_t;
static uint32_t phy_ana_i2c_master_burst_config(phy_i2c_master_command_attribute_t *attr, int size, phy_i2c_master_command_type_t type)
{
#define I2C1_BURST_VAL(en, start, end) (((en) << 31) | ((end) << 22) | ((start) << 16))
#define I2C0_BURST_VAL(en, start, end) (((en) << 15) | ((end) << 6) | ((start) << 0))
uint32_t brust = 0;
for (int i = 0; i < size; i++) {
if (attr[i].config.start == 0xff || attr[i].config.end == 0xff) /* ignore invalid configure */
continue;
if (attr[i].cmd_type == type) {
if (attr[i].config.host_id) {
brust |= I2C1_BURST_VAL(1, attr[i].config.start, attr[i].config.end);
} else {
brust |= I2C0_BURST_VAL(1, attr[i].config.start, attr[i].config.end);
}
}
}
return brust;
}
uint32_t phy_ana_i2c_master_burst_bbpll_config(void)
{
/* PHY supports 2 I2C masters, and the maximum number of configurations
* supported by the I2C master command memory is the command type
* (PHY_I2C_MST_CMD_TYPE_MAX) multiplied by 2 */
phy_i2c_master_command_attribute_t cmd[2 * PHY_I2C_MST_CMD_TYPE_MAX];
int size = sizeof(cmd) / sizeof(cmd[0]);
phy_i2c_master_command_mem_cfg(cmd, &size);
return phy_ana_i2c_master_burst_config(cmd, size, PHY_I2C_MST_CMD_TYPE_BBPLL_CFG);
}
uint32_t phy_ana_i2c_master_burst_rf_onoff(bool on)
{
/* PHY supports 2 I2C masters, and the maximum number of configurations
* supported by the I2C master command memory is the command type
* (PHY_I2C_MST_CMD_TYPE_MAX) multiplied by 2 */
phy_i2c_master_command_attribute_t cmd[2 * PHY_I2C_MST_CMD_TYPE_MAX];
int size = sizeof(cmd) / sizeof(cmd[0]);
phy_i2c_master_command_mem_cfg(cmd, &size);
return phy_ana_i2c_master_burst_config(cmd, size, on ? PHY_I2C_MST_CMD_TYPE_RF_ON : PHY_I2C_MST_CMD_TYPE_RF_OFF);
}
#endif

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