Porównaj commity

...

166 Commity

Autor SHA1 Wiadomość Data
Frank Mertens 0e1dcf461d
Merge edd260e543 into 3d813afa01 2024-04-24 21:40:50 +08:00
Sonika Rathi 3d813afa01 Merge branch 'bugfix/fatfs_optimize_stat_func' into 'master'
fix(fatfs): Optimizes vfs_fat_stat function to get stat structure after readdir

See merge request espressif/esp-idf!28609
2024-04-23 17:24:03 +08:00
Darian 9a24782dd2 Merge branch 'contrib/github_pr_13669' into 'master'
docs: clarify ESP_RETURN_ON_ERROR result (GitHub PR)

Closes IDFGH-12678

See merge request espressif/esp-idf!30397
2024-04-23 14:30:00 +08:00
Roland Dobai a1e9c6e5b0 Merge branch 'fix/docker_entrypoint_permissions' into 'master'
fix(docker): Fix entrypoint.sh is not executable issue (GitHub PR)

Closes IDFGH-12668 and IDFGH-12681

See merge request espressif/esp-idf!30372
2024-04-23 13:57:07 +08:00
Shu Chen 1e12b1b14a Merge branch 'feature/support_openthread_ephemeral_key' into 'master'
feat(openthread): support openthread ephemeral key

See merge request espressif/esp-idf!30340
2024-04-23 12:32:08 +08:00
Mahavir Jain ceff56e1f3 Merge branch 'feat/enable_app_update_test_p4' into 'master'
feat: Enable app_update test app for ESP32P4

Closes IDF-8068 and IDF-8959

See merge request espressif/esp-idf!30295
2024-04-23 12:14:13 +08:00
Ivan Grokhotkov 73190dd04e Merge branch 'version/v5.4.0' into 'master'
Update version to v5.4-dev

See merge request espressif/esp-idf!30352
2024-04-23 08:00:22 +08:00
Ivan Grokhotkov 0436d49815
change(version): Update version to v5.4-dev 2024-04-22 22:43:44 +02:00
Darian Leung d2ea044e49
docs(esp_common): Fix formatting issues in error-handling.rst
This commit fixes the following formatting issues in error-handling.rst:

- Incorrect indentation (3 spaces to 4 spaces)
- Fixed some italics that were supposed to be inline literals
- Used code-block directive for language highlighting
2024-04-23 02:34:25 +08:00
Jakob Hasse 3ef14f52eb Merge branch 'ci/check_missing_runner_only_when_needed' into 'master'
ci: check missing runners only when needed

See merge request espressif/esp-idf!30103
2024-04-22 23:11:32 +08:00
Richard Allen 4226d13b01 docs: clarify ESP_RETURN_ON_ERROR result 2024-04-22 09:56:58 -05:00
Island 148aa32c64 Merge branch 'feat/optimzie_ble_ctrl_memory' into 'master'
ble: support only legacy adv and slave function on esp32c2

Closes BLERP-675

See merge request espressif/esp-idf!30186
2024-04-22 22:50:58 +08:00
Fu Hanxi ed2d492bde
ci: check missing runners only when needed 2024-04-22 15:38:36 +02:00
Jiang Jiang Jian 7cbbabb17c Merge branch 'bugfix/correct_action_frame' into 'master'
fix(esp_wifi): Correct frame subtype in send_mgmt_frame API

Closes WIFIBUG-520

See merge request espressif/esp-idf!30363
2024-04-22 19:11:37 +08:00
Kapil Gupta 79cea90dc1 fix(esp_wifi): Correct action frame type in send_mgmt_frame API 2024-04-22 16:08:18 +05:30
Roland Dobai af302c0bee Merge branch 'feat/add_merged_bin_cmd' into 'master'
feat(tools): Add idf.py merge-bin command and cmake target

See merge request espressif/esp-idf!29996
2024-04-22 17:55:36 +08:00
Jiang Jiang Jian 22f88a2b9f Merge branch 'bugfix/fix_twt_crash_issues' into 'master'
fix(wifi): fix itwt crash issues

Closes WIFIBUG-492

See merge request espressif/esp-idf!30360
2024-04-22 17:10:08 +08:00
Mo Fei Fei c29d7deb1f Merge branch 'docs/update_cn_trans_ulp_lp_core' into 'master'
Docs: update cn trans for ulp-lp-core.rst

Closes DOC-7458

See merge request espressif/esp-idf!30345
2024-04-22 16:44:44 +08:00
Mo Fei Fei 19471852af Docs: update cn trans for ulp-lp-core.rst 2024-04-22 16:44:44 +08:00
Jiang Jiang Jian c119fa05f1 Merge branch 'fix/fix_esp32c6_wifi_iperf_example_build_error' into 'master'
fix(example): fix wifi iperf example build errors when enabled CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS

See merge request espressif/esp-idf!30174
2024-04-22 16:17:47 +08:00
Wang Meng Yang 64bb591ef3 Merge branch 'bugfix/hf_local_param_null' into 'master'
fix(bt/bluedroid): allocate memory for control block of HFP Audio Gateway in...

See merge request espressif/esp-idf!30123
2024-04-22 15:25:06 +08:00
Sonika Rathi e17da6f9f9 fix(fatfs): Optimizes vfs_fat_stat function to get stat structure after readdir
Closes https://github.com/espressif/esp-idf/issues/10220
2024-04-22 09:07:15 +02:00
Igor Udot 5f9b691017 Merge branch 'ci/revert-pytest-ini' into 'master'
ci: revert pytest.ini -s -vv

See merge request espressif/esp-idf!30311
2024-04-22 14:55:23 +08:00
Aditya Patwardhan d444ff58ec Merge branch 'contrib/github_pr_13462' into 'master'
fix: Allocate HTTP header space for async httpd_req_t objects (GitHub PR)

Closes IDFGH-12445

See merge request espressif/esp-idf!29868
2024-04-22 14:17:21 +08:00
Xiahua Liu 248d25a235 fix(docker): Fix entrypoint.sh is not executable issue
Closes https://github.com/espressif/esp-idf/pull/13660
2024-04-22 12:18:13 +07:00
zwl c31a06d257 ble: update sdkconfig.defaults.esp32c6 file for blufi example 2024-04-22 11:25:04 +08:00
zwl 89b0e94782 ble: update sdkconfig.defaults.esp32c2 file for blufi example 2024-04-22 11:25:04 +08:00
zwl dcb9780302 ble: optimize bt cmakelists.txt file 2024-04-22 11:25:04 +08:00
zwl 917134f890 ble: support only legacy adv and slave function on esp32c2 2024-04-22 11:25:04 +08:00
Wang Meng Yang 14bf30d5b6 Merge branch 'bugfix/optimize_hidh_connection' into 'master'
fix(bt/bluedroid): Fix HID Host connection bugs

Closes BT-3680

See merge request espressif/esp-idf!30160
2024-04-22 09:33:28 +08:00
igor.udot 99a0ce0db0 ci: revert pytest.ini -s -vv 2024-04-19 22:26:29 +08:00
Michael (XIAO Xufeng) dffa13b930 Merge branch 'docs/compatibility_c3_v0.4' into 'master'
docs(compatibility): add information of C3 v0.4

See merge request espressif/esp-idf!30353
2024-04-19 22:21:49 +08:00
Martin Vychodil f448fbbc12 Merge branch 'fix/make_eventfd_case_exit_normally' into 'master'
fix(vfs): make case eventfd_select_block exit normally

See merge request espressif/esp-idf!29926
2024-04-19 21:41:24 +08:00
xuxiao f650dcdb5e fix(wifi): fixed itwt crash issues 2024-04-19 20:03:35 +08:00
Shen Meng Jing ed366b55c2 Merge branch 'docs/translate_configure-builtin-jtag' into 'master'
docs: Provide translation for cofigure-builtin-jtag.rst in jtag-debugging

Closes DOC-7523

See merge request espressif/esp-idf!29867
2024-04-19 19:46:31 +08:00
Ivan Grokhotkov 57a80129bc Merge branch 'ci/sdmmc_tests' into 'master'
sdmmc: test-related fixes

Closes IDF-8734

See merge request espressif/esp-idf!30221
2024-04-19 19:22:08 +08:00
Wang Ziyan 288f76960e Merge branch 'docs/update_cn_for_protocols_jtag-debugging_api-guides' into 'master'
docs: Update CN for esp_https_server.rst and tips-and-quirks.rst

Closes DOC-7543

See merge request espressif/esp-idf!30096
2024-04-19 18:53:33 +08:00
shenmengjing 6d81e702d9 docs: Provide translation for cofigure-builtin-jtag.rst in jtag-debugging 2024-04-19 18:53:17 +08:00
Wang Zi Yan 020c6931ee docs: Update CN for esp_https_server.rst and tips-and-quirks.rst 2024-04-19 17:37:05 +08:00
Guillaume Souchere 1b452481b8 Merge branch 'fix/prompt-erased-by-backspace-in-dumbmode' into 'master'
fix(console): bug where backspace erases the prompt in dumb mode

Closes IDFGH-12508

See merge request espressif/esp-idf!30313
2024-04-19 17:30:58 +08:00
Michael (XIAO Xufeng) d40a670613 docs(compatibility): add information of C3 v0.4 2024-04-19 16:46:32 +08:00
Xu Si Yu 728595313f feat(openthread): support openthread ephemeral key 2024-04-19 14:49:10 +08:00
Aditya Patwardhan 0c64e48206 Merge branch 'fix/fix_host_based_security_workflow_doc' into 'master'
fix(docs): Fix the host based security workflow document

See merge request espressif/esp-idf!29409
2024-04-19 14:38:36 +08:00
Aditya Patwardhan 530fdacd88
fix(docs): Fix DIS_ICACHE related information in host security workflow 2024-04-19 11:29:21 +05:30
Aditya Patwardhan 1366949c8a
feat(docs): Add workflow for externally enabling NVS Encryption
Fix documentation for host based workflows for flash encryption and
    secure boot v2
2024-04-19 11:29:21 +05:30
Tomas Rohlinek 22d3473f18 Merge branch 'feature/fatfs_use_dynamic_buffer' into 'master'
feat(storage/fatfs): Use dynamic buffers for fatfs

Closes IDFGH-9561

See merge request espressif/esp-idf!27501
2024-04-19 13:15:38 +08:00
Kapil Gupta 617130a485 Merge branch 'feat/scan_set_params_api' into 'master'
Adds a new API to set default scan parameters

Closes WIFI-6238, WIFI-6344, WIFIBUG-254, and IDFGH-12419

See merge request espressif/esp-idf!27761
2024-04-19 12:03:10 +08:00
Kevin (Lao Kaiyao) 7835ce48f1 Merge branch 'ci/enable_doc_build_for_esp32c5' into 'master'
ci(doc): enable doc build for esp32c5

See merge request espressif/esp-idf!30338
2024-04-19 11:50:10 +08:00
jgujarathi 770162d76c feat(esp_wifi): Adds a new API to set default scan parameters
- esp_wifi_set_scan_parameters() : Used to set the default scan parameters to be used
while scanning. These parameters will be used for all scans conducted by station
including connect scan. Parameters provided through esp_wifi_scan_start() override the
default parameters for that scan only
- esp_wifi_get_scan_parameters(): Used to get the current default scan parameters.
2024-04-19 11:01:53 +08:00
Alexey Lapshin 64a1ed07d9 Merge branch 'fix/fix_load_store_failure_mepc' into 'master'
fix(system): esp32p4: fix mepc when load/store failure occurred

See merge request espressif/esp-idf!30252
2024-04-19 03:37:45 +08:00
Alexey Lapshin 6f2de1fb23 fix(system): esp32p4: fix mepc when load/store failure occurred 2024-04-18 19:49:19 +04:00
Roland Dobai 9b8e2c72ba Merge branch 'docs/coredump_standalone' into 'master'
docs(tools/coredump): add information about standalone tool for advanced users

Closes IDFGH-12407 and IDFGH-12462

See merge request espressif/esp-idf!30039
2024-04-18 21:20:08 +08:00
laokaiyao fc000cd7b7 ci(doc): enable doc build for esp32c5 2024-04-18 19:39:29 +08:00
Wu Zheng Hui 2c4097b4d2 Merge branch 'bugfix/fix_esp32p4_light_sleep_issues' into 'master'
fix(esp_hw_support): fix esp32p4 light sleep issues

Closes PM-96, PM-97, and IDF-9569

See merge request espressif/esp-idf!30089
2024-04-18 19:18:56 +08:00
Zhi Wei Jian 713e36e776 Merge branch 'bugfix/remove_ble_func_discard_declaration' into 'master'
fix(ble/bluedroid): Remove BLE functions discard declaration

Closes BLERP-663

See merge request espressif/esp-idf!30011
2024-04-18 19:00:55 +08:00
wuzhenghui d076b34ed0
feat(esp_pm): add cases to test coexistence of sleep and PSRAM features 2024-04-18 18:07:07 +08:00
wuzhenghui 270b9d22e4
fix(ci): fix CI unity test cases failure 2024-04-18 18:07:07 +08:00
wuzhenghui 0d06f94d99
fix(esp_hw_support): fix unsafe sleep critical area 2024-04-18 18:07:06 +08:00
wuzhenghui 2ceddff922
fix(esp_hw_support): fix the problem of unstable PSRAM power supply during sleep 2024-04-18 18:07:06 +08:00
wuzhenghui 8f33c69c30
fix(esp_hw_support): disable mpll before sleep to avoid mspi module entering an error state 2024-04-18 18:07:02 +08:00
Konstantin Kondrashov 40684a0e1c Merge branch 'feature/freertos_runtime_counter_support' into 'master'
feat(freertos): Runtime Counter support

Closes IDFGH-12057

See merge request espressif/esp-idf!30150
2024-04-18 18:01:34 +08:00
Zhang Wen Xu d02268279f Merge branch 'fix/ieee802154_include_header_issue' into 'master'
ieee802154: fix ieee802154 include header file issue

See merge request espressif/esp-idf!29820
2024-04-18 16:29:00 +08:00
Marius Vikhammer 842b6a1dc4 Merge branch 'bugfix/p4_ulp_wakeup' into 'master'
fix(ulp): fixed lp-core not booting during sleep

Closes IDF-9407

See merge request espressif/esp-idf!30296
2024-04-18 16:23:16 +08:00
zhiweijian b9a1756202 fix(ble/bluedroid): Remove BLE functions discard declaration
fix(nt/bluedroid): Split the device name set functions

feat(bt/bluedroid): added APIs to get/set device name on BT GAP side

change(bt/common): Marked some APIs in device module as deprecated

1. esp_bt_dev_set_device_name
2. esp_bt_dev_get_device_name

change(bt/bluedroid): use BT GAP APIs to set/get device name in bluetooth classic examples

change(bt/bluedroid): use BT/BLE GAP APIs to set/get device name in coexist examples
2024-04-18 15:53:54 +08:00
zhiweijian 5725595d84 fix(ble/bluedroid): Remove esp_bluedroid_init() discard declaration 2024-04-18 15:53:30 +08:00
Shen Meng Jing 2839f80010 Merge branch 'docs/translate_ecdsa_and_qemu' into 'master'
Docs/translate ecdsa and qemu

Closes DOC-7533

See merge request espressif/esp-idf!29920
2024-04-18 15:48:09 +08:00
Konstantin Kondrashov 66e6a48efd feat(freertos): Runtime Counter support
Closes https://github.com/espressif/esp-idf/issues/13120
2024-04-18 10:26:38 +03:00
shenmengjing 4e0c5d3e8e docs: Provide translation for ecdsa.rst and qemu.rst 2024-04-18 14:58:39 +08:00
Gao Xu 10c22e84ed Merge branch 'csi/add_no_backup_buffer_usage_flag' into 'master'
feat(csi): add a flag to allow no backup buffer usage

Closes IDF-9571

See merge request espressif/esp-idf!30185
2024-04-18 14:30:34 +08:00
C.S.M 684b63090b Merge branch 'feature/jpeg_dec_yuv_support' into 'master'
feat(jpeg): Support YUV in both decoder and encoder.

See merge request espressif/esp-idf!30240
2024-04-18 14:27:08 +08:00
Rahul Tank d80a4e0ce1 Merge branch 'bugfix/fix_hex2val_ret' into 'master'
fix(nimble): Add check for return value of hex2val

Closes BT-3695

See merge request espressif/esp-idf!30304
2024-04-18 14:00:21 +08:00
Cao Sen Miao 282f3869c8 fix(jpeg): Fix issue that jpeg encoder does not end with 0xffd9 2024-04-18 12:39:09 +08:00
xiaqilin 34dacbb6ac fix(ieee802154): fix ieee802154 include header file issue and unused value issue 2024-04-18 11:42:35 +08:00
Marius Vikhammer 1fa59c442b fix(ulp): fixed lp-core not booting during sleep
LP core was unable to boot when system was in deepsleep.
This was due to lp uart init in LP rom using XTAL as clk source,
which is normally powered down during sleep.

This would cause lp uart to get stuck while printing ROM output,
and the app would never boot.

Also fixed wrong wakeup cause used by HP core for ULP wake up
2024-04-18 11:36:30 +08:00
Xu Si Yu e8a554ac21 fix(vfs): make case eventfd_select_block exit normally 2024-04-18 11:29:25 +08:00
Zhang Wen Xu e169a5592c Merge branch 'fix/ieee802154_test_acquire_lock_in_interrupt' into 'master'
fix(ieee802154): fix ieee802154 next operation acquire lock in interrupt

See merge request espressif/esp-idf!30250
2024-04-18 11:05:10 +08:00
Island 2cdd56ebc3 Merge branch 'bugfix/fixed_coex_asset_on_esp32c2' into 'master'
ble: fixed an occasional assertion issue in coexistence scenarios on ESP32C2

See merge request espressif/esp-idf!30300
2024-04-18 10:54:15 +08:00
Island fc4e48dca5 Merge branch 'bugfix/fix_ble_appearance' into 'master'
Fixed BLE appearance category ranges

Closes IDFGH-12628

See merge request espressif/esp-idf!30284
2024-04-18 10:43:23 +08:00
gaoxu 4a9eb6fee9 feat(csi): add a test that no backup buffer usage 2024-04-18 10:42:22 +08:00
gaoxu 65acf4abe9 feat(csi): add a flag to allow no backup buffer usage 2024-04-18 10:42:22 +08:00
Cao Sen Miao 28b2e5f2bb feat(jpeg): update example use ldo for sd card 2024-04-18 10:40:48 +08:00
Cao Sen Miao 876a3697ec feat(jpeg): Support jpeg decoder yuv format 2024-04-18 10:40:48 +08:00
morris 04dbe6672d Merge branch 'ci/temp_disable_s3_usb_device' into 'master'
fix(ci): Temporarily disable USB device tests on S3

See merge request espressif/esp-idf!30312
2024-04-18 10:21:44 +08:00
zhanghaipeng 0a4636a8be fix(ble/bluedroid): Fixed set BLE appearance value 2024-04-17 20:38:36 +08:00
Rahul Tank 7ee1e0b8fb fix(nimble): Add check for return value of hex2val 2024-04-17 18:07:59 +05:30
Island e82a723abf Merge branch 'bugfix/ble_mesh_fsm_list_init' into 'master'
bugfix/ble_mesh_fsm_list_init

Closes BLERP-539 and BLERP-451

See merge request espressif/esp-idf!30281
2024-04-17 20:09:52 +08:00
Cao Sen Miao ea8be1533a docs(jpeg): Add docs for explain pixel order supported in jpeg driver 2024-04-17 19:16:44 +08:00
Cao Sen Miao fc9eece101 change(jpeg): modify open_rgb.py for its now supporting open YUV files 2024-04-17 19:16:44 +08:00
Guillaume Souchere ada38e8d5e fix(linenoise): Skip 0x00 to 0x1F character in dump mode
Skipping through the non printable character assures that
in dumb mode, any special keys will not lead to the cursor
movement.
2024-04-17 13:13:58 +02:00
Ivan Grokhotkov 3f663ec789
ci(sdmmc): add test config for p4 2024-04-17 12:49:23 +02:00
Ivan Grokhotkov ad6cce5e3a
fix(sdmmc): correct unused pin number for P4 EV board 2024-04-17 12:49:23 +02:00
Ivan Grokhotkov 3546c81e32
ci(sdmmc): re-enable CD/WP tests 2024-04-17 12:49:22 +02:00
Ivan Grokhotkov b08ddfb25b
fix(sdmmc): don't fail in clock update commands when no card detected
Clock update commands don't actually require the card to be present,
so it's not necessary to fail at this stage.
2024-04-17 12:49:22 +02:00
Ivan Grokhotkov 96074470ec
fix(sdmmc): correct power init in CD/WP tests for P4 2024-04-17 12:49:22 +02:00
Ivan Grokhotkov ad51d0d1ca
ci(sdmmc): clean up stdout to avoid false positive memory leaks 2024-04-17 12:49:22 +02:00
Ivan Grokhotkov 8a66e059e9 Merge branch 'feature/sdmmc_p4_psram' into 'master'
feat(sdmmc): add support for PSRAM DMA

Closes IDF-9662

See merge request espressif/esp-idf!30044
2024-04-17 18:10:00 +08:00
Ivan Grokhotkov 3b42fde974 Merge branch 'ci/test_apps_codeowners' into 'master'
change(ci): split test_apps build-test-rules, add missing code owners

See merge request espressif/esp-idf!30306
2024-04-17 18:04:45 +08:00
Guillaume Souchere aa61062584 fix(console): bug where backspace erases the prompt in dumb mode 2024-04-17 12:03:42 +02:00
Ivan Grokhotkov 545203f1c8
change(ci): split test_apps build-test-rules, add missing code owners 2024-04-17 11:54:33 +02:00
Tomas Rezucha 6b10a3074a fix(ci): Temporarily disable USB device tests on S3
Partially reverts 1302fd70ba
2024-04-17 11:43:10 +02:00
Wu Zheng Hui eded4eabf6 Merge branch 'feature/support_esp32p4_clock_output' into 'master'
feat: support esp32p4 clock output

Closes IDF-8226

See merge request espressif/esp-idf!28619
2024-04-17 17:40:40 +08:00
Wang Meng Yang d8ddc102f6 Merge branch 'bugfix/crash_after_bluedroid_deinit' into 'master'
fix(bt/bluedroid): Fixed controller using null pointer after bluedroid deinit

Closes BTQABR2023-248

See merge request espressif/esp-idf!30172
2024-04-17 17:26:06 +08:00
Fu Hanxi 01d56baac6 Merge branch 'ci/fix_macos_runner' into 'master'
ci: select correct python version for mac runners

Closes IDFCI-2107

See merge request espressif/esp-idf!30102
2024-04-17 16:58:27 +08:00
Jiang Jiang Jian 0f5aca1e47 Merge branch 'bugfix/mgmt_gcmp_issue' into 'master'
fix(wifi): Fix GCMP encryption for mgmt packets and other bugfixes

Closes WIFIBUG-293 and WIFIBUG-459

See merge request espressif/esp-idf!28449
2024-04-17 16:52:22 +08:00
Marius Vikhammer c9efc9cc83 Merge branch 'bugfix/p4_reserved_rtc_mem' into 'master'
fix(rtc_memory): fix conflict between LP-ROM and RTC reserved

Closes IDF-9408

See merge request espressif/esp-idf!30012
2024-04-17 16:45:57 +08:00
Tomáš Rohlínek ede737763c
feat(storage/fatfs): update deprecated syntax for tests 2024-04-17 10:37:31 +02:00
Tomáš Rohlínek b5d78549a5
feat(storage/fatfs): add tests for dynamic buffers 2024-04-17 10:37:31 +02:00
Tomáš Rohlínek 1447420a91
feat(storage/fatfs): add Kconfig option to enable dynamic window buffers 2024-04-17 10:37:31 +02:00
Tomáš Rohlínek 0bd6330e91
feat(storage/fatfs): add dynamic buffers support to FatFS
Closes https://github.com/espressif/esp-idf/issues/10913
2024-04-17 10:37:28 +02:00
Jiang Jiang Jian 9c8f4301a2 Merge branch 'bugfix/fix_lmac_end_frame_exchange_sequence_assert_issue' into 'master'
fix(wifi): fixed lmacEndFrameExchangeSequence assert issue

Closes IDFCI-2125

See merge request espressif/esp-idf!30283
2024-04-17 16:23:12 +08:00
Rahul Tank ba8976aa52 Merge branch 'fix/removed_termination_upon_sign_write_fail' into 'master'
fix(nimble): Removed Code for Termination Upon Signed Write Operation Failure

See merge request espressif/esp-idf!29937
2024-04-17 16:06:57 +08:00
wuzhenghui f3d963a93b
fix(esp_system): update power domain configuration with slow clock source selection 2024-04-17 15:45:52 +08:00
wuzhenghui 59a8a8a54a
fix(esp_hw_support): decrease DCDC volt with increase LDO volt in LDO take over preparation 2024-04-17 15:45:51 +08:00
wuzhenghui 55c5c2467d
fix(esp_hw_support): fix ipc_isr pause/resume order in sleep process 2024-04-17 15:45:51 +08:00
wuzhenghui 8ad94931f2
change(soc): remove clockoutput hardware unavaliable registers 2024-04-17 15:09:54 +08:00
wuzhenghui ffd5d1fd66
feat(esp_hw_support): support set clock divider for esp32p4 clock output 2024-04-17 15:09:54 +08:00
wuzhenghui 309725fcd0
feat(esp_hw_support): support esp32p4 clock output 2024-04-17 15:09:49 +08:00
Wang Fang c86952ed9d docs: Updated CN translation for coredump 2024-04-17 14:56:02 +08:00
Wan Lei 624bcb4757 Merge branch 'feat/csi_disclose_internal_buffer_api' into 'master'
feat(csi): add API to expose internal backup_buffer

Closes IDF-9572

See merge request espressif/esp-idf!30094
2024-04-17 14:51:55 +08:00
zwl d0c1ff0376 ble: fixed an occasional assertion issue in coexistence scenarios on ESP32C2 2024-04-17 14:46:02 +08:00
wuzhenghui 101f1abbf1
refactor(esp_hw_support): add hal layer for clock output feature 2024-04-17 14:25:29 +08:00
Zhang Xiao Yan 36c860a588 Merge branch 'docs/add_description_configure_usb_pins_to_gpio' into 'master'
docs: add code snippet showing how to configure usb pins to gpio

See merge request espressif/esp-idf!30236
2024-04-17 14:03:07 +08:00
Harshit Malpani 12c92bf822
feat: Enable app_update test app for ESP32P4 2024-04-17 11:21:34 +05:30
Marius Vikhammer 4533f16c34 fix(rtc_memory): fix conflict between LP-ROM and RTC reserved 2024-04-17 13:37:56 +08:00
Anton Maklakov c1966573f5 Merge branch 'ci/version-commitliter-hook' into 'master'
ci(pre-commits): update conventional-precommit-linter version

Closes RDT-746

See merge request espressif/esp-idf!30061
2024-04-17 12:25:43 +08:00
muhaidong 490c6d3c38 fix(wifi): fixed lmacEndFrameExchangeSequence assert issue 2024-04-17 11:16:51 +08:00
luoxu b6c09192c8 fix(ble_mesh): rpr server and df bug fixed(10f7fdc1a9) 2024-04-17 11:14:18 +08:00
Jiang Jiang Jian a75bacf781 Merge branch 'fix/wl_fatfs_format' into 'master'
fix(storage/fatfs): fix double mouting of spiflash

Closes IDF-9677

See merge request espressif/esp-idf!30162
2024-04-17 10:48:39 +08:00
wanlei af86df7f02 feat(csi): add API to expose internal backup_buffer 2024-04-17 10:48:11 +08:00
Jiang Jiang Jian 64c41c82cb Merge branch 'docs/update_build_system' into 'master'
docs: update a typo in the build system document

Closes DOC-6637

See merge request espressif/esp-idf!29969
2024-04-17 10:41:55 +08:00
Jiang Jiang Jian 5f19a8797a Merge branch 'contrib/github_pr_13022' into 'master'
fix(freertos): Fix broken portable macro portTRY_ENTER_CRITICAL_SAFE()

Closes IDFGH-11943

See merge request espressif/esp-idf!30030
2024-04-17 10:41:10 +08:00
Jiang Jiang Jian dfd6a7ba6d Merge branch 'enable_esp32p4_sysview_examples' into 'master'
feat(sysview): enable esp32p4 examples

See merge request espressif/esp-idf!30035
2024-04-17 10:39:41 +08:00
Jiang Jiang Jian ff07cae675 Merge branch 'fix/examples_sta2eth_udpcheck' into 'master'
fix(examples): STA-ETH add the padding if the packet length is odd while updating udp checksum

Closes IDFGH-12490

See merge request espressif/esp-idf!30266
2024-04-17 10:35:58 +08:00
Omar Chebib faf0ea8702 Merge branch 'fix/interrupt_source_c5_beta3' into 'master'
fix(esp32c5): fix interrupt sources number for the Beta3 version

See merge request espressif/esp-idf!30271
2024-04-17 10:11:15 +08:00
Sarvesh Bodakhe d97c8ed1b1 fix(wifi): Add bugfix to avoid RSNXE and KDE mismatch during 4-way-handshake 2024-04-16 19:49:28 +05:30
Kapil Gupta 95b522a1be fix(wifi): Fix encryption/decryption issue for mgmt packets
* Fix issues related to mgmt packets encryption in GCMP
* Fix issue of wrong decryption of mgmt packets when PMF is enabled
* Fix softAP bug in handling of SAE Reauthentication
2024-04-16 19:49:09 +05:30
Fu Hanxi 2cde75b531
ci: improve pytest build system tests
- remove temp dirs
- remove idf-component-manager unit test
2024-04-16 15:33:43 +02:00
Fu Hanxi a4f691b88a
ci: always cleanup idf copy in ci 2024-04-16 15:32:10 +02:00
Fu Hanxi b5607cf43c
ci: disable ccache on macos build system test 2024-04-16 15:32:10 +02:00
Fu Hanxi 588ac5f4fb
ci: ensure macos selected the correct python installed by pyenv 2024-04-16 15:31:45 +02:00
Jan Beran 0dec6fe65d feat(tools): Add idf.py merge-bin command and cmake target 2024-04-16 12:49:18 +02:00
Omar Chebib f39b3099f6 fix(esp32c5): fix interrupt sources number for the Beta3 version 2024-04-16 18:17:00 +08:00
wanlei cf055a625b fix(csi): fix common resource changes when clime hardware fail 2024-04-16 17:22:57 +08:00
Linda 3b7e16f182 docs: add code snippet showing how to configure usb pins to gpio 2024-04-16 14:53:12 +08:00
Sumeet Singh 19ad84f008 fix(nimble): Removed code for termination upon signed write operation failure 2024-04-16 09:57:25 +05:30
xiaqilin 0eeed7637f fix(ieee802154): fix ieee802154 next operation acquire lock in interrupt 2024-04-16 10:35:55 +08:00
Frank Mertens edd260e543 change(esp-tls): make wolfSSL backend send SNI and enable OCSP
Almost all sites these days are virtually hosted and hence
SNI (server name indicator TLS extension) should be enabled by
default.

In addition this change enables OCSP (online server status protocol)
support for esp-tls clients using the wolfSSL backend.
The 3 code lines enable OCSP stabling v1.
By default this feature is disabled.
(I will send another PR on esp-wolfssl repository to allow to
enable it easily.)
2024-04-16 01:44:05 +02:00
Frank Mertens 05d3c06c7c fix(esp-tls): make the wolfSSL backend send entire client certificate chains
This change makes the wolfSSL backend sent the complete TLS client certificate
chain. This align the wolfSSL backend with the behavior of the mbedTLS backend.
Some servers need the intermediate certificates to verify a client certificate.
If the provided PEM file contains only a single certificate this change has no effect
and the behavior will be as before.
This impacts higher level APIs to function as someone would expect.
E.g.: esp_websocket_client_config_t.client_cert: when passing here a pem
file containing 2 certificates (the CA's and the client's) it would be
expected that both are transmitted during TLS handshake.
2024-04-16 01:35:07 +02:00
xuxiao 5617bfaaec fix(example): fix wifi iperf example build errors when enabled CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS 2024-04-15 19:07:37 +08:00
Jin Cheng 081dc80eb8 fix(bt/bluedroid): allocate memory for control block of HFP Audio Gateway in its initialization when dynamic memory is wnabled 2024-04-15 11:20:55 +08:00
Ivan Grokhotkov 49b4bc175e
feat(sdmmc): add support for PSRAM DMA on ESP32-P4 2024-04-12 12:56:18 +02:00
Tomáš Rohlínek 615a9c6742
feat(storage/example): enable host test for flash wl fatfs 2024-04-12 10:26:25 +02:00
Tomáš Rohlínek 7c3b9bde0e
feat(storage/fatfs): add testcase with erased spi partition 2024-04-12 10:26:25 +02:00
Tomáš Rohlínek f398b7923a
fix(storage/fatfs): fix double mouting of spiflash 2024-04-12 10:26:22 +02:00
xiongweichao f535fdff2d fix(bt/bluedroid): Fixed crash after bluedroid deinit
hci_host_env.downstream_data_ready is set to NULL during bluedroid deinit,
causing the controller to use a null pointer when calling callback.
2024-04-11 10:39:44 +08:00
liqigan e1d2e0393d fix(bt/bluedroid): Fix HID Host connection bugs
1. Fix is_orig value inconsistency for HIDH open event
2. Fix the error state for repeat connection of the same device
2024-04-10 15:22:02 +08:00
Nebojša Cvetković e96da70654 feat(esptool): merge_bin CMake target 2024-04-08 01:41:34 +01:00
Peter Dragun 1830f58920 docs(tools/coredump): add warning about core dump usage with encrypted parttion
Closes https://github.com/espressif/esp-coredump/issues/8
2024-04-05 15:41:00 +02:00
Tomas Sebestik 87385510ea
ci(pre-commits): update conventional-precommit-linter version 2024-04-05 12:17:27 +02:00
Peter Dragun e5760b35a5 docs(tools/coredump): add information about standalone tool for advanced users
Closes https://github.com/espressif/esp-idf/issues/13433
2024-04-04 16:47:32 +02:00
Erhan Kurubas 890a385a0a feat(sysview): enable esp32p4 examples 2024-04-03 23:22:31 +03:00
Andy Lin 4f6deb9f61 fix(freertos): Fix broken portable macro portTRY_ENTER_CRITICAL_SAFE()
This commit fixes a bug where the portTRY_ENTER_CRITICAL_SAFE() for the
Xtensa and RISC-V FreeRTOS ports were broken as it did not correctly use
the timeout parameter.

Merges: https://github.com/espressif/esp-idf/pull/13022
2024-04-03 14:35:31 +02:00
daiziyan fbebfcb119 docs: update the CN version in the build system document 2024-04-02 11:04:44 +08:00
daiziyan 178f80a170 docs: update a typo in the build system document 2024-04-01 19:29:05 +08:00
Yash Katkar f73194fbbb feat: add the padding if the packet length is odd while updating udp checksum 2024-03-29 21:05:16 +00:00
Mooneer Salem f799e99909 fix: Allocate HTTP header space for async httpd_req_t objects
This resolves bug #13430 by allocating a new copy of resp_hdrs
when calling httpd_req_async_handler_begin(), thus preventing
invalid access to memory from async tasks.
2024-03-27 00:50:29 -07:00
384 zmienionych plików z 4930 dodań i 1589 usunięć

Wyświetl plik

@ -156,6 +156,7 @@
/docs/ @esp-idf-codeowners/docs
/docs/**/api-guides/tools/ @esp-idf-codeowners/tools
/docs/en/api-guides/core_dump.rst @esp-idf-codeowners/debugging
/docs/en/api-guides/jtag-debugging/ @esp-idf-codeowners/debugging
/docs/**/api-reference/bluetooth/ @esp-idf-codeowners/bluetooth
/docs/**/api-reference/network/ @esp-idf-codeowners/network @esp-idf-codeowners/wifi
@ -206,13 +207,19 @@
/tools/ldgen/ @esp-idf-codeowners/build-config
/tools/mass_mfg/ @esp-idf-codeowners/app-utilities
/tools/mocks/ @esp-idf-codeowners/system
/tools/test_apps/README.md @esp-idf-codeowners/docs @esp-idf-codeowners/ci
/tools/test_apps/ @esp-idf-codeowners/ci
/tools/test_apps/README.md @esp-idf-codeowners/docs @esp-idf-codeowners/ci
## Note: owners here should be the same as the owners for the same example subdir, above
/tools/test_apps/build_system/ @esp-idf-codeowners/build-config
/tools/test_apps/configs/ @esp-idf-codeowners/system
/tools/test_apps/linux_compatible/ @esp-idf-codeowners/system
/tools/test_apps/peripherals/ @esp-idf-codeowners/peripherals
/tools/test_apps/phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
/tools/test_apps/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
/tools/test_apps/security/ @esp-idf-codeowners/security
/tools/test_apps/storage/ @esp-idf-codeowners/storage
/tools/test_apps/system/ @esp-idf-codeowners/system
/tools/test_apps/**/*.py @esp-idf-codeowners/ci @esp-idf-codeowners/tools

Wyświetl plik

@ -194,8 +194,12 @@ build_clang_test_apps_esp32c6:
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
- cd ${IDF_PATH}/tools/test_build_system
- python ${IDF_PATH}/tools/ci/get_known_failure_cases_file.py
- pytest --parallel-count ${CI_NODE_TOTAL:-1} --parallel-index ${CI_NODE_INDEX:-1}
--work-dir ${CI_PROJECT_DIR}/test_build_system --junitxml=${CI_PROJECT_DIR}/XUNIT_RESULT.xml
- pytest
--cleanup-idf-copy
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
--work-dir ${CI_PROJECT_DIR}/test_build_system
--junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml
--ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME}
pytest_build_system:
@ -206,11 +210,14 @@ pytest_build_system_macos:
extends:
- .test_build_system_template
- .before_script:build:macos
- .after_script:build:macos:upload-when-fail
- .rules:build:macos
tags:
- macos_shell
parallel: 3
allow_failure: true # IDFCI-2107
variables:
PYENV_VERSION: "3.8"
CI_CCACHE_DISABLE: "1" # ccache: error: Read-only file system
build_docker:
extends:
@ -257,7 +264,6 @@ generate_build_child_pipeline:
dependencies: # set dependencies to null to avoid missing artifacts issue
needs:
- pipeline_variables
- check_test_cases_env_markers_and_required_runners
artifacts:
paths:
- build_child_pipeline.yml

Wyświetl plik

@ -39,7 +39,7 @@ variables:
GIT_FETCH_EXTRA_FLAGS: "--no-recurse-submodules --prune --prune-tags"
# we're using .cache folder for caches
GIT_CLEAN_FLAGS: -ffdx -e .cache/
LATEST_GIT_TAG: v5.3-dev
LATEST_GIT_TAG: v5.4-dev
SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
# by default we will fetch all submodules
@ -52,12 +52,11 @@ variables:
IDF_PATH: "$CI_PROJECT_DIR"
V: "0"
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
PYTHON_VER: 3.8.17
# Docker images
ESP_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-env-v5.3:1"
ESP_IDF_DOC_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-doc-env-v5.3:1-1"
TARGET_TEST_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/target-test-env-v5.3:1"
ESP_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-env-v5.4:1"
ESP_IDF_DOC_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-doc-env-v5.4:1-1"
TARGET_TEST_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/target-test-env-v5.4:1"
SONARQUBE_SCANNER_IMAGE: "${CI_DOCKER_REGISTRY}/sonarqube-scanner:5"
PRE_COMMIT_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-pre-commit:1"
@ -73,7 +72,7 @@ variables:
CI_PYTHON_CONSTRAINT_BRANCH: ""
# Update the filename for a specific ESP-IDF release. It is used only with CI_PYTHON_CONSTRAINT_BRANCH.
CI_PYTHON_CONSTRAINT_FILE: "espidf.constraints.v5.3.txt"
CI_PYTHON_CONSTRAINT_FILE: "espidf.constraints.v5.4.txt"
# Set this variable to repository name of a Python tool you wish to install and test in the context of ESP-IDF CI.
# Keep the variable empty when not used.
@ -208,6 +207,10 @@ variables:
.before_script:build:macos:
before_script:
# macos is running shell executor, which means it would use
# the system installed /usr/local/bin/python3 by default.
# Ensure pyenv and PYENV_VERSION installed
- eval "$(pyenv init -)"
- *common-before_scripts
# On macOS, these tools need to be installed
- export IDF_TOOLS_PATH="${HOME}/.espressif_runner_${CI_RUNNER_ID}_${CI_CONCURRENT_ID}"
@ -216,6 +219,14 @@ variables:
- *setup_tools_and_idf_python_venv
- fetch_submodules
.after_script:build:macos:upload-when-fail:
after_script:
# macos is running shell executor, which means it would use
# the system installed /usr/local/bin/python3 by default.
# Ensure pyenv and PYENV_VERSION installed
- eval "$(pyenv init -)"
- *upload_failed_job_log_artifacts
.before_script:build:
before_script:
- *common-before_scripts

Wyświetl plik

@ -102,7 +102,7 @@ check_docs_lang_sync:
parallel:
matrix:
- DOCLANG: ["en", "zh_CN"]
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32h2", "esp32p4"]
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32c5","esp32h2", "esp32p4"]
check_docs_gh_links:
image: $ESP_IDF_DOC_ENV_IMAGE

Wyświetl plik

@ -166,10 +166,3 @@ pipeline_variables:
- pipeline.env
expire_in: 1 week
when: always
check_test_cases_env_markers_and_required_runners:
extends:
- .pre_check_template
tags: [fast_run, shiny]
script:
- python tools/ci/dynamic_pipelines/scripts/generate_target_test_child_pipeline.py --check

Wyświetl plik

@ -203,7 +203,7 @@ repos:
- id: check-copyright
args: ['--ignore', 'tools/ci/check_copyright_ignore.txt', '--config', 'tools/ci/check_copyright_config.yaml']
- repo: https://github.com/espressif/conventional-precommit-linter
rev: v1.6.0
rev: v1.7.0
hooks:
- id: conventional-precommit-linter
stages: [commit-msg]

Wyświetl plik

@ -61,14 +61,10 @@ Supported since ESP-IDF v4.2.
### ESP32-C3
#### v0.2, v0.3
#### v0.2 - v0.4
Supported since ESP-IDF v4.3.
#### v0.4
To be added.
#### v1.1
| Release branch | Recommended | Required |

Wyświetl plik

@ -61,14 +61,10 @@
### ESP32-C3
#### v0.2 和 v0.3
#### v0.2 - v0.4
从 ESP-IDF v4.3 开始支持。
#### v0.4
待更新。
#### v1.1
| 发布分支 | 推荐版本 | 需求版本 |

Wyświetl plik

@ -2,6 +2,6 @@
components/app_update/test_apps:
disable:
- if: IDF_TARGET in ["esp32c6", "esp32h2", "esp32p4", "esp32c5"]
- if: IDF_TARGET in ["esp32c6", "esp32h2", "esp32c5"]
temporary: true
reason: target esp32c6, esp32h2, esp32p4, esp32c5 is not supported yet # TODO: IDF-8068, [ESP32C5] IDF-8638
reason: target esp32c6, esp32h2 esp32c5 is not supported yet # TODO: [ESP32C5] IDF-8638

Wyświetl plik

@ -1,2 +1,2 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |

Wyświetl plik

@ -19,7 +19,7 @@ def run_multiple_stages(dut: Dut, test_case_num: int, stages: int) -> None:
@pytest.mark.supported_targets
@pytest.mark.temp_skip_ci(targets=['esp32c6', 'esp32h2', 'esp32p4'], reason='c6/h2/p4 support TBD') # TODO: IDF-8959
@pytest.mark.temp_skip_ci(targets=['esp32c6', 'esp32h2'], reason='c6/h2 support TBD')
@pytest.mark.generic
def test_app_update(dut: Dut) -> None:
extra_data = dut.parse_test_menu()

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -24,6 +24,7 @@
#include "bootloader_sha.h"
#include "sys/param.h"
#include "bootloader_flash_priv.h"
#include "esp_rom_caps.h"
#define ESP_PARTITION_HASH_LEN 32 /* SHA-256 digest length */
#define IS_MAX_REV_SET(max_chip_rev_full) (((max_chip_rev_full) != 65535) && ((max_chip_rev_full) != 0))
@ -212,7 +213,12 @@ void bootloader_common_update_rtc_retain_mem(esp_partition_pos_t* partition, boo
rtc_retain_mem_t* bootloader_common_get_rtc_retain_mem(void)
{
#ifdef BOOTLOADER_BUILD
#if ESP_ROM_HAS_LP_ROM
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_LOW)
#else
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_HIGH - sizeof(rtc_retain_mem_t))
#endif //ESP_ROM_HAS_LP_ROM
static rtc_retain_mem_t *const s_bootloader_retain_mem = (rtc_retain_mem_t *)RTC_RETAIN_MEM_ADDR;
return s_bootloader_retain_mem;
#else
@ -221,4 +227,5 @@ rtc_retain_mem_t* bootloader_common_get_rtc_retain_mem(void)
#endif // !BOOTLOADER_BUILD
}
#endif // CONFIG_BOOTLOADER_RESERVE_RTC_MEM

Wyświetl plik

@ -847,17 +847,8 @@ if(CONFIG_BT_ENABLED)
target_link_directories(${COMPONENT_LIB} INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
elseif(CONFIG_IDF_TARGET_ESP32C2 AND CONFIG_BT_CONTROLLER_ENABLED)
add_prebuilt_library(libble_app "controller/lib_esp32c2/esp32c2-bt-lib/libble_app.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
elseif(CONFIG_IDF_TARGET_ESP32C6 AND CONFIG_BT_CONTROLLER_ENABLED)
add_prebuilt_library(libble_app "controller/lib_esp32c6/esp32c6-bt-lib/libble_app.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
elseif(CONFIG_IDF_TARGET_ESP32H2 AND CONFIG_BT_CONTROLLER_ENABLED)
add_prebuilt_library(libble_app "controller/lib_esp32h2/esp32h2-bt-lib/libble_app.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
elseif(CONFIG_IDF_TARGET_ESP32C5 AND CONFIG_BT_CONTROLLER_ENABLED)
add_prebuilt_library(libble_app "controller/lib_esp32c5/esp32c5-bt-lib/libble_app.a")
elseif(CONFIG_BT_CONTROLLER_ENABLED)
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
endif()

Wyświetl plik

@ -241,7 +241,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
case BTA_GATTS_CREATE_EVT:
blufi_env.handle_srvc = p_data->create.service_id;
//add the frist blufi characteristic --> write characteristic
//add the first blufi characteristic --> write characteristic
BTA_GATTS_AddCharacteristic(blufi_env.handle_srvc, &blufi_char_uuid_p2e,
(GATT_PERM_WRITE),
(GATT_CHAR_PROP_BIT_WRITE),
@ -370,7 +370,7 @@ void esp_blufi_deinit(void)
void esp_blufi_adv_start(void)
{
esp_bt_dev_set_device_name(BLUFI_DEVICE_NAME);
esp_ble_gap_set_device_name(BLUFI_DEVICE_NAME);
esp_ble_gap_config_adv_data(&blufi_adv_data);
}

Wyświetl plik

@ -450,6 +450,7 @@ config BT_LE_USE_ESP_TIMER
config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
bool "BLE adv report flow control supported"
depends on BT_LE_ROLE_OBSERVER_ENABLE
default y
help
The function is mainly used to enable flow control for advertising reports. When it is enabled,
@ -498,3 +499,31 @@ config BT_LE_CCA_RSSI_THRESH
default 20
help
Power threshold of CCA in unit of -1 dBm.
config BT_LE_ROLE_CENTROL_ENABLE
bool "Enable BLE Centrol role function"
depends on !BT_NIMBLE_ENABLED
default y
help
Enable centrol role function.
config BT_LE_ROLE_PERIPHERAL_ENABLE
bool "Enable BLE Peripheral role function"
depends on !BT_NIMBLE_ENABLED
default y
help
Enable Peripheral role function.
config BT_LE_ROLE_BROADCASTER_ENABLE
bool "Enable BLE Broadcaster role function"
depends on !BT_NIMBLE_ENABLED
default y
help
Enable broadcaster role function.
config BT_LE_ROLE_OBSERVER_ENABLE
bool "Enable BLE Observer role function"
depends on !BT_NIMBLE_ENABLED
default y
help
Enable observer role function.

Wyświetl plik

@ -652,6 +652,15 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
return ret;
}
#if DEFAULT_BT_LE_50_FEATURE_SUPPORT || DEFAULT_BT_LE_ROLE_CENTROL || DEFAULT_BT_LE_ROLE_OBSERVER
extern int esp_ble_rom_func_ptr_init_all(void);
esp_ble_rom_func_ptr_init_all();
#else
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Init only legacy adv and slave function");
extern int esp_ble_rom_func_ptr_init_legacy_adv_and_slave(void);
esp_ble_rom_func_ptr_init_legacy_adv_and_slave();
#endif
/* Initialize the function pointers for OS porting */
npl_freertos_funcs_init();
struct npl_funcs_t *p_npl_funcs = npl_freertos_funcs_get();

Wyświetl plik

@ -46,6 +46,10 @@ extern "C" {
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0)
#endif
#define DEFAULT_BT_LE_ROLE_OBSERVER MYNEWT_VAL(BLE_ROLE_OBSERVER)
#define DEFAULT_BT_LE_ROLE_CENTROL MYNEWT_VAL(BLE_ROLE_CENTRAL)
#define DEFAULT_BT_LE_ROLE_PERIPHERAL MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
#define DEFAULT_BT_LE_ROLE_BROADCASTER MYNEWT_VAL(BLE_ROLE_BROADCASTER)
#else
#if CONFIG_BT_LE_LL_CFG_FEAT_LE_CODED_PHY
@ -57,13 +61,13 @@ extern "C" {
#if defined(CONFIG_BT_LE_MAX_PERIODIC_ADVERTISER_LIST)
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST (CONFIG_BT_LE_MAX_PERIODIC_ADVERTISER_LIST)
#else
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST (5)
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST (0)
#endif
#if defined(CONFIG_BT_LE_MAX_PERIODIC_SYNCS)
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS (CONFIG_BT_LE_MAX_PERIODIC_SYNCS)
#else
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS (1)
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS (0)
#endif
#if defined(CONFIG_BT_LE_MAX_CONNECTIONS)
@ -125,6 +129,29 @@ extern "C" {
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0)
#endif
#if defined(CONFIG_BT_LE_ROLE_CENTROL_ENABLE)
#define DEFAULT_BT_LE_ROLE_CENTROL (1)
#else
#define DEFAULT_BT_LE_ROLE_CENTROL (0)
#endif
#if defined(CONFIG_BT_LE_ROLE_PERIPHERAL_ENABLE)
#define DEFAULT_BT_LE_ROLE_PERIPHERAL (1)
#else
#define DEFAULT_BT_LE_ROLE_PERIPHERAL (0)
#endif
#if defined(CONFIG_BT_LE_ROLE_BROADCASTER_ENABLE)
#define DEFAULT_BT_LE_ROLE_BROADCASTER (1)
#else
#define DEFAULT_BT_LE_ROLE_BROADCASTER (0)
#endif
#if defined(CONFIG_BT_LE_ROLE_OBSERVER_ENABLE)
#define DEFAULT_BT_LE_ROLE_OBSERVER (1)
#else
#define DEFAULT_BT_LE_ROLE_OBSERVER (0)
#endif
#endif
#define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF

@ -1 +1 @@
Subproject commit 05fa7ad7edc0fda255e353880bbd38263bc08b9b
Subproject commit b9a902c3551ef4a2032b6662a4cbb018125ddfda

Wyświetl plik

@ -1132,7 +1132,7 @@ int bt_mesh_gatts_service_start(struct bt_mesh_gatt_service *svc)
int bt_mesh_gatts_set_local_device_name(const char *name)
{
BTM_SetLocalDeviceName((char *)name);
BTM_SetLocalDeviceName((char *)name, BT_DEVICE_TYPE_BLE);
return 0;
}
@ -1481,7 +1481,7 @@ static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
result = NULL;
}
/* Register Notification fot Mesh Provisioning/Proxy Data Out Characteristic */
/* Register Notification for Mesh Provisioning/Proxy Data Out Characteristic */
status = BTA_GATTC_RegisterForNotifications(bt_mesh_gattc_if, bt_mesh_gattc_info[i].addr.val,
bt_mesh_gattc_info[i].data_out_handle);
if (status != BTA_GATT_OK) {

@ -1 +1 @@
Subproject commit 41bf5fc0926fd6d3fb39cb5107e97f2fc6aed7e5
Subproject commit 4934ca903807dd74f7f808dadcd9a478e18fc6c3

Wyświetl plik

@ -360,6 +360,7 @@ esp_err_t esp_ble_gap_config_local_icon (uint16_t icon)
case ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV:
case ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD:
case ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV:
case ESP_BLE_APPEARANCE_STANDALONE_SPEAKER:
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON;
@ -457,9 +458,25 @@ esp_err_t esp_ble_gap_set_prefer_conn_params(esp_bd_addr_t bd_addr,
esp_err_t esp_ble_gap_set_device_name(const char *name)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
return esp_bt_dev_set_device_name(name);
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (!name){
return ESP_ERR_INVALID_ARG;
}
if (strlen(name) > BTC_MAX_LOC_BD_NAME_LEN) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_SET_DEV_NAME;
arg.set_dev_name.device_name = (char *)name;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_get_device_name(void)

Wyświetl plik

@ -517,4 +517,40 @@ esp_err_t esp_bt_gap_set_min_enc_key_size(uint8_t key_size)
}
#endif /* #if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE) */
esp_err_t esp_bt_gap_set_device_name(const char *name)
{
btc_msg_t msg;
btc_gap_bt_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if ((!name) || (strlen(name) > BTC_MAX_LOC_BD_NAME_LEN)) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BT;
msg.act = BTC_GAP_BT_ACT_SET_DEV_NAME;
arg.bt_set_dev_name.device_name = (char *)name;
return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy,
btc_gap_bt_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_bt_gap_get_device_name(void)
{
btc_msg_t msg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BT;
msg.act = BTC_GAP_BT_ACT_GET_DEV_NAME;
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif /* #if BTC_GAP_BT_INCLUDED == TRUE */

Wyświetl plik

@ -96,7 +96,7 @@ const uint8_t *esp_bt_dev_get_address(void);
* - ESP_ERR_INVALID_STATE : if bluetooth stack is not yet enabled
* - ESP_FAIL : others
*/
esp_err_t esp_bt_dev_set_device_name(const char *name);
esp_err_t esp_bt_dev_set_device_name(const char *name) __attribute__((deprecated("Please use esp_bt_gap_set_device_name or esp_ble_gap_set_device_name")));
/**
* @brief Get bluetooth device name. This function should be called after esp_bluedroid_enable()
@ -110,7 +110,7 @@ esp_err_t esp_bt_dev_set_device_name(const char *name);
* - ESP_ERR_INVALID_STATE : if bluetooth stack is not yet enabled
* - ESP_FAIL : others
*/
esp_err_t esp_bt_dev_get_device_name(void);
esp_err_t esp_bt_dev_get_device_name(void) __attribute__((deprecated("Please use esp_bt_gap_get_device_name or esp_ble_gap_get_device_name")));
/**
* @brief Config bluetooth device coexis status. This function should be called after esp_bluedroid_enable()

Wyświetl plik

@ -70,7 +70,7 @@ esp_err_t esp_bluedroid_disable(void);
* - ESP_OK : Succeed
* - Other : Failed
*/
esp_err_t esp_bluedroid_init(void) __attribute__((deprecated("Please use esp_bluedroid_init_with_cfg")));
esp_err_t esp_bluedroid_init(void);
/**
* @brief Init and alloc the resource for bluetooth, must be prior to every bluetooth stuff.

Wyświetl plik

@ -104,6 +104,7 @@ typedef uint8_t esp_ble_auth_req_t; /*!< combination of the above bit
#define ESP_BLE_APPEARANCE_CYCLING_CADENCE 0x0483 /*!< relate to BTM_BLE_APPEARANCE_CYCLING_CADENCE in stack/btm_ble_api.h */
#define ESP_BLE_APPEARANCE_CYCLING_POWER 0x0484 /*!< relate to BTM_BLE_APPEARANCE_CYCLING_POWER in stack/btm_ble_api.h */
#define ESP_BLE_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485 /*!< relate to BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE in stack/btm_ble_api.h */
#define ESP_BLE_APPEARANCE_STANDALONE_SPEAKER 0x0841 /*!< relate to BTM_BLE_APPEARANCE_STANDALONE_SPEAKER in stack/btm_ble_api.h */
#define ESP_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40 /*!< relate to BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER in stack/btm_ble_api.h */
#define ESP_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41 /*!< relate to BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP in stack/btm_ble_api.h */
#define ESP_BLE_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42 /*!< relate to BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST in stack/btm_ble_api.h */
@ -1813,7 +1814,7 @@ esp_err_t esp_ble_gap_set_prefer_conn_params(esp_bd_addr_t bd_addr,
* - other : failed
*
*/
esp_err_t esp_ble_gap_set_device_name(const char *name) __attribute__((deprecated("Please use esp_bt_dev_set_device_name")));
esp_err_t esp_ble_gap_set_device_name(const char *name);
/**
* @brief Get device name of the local device
@ -1823,7 +1824,7 @@ esp_err_t esp_ble_gap_set_device_name(const char *name) __attribute__((deprecate
* - other : failed
*
*/
esp_err_t esp_ble_gap_get_device_name(void) __attribute__((deprecated("Please use esp_bt_dev_get_device_name")));
esp_err_t esp_ble_gap_get_device_name(void);
/**
* @brief This function is called to get local used address and address type.

Wyświetl plik

@ -105,7 +105,7 @@ typedef uint8_t esp_bt_eir_type_t;
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH5 0x1000
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH5 0x2000
// DM1 cann not be disabled. All options are mandatory to include DM1.
// DM1 can not be disabled. All options are mandatory to include DM1.
#define ESP_BT_ACL_DM1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM1 | 0x330e) /* 0x330e */
#define ESP_BT_ACL_DH1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH1 | 0x330e) /* 0x331e */
#define ESP_BT_ACL_DM3_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM3 | 0x330e) /* 0x370e */
@ -146,7 +146,7 @@ typedef struct {
uint8_t *p_url; /*!< URL point */
} esp_bt_eir_data_t;
/// Major service class field of Class of Device, mutiple bits can be set
/// Major service class field of Class of Device, multiple bits can be set
typedef enum {
ESP_BT_COD_SRVC_NONE = 0, /*!< None indicates an invalid value */
ESP_BT_COD_SRVC_LMTD_DISCOVER = 0x1, /*!< Limited Discoverable Mode */
@ -271,6 +271,7 @@ typedef enum {
ESP_BT_GAP_ACL_PKT_TYPE_CHANGED_EVT, /*!< Set ACL packet types event */
ESP_BT_GAP_ENC_CHG_EVT, /*!< Encryption change event */
ESP_BT_GAP_SET_MIN_ENC_KEY_SIZE_EVT, /*!< Set minimum encryption key size */
ESP_BT_GAP_GET_DEV_NAME_CMPL_EVT, /*!< Get device name complete event */
ESP_BT_GAP_EVT_MAX,
} esp_bt_gap_cb_event_t;
@ -487,6 +488,14 @@ typedef union {
uint16_t handle; /*!< ACL connection handle */
esp_bd_addr_t bda; /*!< remote bluetooth device address */
} acl_disconn_cmpl_stat; /*!< ACL disconnection complete status parameter struct */
/**
* @brief ESP_GAP_BT_GET_DEV_NAME_CMPL_EVT
*/
struct get_dev_name_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate the get device name success status */
char *name; /*!< Name of bluetooth device */
} get_dev_name_cmpl; /*!< Get device name complete status parameter struct */
} esp_bt_gap_cb_param_t;
/**
@ -553,7 +562,7 @@ static inline uint32_t esp_bt_gap_get_cod_format_type(uint32_t cod)
*
* @return
* - true if cod is valid
* - false otherise
* - false otherwise
*/
static inline bool esp_bt_gap_is_valid_cod(uint32_t cod)
{
@ -922,7 +931,7 @@ esp_err_t esp_bt_gap_get_page_timeout(void);
esp_err_t esp_bt_gap_set_acl_pkt_types(esp_bd_addr_t remote_bda, esp_bt_acl_pkt_type_t pkt_types);
/**
* @brief Set the mininal size of encryption key
* @brief Set the minimal size of encryption key
*
* @return - ESP_OK: success
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
@ -930,6 +939,26 @@ esp_err_t esp_bt_gap_set_acl_pkt_types(esp_bd_addr_t remote_bda, esp_bt_acl_pkt_
*/
esp_err_t esp_bt_gap_set_min_enc_key_size(uint8_t key_size);
/**
* @brief Set device name to the local device
*
* @param[in] name - device name.
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_bt_gap_set_device_name(const char *name);
/**
* @brief Get device name of the local device
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_bt_gap_get_device_name(void);
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -683,9 +683,11 @@ static void bta_dm_disable_timer_cback (TIMER_LIST_ENT *p_tle)
*******************************************************************************/
void bta_dm_set_dev_name (tBTA_DM_MSG *p_data)
{
BTM_SetLocalDeviceName((char *)p_data->set_name.name);
BTM_SetLocalDeviceName((char *)p_data->set_name.name, p_data->set_name.name_type);
#if CLASSIC_BT_INCLUDED
bta_dm_set_eir ((char *)p_data->set_name.name);
if (p_data->set_name.name_type & BT_DEVICE_TYPE_BREDR) {
bta_dm_set_eir ((char *)p_data->set_name.name);
}
#endif /// CLASSIC_BT_INCLUDED
}
@ -704,7 +706,7 @@ void bta_dm_get_dev_name (tBTA_DM_MSG *p_data)
tBTM_STATUS status;
char *name = NULL;
status = BTM_ReadLocalDeviceName(&name);
status = BTM_ReadLocalDeviceName(&name, p_data->get_name.name_type);
if (p_data->get_name.p_cback) {
(*p_data->get_name.p_cback)(status, name);
}
@ -4168,7 +4170,7 @@ static void bta_dm_set_eir (char *local_name)
if (p_bta_dm_eir_cfg->bta_dm_eir_included_name) {
/* if local name is not provided, get it from controller */
if ( local_name == NULL ) {
if ( BTM_ReadLocalDeviceName( &local_name ) != BTM_SUCCESS ) {
if ( BTM_ReadLocalDeviceName( &local_name, BT_DEVICE_TYPE_BREDR) != BTM_SUCCESS ) {
APPL_TRACE_ERROR("Fail to read local device name for EIR");
}
}

Wyświetl plik

@ -166,7 +166,7 @@ void BTA_DisableTestMode(void)
** Returns void
**
*******************************************************************************/
void BTA_DmSetDeviceName(const char *p_name)
void BTA_DmSetDeviceName(const char *p_name, tBT_DEVICE_TYPE name_type)
{
tBTA_DM_API_SET_NAME *p_msg;
@ -176,6 +176,7 @@ void BTA_DmSetDeviceName(const char *p_name)
/* truncate the name if needed */
BCM_STRNCPY_S((char *)p_msg->name, p_name, BD_NAME_LEN);
p_msg->name[BD_NAME_LEN] = '\0';
p_msg->name_type = name_type;
bta_sys_sendmsg(p_msg);
}
@ -191,13 +192,14 @@ void BTA_DmSetDeviceName(const char *p_name)
** Returns void
**
*******************************************************************************/
void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback)
void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback, tBT_DEVICE_TYPE name_type)
{
tBTA_DM_API_GET_NAME *p_msg;
if ((p_msg = (tBTA_DM_API_GET_NAME *) osi_malloc(sizeof(tBTA_DM_API_GET_NAME))) != NULL) {
p_msg->hdr.event = BTA_DM_API_GET_NAME_EVT;
p_msg->p_cback = p_cback;
p_msg->name_type = name_type;
bta_sys_sendmsg(p_msg);
}
}

Wyświetl plik

@ -255,11 +255,13 @@ typedef struct {
typedef struct {
BT_HDR hdr;
BD_NAME name; /* max 248 bytes name, plus must be Null terminated */
tBT_DEVICE_TYPE name_type; /* name for BLE, name for BT or name for BTDM */
} tBTA_DM_API_SET_NAME;
typedef struct {
BT_HDR hdr;
BT_HDR hdr;
tBTA_GET_DEV_NAME_CBACK *p_cback;
tBT_DEVICE_TYPE name_type;
} tBTA_DM_API_GET_NAME;
#if (ESP_COEX_VSC_INCLUDED == TRUE)

Wyświetl plik

@ -276,7 +276,7 @@ static void bta_hh_di_sdp_cback(UINT16 result)
bta_hh_update_di_info(p_cb, di_rec.rec.vendor, di_rec.rec.product, di_rec.rec.version, 0);
}
} else { /* no DI recrod available */
} else { /* no DI record available */
bta_hh_update_di_info(p_cb, BTA_HH_VENDOR_ID_INVALID, 0, 0, 0);
}
@ -358,7 +358,7 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
return;
}
/* GetSDPRecord. at one time only one SDP precedure can be active */
/* GetSDPRecord. at one time only one SDP procedure can be active */
else if (!bta_hh_cb.p_disc_db) {
bta_hh_cb.p_disc_db = (tSDP_DISCOVERY_DB *) osi_malloc(p_bta_hh_cfg->sdp_db_size);
@ -429,6 +429,7 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
APPL_TRACE_DEBUG ("bta_hh_sdp_cmpl: HID_HostOpenDev failed: \
Status 0x%2X", ret);
#endif
conn_dat.is_orig = HID_HostConnectOrig(p_cb->hid_handle);
/* open fail, remove device from management device list */
HID_HostRemoveDev( p_cb->hid_handle);
status = BTA_HH_ERR;
@ -452,8 +453,6 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
HID_HostRemoveDev( p_cb->incoming_hid_handle);
}
conn_dat.status = status;
/* check if host initiate the connection*/
conn_dat.is_orig = !p_cb->incoming_conn;
(* bta_hh_cb.p_cback)(BTA_HH_OPEN_EVT, (tBTA_HH *)&conn_dat);
/* move state machine W4_CONN ->IDLE */
@ -523,8 +522,7 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
memset((void *)&conn, 0, sizeof (tBTA_HH_CONN));
conn.handle = dev_handle;
/* check if host initiate the connection*/
conn.is_orig = !p_cb->incoming_conn;
conn.is_orig = HID_HostConnectOrig(dev_handle);
bdcpy(conn.bda, p_cb->addr);
/* increase connection number */
@ -596,7 +594,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
if (p_cb->app_id != 0) {
bta_hh_sm_execute(p_cb, BTA_HH_OPEN_CMPL_EVT, p_data);
} else
/* app_id == 0 indicates an incoming conenction request arrives without SDP
/* app_id == 0 indicates an incoming connection request arrives without SDP
performed, do it first */
{
/* store the handle here in case sdp fails - need to disconnect */
@ -637,7 +635,7 @@ void bta_hh_data_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
**
** Function bta_hh_handsk_act
**
** Description HID Host process a handshake acknoledgement.
** Description HID Host process a handshake acknowledgement.
**
**
** Returns void
@ -674,7 +672,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
p_cb->w4_evt = 0;
break;
/* acknoledgement from HID device for SET_ transaction */
/* acknowledgement from HID device for SET_ transaction */
case BTA_HH_SET_RPT_EVT:
case BTA_HH_SET_PROTO_EVT:
case BTA_HH_SET_IDLE_EVT :
@ -693,8 +691,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
case BTA_HH_OPEN_EVT:
conn.status = p_data->hid_cback.data ? BTA_HH_ERR_PROTO : BTA_HH_OK;
conn.handle = p_cb->hid_handle;
/* check if host initiate the connection*/
conn.is_orig = !p_cb->incoming_conn;
conn.is_orig = HID_HostConnectOrig(p_cb->hid_handle);
bdcpy(conn.bda, p_cb->addr);
(* bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH *)&conn);
#if BTA_HH_DEBUG
@ -704,12 +701,12 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
break;
default:
/* unknow transaction handshake response */
/* unknown transaction handshake response */
APPL_TRACE_DEBUG("unknown transaction type");
break;
}
/* transaction achknoledgement received, inform PM for mode change */
/* transaction acknowledgement received, inform PM for mode change */
bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr);
return;
}
@ -799,7 +796,7 @@ void bta_hh_open_failure(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
conn_dat.status = (reason == HID_ERR_AUTH_FAILED) ?
BTA_HH_ERR_AUTH_FAILED : BTA_HH_ERR;
/* check if host initiate the connection*/
conn_dat.is_orig = !p_cb->incoming_conn;
conn_dat.is_orig = HID_HostConnectOrig(p_cb->hid_handle);
bdcpy(conn_dat.bda, p_cb->addr);
HID_HostCloseDev(p_cb->hid_handle);
@ -844,13 +841,13 @@ void bta_hh_close_act (tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
/* Check reason for closing */
if ((reason & (HID_L2CAP_CONN_FAIL | HID_L2CAP_REQ_FAIL)) || /* Failure to initialize connection (page timeout or l2cap error) */
(reason == HID_ERR_AUTH_FAILED) || /* Authenication error (while initiating) */
(reason == HID_ERR_AUTH_FAILED) || /* Authentication error (while initiating) */
(reason == HID_ERR_L2CAP_FAILED)) { /* Failure creating l2cap connection */
/* Failure in opening connection */
conn_dat.handle = p_cb->hid_handle;
conn_dat.status = (reason == HID_ERR_AUTH_FAILED) ? BTA_HH_ERR_AUTH_FAILED : BTA_HH_ERR;
/* check if host initiate the connection*/
conn_dat.is_orig = !p_cb->incoming_conn;
conn_dat.is_orig = HID_HostConnectOrig(p_cb->hid_handle);
bdcpy(conn_dat.bda, p_cb->addr);
HID_HostCloseDev(p_cb->hid_handle);

Wyświetl plik

@ -293,7 +293,7 @@ void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event, tBTA_HH_DATA *p_data)
cback_data.conn.status = BTA_HH_ERR_DB_FULL;
cback_data.conn.handle = BTA_HH_INVALID_HANDLE;
/* check if host initiate the connection*/
cback_data.conn.is_orig = !p_cb->incoming_conn;
cback_data.conn.is_orig = TRUE;
break;
/* DB full, BTA_HhAddDev */
case BTA_HH_API_MAINT_DEV_EVT:

Wyświetl plik

@ -1728,7 +1728,7 @@ extern void BTA_DisableTestMode(void);
** Returns void
**
*******************************************************************************/
extern void BTA_DmSetDeviceName(const char *p_name);
extern void BTA_DmSetDeviceName(const char *p_name, tBT_DEVICE_TYPE name_type);
/*******************************************************************************
**
@ -1740,7 +1740,7 @@ extern void BTA_DmSetDeviceName(const char *p_name);
** Returns void
**
*******************************************************************************/
extern void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback);
extern void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback, tBT_DEVICE_TYPE name_type);
/*******************************************************************************
**

Wyświetl plik

@ -141,10 +141,10 @@ void btc_dev_call_handler(btc_msg_t *msg)
switch (msg->act) {
case BTC_DEV_ACT_SET_DEVICE_NAME:
BTA_DmSetDeviceName(arg->set_dev_name.device_name);
BTA_DmSetDeviceName(arg->set_dev_name.device_name, BT_DEVICE_TYPE_DUMO);
break;
case BTC_DEV_ACT_GET_DEVICE_NAME:
BTA_DmGetDeviceName(btc_dev_get_dev_name_callback);
BTA_DmGetDeviceName(btc_dev_get_dev_name_callback, BT_DEVICE_TYPE_DUMO);
break;
#if (ESP_COEX_VSC_INCLUDED == TRUE)
case BTC_DEV_ACT_CFG_COEX_STATUS:

Wyświetl plik

@ -789,7 +789,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
/* Set initial device name, it can be overwritten later */
if (p_data->enable.status == BTA_SUCCESS) {
const char *initial_device_name = "ESP32";
BTA_DmSetDeviceName(initial_device_name);
BTA_DmSetDeviceName(initial_device_name, BT_DEVICE_TYPE_DUMO);
}
btc_enable_bluetooth_evt(p_data->enable.status);
break;

Wyświetl plik

@ -1694,6 +1694,18 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
}
break;
}
case BTC_GAP_BLE_ACT_SET_DEV_NAME:{
btc_ble_gap_args_t *src = (btc_ble_gap_args_t *)p_src;
btc_ble_gap_args_t *dst = (btc_ble_gap_args_t *)p_dest;
dst->set_dev_name.device_name = (char *)osi_malloc((BTC_MAX_LOC_BD_NAME_LEN + 1) * sizeof(char));
if (dst->set_dev_name.device_name) {
BCM_STRNCPY_S(dst->set_dev_name.device_name, src->set_dev_name.device_name, BTC_MAX_LOC_BD_NAME_LEN);
dst->set_dev_name.device_name[BTC_MAX_LOC_BD_NAME_LEN] = '\0';
} else {
BTC_TRACE_ERROR("%s %d no mem\n",__func__, msg->act);
}
break;
}
default:
BTC_TRACE_ERROR("Unhandled deep copy %d\n", msg->act);
break;
@ -1822,6 +1834,14 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
}
break;
}
case BTC_GAP_BLE_ACT_SET_DEV_NAME:{
char *p_name = ((btc_ble_gap_args_t *)msg->arg)->set_dev_name.device_name;
if (p_name) {
osi_free((uint8_t *)p_name);
}
break;
}
break;
default:
BTC_TRACE_DEBUG("Unhandled deep free %d\n", msg->act);
break;
@ -1944,10 +1964,10 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
break;
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
case BTC_GAP_BLE_ACT_SET_DEV_NAME:
BTA_DmSetDeviceName(arg->set_dev_name.device_name);
BTA_DmSetDeviceName(arg->set_dev_name.device_name, BT_DEVICE_TYPE_BLE);
break;
case BTC_GAP_BLE_ACT_GET_DEV_NAME:
BTA_DmGetDeviceName(btc_gap_ble_get_dev_name_callback);
BTA_DmGetDeviceName(btc_gap_ble_get_dev_name_callback, BT_DEVICE_TYPE_BLE);
break;
#if (BLE_42_FEATURE_SUPPORT == TRUE)
case BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW:

Wyświetl plik

@ -878,6 +878,33 @@ static void btc_gap_bt_set_qos(btc_gap_bt_args_t *arg)
#endif /// (BTA_DM_QOS_INCLUDED == TRUE)
}
static void btc_gap_bt_get_dev_name_callback(UINT8 status, char *name)
{
esp_bt_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg = {0};
memset(&param, 0, sizeof(esp_bt_gap_cb_param_t));
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BT;
msg.act = BTC_GAP_BT_GET_DEV_NAME_CMPL_EVT;
param.get_dev_name_cmpl.status = btc_btm_status_to_esp_status(status);
param.get_dev_name_cmpl.name = (char *)osi_malloc(BTC_MAX_LOC_BD_NAME_LEN + 1);
if (param.get_dev_name_cmpl.name) {
BCM_STRNCPY_S(param.get_dev_name_cmpl.name, name, BTC_MAX_LOC_BD_NAME_LEN);
param.get_dev_name_cmpl.name[BTC_MAX_LOC_BD_NAME_LEN] = '\0';
} else {
param.get_dev_name_cmpl.status = ESP_BT_STATUS_NOMEM;
}
ret = btc_transfer_context(&msg, &param, sizeof(esp_bt_gap_cb_param_t), NULL, NULL);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
switch (msg->act) {
@ -897,6 +924,7 @@ void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
case BTC_GAP_BT_ACT_SET_PAGE_TIMEOUT:
case BTC_GAP_BT_ACT_GET_PAGE_TIMEOUT:
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES:
case BTC_GAP_BT_ACT_GET_DEV_NAME:
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
case BTC_GAP_BT_ACT_SET_MIN_ENC_KEY_SIZE:
#endif
@ -941,6 +969,18 @@ void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
}
break;
}
case BTC_GAP_BT_ACT_SET_DEV_NAME: {
btc_gap_bt_args_t *src = (btc_gap_bt_args_t *)p_src;
btc_gap_bt_args_t *dst = (btc_gap_bt_args_t *)p_dest;
dst->bt_set_dev_name.device_name = (char *)osi_malloc((BTC_MAX_LOC_BD_NAME_LEN + 1) * sizeof(char));
if (dst->bt_set_dev_name.device_name) {
BCM_STRNCPY_S(dst->bt_set_dev_name.device_name, src->bt_set_dev_name.device_name, BTC_MAX_LOC_BD_NAME_LEN);
dst->bt_set_dev_name.device_name[BTC_MAX_LOC_BD_NAME_LEN] = '\0';
} else {
BTC_TRACE_ERROR("%s %d no mem\n", __func__, msg->act);
}
break;
}
default:
BTC_TRACE_ERROR("Unhandled deep copy %d\n", msg->act);
break;
@ -967,6 +1007,7 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
case BTC_GAP_BT_ACT_SET_PAGE_TIMEOUT:
case BTC_GAP_BT_ACT_GET_PAGE_TIMEOUT:
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES:
case BTC_GAP_BT_ACT_GET_DEV_NAME:
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
case BTC_GAP_BT_ACT_SET_MIN_ENC_KEY_SIZE:
#endif
@ -988,6 +1029,13 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
osi_free(arg->config_eir.eir_data.p_url);
}
break;
case BTC_GAP_BT_ACT_SET_DEV_NAME: {
char *p_name = arg->bt_set_dev_name.device_name;
if (p_name) {
osi_free((uint8_t *)p_name);
}
break;
}
default:
BTC_TRACE_ERROR("Unhandled deep copy %d, arg: %p\n", msg->act, arg);
break;
@ -1086,6 +1134,14 @@ void btc_gap_bt_call_handler(btc_msg_t *msg)
break;
}
#endif
case BTC_GAP_BT_ACT_SET_DEV_NAME: {
BTA_DmSetDeviceName(arg->bt_set_dev_name.device_name, BT_DEVICE_TYPE_BREDR);
break;
}
case BTC_GAP_BT_ACT_GET_DEV_NAME: {
BTA_DmGetDeviceName(btc_gap_bt_get_dev_name_callback, BT_DEVICE_TYPE_BREDR);
break;
}
default:
break;
}
@ -1141,6 +1197,7 @@ void btc_gap_bt_cb_deep_free(btc_msg_t *msg)
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
case BTC_GAP_BT_SET_MIN_ENC_KEY_SIZE_EVT:
#endif /// ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE
case BTC_GAP_BT_GET_DEV_NAME_CMPL_EVT:
break;
default:
BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act);
@ -1238,6 +1295,10 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg)
break;
}
#endif
case BTC_GAP_BT_GET_DEV_NAME_CMPL_EVT: {
btc_gap_bt_cb_to_app(ESP_BT_GAP_GET_DEV_NAME_CMPL_EVT, (esp_bt_gap_cb_param_t *)msg->arg);
break;
}
default:
BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act);
break;

Wyświetl plik

@ -318,9 +318,19 @@ bt_status_t btc_hf_init(void)
BTC_TRACE_DEBUG("%s - max_hf_clients=%d", __func__, btc_max_hf_clients);
#if HFP_DYNAMIC_MEMORY == TRUE
if (hf_local_param == NULL) {
if ((hf_local_param = (hf_local_param_t *)osi_malloc(BTC_HF_NUM_CB * sizeof(hf_local_param_t))) == NULL) {
BTC_TRACE_ERROR("%s malloc failed!", __func__);
return BT_STATUS_NOMEM;
}
}
memset((void *)hf_local_param, 0, BTC_HF_NUM_CB * sizeof(hf_local_param_t));
#endif
/* Invoke the enable service API to the core to set the appropriate service_id
* Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
* othwerwise only HSP is enabled (tablet)*/
* otherwise only HSP is enabled (tablet)*/
#if (defined(BTC_HF_SERVICES) && (BTC_HF_SERVICES & BTA_HFP_SERVICE_MASK))
btc_dm_enable_service(BTA_HFP_SERVICE_ID);
#else
@ -747,7 +757,7 @@ static bt_status_t btc_hf_phone_state_update(bt_bdaddr_t *bd_addr,int num_active
}
/* CIND response should have been updated. */
BTA_AgResult(BTA_AG_HANDLE_ALL, res, &ag_res);
/* Just open SCO conenction. */
/* Just open SCO connection. */
BTA_AgAudioOpen(ag_res.audio_handle);
activeCallUpdated = TRUE;
}
@ -1560,7 +1570,7 @@ void btc_hf_cb_handler(btc_msg_t *msg)
CHECK_HF_IDX(idx);
BTC_TRACE_DEBUG("AG Bitmap of peer-codecs %d", p_data->val.num);
#if (BTM_WBS_INCLUDED == TRUE)
/* If the peer supports mSBC and the BTC prefferred codec is also mSBC, then
/* If the peer supports mSBC and the BTC preferred codec is also mSBC, then
** we should set the BTA AG Codec to mSBC. This would trigger a +BCS to mSBC at the time
** of SCO connection establishment */
if ((btc_conf_hf_force_wbs == TRUE) && (p_data->val.num & BTA_AG_CODEC_MSBC)) {
@ -1596,7 +1606,7 @@ void btc_hf_cb_handler(btc_msg_t *msg)
BTC_TRACE_DEBUG("AG final seleded codec is %d 1=CVSD 2=MSBC", p_data->val.num);
memcpy(param.bcs_rep.remote_addr, &hf_local_param[idx].btc_hf_cb.connected_bda,sizeof(esp_bd_addr_t));
param.bcs_rep.mode = p_data->val.num;
/* No ESP_HF_WBS_NONE case, becuase HFP 1.6 supported device can send BCS */
/* No ESP_HF_WBS_NONE case, because HFP 1.6 supported device can send BCS */
btc_hf_cb_to_app(ESP_HF_BCS_RESPONSE_EVT, &param);
} while (0);
break;

Wyświetl plik

@ -189,7 +189,7 @@ static btc_hh_device_t *btc_hh_find_connected_dev_by_bda(BD_ADDR bd_addr)
*
* Function btc_hh_stop_vup_timer
*
* Description stop vitual unplug timer
* Description stop virtual unplug timer
*
* Returns void
******************************************************************************/
@ -316,7 +316,7 @@ void btc_hh_remove_device(BD_ADDR bd_addr)
for (i = 0; i < BTC_HH_MAX_ADDED_DEV; i++) {
p_added_dev = &btc_hh_cb.added_devices[i];
if (p_added_dev->bd_addr == bd_addr) {
if (memcmp(p_added_dev->bd_addr, bd_addr, BD_ADDR_LEN) == 0) {
BTA_HhRemoveDev(p_added_dev->dev_handle);
btc_storage_remove_hid_info((bt_bdaddr_t *)p_added_dev->bd_addr);
memset(p_added_dev->bd_addr, 0, 6);
@ -544,6 +544,11 @@ static void btc_hh_connect(btc_hidh_args_t *arg)
BTC_TRACE_ERROR("%s exceeded the maximum supported HID device number %d!", __func__, BTC_HH_MAX_HID);
ret = ESP_HIDH_ERR_NO_RES;
break;
} else if (dev && dev->dev_status == ESP_HIDH_CONN_STATE_CONNECTED) {
BTC_TRACE_WARNING("%s Device[%s] already connected", __func__,
bdaddr_to_string((const bt_bdaddr_t *)arg->connect.bd_addr, bdstr, sizeof(bdstr)));
param.open.conn_status = ESP_HIDH_CONN_STATE_CONNECTED;
break;
}
for (int i = 0; i < BTC_HH_MAX_ADDED_DEV; i++) {
@ -662,7 +667,7 @@ static void btc_hh_virtual_unplug(btc_hidh_args_t *arg)
param.unplug.conn_status = ESP_HIDH_CONN_STATE_DISCONNECTING;
param.unplug.handle = p_dev->dev_handle;
} else if ((p_dev != NULL) && (p_dev->dev_status == ESP_HIDH_CONN_STATE_CONNECTED)) {
BTC_TRACE_WARNING("%s: Virtual unplug not suported, disconnecting device", __func__);
BTC_TRACE_WARNING("%s: Virtual unplug not supported, disconnecting device", __func__);
/* start the timer */
btc_hh_start_vup_timer(arg->unplug.bd_addr);
p_dev->local_vup = true;

Wyświetl plik

@ -185,7 +185,7 @@ typedef union {
//BTC_GAP_BLE_ACT_SET_DEV_NAME,
struct set_dev_name_args {
#define ESP_GAP_DEVICE_NAME_MAX (32)
char device_name[ESP_GAP_DEVICE_NAME_MAX + 1];
char *device_name;
} set_dev_name;
#if (BLE_42_FEATURE_SUPPORT == TRUE)
//BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW,

Wyświetl plik

@ -38,6 +38,7 @@ typedef enum {
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
BTC_GAP_BT_SET_MIN_ENC_KEY_SIZE_EVT,
#endif
BTC_GAP_BT_GET_DEV_NAME_CMPL_EVT,
}btc_gap_bt_evt_t;
typedef enum {
@ -64,6 +65,8 @@ typedef enum {
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
BTC_GAP_BT_ACT_SET_MIN_ENC_KEY_SIZE,
#endif
BTC_GAP_BT_ACT_SET_DEV_NAME,
BTC_GAP_BT_ACT_GET_DEV_NAME,
} btc_gap_bt_act_t;
/* btc_bt_gap_args_t */
@ -177,6 +180,11 @@ typedef union {
uint8_t key_size;
} set_min_enc_key_size;
#endif
// BTC_GAP_BT_ACT_SET_DEV_NAME
struct bt_set_dev_name_args {
char *device_name;
} bt_set_dev_name;
} btc_gap_bt_args_t;
void btc_gap_bt_call_handler(btc_msg_t *msg);

Wyświetl plik

@ -144,6 +144,10 @@ void hci_shut_down(void)
bool hci_downstream_data_post(uint32_t timeout)
{
if (hci_host_env.downstream_data_ready == NULL) {
HCI_TRACE_WARNING("%s downstream_data_ready event not created", __func__);
return false;
}
return osi_thread_post_event(hci_host_env.downstream_data_ready, timeout);
}
@ -263,7 +267,7 @@ static void transmit_command(
// in case the upper layer didn't already
command->event = MSG_STACK_TO_HC_HCI_CMD;
HCI_TRACE_DEBUG("HCI Enqueue Comamnd opcode=0x%x\n", metadata->opcode);
HCI_TRACE_DEBUG("HCI Enqueue Command opcode=0x%x\n", metadata->opcode);
BTTRC_DUMP_BUFFER(NULL, command->data + command->offset, command->len);
fixed_pkt_queue_enqueue(hci_host_env.command_queue, linked_pkt, FIXED_PKT_QUEUE_MAX_TIMEOUT);

Wyświetl plik

@ -2236,16 +2236,16 @@ UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
/* device name */
#if BTM_MAX_LOC_BD_NAME_LEN > 0
if (len > MIN_ADV_LENGTH && data_mask & BTM_BLE_AD_BIT_DEV_NAME) {
if (strlen(btm_cb.cfg.bd_name) > (UINT16)(len - MIN_ADV_LENGTH)) {
if (strlen(btm_cb.cfg.ble_bd_name) > (UINT16)(len - MIN_ADV_LENGTH)) {
cp_len = (UINT16)(len - MIN_ADV_LENGTH);
*p++ = cp_len + 1;
*p++ = BTM_BLE_AD_TYPE_NAME_SHORT;
ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
ARRAY_TO_STREAM(p, btm_cb.cfg.ble_bd_name, cp_len);
} else {
cp_len = (UINT16)strlen(btm_cb.cfg.bd_name);
cp_len = (UINT16)strlen(btm_cb.cfg.ble_bd_name);
*p++ = cp_len + 1;
*p++ = BTM_BLE_AD_TYPE_NAME_CMPL;
ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
ARRAY_TO_STREAM(p, btm_cb.cfg.ble_bd_name, cp_len);
}
len -= (cp_len + MIN_ADV_LENGTH);
data_mask &= ~BTM_BLE_AD_BIT_DEV_NAME;
@ -3291,6 +3291,7 @@ static void btm_ble_appearance_to_cod(UINT16 appearance, UINT8 *dev_class)
case BTM_BLE_APPEARANCE_CYCLING_CADENCE:
case BTM_BLE_APPEARANCE_CYCLING_POWER:
case BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE:
case BTM_BLE_APPEARANCE_STANDALONE_SPEAKER:
case BTM_BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS:
case BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION:
case BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV:

Wyświetl plik

@ -81,7 +81,8 @@ void btm_dev_init (void)
/* Initialize nonzero defaults */
#if (BTM_MAX_LOC_BD_NAME_LEN > 0)
memset(btm_cb.cfg.bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
memset(btm_cb.cfg.ble_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
memset(btm_cb.cfg.bredr_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
#endif
btm_cb.devcb.reset_timer.param = (TIMER_PARAM_TYPE)TT_DEV_RESET;
@ -449,11 +450,11 @@ static void btm_decode_ext_features_page (UINT8 page_number, const BD_FEATURES p
** Returns status of the operation
**
*******************************************************************************/
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type)
{
UINT8 *p;
if (!p_name || !p_name[0] || (strlen ((char *)p_name) > BD_NAME_LEN)) {
if (!p_name || !p_name[0] || (strlen ((char *)p_name) > BD_NAME_LEN) || (name_type > BT_DEVICE_TYPE_DUMO)) {
return (BTM_ILLEGAL_VALUE);
}
@ -463,16 +464,26 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
#if BTM_MAX_LOC_BD_NAME_LEN > 0
/* Save the device name if local storage is enabled */
p = (UINT8 *)btm_cb.cfg.bd_name;
if (p != (UINT8 *)p_name) {
BCM_STRNCPY_S(btm_cb.cfg.bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
btm_cb.cfg.bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
if (name_type & BT_DEVICE_TYPE_BLE) {
p = (UINT8 *)btm_cb.cfg.ble_bd_name;
if (p != (UINT8 *)p_name) {
BCM_STRNCPY_S(btm_cb.cfg.ble_bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
btm_cb.cfg.ble_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
}
}
if (name_type & BT_DEVICE_TYPE_BREDR) {
p = (UINT8 *)btm_cb.cfg.bredr_bd_name;
if (p != (UINT8 *)p_name) {
BCM_STRNCPY_S(btm_cb.cfg.bredr_bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
btm_cb.cfg.bredr_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
}
}
#else
p = (UINT8 *)p_name;
#endif
#if CLASSIC_BT_INCLUDED
if (btsnd_hcic_change_name(p)) {
if ((name_type & BT_DEVICE_TYPE_BREDR) && btsnd_hcic_change_name(p)) {
return (BTM_CMD_STARTED);
} else
#endif
@ -496,10 +507,33 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
** is returned and p_name is set to NULL
**
*******************************************************************************/
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name)
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name, tBT_DEVICE_TYPE name_type)
{
/*
// name_type should be BT_DEVICE_TYPE_BLE or BT_DEVICE_TYPE_BREDR
if (name_type > BT_DEVICE_TYPE_BREDR) {
*p_name = NULL;
BTM_TRACE_ERROR("name_type unknown %d", name_type);
return (BTM_NO_RESOURCES);
}
*/
#if BTM_MAX_LOC_BD_NAME_LEN > 0
*p_name = btm_cb.cfg.bd_name;
if ((name_type == BT_DEVICE_TYPE_DUMO) &&
(BCM_STRNCMP_S(btm_cb.cfg.bredr_bd_name, btm_cb.cfg.ble_bd_name, BTM_MAX_LOC_BD_NAME_LEN) != 0)) {
*p_name = NULL;
BTM_TRACE_ERROR("Error, BLE and BREDR have different names, return NULL\n");
return (BTM_NO_RESOURCES);
}
if (name_type & BT_DEVICE_TYPE_BLE) {
*p_name = btm_cb.cfg.ble_bd_name;
}
if (name_type & BT_DEVICE_TYPE_BREDR) {
*p_name = btm_cb.cfg.bredr_bd_name;
}
return (BTM_SUCCESS);
#else
*p_name = NULL;
@ -747,7 +781,7 @@ void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
/* If there was a callback address for vcs complete, call it */
if (p_vsc_cplt_cback) {
/* Pass paramters to the callback function */
/* Pass parameters to the callback function */
vcs_cplt_params.opcode = opcode; /* Number of bytes in return info */
vcs_cplt_params.param_len = evt_len; /* Number of bytes in return info */
vcs_cplt_params.p_param_buf = p;

Wyświetl plik

@ -809,7 +809,7 @@ void btm_sec_clr_temp_auth_service (BD_ADDR bda)
return;
}
/* Reset the temporary authorized flag so that next time (untrusted) service is accessed autorization will take place */
/* Reset the temporary authorized flag so that next time (untrusted) service is accessed authorization will take place */
if (p_dev_rec->last_author_service_id != BTM_SEC_NO_LAST_SERVICE_ID && p_dev_rec->p_cur_service) {
BTM_TRACE_DEBUG ("btm_sec_clr_auth_service_by_psm [clearing device: %02x:%02x:%02x:%02x:%02x:%02x]\n",
bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);
@ -1364,7 +1364,7 @@ tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SE
|| (transport == BT_TRANSPORT_LE && p_dev_rec->ble_hci_handle == BTM_SEC_INVALID_HANDLE)
#endif
) {
/* Connection should be up and runnning */
/* Connection should be up and running */
BTM_TRACE_WARNING ("Security Manager: BTM_SetEncryption not connected\n");
if (p_callback) {
@ -1790,15 +1790,15 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
}
#if BTM_MAX_LOC_BD_NAME_LEN > 0
name_size = name_len;
if (name_size > strlen(btm_cb.cfg.bd_name)) {
if (name_size > strlen(btm_cb.cfg.bredr_bd_name)) {
name_type = BTM_EIR_COMPLETE_LOCAL_NAME_TYPE;
name_size = (UINT16)strlen(btm_cb.cfg.bd_name);
name_size = (UINT16)strlen(btm_cb.cfg.bredr_bd_name);
}
delta = name_size + 2;
if (max_len >= delta) {
*p++ = name_size + 1;
*p++ = name_type;
ARRAY_TO_STREAM (p, btm_cb.cfg.bd_name, name_size);
ARRAY_TO_STREAM (p, btm_cb.cfg.bredr_bd_name, name_size);
len += delta;
max_len -= delta;
}
@ -2118,7 +2118,7 @@ tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm, UINT16 handle
/* If there is no application registered with this PSM do not allow connection */
if (!p_serv_rec) {
BTM_TRACE_WARNING ("%s() PSM: %d no application registerd\n", __func__, psm);
BTM_TRACE_WARNING ("%s() PSM: %d no application registered\n", __func__, psm);
(*p_callback) (bd_addr, transport, p_ref_data, BTM_MODE_UNSUPPORTED);
return (BTM_MODE_UNSUPPORTED);
}
@ -2514,7 +2514,7 @@ tBTM_STATUS btm_sec_mx_access_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_o
if (rc == BTM_SUCCESS) {
BTM_TRACE_EVENT("%s: allow to bypass, checking authorization\n", __FUNCTION__);
/* the security in BTM_SEC_IN_FLAGS is fullfilled so far, check the requirements in */
/* the security in BTM_SEC_IN_FLAGS is fulfilled so far, check the requirements in */
/* btm_sec_execute_procedure */
if ((is_originator && (p_serv_rec->security_flags & BTM_SEC_OUT_AUTHORIZE)) ||
(!is_originator && (p_serv_rec->security_flags & BTM_SEC_IN_AUTHORIZE))) {
@ -3979,7 +3979,7 @@ void btm_sec_auth_complete (UINT16 handle, UINT8 status)
/* or BR key is higher security than existing LE keys */
(!(p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_AUTHED) &&
(p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_AUTHED)))) {
BTM_TRACE_DEBUG ("link encrypted afer dedic bonding can use SMP_BR_CHNL\n");
BTM_TRACE_DEBUG ("link encrypted after dedic bonding can use SMP_BR_CHNL\n");
if (btm_sec_is_master(p_dev_rec)) {
// Encryption is required to start SM over BR/EDR
@ -4255,7 +4255,7 @@ static void btm_sec_connect_after_reject_timeout (TIMER_LIST_ENT *p_tle)
** Function btm_sec_connected
**
** Description This function is when a connection to the peer device is
** establsihed
** established
**
** Returns void
**
@ -5926,7 +5926,7 @@ static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec)
**
** Function btm_sec_auth_payload_tout
**
** Description Processes the HCI Autheniticated Payload Timeout Event
** Description Processes the HCI Authenticated Payload Timeout Event
** indicating that a packet containing a valid MIC on the
** connection handle was not received within the programmed
** timeout value. (Spec Default is 30 secs, but can be
@ -6294,7 +6294,7 @@ static BOOLEAN btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec)
** Description This function is called when legacy authentication is used
** and only remote device has completed the authentication
**
** Returns TRUE if aunthentication command sent successfully
** Returns TRUE if authentication command sent successfully
**
*******************************************************************************/
BOOLEAN btm_sec_legacy_authentication_mutual (tBTM_SEC_DEV_REC *p_dev_rec)

Wyświetl plik

@ -721,7 +721,8 @@ struct tBTM_SEC_DEV_REC{
*/
typedef struct {
#if BTM_MAX_LOC_BD_NAME_LEN > 0
tBTM_LOC_BD_NAME bd_name; /* local Bluetooth device name */
tBTM_LOC_BD_NAME bredr_bd_name; /* local BREDR device name */
tBTM_LOC_BD_NAME ble_bd_name; /* local BLE device name */
#endif
BOOLEAN pin_type; /* TRUE if PIN type is fixed */
UINT8 pin_code_len; /* Bonding information */

Wyświetl plik

@ -65,7 +65,7 @@ static const tGATT_CBACK gap_cback = {
**
** Function gap_find_clcb_by_bd_addr
**
** Description The function searches all LCB with macthing bd address
** Description The function searches all LCB with matching bd address
**
** Returns total number of clcb found.
**
@ -88,7 +88,7 @@ tGAP_CLCB *gap_find_clcb_by_bd_addr(BD_ADDR bda)
**
** Function gap_ble_find_clcb_by_conn_id
**
** Description The function searches all LCB with macthing connection ID
** Description The function searches all LCB with matching connection ID
**
** Returns total number of clcb found.
**
@ -163,7 +163,7 @@ void gap_ble_dealloc_clcb(tGAP_CLCB *p_clcb)
**
** Description The function enqueue a GAP client request
**
** Returns TRUE is successul; FALSE otherwise
** Returns TRUE is successful; FALSE otherwise
**
*******************************************************************************/
BOOLEAN gap_ble_enqueue_request (tGAP_CLCB *p_clcb, UINT16 uuid, tGAP_BLE_CMPL_CBACK *p_cback)
@ -185,7 +185,7 @@ BOOLEAN gap_ble_enqueue_request (tGAP_CLCB *p_clcb, UINT16 uuid, tGAP_BLE_CMPL_C
**
** Description The function dequeue a GAP client request if any
**
** Returns TRUE is successul; FALSE otherwise
** Returns TRUE is successful; FALSE otherwise
**
*******************************************************************************/
BOOLEAN gap_ble_dequeue_request (tGAP_CLCB *p_clcb, UINT16 *p_uuid, tGAP_BLE_CMPL_CBACK **p_cback)
@ -221,7 +221,7 @@ tGATT_STATUS gap_read_attr_value (UINT16 handle, tGATT_VALUE *p_value, BOOLEAN i
switch (p_db_attr->uuid) {
case GATT_UUID_GAP_DEVICE_NAME:
BTM_ReadLocalDeviceName((char **)&p_dev_name);
BTM_ReadLocalDeviceName((char **)&p_dev_name, BT_DEVICE_TYPE_BLE);
if (strlen ((char *)p_dev_name) > GATT_MAX_ATTR_LEN) {
p_value->len = GATT_MAX_ATTR_LEN;
} else {
@ -304,7 +304,7 @@ UINT8 gap_proc_write_req( tGATTS_REQ_TYPE type, tGATT_WRITE_REQ *p_data)
case GATT_UUID_GAP_DEVICE_NAME: {
UINT8 *p_val = p_data->value;
p_val[p_data->len] = '\0';
BTM_SetLocalDeviceName((char *)p_val);
BTM_SetLocalDeviceName((char *)p_val, BT_DEVICE_TYPE_BLE);
return GATT_SUCCESS;
}
#endif
@ -385,7 +385,7 @@ void gap_ble_s_attr_request_cback (UINT16 conn_id, UINT32 trans_id,
**
** Function btm_ble_att_db_init
**
** Description GAP ATT database initalization.
** Description GAP ATT database initialization.
**
** Returns void.
**
@ -510,7 +510,7 @@ void GAP_BleAttrDBUpdate(UINT16 attr_uuid, tGAP_BLE_ATTR_VALUE *p_value)
break;
case GATT_UUID_GAP_DEVICE_NAME:
BTM_SetLocalDeviceName((char *)p_value->p_dev_name);
BTM_SetLocalDeviceName((char *)p_value->p_dev_name, BT_DEVICE_TYPE_BLE);
break;
case GATT_UUID_GAP_CENTRAL_ADDR_RESOL:
@ -529,7 +529,7 @@ void GAP_BleAttrDBUpdate(UINT16 attr_uuid, tGAP_BLE_ATTR_VALUE *p_value)
**
** Function gap_ble_send_cl_read_request
**
** Description utility function to send a read request for a GAP charactersitic
** Description utility function to send a read request for a GAP characteristic
**
** Returns TRUE if read started, else FALSE if GAP is busy
**

Wyświetl plik

@ -379,6 +379,7 @@ tHID_STATUS HID_HostAddDev ( BD_ADDR addr, UINT16 attr_mask, UINT8 *handle )
if (!hh_cb.devices[i].in_use) {
hh_cb.devices[i].in_use = TRUE;
hh_cb.devices[i].delay_remove = FALSE;
hh_cb.devices[i].is_orig = FALSE;
memcpy( hh_cb.devices[i].addr, addr, sizeof( BD_ADDR ) ) ;
hh_cb.devices[i].state = HID_DEV_NO_CONN;
hh_cb.devices[i].conn_tries = 0 ;
@ -486,6 +487,7 @@ tHID_STATUS HID_HostOpenDev ( UINT8 dev_handle )
}
hh_cb.devices[dev_handle].conn_tries = 1;
hh_cb.devices[dev_handle].is_orig = TRUE;
return hidh_conn_initiate( dev_handle );
}
@ -651,4 +653,23 @@ BOOLEAN hid_known_hid_device (BD_ADDR bd_addr)
return FALSE;
}
BOOLEAN HID_HostConnectOrig(UINT8 dev_handle)
{
BOOLEAN ret = FALSE;
do {
if (!hh_cb.reg_flag) {
break;
}
if ((dev_handle >= HID_HOST_MAX_DEVICES) || (!hh_cb.devices[dev_handle].in_use)) {
break;
}
ret = hh_cb.devices[dev_handle].is_orig;
} while (0);
return ret;
}
#endif //HID_HOST_INCLUDED

Wyświetl plik

@ -35,11 +35,11 @@ enum { HID_DEV_NO_CONN, HID_DEV_CONNECTED };
typedef struct per_device_ctb {
BOOLEAN in_use;
BOOLEAN delay_remove;
BOOLEAN is_orig;
BD_ADDR addr; /* BD-Addr of the host device */
UINT16 attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate;
0x04- sdp_disable; */
UINT8 state; /* Device state if in HOST-KNOWN mode */
UINT8 conn_substate;
UINT8 conn_tries; /* Remembers to the number of connection attempts while CONNECTING */
tHID_CONN conn; /* L2CAP channel info */

Wyświetl plik

@ -33,6 +33,8 @@ typedef int32_t INT32;
#define BCM_STRCPY_S(x1,x2) strcpy((x1),(x2))
#define BCM_STRNCPY_S(x1,x2,x3) strncpy((x1),(x2),(x3))
#define BCM_STRCMP_S(x1,x2) strcmp((x1),(x2))
#define BCM_STRNCMP_S(x1,x2,x3) strncmp((x1),(x2),(x3))
/* READ WELL !!
**

Wyświetl plik

@ -473,7 +473,6 @@ typedef enum {
#define BTM_COD_SERVICE_CLASS_LO_B 0x00E0
#define BTM_COD_SERVICE_CLASS_MASK 0xFFE0
/* BTM service definitions
** Used for storing EIR data to bit mask
*/
@ -2079,7 +2078,7 @@ BOOLEAN BTM_IsDeviceUp (void);
**
*******************************************************************************/
//extern
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name);
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type);
/*******************************************************************************
**
@ -2108,7 +2107,7 @@ tBTM_STATUS BTM_SetDeviceClass (DEV_CLASS dev_class);
**
*******************************************************************************/
//extern
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name);
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name, tBT_DEVICE_TYPE name_type);
/*******************************************************************************
**

Wyświetl plik

@ -254,6 +254,7 @@ typedef UINT8 BLE_SIGNATURE[BTM_BLE_AUTH_SIGN_LEN]; /* Device address */
#define BTM_BLE_APPEARANCE_CYCLING_CADENCE 0x0483
#define BTM_BLE_APPEARANCE_CYCLING_POWER 0x0484
#define BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485
#define BTM_BLE_APPEARANCE_STANDALONE_SPEAKER 0x0841
#define BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40
#define BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41
#define BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42

Wyświetl plik

@ -249,6 +249,17 @@ BOOLEAN hid_known_hid_device (BD_ADDR bd_addr);
*******************************************************************************/
extern UINT8 HID_HostSetTraceLevel (UINT8 new_level);
/*******************************************************************************
**
** Function HID_HostConnectOrig
**
** Description Check if the HID Host initiates the connection
**
** Returns TRUE if the HID Host initiates the connection else FALSE
**
*******************************************************************************/
extern BOOLEAN HID_HostConnectOrig(UINT8 dev_handle);
#ifdef __cplusplus
}
#endif

@ -1 +1 @@
Subproject commit 8d5c871596753da452b1cf56d28442660af0c599
Subproject commit cc997ecc33fff506baa0629f784bad75be4f16fc

Wyświetl plik

@ -178,6 +178,7 @@ enum KEY_ACTION{
CTRL_U = 21, /* Ctrl+u */
CTRL_W = 23, /* Ctrl+w */
ESC = 27, /* Escape */
UNIT_SEP = 31, /* ctrl-_ */
BACKSPACE = 127 /* Backspace */
};
@ -1131,15 +1132,23 @@ static int linenoiseDumb(char* buf, size_t buflen, const char* prompt) {
int c = fgetc(stdin);
if (c == '\n') {
break;
} else if (c >= 0x1c && c <= 0x1f){
continue; /* consume arrow keys */
} else if (c == BACKSPACE || c == 0x8) {
} else if (c == BACKSPACE || c == CTRL_H) {
if (count > 0) {
buf[count - 1] = 0;
count --;
count--;
/* Only erase symbol echoed from stdin. */
fputs("\x08 ", stdout); /* Windows CMD: erase symbol under cursor */
flushWrite();
} else {
/* Consume backspace if the command line is empty to avoid erasing the prompt */
continue;
}
fputs("\x08 ", stdout); /* Windows CMD: erase symbol under cursor */
flushWrite();
} else if (c <= UNIT_SEP) {
/* Consume all character that are non printable (the backspace
* case is handled above) */
continue;
} else {
buf[count] = c;
++count;

Wyświetl plik

@ -97,7 +97,7 @@ static esp_err_t esp_load_wolfssl_verify_buffer(esp_tls_t *tls, const unsigned c
wolf_fileformat = WOLFSSL_FILETYPE_ASN1;
}
if (type == FILE_TYPE_SELF_CERT) {
if ((*err_ret = wolfSSL_CTX_use_certificate_buffer( (WOLFSSL_CTX *)tls->priv_ctx, cert_buf, cert_len, wolf_fileformat)) == WOLFSSL_SUCCESS) {
if ((*err_ret = wolfSSL_CTX_use_certificate_chain_buffer_format( (WOLFSSL_CTX *)tls->priv_ctx, cert_buf, cert_len, wolf_fileformat)) == WOLFSSL_SUCCESS) {
return ESP_OK;
}
return ESP_FAIL;
@ -310,6 +310,14 @@ static esp_err_t set_client_config(const char *hostname, size_t hostlen, esp_tls
#endif /* CONFIG_WOLFSSL_HAVE_ALPN */
}
#ifdef CONFIG_WOLFSSL_HAVE_OCSP
wolfSSL_CTX_EnableOCSPStapling((WOLFSSL_CTX *)tls->priv_ctx );
wolfSSL_UseOCSPStapling((WOLFSSL *)tls->priv_ssl, WOLFSSL_CSR_OCSP, 0);
wolfSSL_CTX_EnableOCSP((WOLFSSL_CTX *)tls->priv_ctx, 0);
#endif
wolfSSL_CTX_UseSNI(tls->priv_ctx, WOLFSSL_SNI_HOST_NAME, hostname, hostlen);
wolfSSL_set_fd((WOLFSSL *)tls->priv_ssl, tls->sockfd);
return ESP_OK;
}

Wyświetl plik

@ -13,7 +13,7 @@ extern "C" {
/** Major version number (X.x.x) */
#define ESP_IDF_VERSION_MAJOR 5
/** Minor version number (x.X.x) */
#define ESP_IDF_VERSION_MINOR 3
#define ESP_IDF_VERSION_MINOR 4
/** Patch version number (x.x.X) */
#define ESP_IDF_VERSION_PATCH 0

Wyświetl plik

@ -32,8 +32,11 @@ typedef struct {
int lane_bit_rate_mbps; ///< Lane bit rate in Mbps
mipi_csi_color_t input_data_color_type; ///< Input color type
mipi_csi_color_t output_data_color_type; ///< Output color type
bool byte_swap_en; ///< Enable byte swap
int queue_items; ///< Queue items
struct {
uint32_t byte_swap_en : 1; ///< Enable byte swap
uint32_t bk_buffer_dis : 1; ///< Disable backup buffer
}; ///< Boolean Flags
} esp_cam_ctlr_csi_config_t;
/**

Wyświetl plik

@ -42,6 +42,8 @@ static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_
static esp_err_t s_del_csi_ctlr(csi_controller_t *ctlr);
static esp_err_t s_ctlr_del(esp_cam_ctlr_t *cam_ctlr);
static esp_err_t s_register_event_callbacks(esp_cam_ctlr_handle_t handle, const esp_cam_ctlr_evt_cbs_t *cbs, void *user_data);
static esp_err_t s_csi_ctlr_get_internal_buffer(esp_cam_ctlr_handle_t handle, uint32_t fb_num, const void **fb0, ...);
static esp_err_t s_csi_ctlr_get_buffer_length(esp_cam_ctlr_handle_t handle, size_t *ret_fb_len);
static esp_err_t s_csi_ctlr_enable(esp_cam_ctlr_handle_t ctlr);
static esp_err_t s_ctlr_csi_start(esp_cam_ctlr_handle_t handle);
static esp_err_t s_ctlr_csi_stop(esp_cam_ctlr_handle_t handle);
@ -99,12 +101,17 @@ esp_err_t esp_cam_new_csi_ctlr(const esp_cam_ctlr_csi_config_t *config, esp_cam_
csi_controller_t *ctlr = heap_caps_calloc(1, sizeof(csi_controller_t), CSI_MEM_ALLOC_CAPS);
ESP_RETURN_ON_FALSE(ctlr, ESP_ERR_NO_MEM, TAG, "no mem for csi controller context");
ret = s_csi_claim_controller(ctlr);
if (ret != ESP_OK) {
//claim fail, clean and return directly
free(ctlr);
ESP_RETURN_ON_ERROR(ret, TAG, "no available csi controller");
}
ESP_LOGD(TAG, "config->queue_items: %d", config->queue_items);
ctlr->trans_que = xQueueCreateWithCaps(config->queue_items, sizeof(esp_cam_ctlr_trans_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
ESP_GOTO_ON_FALSE(ctlr->trans_que, ESP_ERR_NO_MEM, err, TAG, "no memory for transaction queue");
//claim a controller, then do assignment
ESP_GOTO_ON_ERROR(s_csi_claim_controller(ctlr), err, TAG, "no available csi controller");
#if SOC_ISP_SHARE_CSI_BRG
ESP_GOTO_ON_ERROR(mipi_csi_brg_claim(MIPI_CSI_BRG_USER_CSI, &ctlr->csi_brg_id), err, TAG, "csi bridge is in use already");
ctlr->csi_brg_in_use = true;
@ -147,16 +154,19 @@ esp_err_t esp_cam_new_csi_ctlr(const esp_cam_ctlr_csi_config_t *config, esp_cam_
ctlr->fb_size_in_bytes = fb_size_in_bits / 8;
ESP_LOGD(TAG, "ctlr->fb_size_in_bytes=%d", ctlr->fb_size_in_bytes);
size_t dma_alignment = 4; //TODO: IDF-9126, replace with dwgdma alignment API
size_t cache_alignment = 1;
ESP_GOTO_ON_ERROR(esp_cache_get_alignment(MALLOC_CAP_SPIRAM | MALLOC_CAP_DMA, &cache_alignment), err, TAG, "failed to get cache alignment");
size_t alignment = MAX(cache_alignment, dma_alignment);
ESP_LOGD(TAG, "alignment: 0x%x\n", alignment);
ctlr->bk_buffer_dis = config->bk_buffer_dis;
if (!ctlr->bk_buffer_dis) {
size_t dma_alignment = 4; //TODO: IDF-9126, replace with dwgdma alignment API
size_t cache_alignment = 1;
ESP_GOTO_ON_ERROR(esp_cache_get_alignment(MALLOC_CAP_SPIRAM | MALLOC_CAP_DMA, &cache_alignment), err, TAG, "failed to get cache alignment");
size_t alignment = MAX(cache_alignment, dma_alignment);
ESP_LOGD(TAG, "alignment: 0x%x\n", alignment);
ctlr->backup_buffer = heap_caps_aligned_alloc(alignment, ctlr->fb_size_in_bytes, MALLOC_CAP_SPIRAM);
ESP_GOTO_ON_FALSE(ctlr->backup_buffer, ESP_ERR_NO_MEM, err, TAG, "no mem for backup buffer");
ESP_LOGD(TAG, "ctlr->backup_buffer: %p\n", ctlr->backup_buffer);
esp_cache_msync((void *)(ctlr->backup_buffer), ctlr->fb_size_in_bytes, ESP_CACHE_MSYNC_FLAG_DIR_C2M);
ctlr->backup_buffer = heap_caps_aligned_alloc(alignment, ctlr->fb_size_in_bytes, MALLOC_CAP_SPIRAM);
ESP_GOTO_ON_FALSE(ctlr->backup_buffer, ESP_ERR_NO_MEM, err, TAG, "no mem for backup buffer");
ESP_LOGD(TAG, "ctlr->backup_buffer: %p\n", ctlr->backup_buffer);
esp_cache_msync((void *)(ctlr->backup_buffer), ctlr->fb_size_in_bytes, ESP_CACHE_MSYNC_FLAG_DIR_C2M);
}
mipi_csi_hal_config_t hal_config;
hal_config.frame_height = config->h_res;
@ -207,6 +217,8 @@ esp_err_t esp_cam_new_csi_ctlr(const esp_cam_ctlr_csi_config_t *config, esp_cam_
ctlr->base.disable = s_csi_ctlr_disable;
ctlr->base.receive = s_ctlr_csi_receive;
ctlr->base.register_event_callbacks = s_register_event_callbacks;
ctlr->base.get_internal_buffer = s_csi_ctlr_get_internal_buffer;
ctlr->base.get_buffer_len = s_csi_ctlr_get_buffer_length;
*ret_handle = &(ctlr->base);
@ -237,7 +249,9 @@ esp_err_t s_del_csi_ctlr(csi_controller_t *ctlr)
PERIPH_RCC_ATOMIC() {
mipi_csi_ll_enable_phy_config_clock(ctlr->csi_id, 0);
}
free(ctlr->backup_buffer);
if (!ctlr->bk_buffer_dis) {
free(ctlr->backup_buffer);
}
vQueueDeleteWithCaps(ctlr->trans_que);
free(ctlr);
@ -251,6 +265,36 @@ static esp_err_t s_ctlr_del(esp_cam_ctlr_t *cam_ctlr)
return ESP_OK;
}
static esp_err_t s_csi_ctlr_get_internal_buffer(esp_cam_ctlr_handle_t handle, uint32_t fb_num, const void **fb0, ...)
{
csi_controller_t *csi_ctlr = __containerof(handle, csi_controller_t, base);
ESP_RETURN_ON_FALSE((csi_ctlr->csi_fsm >= CSI_FSM_INIT) && (csi_ctlr->backup_buffer), ESP_ERR_INVALID_STATE, TAG, "driver don't initialized or back_buffer not available");
ESP_RETURN_ON_FALSE(fb_num && fb_num <= 1, ESP_ERR_INVALID_ARG, TAG, "invalid frame buffer number");
csi_ctlr->bk_buffer_exposed = true;
const void **fb_itor = fb0;
va_list args;
va_start(args, fb0);
for (uint32_t i = 0; i < fb_num; i++) {
if (fb_itor) {
*fb_itor = csi_ctlr->backup_buffer;
fb_itor = va_arg(args, const void **);
}
}
va_end(args);
return ESP_OK;
}
static esp_err_t s_csi_ctlr_get_buffer_length(esp_cam_ctlr_handle_t handle, size_t *ret_fb_len)
{
csi_controller_t *csi_ctlr = __containerof(handle, csi_controller_t, base);
ESP_RETURN_ON_FALSE((csi_ctlr->csi_fsm >= CSI_FSM_INIT) && (csi_ctlr->backup_buffer), ESP_ERR_INVALID_STATE, TAG, "driver don't initialized or back_buffer not available");
*ret_fb_len = csi_ctlr->fb_size_in_bytes;
return ESP_OK;
}
static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_gdma_trans_done_event_data_t *event_data, void *user_data)
{
bool need_yield = false;
@ -291,7 +335,7 @@ static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_
} else {
csi_dma_transfer_config.dst.addr = (uint32_t)(new_trans.buffer);
}
} else {
} else if (!ctlr->bk_buffer_dis) {
use_backup = true;
}
@ -300,13 +344,15 @@ static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_
new_trans.buflen = ctlr->fb_size_in_bytes;
ESP_EARLY_LOGD(TAG, "no new buffer or no long enough new buffer, use driver internal buffer");
csi_dma_transfer_config.dst.addr = (uint32_t)ctlr->backup_buffer;
} else {
assert(false && "no new buffer, and no driver internal buffer");
}
ESP_EARLY_LOGD(TAG, "new_trans.buffer: %p, new_trans.buflen: %d", new_trans.buffer, new_trans.buflen);
dw_gdma_channel_config_transfer(chan, &csi_dma_transfer_config);
dw_gdma_channel_enable_ctrl(chan, true);
if (ctlr->trans.buffer != ctlr->backup_buffer) {
if ((ctlr->trans.buffer != ctlr->backup_buffer) || ctlr->bk_buffer_exposed) {
esp_err_t ret = esp_cache_msync((void *)(ctlr->trans.buffer), ctlr->trans.received_size, ESP_CACHE_MSYNC_FLAG_INVALIDATE);
assert(ret == ESP_OK);
assert(ctlr->cbs.on_trans_finished);
@ -383,9 +429,11 @@ esp_err_t s_ctlr_csi_start(esp_cam_ctlr_handle_t handle)
if (ctlr->cbs.on_get_new_trans) {
ctlr->cbs.on_get_new_trans(handle, &trans, ctlr->cbs_user_data);
ESP_RETURN_ON_FALSE(trans.buffer, ESP_ERR_INVALID_STATE, TAG, "no ready transaction, cannot start");
} else {
} else if (!ctlr->bk_buffer_dis) {
trans.buffer = ctlr->backup_buffer;
trans.buflen = ctlr->fb_size_in_bytes;
} else {
ESP_RETURN_ON_FALSE(false, ESP_ERR_INVALID_STATE, TAG, "no ready transaction, and no backup buffer");
}
ESP_LOGD(TAG, "trans.buffer: %p, trans.buflen: %d", trans.buffer, trans.buflen);

Wyświetl plik

@ -26,7 +26,7 @@ extern "C" {
#endif
typedef enum {
CSI_FSM_INIT,
CSI_FSM_INIT = 1,
CSI_FSM_ENABLED,
CSI_FSM_STARTED,
} csi_fsm_t;
@ -55,6 +55,8 @@ struct csi_controller_t {
size_t fb_size_in_bytes; //Frame buffer size, in bytes
esp_cam_ctlr_trans_t trans; //Saved done transaction to be given out to callers
void *backup_buffer; //backup buffer to make csi bridge can work to avoid wrong state
bool bk_buffer_exposed; //status of if back_buffer is exposed to users
bool bk_buffer_dis; //Allow to not malloc backup_buffer
QueueHandle_t trans_que; //transaction queue
esp_cam_ctlr_evt_cbs_t cbs; //user callbacks
void *cbs_user_data; //callback userdata

Wyświetl plik

@ -64,6 +64,26 @@ esp_err_t esp_cam_ctlr_register_event_callbacks(esp_cam_ctlr_handle_t handle, co
return handle->register_event_callbacks(handle, cbs, user_data);
}
esp_err_t esp_cam_ctlr_get_frame_buffer(esp_cam_ctlr_handle_t handle, uint32_t fb_num, const void **fb0, ...)
{
ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null handle");
ESP_RETURN_ON_FALSE(handle->get_internal_buffer, ESP_ERR_NOT_SUPPORTED, TAG, "get buffer function not supported");
va_list args;
va_start(args, fb0);
esp_err_t ret = handle->get_internal_buffer(handle, fb_num, fb0, args);
va_end(args);
return ret;
}
esp_err_t esp_cam_ctlr_get_frame_buffer_len(esp_cam_ctlr_handle_t handle, size_t *ret_fb_len)
{
ESP_RETURN_ON_FALSE(handle && ret_fb_len, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null handle");
ESP_RETURN_ON_FALSE(handle->get_buffer_len, ESP_ERR_NOT_SUPPORTED, TAG, "get buffer length function not supported");
return handle->get_buffer_len(handle, ret_fb_len);
}
esp_err_t esp_cam_del_ctlr(esp_cam_ctlr_handle_t handle)
{
ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");

Wyświetl plik

@ -102,6 +102,36 @@ esp_err_t esp_cam_del_ctlr(esp_cam_ctlr_handle_t handle);
*/
esp_err_t esp_cam_ctlr_register_event_callbacks(esp_cam_ctlr_handle_t handle, const esp_cam_ctlr_evt_cbs_t *cbs, void *user_data);
/**
* @brief Get ESP CAM controller internal malloced backup buffer(s) addr
*
* @note Generally, data in internal buffer is ready when `on_trans_finished` event
*
* @param[in] handle ESP CAM controller handle
* @param[in] fb_num Number of frame buffer(s) to get. This value must be the same as the number of the followed fbN parameters
* @param[out] fb0 Address of the frame buffer 0 (first frame buffer)
* @param[out] ... List of other frame buffers if any
*
* @return
* - ESP_OK
* - ESP_ERR_INVALID_ARG: Invalid argument
* - ESP_ERR_INVALID_STATE: Invalid driver state
*/
esp_err_t esp_cam_ctlr_get_frame_buffer(esp_cam_ctlr_handle_t handle, uint32_t fb_num, const void **fb0, ...);
/**
* @brief Get ESP CAM controller internal backup buffer length
*
* @param[in] handle ESP CAM controller handle
* @param[out] ret_fb_len Optional, The size of each frame buffer, in bytes.
*
* @return
* - ESP_OK
* - ESP_ERR_INVALID_ARG: NULL ptr
* - ESP_ERR_INVALID_STATE: Invalid driver state
*/
esp_err_t esp_cam_ctlr_get_frame_buffer_len(esp_cam_ctlr_handle_t handle, size_t *ret_fb_len);
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -105,6 +105,34 @@ struct esp_cam_ctlr_t {
*/
esp_err_t (*register_event_callbacks)(esp_cam_ctlr_t *ctlr, const esp_cam_ctlr_evt_cbs_t *cbs, void *user_ctx);
/**
* @brief Get ESP CAM controller internal malloced backup buffer(s) addr
*
* @param[in] esp_cam_ctlr_t * ESP CAM controller handle
* @param[in] uint32_t Number of frame buffer(s) to get. This value must be the same as the number of the followed fbN parameters
* @param[out] const void ** Address of the frame buffer 0 (first frame buffer)
* @param[out] ... List of other frame buffers if any
*
* @return
* - ESP_OK
* - ESP_ERR_INVALID_ARG: Invalid argument
* - ESP_ERR_INVALID_STATE: Invalid driver state
*/
esp_err_t (*get_internal_buffer)(esp_cam_ctlr_t *, uint32_t, const void **, ...);
/**
* @brief Get ESP CAM controller internal backup buffer length
*
* @param[in] esp_cam_ctlr_t * ESP CAM controller handle
* @param[out] size_t * The size of each frame buffer, in bytes.
*
* @return
* - ESP_OK
* - ESP_ERR_INVALID_ARG: NULL ptr
* - ESP_ERR_INVALID_STATE: Invalid driver state
*/
esp_err_t (*get_buffer_len)(esp_cam_ctlr_t *, size_t *);
void *user_data; ///< User data
};

Wyświetl plik

@ -25,5 +25,39 @@ TEST_CASE("TEST CSI driver allocation", "[csi]")
esp_cam_ctlr_handle_t handle = NULL;
TEST_ESP_OK(esp_cam_new_csi_ctlr(&csi_config, &handle));
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, esp_cam_new_csi_ctlr(&csi_config, &handle));
uint8_t *bk_buffer = NULL;
size_t bk_buffer_len = 0;
TEST_ESP_OK(esp_cam_ctlr_get_frame_buffer(handle, 1, (const void **)&bk_buffer));
TEST_ESP_OK(esp_cam_ctlr_get_frame_buffer_len(handle, &bk_buffer_len));
TEST_ASSERT_NOT_NULL(bk_buffer);
TEST_ASSERT_EQUAL((csi_config.h_res * csi_config.v_res * 2), bk_buffer_len); // out type RGB565 using 2 byte / pixel
TEST_ESP_OK(esp_cam_del_ctlr(handle));
}
TEST_CASE("TEST CSI driver no backup buffer usage", "[csi]")
{
esp_cam_ctlr_csi_config_t csi_config = {
.ctlr_id = 0,
.h_res = 800,
.v_res = 640,
.lane_bit_rate_mbps = 200,
.input_data_color_type = MIPI_CSI_COLOR_RAW8,
.output_data_color_type = MIPI_CSI_COLOR_RGB565,
.data_lane_num = 2,
.byte_swap_en = false,
.queue_items = 1,
.bk_buffer_dis = 1,
};
esp_cam_ctlr_handle_t handle = NULL;
TEST_ESP_OK(esp_cam_new_csi_ctlr(&csi_config, &handle));
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, esp_cam_new_csi_ctlr(&csi_config, &handle));
uint8_t *bk_buffer = NULL;
size_t bk_buffer_len = 0;
TEST_ESP_ERR(ESP_ERR_INVALID_STATE, esp_cam_ctlr_get_frame_buffer(handle, 1, (const void **)&bk_buffer));
TEST_ESP_ERR(ESP_ERR_INVALID_STATE, esp_cam_ctlr_get_frame_buffer_len(handle, &bk_buffer_len));
TEST_ASSERT_NULL(bk_buffer);
TEST_ASSERT_EQUAL(0, bk_buffer_len);
TEST_ESP_OK(esp_cam_del_ctlr(handle));
}

Wyświetl plik

@ -9,6 +9,7 @@
#include <stdint.h>
#include "esp_err.h"
#include "jpeg_types.h"
#include "hal/jpeg_types.h"
#ifdef __cplusplus
extern "C" {
@ -19,7 +20,7 @@ extern "C" {
*/
typedef struct {
jpeg_dec_output_format_t output_format; /*!< JPEG decoder output format */
jpeg_dec_rgb_element_order_t rgb_order; /*!< JPEG decoder output order */
jpeg_dec_rgb_element_order_t rgb_order; /*!< JPEG decoder output order */
jpeg_yuv_rgb_conv_std_t conv_std; /*!< JPEG decoder yuv->rgb standard */
} jpeg_decode_cfg_t;
@ -37,6 +38,7 @@ typedef struct {
typedef struct {
uint32_t width; /*!< Number of pixels in the horizontal direction */
uint32_t height; /*!< Number of pixels in the vertical direction */
jpeg_down_sampling_type_t sample_method; /*!< compressed JPEG picture sampling method */
} jpeg_decode_picture_info_t;
/**

Wyświetl plik

@ -20,6 +20,9 @@ typedef enum {
JPEG_DECODE_OUT_FORMAT_RGB888 = COLOR_TYPE_ID(COLOR_SPACE_RGB, COLOR_PIXEL_RGB888), /*!< output RGB888 format */
JPEG_DECODE_OUT_FORMAT_RGB565 = COLOR_TYPE_ID(COLOR_SPACE_RGB, COLOR_PIXEL_RGB565), /*!< output RGB565 format */
JPEG_DECODE_OUT_FORMAT_GRAY = COLOR_TYPE_ID(COLOR_SPACE_GRAY, COLOR_PIXEL_GRAY8), /*!< output the gray picture */
JPEG_DECODE_OUT_FORMAT_YUV444 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV444), /*!< output yuv444 format */
JPEG_DECODE_OUT_FORMAT_YUV422 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV422), /*!< output yuv422 format */
JPEG_DECODE_OUT_FORMAT_YUV420 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV420), /*!< output yuv420 format */
} jpeg_dec_output_format_t;
/**
@ -53,6 +56,7 @@ typedef enum {
JPEG_ENCODE_IN_FORMAT_RGB888 = COLOR_TYPE_ID(COLOR_SPACE_RGB, COLOR_PIXEL_RGB888), /*!< input RGB888 format */
JPEG_ENCODE_IN_FORMAT_RGB565 = COLOR_TYPE_ID(COLOR_SPACE_RGB, COLOR_PIXEL_RGB565), /*!< input RGB565 format */
JPEG_ENCODE_IN_FORMAT_GRAY = COLOR_TYPE_ID(COLOR_SPACE_GRAY, COLOR_PIXEL_GRAY8), /*!< input GRAY format */
JPEG_ENCODE_IN_FORMAT_YUV422 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV422), /*!< input YUV422 format */
} jpeg_enc_input_format_t;
/**

Wyświetl plik

@ -144,6 +144,7 @@ esp_err_t jpeg_decoder_get_info(const uint8_t *in_buf, uint32_t inbuf_len, jpeg_
uint16_t width = 0;
uint8_t thischar = 0;
uint8_t lastchar = 0;
uint8_t hivi = 0;
while (header_info->buffer_left) {
lastchar = thischar;
@ -155,6 +156,10 @@ esp_err_t jpeg_decoder_get_info(const uint8_t *in_buf, uint32_t inbuf_len, jpeg_
jpeg_get_bytes(header_info, 1);
height = jpeg_get_bytes(header_info, 2);
width = jpeg_get_bytes(header_info, 2);
jpeg_get_bytes(header_info, 1);
jpeg_get_bytes(header_info, 1);
hivi = jpeg_get_bytes(header_info, 1);
break;
}
// This function only used for get width and height. So only read SOF marker is enough.
@ -167,6 +172,21 @@ esp_err_t jpeg_decoder_get_info(const uint8_t *in_buf, uint32_t inbuf_len, jpeg_
picture_info->height = height;
picture_info->width = width;
switch (hivi) {
case 0x11:
picture_info->sample_method = JPEG_DOWN_SAMPLING_YUV444;
break;
case 0x21:
picture_info->sample_method = JPEG_DOWN_SAMPLING_YUV422;
break;
case 0x22:
picture_info->sample_method = JPEG_DOWN_SAMPLING_YUV420;
break;
default:
ESP_LOGE(TAG, "Sampling factor cannot be recognized");
return ESP_ERR_INVALID_STATE;
}
free(header_info);
return ESP_OK;
}
@ -195,14 +215,13 @@ esp_err_t jpeg_decoder_process(jpeg_decoder_handle_t decoder_engine, const jpeg_
decoder_engine->output_format = decode_cfg->output_format;
decoder_engine->rgb_order = decode_cfg->rgb_order;
decoder_engine->conv_std = decode_cfg->conv_std;
decoder_engine->decoded_buf = decode_outbuf;
ESP_GOTO_ON_ERROR(jpeg_parse_marker(decoder_engine, bit_stream, stream_size), err, TAG, "jpeg parse marker failed");
ESP_GOTO_ON_ERROR(jpeg_parse_header_info_to_hw(decoder_engine), err, TAG, "write header info to hw failed");
ESP_GOTO_ON_ERROR(jpeg_dec_config_dma_descriptor(decoder_engine), err, TAG, "config dma descriptor failed");
*out_size = decoder_engine->header_info->process_h * decoder_engine->header_info->process_v * decoder_engine->pixel;
*out_size = decoder_engine->header_info->process_h * decoder_engine->header_info->process_v * decoder_engine->bit_per_pixel / 8;
ESP_GOTO_ON_FALSE((*out_size <= outbuf_size), ESP_ERR_INVALID_ARG, err, TAG, "Given buffer size % " PRId32 " is smaller than actual jpeg decode output size % " PRId32 "the height and width of output picture size will be adjusted to 16 bytes aligned automatically", outbuf_size, *out_size);
dma2d_trans_config_t trans_desc = {
@ -222,8 +241,8 @@ esp_err_t jpeg_decoder_process(jpeg_decoder_handle_t decoder_engine, const jpeg_
// Blocking for JPEG decode transaction finishes.
while (1) {
jpeg_dma2d_dec_evt_t jpeg_dma2d_event;
BaseType_t ret = xQueueReceive(decoder_engine->evt_queue, &jpeg_dma2d_event, decoder_engine->timeout_tick);
ESP_GOTO_ON_FALSE(ret == pdTRUE, ESP_ERR_TIMEOUT, err, TAG, "jpeg-dma2d handle jpeg decode timeout, please check `timeout_ms` ");
BaseType_t ret_val = xQueueReceive(decoder_engine->evt_queue, &jpeg_dma2d_event, decoder_engine->timeout_tick);
ESP_GOTO_ON_FALSE(ret_val == pdTRUE, ESP_ERR_TIMEOUT, err, TAG, "jpeg-dma2d handle jpeg decode timeout, please check `timeout_ms` ");
// Dealing with JPEG event
if (jpeg_dma2d_event.jpgd_status != 0) {
@ -328,23 +347,49 @@ static esp_err_t jpeg_dec_config_dma_descriptor(jpeg_decoder_handle_t decoder_en
jpeg_dec_format_hb_t best_hb_idx = 0;
color_space_pixel_format_t picture_format;
picture_format.color_type_id = decoder_engine->output_format;
decoder_engine->pixel = color_hal_pixel_format_get_bit_depth(picture_format) / 8;
switch (decoder_engine->output_format) {
case JPEG_DECODE_OUT_FORMAT_RGB888:
best_hb_idx = JPEG_DEC_RGB888_HB;
decoder_engine->bit_per_pixel = color_hal_pixel_format_get_bit_depth(picture_format);
if (decoder_engine->no_color_conversion == false) {
switch (decoder_engine->output_format) {
case JPEG_DECODE_OUT_FORMAT_RGB888:
best_hb_idx = JPEG_DEC_RGB888_HB;
break;
case JPEG_DECODE_OUT_FORMAT_RGB565:
best_hb_idx = JPEG_DEC_RGB565_HB;
break;
case JPEG_DECODE_OUT_FORMAT_GRAY:
best_hb_idx = JPEG_DEC_GRAY_HB;
break;
case JPEG_DECODE_OUT_FORMAT_YUV444:
best_hb_idx = JPEG_DEC_YUV444_HB;
break;
default:
ESP_LOGE(TAG, "wrong, we don't support decode to such format.");
return ESP_ERR_NOT_SUPPORTED;
}
} else {
best_hb_idx = JPEG_DEC_DIRECT_OUTPUT_HB;
}
uint8_t sample_method_idx = 0;
switch (decoder_engine->sample_method) {
case JPEG_DOWN_SAMPLING_YUV444:
sample_method_idx = 0;
break;
case JPEG_DECODE_OUT_FORMAT_RGB565:
best_hb_idx = JPEG_DEC_RGB565_HB;
case JPEG_DOWN_SAMPLING_YUV422:
sample_method_idx = 1;
break;
case JPEG_DECODE_OUT_FORMAT_GRAY:
best_hb_idx = JPEG_DEC_GRAY_HB;
case JPEG_DOWN_SAMPLING_YUV420:
sample_method_idx = 2;
break;
case JPEG_DOWN_SAMPLING_GRAY:
sample_method_idx = 3;
break;
default:
ESP_LOGE(TAG, "wrong, we don't support decode to such format.");
ESP_LOGE(TAG, "wrong, we don't support such sampling mode.");
return ESP_ERR_NOT_SUPPORTED;
}
uint32_t dma_hb = dec_hb_tbl[decoder_engine->sample_method][best_hb_idx];
uint32_t dma_hb = dec_hb_tbl[sample_method_idx][best_hb_idx];
uint32_t dma_vb = decoder_engine->header_info->mcuy;
// Configure tx link descriptor
@ -375,7 +420,6 @@ static void jpeg_dec_config_dma_csc(jpeg_decoder_handle_t decoder_engine, dma2d_
dma2d_scramble_order_t post_scramble = DMA2D_SCRAMBLE_ORDER_BYTE2_1_0;
dma2d_csc_rx_option_t rx_csc_option = DMA2D_CSC_RX_NONE;
// Config output Endians
if (decoder_engine->rgb_order == JPEG_DEC_RGB_ELEMENT_ORDER_RGB) {
if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_RGB565) {
@ -398,7 +442,13 @@ static void jpeg_dec_config_dma_csc(jpeg_decoder_handle_t decoder_engine, dma2d_
} else if (decoder_engine->conv_std == JPEG_YUV_RGB_CONV_STD_BT709) {
rx_csc_option = DMA2D_CSC_RX_YUV420_TO_RGB888_709;
}
} else if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_GRAY) {
} else if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV444) {
if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV422) {
rx_csc_option = DMA2D_CSC_RX_YUV422_TO_YUV444;
} else if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV420) {
rx_csc_option = DMA2D_CSC_RX_YUV420_TO_YUV444;
}
} else {
rx_csc_option = DMA2D_CSC_RX_NONE;
}
@ -493,6 +543,27 @@ static bool jpeg_dec_transaction_on_picked(uint32_t channel_num, const dma2d_tra
return false;
}
static esp_err_t jpeg_color_space_support_check(jpeg_decoder_handle_t decoder_engine)
{
if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV444) {
if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV422 || decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV420) {
ESP_LOGE(TAG, "Detected YUV444 but want to convert to YUV422/YUV420, which is not supported");
return ESP_ERR_INVALID_ARG;
}
} else if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV422) {
if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV420) {
ESP_LOGE(TAG, "Detected YUV422 but want to convert to YUV420, which is not supported");
return ESP_ERR_INVALID_ARG;
}
} else if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV420) {
if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV422) {
ESP_LOGE(TAG, "Detected YUV420 but want to convert to YUV422, which is not supported");
return ESP_ERR_INVALID_ARG;
}
}
return ESP_OK;
}
static esp_err_t jpeg_parse_header_info_to_hw(jpeg_decoder_handle_t decoder_engine)
{
ESP_RETURN_ON_FALSE(decoder_engine, ESP_ERR_INVALID_ARG, TAG, "jpeg decode handle is null");
@ -534,6 +605,12 @@ static esp_err_t jpeg_parse_header_info_to_hw(jpeg_decoder_handle_t decoder_engi
decoder_engine->sample_method = JPEG_DOWN_SAMPLING_GRAY;
}
ESP_RETURN_ON_ERROR(jpeg_color_space_support_check(decoder_engine), TAG, "jpeg decoder not support the combination of output format and down sampling format");
if ((uint32_t)decoder_engine->sample_method == (uint32_t)decoder_engine->output_format) {
decoder_engine->no_color_conversion = true;
}
// Write DHT information
dht_func[0][0](hal, header_info->huffbits[0][0], header_info->huffcode[0][0], header_info->tmp_huff);
dht_func[0][1](hal, header_info->huffbits[0][1], header_info->huffcode[0][1], header_info->tmp_huff);

Wyświetl plik

@ -142,6 +142,9 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
ESP_RETURN_ON_FALSE(encode_inbuf, ESP_ERR_INVALID_ARG, TAG, "jpeg encode picture buffer is null");
ESP_RETURN_ON_FALSE(out_size, ESP_ERR_INVALID_ARG, TAG, "jpeg encode picture out_size is null");
ESP_RETURN_ON_FALSE(((uintptr_t)bit_stream % cache_hal_get_cache_line_size(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_DATA)) == 0, ESP_ERR_INVALID_ARG, TAG, "jpeg encode bit stream is not aligned, please use jpeg_alloc_encoder_mem to malloc your buffer");
if (encode_cfg->src_type == JPEG_ENCODE_IN_FORMAT_YUV422) {
ESP_RETURN_ON_FALSE(encode_cfg->sub_sample == JPEG_DOWN_SAMPLING_YUV422, ESP_ERR_INVALID_ARG, TAG, "Sub sampling is not supported under this source type");
}
esp_err_t ret = ESP_OK;
@ -176,6 +179,10 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
encoder_engine->color_space = JPEG_ENC_SRC_GRAY;
best_hb_idx = JPEG_ENC_SRC_GRAY_HB;
break;
case JPEG_ENCODE_IN_FORMAT_YUV422:
encoder_engine->color_space = JPEG_ENC_SRC_YUV422;
best_hb_idx = JPEG_ENC_SRC_YUV422_HB;
break;
default:
ESP_LOGE(TAG, "wrong, we don't support encode from such format.");
ret = ESP_ERR_NOT_SUPPORTED;
@ -198,7 +205,26 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
ESP_GOTO_ON_ERROR(s_jpeg_set_header_info(encoder_engine), err, TAG, "set header failed");
jpeg_hal_set_quantization_coefficient(hal, encoder_engine->header_info->m_quantization_tables[0], encoder_engine->header_info->m_quantization_tables[1]);
uint32_t dma_hb = enc_hb_tbl[best_hb_idx][encoder_engine->header_info->sub_sample];
uint8_t sample_method_idx = 0;
switch (encoder_engine->header_info->sub_sample) {
case JPEG_DOWN_SAMPLING_YUV444:
sample_method_idx = 0;
break;
case JPEG_DOWN_SAMPLING_YUV422:
sample_method_idx = 1;
break;
case JPEG_DOWN_SAMPLING_YUV420:
sample_method_idx = 2;
break;
case JPEG_DOWN_SAMPLING_GRAY:
sample_method_idx = 3;
break;
default:
ESP_LOGE(TAG, "wrong, we don't support such sampling mode.");
return ESP_ERR_NOT_SUPPORTED;
}
uint32_t dma_hb = enc_hb_tbl[best_hb_idx][sample_method_idx];
uint32_t dma_vb = encoder_engine->mcuy;
ESP_GOTO_ON_FALSE((encoder_engine->header_info->header_len % cache_hal_get_cache_line_size(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_DATA)) == 0, ESP_ERR_INVALID_STATE, err, TAG, "The header is not cache line aligned, please check");
@ -237,8 +263,8 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
if (s_rcv_event.dma_evt & JPEG_DMA2D_RX_EOF) {
compressed_size = s_dma_desc_get_len(encoder_engine->rxlink);
compressed_size = JPEG_ALIGN_UP(compressed_size, cache_hal_get_cache_line_size(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_DATA));
ESP_GOTO_ON_ERROR(esp_cache_msync((void*)(bit_stream + encoder_engine->header_info->header_len), compressed_size, ESP_CACHE_MSYNC_FLAG_DIR_M2C), err, TAG, "sync memory to cache failed");
uint32_t _compressed_size = JPEG_ALIGN_UP(compressed_size, cache_hal_get_cache_line_size(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_DATA));
ESP_GOTO_ON_ERROR(esp_cache_msync((void*)(bit_stream + encoder_engine->header_info->header_len), _compressed_size, ESP_CACHE_MSYNC_FLAG_DIR_M2C), err, TAG, "sync memory to cache failed");
break;
}
}

Wyświetl plik

@ -39,7 +39,7 @@ const uint8_t zigzag_arr[64] = {
* decompression. It is used to decode the Huffman-coded symbols in the compressed
* data stream during the decoding process.
*/
const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_MAX][JPEG_DEC_BEST_HB_MAX] = {
const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_NUM][JPEG_DEC_BEST_HB_MAX] = {
{40, 40, 40, 32, 0},
{64, 32, 32, 64, 0},
{48, 32, 32, 48, 0},
@ -53,7 +53,7 @@ const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_MAX][JPEG_DEC_BEST_HB_MAX] = {
* compression. It is used to decode the Huffman-coded symbols in the compressed
* data stream during the encoding process.
*/
const uint32_t enc_hb_tbl[JPEG_ENC_BEST_HB_MAX][JPEG_DOWN_SAMPLING_MAX] = {
const uint32_t enc_hb_tbl[JPEG_ENC_BEST_HB_MAX][JPEG_DOWN_SAMPLING_NUM] = {
{40, 32, 32, 0},
{0, 64, 0, 0},
{64, 64, 48, 0},

Wyświetl plik

@ -56,9 +56,8 @@ struct jpeg_codec_t {
};
typedef enum {
// TODO: Support DR and YUV444 on decoder.
//JPEG_DEC_DR_HB = 0, /*!< Direct output */
//JPEG_DEC_YUV444_HB = 1, /*!< output YUV444 format */
JPEG_DEC_DIRECT_OUTPUT_HB = 0, /*!< Direct output */
JPEG_DEC_YUV444_HB = 1, /*!< output YUV444 format */
JPEG_DEC_RGB888_HB = 2, /*!< output RGB888 format */
JPEG_DEC_RGB565_HB = 3, /*!< output RGB565 format */
JPEG_DEC_GRAY_HB = 4, /*!< output the gray picture */
@ -96,9 +95,10 @@ struct jpeg_decoder_t {
jpeg_dec_header_info_t *header_info; // Pointer to current picture information
jpeg_down_sampling_type_t sample_method; // method of sampling the JPEG picture.
jpeg_dec_output_format_t output_format; // picture output format.
jpeg_dec_rgb_element_order_t rgb_order; // RGB pixel order
jpeg_dec_rgb_element_order_t rgb_order; // RGB pixel order
jpeg_yuv_rgb_conv_std_t conv_std; // YUV RGB conversion standard
uint8_t pixel; // size per pixel
bool no_color_conversion; // No color conversion, directly output based on compressed format
uint8_t bit_per_pixel; // bit size per pixel
QueueHandle_t evt_queue; // jpeg event from 2DDMA and JPEG engine
uint8_t *decoded_buf; // pointer to the rx buffer.
uint32_t total_size; // jpeg picture origin size (in bytes)
@ -127,8 +127,7 @@ typedef struct {
typedef enum {
JPEG_ENC_SRC_RGB888_HB = 0, // Input RGB888 format
// TODO: Support encoder source format for yuv422
// JPEG_ENC_SRC_YUV422_HB = 1, // Input YUV422 format
JPEG_ENC_SRC_YUV422_HB = 1, // Input YUV422 format
JPEG_ENC_SRC_RGB565_HB = 2, // Input RGB565 format
JPEG_ENC_SRC_GRAY_HB = 3, // Input GRAY format
JPEG_ENC_BEST_HB_MAX,

Wyświetl plik

@ -36,7 +36,7 @@ extern const uint8_t zigzag_arr[64];
* decompression. It is used to decode the Huffman-coded symbols in the compressed
* data stream during the decoding process.
*/
extern const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_MAX][JPEG_DEC_BEST_HB_MAX];
extern const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_NUM][JPEG_DEC_BEST_HB_MAX];
/**
* @brief DMA2D best hb value table for JPEG compression.
@ -45,7 +45,7 @@ extern const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_MAX][JPEG_DEC_BEST_HB_MAX];
* compression. It is used to decode the Huffman-coded symbols in the compressed
* data stream during the encoding process.
*/
extern const uint32_t enc_hb_tbl[JPEG_ENC_BEST_HB_MAX][JPEG_DOWN_SAMPLING_MAX];
extern const uint32_t enc_hb_tbl[JPEG_ENC_BEST_HB_MAX][JPEG_DOWN_SAMPLING_NUM];
/**
* @brief Setup the standard Huffman tables (JPEG standard sections K.3.3)

Wyświetl plik

@ -348,7 +348,8 @@ esp_err_t sdmmc_host_start_command(int slot, sdmmc_hw_cmd_t cmd, uint32_t arg)
if (!(slot == 0 || slot == 1)) {
return ESP_ERR_INVALID_ARG;
}
if (!sdmmc_ll_is_card_detected(s_host_ctx.hal.dev, slot)) {
// if this isn't a clock update command, check the card detect status
if (!sdmmc_ll_is_card_detected(s_host_ctx.hal.dev, slot) && !cmd.update_clk_reg) {
return ESP_ERR_NOT_FOUND;
}
if (cmd.data_expected && cmd.rw && sdmmc_ll_is_card_write_protected(s_host_ctx.hal.dev, slot)) {

Wyświetl plik

@ -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
*/
@ -14,7 +14,6 @@
#include "freertos/semphr.h"
#include "freertos/task.h"
#include "soc/sdmmc_periph.h"
#include "soc/soc_memory_layout.h"
#include "driver/sdmmc_types.h"
#include "driver/sdmmc_defs.h"
#include "driver/sdmmc_host.h"
@ -130,14 +129,18 @@ esp_err_t sdmmc_host_do_transaction(int slot, sdmmc_command_t* cmdinfo)
if (cmdinfo->data) {
// Length should be either <4 or >=4 and =0 (mod 4).
if (cmdinfo->datalen >= 4 && cmdinfo->datalen % 4 != 0) {
ESP_LOGD(TAG, "%s: invalid size: total=%d",
ESP_LOGE(TAG, "%s: invalid size: total=%d",
__func__, cmdinfo->datalen);
ret = ESP_ERR_INVALID_SIZE;
goto out;
}
if ((intptr_t) cmdinfo->data % 4 != 0 ||
!esp_ptr_dma_capable(cmdinfo->data)) {
ESP_LOGD(TAG, "%s: buffer %p can not be used for DMA", __func__, cmdinfo->data);
esp_dma_mem_info_t dma_mem_info;
sdmmc_host_get_dma_info(slot, &dma_mem_info);
#ifdef SOC_SDMMC_PSRAM_DMA_CAPABLE
dma_mem_info.extra_heap_caps |= MALLOC_CAP_SPIRAM;
#endif
if (!esp_dma_is_buffer_alignment_satisfied(cmdinfo->data, cmdinfo->buflen, dma_mem_info)) {
ESP_LOGE(TAG, "%s: buffer %p can not be used for DMA", __func__, cmdinfo->data);
ret = ESP_ERR_INVALID_ARG;
goto out;
}

Wyświetl plik

@ -1,13 +1,16 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include "esp_dma_utils.h"
#include "esp_heap_caps.h"
#include "test_utils.h"
#include "sdkconfig.h"
#include "soc/soc_caps.h"
@ -17,7 +20,8 @@
#include "sdmmc_test_rw_common.h"
static void do_single_rw_perf_test(sdmmc_card_t* card, size_t start_block,
size_t block_count, size_t alignment, FILE* performance_log);
size_t block_count, size_t alignment, FILE* performance_log,
uint32_t extra_alloc_caps);
static void fill_buffer(uint32_t seed, uint8_t* dst, size_t count)
{
@ -41,13 +45,22 @@ static void check_buffer(uint32_t seed, const uint8_t* src, size_t count)
}
static void do_single_rw_perf_test(sdmmc_card_t* card, size_t start_block,
size_t block_count, size_t alignment, FILE* performance_log)
size_t block_count, size_t alignment, FILE* performance_log,
uint32_t extra_alloc_caps)
{
size_t block_size = card->csd.sector_size;
size_t total_size = block_size * block_count;
printf(" %8d | %3d | %d | %4.1f ", start_block, block_count, alignment, total_size / 1024.0f);
const char* alloc_str = (extra_alloc_caps & MALLOC_CAP_SPIRAM) ? "spiram" : " sram ";
printf(" %8d | %3d | %d | %s | %4.1f ", start_block, block_count, alignment, alloc_str, total_size / 1024.0f);
size_t actual_size = 0;
uint32_t *buffer = NULL;
esp_dma_mem_info_t dma_mem_info = {
.extra_heap_caps = extra_alloc_caps,
.dma_alignment_bytes = 64,
};
TEST_ESP_OK(esp_dma_capable_malloc(total_size + 4, &dma_mem_info, (void**) &buffer, &actual_size));
uint32_t* buffer = heap_caps_malloc(total_size + 4, MALLOC_CAP_DMA);
size_t offset = alignment % 4;
uint8_t* c_buffer = (uint8_t*) buffer + offset;
fill_buffer(start_block, c_buffer, total_size / sizeof(buffer[0]));
@ -80,10 +93,10 @@ static void do_single_rw_perf_test(sdmmc_card_t* card, size_t start_block,
static const char wr_speed_str[] = "SDMMC_WR_SPEED";
static const char rd_speed_str[] = "SDMMC_RD_SPEED";
int aligned = ((alignment % 4) == 0) ? 1 : 0;
IDF_LOG_PERFORMANCE(wr_speed_str, "%d, blk_n: %d, aligned: %d",
(int)(total_size * 1000 / time_wr), block_count, aligned);
IDF_LOG_PERFORMANCE(rd_speed_str, "%d, blk_n: %d, aligned: %d",
(int)(total_size * 1000 / time_rd), block_count, aligned);
IDF_LOG_PERFORMANCE(wr_speed_str, "%d, blk_n: %d, aligned: %d, alloc: %s",
(int)(total_size * 1000 / time_wr), block_count, aligned, alloc_str);
IDF_LOG_PERFORMANCE(rd_speed_str, "%d, blk_n: %d, aligned: %d, alloc: %s",
(int)(total_size * 1000 / time_rd), block_count, aligned, alloc_str);
stdout = old_stdout;
}
}
@ -93,7 +106,13 @@ void sdmmc_test_rw_unaligned_buffer(sdmmc_card_t* card)
const size_t buffer_size = 4096;
const size_t block_count = buffer_size / 512;
const size_t extra = 4;
uint8_t* buffer = heap_caps_malloc(buffer_size + extra, MALLOC_CAP_DMA);
const size_t total_size = buffer_size + extra;
size_t actual_size = 0;
uint8_t *buffer = NULL;
esp_dma_mem_info_t dma_mem_info = {
.dma_alignment_bytes = 64,
};
TEST_ESP_OK(esp_dma_capable_malloc(total_size + 4, &dma_mem_info, (void**) &buffer, &actual_size));
// Check read behavior: do aligned write, then unaligned read
const uint32_t seed = 0x89abcdef;
@ -116,20 +135,30 @@ void sdmmc_test_rw_unaligned_buffer(sdmmc_card_t* card)
void sdmmc_test_rw_performance(sdmmc_card_t *card, FILE *perf_log)
{
sdmmc_card_print_info(stdout, card);
printf(" sector | count | align | size(kB) | wr_time(ms) | wr_speed(MB/s) | rd_time(ms) | rd_speed(MB/s)\n");
printf(" sector | count | align | alloc | size(kB) | wr_time(ms) | wr_speed(MB/s) | rd_time(ms) | rd_speed(MB/s)\n");
const int offset = 0;
/* aligned */
do_single_rw_perf_test(card, offset, 1, 4, perf_log);
do_single_rw_perf_test(card, offset, 4, 4, perf_log);
do_single_rw_perf_test(card, offset, 8, 4, perf_log);
do_single_rw_perf_test(card, offset, 16, 4, perf_log);
do_single_rw_perf_test(card, offset, 32, 4, perf_log);
do_single_rw_perf_test(card, offset, 64, 4, perf_log);
do_single_rw_perf_test(card, offset, 128, 4, perf_log);
do_single_rw_perf_test(card, offset, 1, 4, perf_log, 0);
do_single_rw_perf_test(card, offset, 4, 4, perf_log, 0);
do_single_rw_perf_test(card, offset, 8, 4, perf_log, 0);
do_single_rw_perf_test(card, offset, 16, 4, perf_log, 0);
do_single_rw_perf_test(card, offset, 32, 4, perf_log, 0);
do_single_rw_perf_test(card, offset, 64, 4, perf_log, 0);
do_single_rw_perf_test(card, offset, 128, 4, perf_log, 0);
/* unaligned */
do_single_rw_perf_test(card, offset, 1, 1, perf_log);
do_single_rw_perf_test(card, offset, 8, 1, perf_log);
do_single_rw_perf_test(card, offset, 128, 1, perf_log);
do_single_rw_perf_test(card, offset, 1, 1, perf_log, 0);
do_single_rw_perf_test(card, offset, 8, 1, perf_log, 0);
do_single_rw_perf_test(card, offset, 128, 1, perf_log, 0);
#if CONFIG_SPIRAM && SOC_SDMMC_PSRAM_DMA_CAPABLE
/* spiram */
do_single_rw_perf_test(card, offset, 1, 4, perf_log, MALLOC_CAP_SPIRAM);
do_single_rw_perf_test(card, offset, 4, 4, perf_log, MALLOC_CAP_SPIRAM);
do_single_rw_perf_test(card, offset, 8, 4, perf_log, MALLOC_CAP_SPIRAM);
do_single_rw_perf_test(card, offset, 16, 4, perf_log, MALLOC_CAP_SPIRAM);
do_single_rw_perf_test(card, offset, 32, 4, perf_log, MALLOC_CAP_SPIRAM);
do_single_rw_perf_test(card, offset, 64, 4, perf_log, MALLOC_CAP_SPIRAM);
do_single_rw_perf_test(card, offset, 128, 4, perf_log, MALLOC_CAP_SPIRAM);
#endif
}
void sdmmc_test_rw_with_offset(sdmmc_card_t* card)
@ -137,22 +166,22 @@ void sdmmc_test_rw_with_offset(sdmmc_card_t* card)
sdmmc_card_print_info(stdout, card);
printf(" sector | count | align | size(kB) | wr_time(ms) | wr_speed(MB/s) | rd_time(ms) | rd_speed(MB/s)\n");
/* aligned */
do_single_rw_perf_test(card, 1, 16, 4, NULL);
do_single_rw_perf_test(card, 16, 32, 4, NULL);
do_single_rw_perf_test(card, 48, 64, 4, NULL);
do_single_rw_perf_test(card, 128, 128, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity - 64, 32, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity - 64, 64, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity - 8, 1, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 1, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 4, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 8, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 16, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 32, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 64, 4, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 128, 4, NULL);
do_single_rw_perf_test(card, 1, 16, 4, NULL, 0);
do_single_rw_perf_test(card, 16, 32, 4, NULL, 0);
do_single_rw_perf_test(card, 48, 64, 4, NULL, 0);
do_single_rw_perf_test(card, 128, 128, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity - 64, 32, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity - 64, 64, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity - 8, 1, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity / 2, 1, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity / 2, 4, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity / 2, 8, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity / 2, 16, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity / 2, 32, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity / 2, 64, 4, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity / 2, 128, 4, NULL, 0);
/* unaligned */
do_single_rw_perf_test(card, card->csd.capacity / 2, 1, 1, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 8, 1, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 128, 1, NULL);
do_single_rw_perf_test(card, card->csd.capacity / 2, 1, 1, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity / 2, 8, 1, NULL, 0);
do_single_rw_perf_test(card, card->csd.capacity / 2, 128, 1, NULL, 0);
}

Wyświetl plik

@ -341,7 +341,7 @@ static const sdmmc_test_board_info_t s_board_info = {
.d7 = GPIO_NUM_NC,
.cd = GPIO_NUM_NC,
.wp = GPIO_NUM_NC,
.unused_pin = 2,
.unused_pin = 54,
}
},
};

Wyświetl plik

@ -12,8 +12,6 @@
#include "sd_pwr_ctrl.h"
#include "sd_pwr_ctrl_by_on_chip_ldo.h"
//TODO: IDF-8734
#if !CONFIG_IDF_TARGET_ESP32 && !CONFIG_IDF_TARGET_ESP32S3
TEST_CASE("CD input works in SD mode", "[sdmmc]")
{
sdmmc_host_t config = SDMMC_HOST_DEFAULT();
@ -21,6 +19,17 @@ TEST_CASE("CD input works in SD mode", "[sdmmc]")
sdmmc_test_board_get_config_sdmmc(SDMMC_HOST_SLOT_1, &config, &slot_config);
const int test_gpio = sdmmc_test_board_get_slot_info(SDMMC_HOST_SLOT_1)->unused_pin;
slot_config.gpio_cd = test_gpio;
#if SOC_SDMMC_IO_POWER_EXTERNAL
#define SDMMC_PWR_LDO_CHANNEL 4
sd_pwr_ctrl_ldo_config_t ldo_config = {
.ldo_chan_id = SDMMC_PWR_LDO_CHANNEL,
};
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
TEST_ESP_OK(sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle));
config.pwr_ctrl_handle = pwr_ctrl_handle;
#endif
sdmmc_test_board_card_power_set(true);
TEST_ESP_OK(sdmmc_host_init());
TEST_ESP_OK(sdmmc_host_init_slot(SDMMC_HOST_SLOT_1, &slot_config));
@ -42,6 +51,17 @@ TEST_CASE("WP input works in SD mode", "[sdmmc]")
sdmmc_test_board_get_config_sdmmc(SDMMC_HOST_SLOT_1, &config, &slot_config);
const int test_gpio = sdmmc_test_board_get_slot_info(SDMMC_HOST_SLOT_1)->unused_pin;
slot_config.gpio_wp = test_gpio;
#if SOC_SDMMC_IO_POWER_EXTERNAL
#define SDMMC_PWR_LDO_CHANNEL 4
sd_pwr_ctrl_ldo_config_t ldo_config = {
.ldo_chan_id = SDMMC_PWR_LDO_CHANNEL,
};
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
TEST_ESP_OK(sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle));
config.pwr_ctrl_handle = pwr_ctrl_handle;
#endif
TEST_ESP_OK(sdmmc_host_init());
TEST_ESP_OK(sdmmc_host_init_slot(SDMMC_HOST_SLOT_1, &slot_config));
@ -53,4 +73,3 @@ TEST_CASE("WP input works in SD mode", "[sdmmc]")
TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(config.pwr_ctrl_handle));
#endif
}
#endif

Wyświetl plik

@ -5,6 +5,8 @@ set(priv_requires
sdmmc_tests
# general
unity
# for PSRAM tests
esp_psram
)
idf_component_register(SRCS ${srcs}

Wyświetl plik

@ -13,11 +13,13 @@
void setUp(void)
{
printf("%s", ""); /* sneakily lazy-allocate the reent structure for this test task */
unity_utils_record_free_mem();
}
void tearDown(void)
{
esp_reent_cleanup();
unity_utils_evaluate_leaks_direct(TEST_MEMORY_LEAK_THRESHOLD);
}

Wyświetl plik

@ -1,12 +1,16 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded_idf import IdfDut
@pytest.mark.esp32
@pytest.mark.esp32s3
@pytest.mark.esp32p4
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='lack of runners, IDF-8970')
@pytest.mark.sdcard
def test_sdmmc(dut: IdfDut) -> None:
dut.run_all_single_board_cases()
# SDMMC driver can't be reinitialized if the test fails,
# so we need to reset the board between tests to avoid failing
# all the tests after the first one fails.
dut.run_all_single_board_cases(reset=True)

Wyświetl plik

@ -0,0 +1,5 @@
CONFIG_SDMMC_BOARD_ESP32P4_EV_BOARD=y
CONFIG_SPIRAM=y
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_SPIRAM_SPEED_200M=y

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -392,54 +392,54 @@ esp_err_t httpd_resp_send_err(httpd_req_t *req, httpd_err_code_t error, const ch
const char *status;
switch (error) {
case HTTPD_501_METHOD_NOT_IMPLEMENTED:
status = "501 Method Not Implemented";
msg = "Server does not support this method";
break;
case HTTPD_505_VERSION_NOT_SUPPORTED:
status = "505 Version Not Supported";
msg = "HTTP version not supported by server";
break;
case HTTPD_400_BAD_REQUEST:
status = "400 Bad Request";
msg = "Bad request syntax";
break;
case HTTPD_401_UNAUTHORIZED:
status = "401 Unauthorized";
msg = "No permission -- see authorization schemes";
break;
case HTTPD_403_FORBIDDEN:
status = "403 Forbidden";
msg = "Request forbidden -- authorization will not help";
break;
case HTTPD_404_NOT_FOUND:
status = "404 Not Found";
msg = "Nothing matches the given URI";
break;
case HTTPD_405_METHOD_NOT_ALLOWED:
status = "405 Method Not Allowed";
msg = "Specified method is invalid for this resource";
break;
case HTTPD_408_REQ_TIMEOUT:
status = "408 Request Timeout";
msg = "Server closed this connection";
break;
case HTTPD_414_URI_TOO_LONG:
status = "414 URI Too Long";
msg = "URI is too long";
break;
case HTTPD_411_LENGTH_REQUIRED:
status = "411 Length Required";
msg = "Client must specify Content-Length";
break;
case HTTPD_431_REQ_HDR_FIELDS_TOO_LARGE:
status = "431 Request Header Fields Too Large";
msg = "Header fields are too long";
break;
case HTTPD_500_INTERNAL_SERVER_ERROR:
default:
status = "500 Internal Server Error";
msg = "Server has encountered an unexpected error";
case HTTPD_501_METHOD_NOT_IMPLEMENTED:
status = "501 Method Not Implemented";
msg = "Server does not support this method";
break;
case HTTPD_505_VERSION_NOT_SUPPORTED:
status = "505 Version Not Supported";
msg = "HTTP version not supported by server";
break;
case HTTPD_400_BAD_REQUEST:
status = "400 Bad Request";
msg = "Bad request syntax";
break;
case HTTPD_401_UNAUTHORIZED:
status = "401 Unauthorized";
msg = "No permission -- see authorization schemes";
break;
case HTTPD_403_FORBIDDEN:
status = "403 Forbidden";
msg = "Request forbidden -- authorization will not help";
break;
case HTTPD_404_NOT_FOUND:
status = "404 Not Found";
msg = "Nothing matches the given URI";
break;
case HTTPD_405_METHOD_NOT_ALLOWED:
status = "405 Method Not Allowed";
msg = "Specified method is invalid for this resource";
break;
case HTTPD_408_REQ_TIMEOUT:
status = "408 Request Timeout";
msg = "Server closed this connection";
break;
case HTTPD_414_URI_TOO_LONG:
status = "414 URI Too Long";
msg = "URI is too long";
break;
case HTTPD_411_LENGTH_REQUIRED:
status = "411 Length Required";
msg = "Client must specify Content-Length";
break;
case HTTPD_431_REQ_HDR_FIELDS_TOO_LARGE:
status = "431 Request Header Fields Too Large";
msg = "Header fields are too long";
break;
case HTTPD_500_INTERNAL_SERVER_ERROR:
default:
status = "500 Internal Server Error";
msg = "Server has encountered an unexpected error";
}
/* If user has provided custom message, override default message */
@ -614,6 +614,19 @@ esp_err_t httpd_req_async_handler_begin(httpd_req_t *r, httpd_req_t **out)
}
memcpy(async->aux, r->aux, sizeof(struct httpd_req_aux));
// Copy response header block
struct httpd_data *hd = (struct httpd_data *) r->handle;
struct httpd_req_aux *async_aux = (struct httpd_req_aux *) async->aux;
struct httpd_req_aux *r_aux = (struct httpd_req_aux *) r->aux;
async_aux->resp_hdrs = calloc(hd->config.max_resp_headers, sizeof(struct resp_hdr));
if (async_aux->resp_hdrs == NULL) {
free(async_aux);
free(async);
return ESP_ERR_NO_MEM;
}
memcpy(async_aux->resp_hdrs, r_aux->resp_hdrs, hd->config.max_resp_headers * sizeof(struct resp_hdr));
// mark socket as "in use"
struct httpd_req_aux *ra = r->aux;
ra->sd->for_async_req = true;
@ -632,6 +645,7 @@ esp_err_t httpd_req_async_handler_complete(httpd_req_t *r)
struct httpd_req_aux *ra = r->aux;
ra->sd->for_async_req = false;
free(ra->resp_hdrs);
free(r->aux);
free(r);
@ -658,7 +672,7 @@ static int httpd_sock_err(const char *ctx, int sockfd)
int errval;
ESP_LOGW(TAG, LOG_FMT("error in %s : %d"), ctx, errno);
switch(errno) {
switch (errno) {
case EAGAIN:
case EINTR:
errval = HTTPD_SOCK_ERR_TIMEOUT;

Wyświetl plik

@ -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
*/
@ -11,8 +11,9 @@
#include "esp_clock_output.h"
#include "esp_check.h"
#include "esp_rom_gpio.h"
#include "clkout_channel.h"
#include "soc/clkout_channel.h"
#include "hal/gpio_hal.h"
#include "hal/clk_tree_hal.h"
#include "hal/clk_tree_ll.h"
#include "soc/soc_caps.h"
#include "soc/io_mux_reg.h"
@ -20,7 +21,7 @@
typedef struct clkout_channel_handle {
bool is_mapped;
soc_clkout_sig_id_t mapped_clock;
uint8_t channel_id;
clock_out_channel_t channel_id;
uint8_t ref_cnt;
uint64_t mapped_io_bmap;
portMUX_TYPE clkout_channel_lock;
@ -87,13 +88,12 @@ static clkout_channel_handle_t* clkout_channel_alloc(soc_clkout_sig_id_t clk_sig
allocated_channel->mapped_io_bmap |= BIT(gpio_num);
allocated_channel->mapped_clock = clk_sig;
allocated_channel->ref_cnt++;
if (allocated_channel->ref_cnt == 1) {
portENTER_CRITICAL(&s_clkout_lock);
#if SOC_CLOCKOUT_HAS_SOURCE_GATE
clk_ll_enable_clkout_source(clk_sig, true);
#endif
gpio_ll_set_pin_ctrl(clk_sig, CLKOUT_CHANNEL_MASK(allocated_channel->channel_id), CLKOUT_CHANNEL_SHIFT(allocated_channel->channel_id));
clk_hal_clock_output_setup(clk_sig, allocated_channel->channel_id);
portEXIT_CRITICAL(&s_clkout_lock);
}
portEXIT_CRITICAL(&allocated_channel->clkout_channel_lock);
@ -150,7 +150,7 @@ static void clkout_channel_free(clkout_channel_handle_t *channel_hdl)
#if SOC_CLOCKOUT_HAS_SOURCE_GATE
clk_ll_enable_clkout_source(channel_hdl->mapped_clock, false);
#endif
gpio_ll_set_pin_ctrl(0, CLKOUT_CHANNEL_MASK(channel_hdl->channel_id), CLKOUT_CHANNEL_SHIFT(channel_hdl->channel_id));
clk_hal_clock_output_teardown(channel_hdl->channel_id);
portEXIT_CRITICAL(&s_clkout_lock);
channel_hdl->mapped_clock = CLKOUT_SIG_INVALID;
channel_hdl->is_mapped = false;
@ -187,7 +187,11 @@ static void clkout_mapping_free(esp_clock_output_mapping_t *mapping_hdl)
esp_err_t esp_clock_output_start(soc_clkout_sig_id_t clk_sig, gpio_num_t gpio_num, esp_clock_output_mapping_handle_t *clkout_mapping_ret_hdl)
{
ESP_RETURN_ON_FALSE((clkout_mapping_ret_hdl != NULL), ESP_ERR_INVALID_ARG, TAG, "Clock out mapping handle passed in is invalid");
#if SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX
ESP_RETURN_ON_FALSE(GPIO_IS_VALID_GPIO(gpio_num), ESP_ERR_INVALID_ARG, TAG, "%s", "Output GPIO number error");
#else
ESP_RETURN_ON_FALSE(IS_VALID_CLKOUT_IO(gpio_num), ESP_ERR_INVALID_ARG, TAG, "%s", "Output GPIO number error");
#endif
esp_clock_output_mapping_t *hdl;
SLIST_FOREACH(hdl, &s_mapping_list, next) {
@ -214,6 +218,18 @@ esp_err_t esp_clock_output_stop(esp_clock_output_mapping_handle_t clkout_mapping
return ESP_OK;
}
#if SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER
esp_err_t esp_clock_output_set_divider(esp_clock_output_mapping_handle_t clkout_mapping_hdl, uint32_t div_num)
{
ESP_RETURN_ON_FALSE(((div_num > 0) && (div_num <= 256)), ESP_ERR_INVALID_ARG, TAG, "Divider number must be in the range of [1, 256]");
ESP_RETURN_ON_FALSE((clkout_mapping_hdl != NULL), ESP_ERR_INVALID_ARG, TAG, "Clock out mapping handle passed in is invalid");
portENTER_CRITICAL(&clkout_mapping_hdl->clkout_mapping_lock);
clk_hal_clock_output_set_divider(clkout_mapping_hdl->clkout_channel_hdl->channel_id, div_num);
portEXIT_CRITICAL(&clkout_mapping_hdl->clkout_mapping_lock);
return ESP_OK;
}
#endif
#if CONFIG_IDF_TARGET_ESP32
// Due to a hardware bug, PIN_CTRL cannot select 0xf output, whereas 0xf is the default value.
__attribute__((constructor))

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -25,7 +25,7 @@ typedef struct esp_clock_output_mapping *esp_clock_output_mapping_handle_t;
*
* @param[in] clk_src The clock signal source to be mapped to GPIOs
* @param[in] gpio_num GPIO number to be mapped soc_root_clk signal source
* @param[out] clkout_mapping_ret_hdl Clock output controll handler
* @param[out] clkout_mapping_ret_hdl Clock output control handler
* @return
* - ESP_OK: Output specified clock signal to specified GPIO successfully
* - ESP_ERR_INVALID_ARG: Specified GPIO not supported to output internal clock
@ -36,12 +36,26 @@ esp_err_t esp_clock_output_start(soc_clkout_sig_id_t clk_sig, gpio_num_t gpio_nu
/**
* @brief Stop clock signal to GPIO outputting
* @param[in] clkout_mapping_hdl Clock output mapping controll handle
* @param[in] clkout_mapping_hdl Clock output mapping control handle
* @return
* - ESP_OK: Disable the clock output on GPIO successfully
* - ESP_ERR_INVALID_STATE The clock in handle is already in the disabled state
* - ESP_ERR_INVALID_ARG The clock mapping handle is not initialized yet
* - ESP_ERR_INVALID_STATE The clock mapping handle is already in the disabled state
*/
esp_err_t esp_clock_output_stop(esp_clock_output_mapping_handle_t clkout_mapping_hdl);
#if SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER
/**
* @brief Output the mapped clock after frequency division
* @param clkout_mapping_hdl clkout_mapping_hdl Clock output mapping control handle
* @param div_num clock frequency division value, should be in the range of 1 ~ 256
* @return
* - ESP_OK: Disable the clock output on GPIO successfully
* - ESP_ERR_INVALID_ARG The clock mapping handle is not initialized yet or the div_num is in bad range
*/
esp_err_t esp_clock_output_set_divider(esp_clock_output_mapping_handle_t clkout_mapping_hdl, uint32_t div_num);
#endif
#endif // SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX || SOC_GPIO_CLOCKOUT_BY_IO_MUX
#ifdef __cplusplus

Wyświetl plik

@ -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
*/
@ -32,7 +32,7 @@ void rtc_clk_cpu_set_to_default_config(void);
* Currently, this function is only used for tracking whether USB Serial/JTAG is using the 48MHz PHY clock
*
* Note: Calling this function only helps to not disable the BBPLL clock in `rtc_clk_cpu_freq_set_config`.
* For light and deep sleep, whether to disable the BBPLL in the interal call to `rtc_clk_cpu_freq_set_xtal`
* For light and deep sleep, whether to disable the BBPLL in the internal call to `rtc_clk_cpu_freq_set_xtal`
* varies for targets.
* On ESP32C3/S3, USB CDC device can not function properly during sleep due to the lack of APB clock. Therefore.
* `rtc_clk_cpu_freq_set_xtal` will always disable BBPLL, no matter whether BBPLL has any consumer.
@ -65,6 +65,13 @@ void rtc_clk_mpll_disable(void);
* @param[in] mpll_freq MPLL frequency
*/
void rtc_clk_mpll_configure(uint32_t xtal_freq, uint32_t mpll_freq);
/**
* Get the MPLL frequency
* @return the value of MPLL frequency in MHz
*/
uint32_t rtc_clk_mpll_get_freq(void);
#endif //#if SOC_CLK_MPLL_SUPPORTED
/**

Wyświetl plik

@ -586,7 +586,6 @@ void sleep_smp_cpu_sleep_prepare(void)
esp_ipc_isr_call((esp_ipc_isr_func_t)smp_core_do_retention, NULL);
#else
esp_ipc_isr_stall_other_cpu();
esp_ipc_isr_stall_pause();
#endif
}
@ -601,7 +600,6 @@ void sleep_smp_cpu_wakeup_prepare(void)
}
atomic_store(&s_smp_retention_state[core_id], SMP_IDLE);
#else
esp_ipc_isr_stall_resume();
esp_ipc_isr_release_other_cpu();
#endif
}

Wyświetl plik

@ -209,6 +209,7 @@ void esp_cpu_configure_region_protection(void)
// 6. LP memory
#if CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT && !BOOTLOADER_BUILD
extern int _rtc_text_start;
extern int _rtc_text_end;
/* Reset the corresponding PMP config because PMP_ENTRY_SET only sets the given bits
* Bootloader might have given extra permissions and those won't be cleared
@ -218,13 +219,9 @@ void esp_cpu_configure_region_protection(void)
PMP_ENTRY_CFG_RESET(11);
PMP_ENTRY_CFG_RESET(12);
PMP_ENTRY_SET(9, SOC_RTC_IRAM_LOW, NONE);
#if CONFIG_ULP_COPROC_RESERVE_MEM
// First part of LP mem is reserved for coprocessor
PMP_ENTRY_SET(10, SOC_RTC_IRAM_LOW + CONFIG_ULP_COPROC_RESERVE_MEM, PMP_TOR | RW);
#else // CONFIG_ULP_COPROC_RESERVE_MEM
// Repeat same previous entry, to ensure next entry has correct base address (TOR)
PMP_ENTRY_SET(10, SOC_RTC_IRAM_LOW, NONE);
#endif // !CONFIG_ULP_COPROC_RESERVE_MEM
// First part of LP mem is reserved for RTC reserved mem (shared between bootloader and app)
// as well as memory for ULP coprocessor
PMP_ENTRY_SET(10, (int)&_rtc_text_start, PMP_TOR | RW);
PMP_ENTRY_SET(11, (int)&_rtc_text_end, PMP_TOR | RX);
PMP_ENTRY_SET(12, SOC_RTC_IRAM_HIGH, PMP_TOR | RW);
#else

Wyświetl plik

@ -159,6 +159,10 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
config->digital = digital_default;
pmu_sleep_analog_config_t analog_default = PMU_SLEEP_ANALOG_LSLP_CONFIG_DEFAULT(pd_flags);
#if CONFIG_SPIRAM
analog_default.hp_sys.analog.pd_cur = 1;
analog_default.lp_sys[PMU_MODE_LP_SLEEP].analog.pd_cur = 1;
#endif
config->analog = analog_default;
}
return config;
@ -257,13 +261,13 @@ void pmu_sleep_init(const pmu_sleep_config_t *config, bool dslp)
void pmu_sleep_increase_ldo_volt(void) {
REG_SET_FIELD(PMU_HP_ACTIVE_HP_REGULATOR0_REG, PMU_HP_ACTIVE_HP_REGULATOR_DBIAS, 30);
REG_SET_BIT(PMU_HP_ACTIVE_HP_REGULATOR0_REG, PMU_HP_ACTIVE_HP_REGULATOR_XPD);
// Decrease the DCDC voltage to reduce the voltage difference between the DCDC and the LDO to avoid overshooting the DCDC voltage during wake-up.
REG_SET_FIELD(PMU_HP_ACTIVE_BIAS_REG, PMU_HP_ACTIVE_DCM_VSET, 24);
}
void pmu_sleep_shutdown_dcdc(void) {
SET_PERI_REG_MASK(LP_SYSTEM_REG_SYS_CTRL_REG, LP_SYSTEM_REG_LP_FIB_DCDC_SWITCH); //0: enable, 1: disable
REG_SET_BIT(PMU_DCM_CTRL_REG, PMU_DCDC_OFF_REQ);
// Decrease the DCDC voltage to reduce the voltage difference between the DCDC and the LDO to avoid overshooting the DCDC voltage during wake-up.
REG_SET_FIELD(PMU_HP_ACTIVE_BIAS_REG, PMU_HP_ACTIVE_DCM_VSET, 24);
// Decrease hp_ldo voltage.
REG_SET_FIELD(PMU_HP_ACTIVE_HP_REGULATOR0_REG, PMU_HP_ACTIVE_HP_REGULATOR_DBIAS, 24);
}

Wyświetl plik

@ -11,7 +11,7 @@ extern "C" {
#endif
#define PMU_SDIO_WAKEUP_EN BIT(0)
#define PMU_SW_WAKEUP_HP_EN BIT(1)
#define PMU_LP_CORE_WAKEUP_EN BIT(1)
#define PMU_GPIO_WAKEUP_EN BIT(2)
#define PMU_USB_WAKEUP_EN BIT(3)
#define PMU_UART4_WAKEUP_EN BIT(4)
@ -26,7 +26,7 @@ extern "C" {
#define PMU_LP_TIMER_WAKEUP_EN BIT(13)
#define PMU_BOD_WAKEUP_EN BIT(14)
#define PMU_VDDBAT_UNDERVOLT_WAKEUP_EN BIT(15)
#define PMU_LP_CORE_WAKEUP_EN BIT(16)
#define PMU_LP_CORE_TRAP_WAKEUP_EN BIT(16)
#define PMU_ETM_WAKEUP_EN BIT(17)
#define PMU_LP_TIMER1_WAKEUP_EN BIT(18)
#define PMU_LP_I2S_WAKEUP_EN BIT(19)

Wyświetl plik

@ -13,6 +13,7 @@
#include "esp32p4/rom/rtc.h"
#include "soc/rtc.h"
#include "esp_private/rtc_clk.h"
#include "esp_attr.h"
#include "esp_hw_log.h"
#include "esp_rom_sys.h"
#include "hal/clk_tree_ll.h"
@ -26,6 +27,9 @@ static const char *TAG = "rtc_clk";
// CPLL frequency option, in 360/400MHz. Zero if CPLL is not enabled.
static int s_cur_cpll_freq = 0;
// MPLL frequency option, 400MHz. Zero if MPLL is not enabled.
static DRAM_ATTR uint32_t s_cur_mpll_freq = 0;
void rtc_clk_32k_enable(bool enable)
{
if (enable) {
@ -483,6 +487,7 @@ bool rtc_dig_8m_enabled(void)
void rtc_clk_mpll_disable(void)
{
clk_ll_mpll_disable();
s_cur_mpll_freq = 0;
}
void rtc_clk_mpll_enable(void)
@ -500,4 +505,10 @@ void rtc_clk_mpll_configure(uint32_t xtal_freq, uint32_t mpll_freq)
while(!regi2c_ctrl_ll_mpll_calibration_is_done());
/* MPLL calibration stop */
regi2c_ctrl_ll_mpll_calibration_stop();
s_cur_mpll_freq = mpll_freq;
}
uint32_t rtc_clk_mpll_get_freq(void)
{
return s_cur_mpll_freq;
}

Wyświetl plik

@ -16,6 +16,7 @@
#include "esp_private/esp_sleep_internal.h"
#include "esp_private/esp_timer_private.h"
#include "esp_private/periph_ctrl.h"
#include "esp_private/rtc_clk.h"
#include "esp_private/sleep_event.h"
#include "esp_private/system_internal.h"
#include "esp_log.h"
@ -27,6 +28,7 @@
#include "soc/soc_caps.h"
#include "driver/rtc_io.h"
#include "hal/rtc_io_hal.h"
#include "hal/clk_tree_hal.h"
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
#include "esp_private/pm_impl.h"
@ -924,6 +926,13 @@ static esp_err_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t m
#endif
#endif
#if SOC_CLK_MPLL_SUPPORTED
uint32_t mpll_freq_mhz = rtc_clk_mpll_get_freq();
if (mpll_freq_mhz) {
rtc_clk_mpll_disable();
}
#endif
#if SOC_DCDC_SUPPORTED
uint64_t ldo_increased_us = rtc_time_slowclk_to_us(rtc_time_get() - s_config.rtc_ticks_at_ldo_prepare, s_config.rtc_clk_cal_period);
if (ldo_increased_us < LDO_POWER_TAKEOVER_PREPARATION_TIME_US) {
@ -951,6 +960,13 @@ static esp_err_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t m
result = call_rtc_sleep_start(reject_triggers, config.lslp_mem_inf_fpu, deep_sleep);
#endif
#if SOC_CLK_MPLL_SUPPORTED
if (mpll_freq_mhz) {
rtc_clk_mpll_enable();
rtc_clk_mpll_configure(clk_hal_xtal_get_freq_mhz(), mpll_freq_mhz);
}
#endif
/* Unhold the SPI CS pin */
#if (CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP && CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND)
#if !CONFIG_IDF_TARGET_ESP32H2 // ESP32H2 TODO IDF-7359: related rtcio ll func not supported yet
@ -1244,8 +1260,8 @@ esp_err_t esp_light_sleep_start(void)
sleep_smp_cpu_sleep_prepare();
#else
esp_ipc_isr_stall_other_cpu();
esp_ipc_isr_stall_pause();
#endif
esp_ipc_isr_stall_pause();
#endif
#if CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION && CONFIG_PM_SLP_IRAM_OPT
@ -1395,10 +1411,10 @@ esp_err_t esp_light_sleep_start(void)
#endif
#if !CONFIG_FREERTOS_UNICORE
esp_ipc_isr_stall_resume();
#if CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP && SOC_PM_CPU_RETENTION_BY_SW
sleep_smp_cpu_wakeup_prepare();
#else
esp_ipc_isr_stall_resume();
esp_ipc_isr_release_other_cpu();
#endif
#endif
@ -1408,7 +1424,6 @@ esp_err_t esp_light_sleep_start(void)
wdt_hal_disable(&rtc_wdt_ctx);
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
}
portEXIT_CRITICAL(&s_config.lock);
#if CONFIG_ESP_TASK_WDT_USE_ESP_TIMER
/* Restart the Task Watchdog timer as it was stopped before sleeping. */
@ -1425,6 +1440,8 @@ esp_err_t esp_light_sleep_start(void)
s_sleep_ctx->sleep_request_result = err;
}
#endif
portEXIT_CRITICAL(&s_config.lock);
return err;
}

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -20,6 +20,8 @@
static const int test_clk_out_io[] = {0, 1, 3};
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
static const int test_clk_out_io[] = {18, 19, 20};
#elif CONFIG_IDF_TARGET_ESP32P4
static const int test_clk_out_io[] = {7, 8};
#else
static const int test_clk_out_io[] = {3, 4, 5, 6};
#endif
@ -33,6 +35,9 @@ void output_clock_1(void *pvParameter)
esp_clock_output_mapping_handle_t clkout_mapping_hdl;
for (int i = 0; i < TEST_LOOPS; ++i) {
TEST_ESP_OK(esp_clock_output_start(test_clk_out_sig[0], test_clk_out_io[0], &clkout_mapping_hdl));
#if SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER
TEST_ESP_OK(esp_clock_output_set_divider(clkout_mapping_hdl, 8));
#endif
vTaskDelay(3);
TEST_ESP_OK(esp_clock_output_stop(clkout_mapping_hdl));
vTaskDelay(7);
@ -54,6 +59,7 @@ void output_clock_2(void *pvParameter)
vTaskDelete(NULL);
}
#if SOC_GPIO_CLOCKOUT_CHANNEL_NUM >= 3
void output_clock_3(void *pvParameter)
{
rtc_dig_clk8m_enable();
@ -67,7 +73,7 @@ void output_clock_3(void *pvParameter)
xSemaphoreGive(test_done_semphr);
vTaskDelete(NULL);
}
#endif
// This case is now tested only manually
TEST_CASE("GPIO output internal clock", "[gpio_output_clock][ignore]")
@ -75,10 +81,12 @@ TEST_CASE("GPIO output internal clock", "[gpio_output_clock][ignore]")
test_done_semphr = xSemaphoreCreateCounting(3, 0);
xTaskCreate(&output_clock_1, "output_clock_1", 4096, NULL, 4, NULL);
xTaskCreate(&output_clock_2, "output_clock_2", 4096, NULL, 4, NULL);
#if SOC_GPIO_CLOCKOUT_CHANNEL_NUM >= 3
xTaskCreate(&output_clock_3, "output_clock_3", 4096, NULL, 4, NULL);
#endif
int cnt = 0;
while (cnt < 3) {
while (cnt < SOC_GPIO_CLOCKOUT_CHANNEL_NUM) {
if (xSemaphoreTake(test_done_semphr, portMAX_DELAY) == pdTRUE) {
cnt++;
}
@ -86,8 +94,13 @@ TEST_CASE("GPIO output internal clock", "[gpio_output_clock][ignore]")
vTaskDelay(1);
vSemaphoreDelete(test_done_semphr);
#if CONFIG_IDF_TARGET_ESP32
/* ESP32 clock out channel pin reuses UART TX/RX pin, restore its default
configuration at the end of the test */
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_U0RXD);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_U0TXD);
#endif
}
#if SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX

Wyświetl plik

@ -5,5 +5,5 @@ set(sources "test_app_main.c"
# the component must be registered as a WHOLE_ARCHIVE
idf_component_register(SRCS ${sources}
INCLUDE_DIRS "."
PRIV_REQUIRES unity esp_pm ulp driver esp_timer
PRIV_REQUIRES unity esp_pm ulp driver esp_timer esp_psram
WHOLE_ARCHIVE)

Wyświetl plik

@ -14,3 +14,31 @@ from pytest_embedded import Dut
], indirect=True)
def test_esp_pm(dut: Dut) -> None:
dut.run_all_single_board_cases()
# psram attr tests with xip_psram
@pytest.mark.esp32s2
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
[
'pm_xip_psram_esp32s2'
],
indirect=True,
)
def test_esp_attr_xip_psram_esp32s2(dut: Dut) -> None:
dut.run_all_single_board_cases()
# psram attr tests with xip_psram
@pytest.mark.esp32s3
@pytest.mark.generic
@pytest.mark.parametrize(
'config',
[
'pm_xip_psram_esp32s3'
],
indirect=True,
)
def test_esp_attr_xip_psram_esp32s3(dut: Dut) -> None:
dut.run_all_single_board_cases()

Wyświetl plik

@ -0,0 +1,6 @@
CONFIG_IDF_TARGET="esp32s2"
CONFIG_SPIRAM=y
CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y
CONFIG_SPIRAM_RODATA=y

Wyświetl plik

@ -0,0 +1,6 @@
CONFIG_IDF_TARGET="esp32s3"
CONFIG_SPIRAM=y
CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y
CONFIG_SPIRAM_RODATA=y

Wyświetl plik

@ -1018,7 +1018,6 @@ r_ble_lll_conn_coex_dpc_update_on_event_scheduled = 0x400014e4;
r_ble_lll_conn_coex_dpc_update_on_event_started = 0x400014e8;
r_ble_lll_conn_cth_flow_alloc_credit = 0x400014ec;
r_ble_lll_conn_current_sm_over = 0x400014f4;
r_ble_lll_conn_event_end_timer_cb = 0x40001508;
r_ble_lll_conn_event_is_over = 0x40001510;
r_ble_lll_conn_event_start_cb = 0x40001514;
r_ble_lll_conn_free_rx_mbuf = 0x40001518;
@ -1793,8 +1792,8 @@ ieee80211_decap = 0x40001ffc;
ieee80211_set_tx_pti = 0x40002000;
wifi_is_started = 0x40002004;
ieee80211_gettid = 0x40002008;
ieee80211_ccmp_decrypt = 0x4000200c;
ieee80211_ccmp_encrypt = 0x40002010;
/* ieee80211_ccmp_decrypt = 0x4000200c; */
/* ieee80211_ccmp_encrypt = 0x40002010; */
ccmp_encap = 0x40002014;
ccmp_decap = 0x40002018;
tkip_encap = 0x4000201c;
@ -1848,7 +1847,7 @@ ieee80211_crypto_aes_128_cmac_encrypt = 0x40002100;
ieee80211_alloc_tx_buf = 0x40002108;
/* ieee80211_output_do = 0x4000210c; */
/* ieee80211_send_nulldata = 0x40002110; */
ieee80211_setup_robust_mgmtframe = 0x40002114;
/* ieee80211_setup_robust_mgmtframe = 0x40002114; */
ieee80211_encap_null_data = 0x4000211c;
ieee80211_send_deauth = 0x40002120;
ieee80211_alloc_deauth = 0x40002124;

Wyświetl plik

@ -80,7 +80,7 @@ pm_on_data_rx = 0x40000ca8;
pm_sleep_for = 0x40000cc4;
//pm_tbtt_process = 0x40000cc8;
ppAMPDU2Normal = 0x40000ccc;
ppAssembleAMPDU = 0x40000cd0;
/* ppAssembleAMPDU = 0x40000cd0; */
ppCalFrameTimes = 0x40000cd4;
ppCalSubFrameLength = 0x40000cd8;
//ppCalTxAMPDULength = 0x40000cdc;

Wyświetl plik

@ -50,6 +50,9 @@ extern "C" {
* RTC_CNTL_STORE5_REG APB bus frequency
* RTC_CNTL_STORE6_REG FAST_RTC_MEMORY_ENTRY
* RTC_CNTL_STORE7_REG FAST_RTC_MEMORY_CRC
* LP_SYS_LP_STORE8_REG sleep mode and wake stub address
* LP_SYS_LP_STORE9_REG LP_UART_INIT_CTRL
* LP_SYS_LP_STORE10_REG LP_ROM_LOG_CTRL
*************************************************************************************
*/
@ -75,6 +78,10 @@ extern "C" {
#define RTC_SLEEP_WAKE_STUB_ADDR_REG LP_SYSTEM_REG_LP_STORE8_REG
#define RTC_SLEEP_MODE_REG LP_SYSTEM_REG_LP_STORE8_REG
// lp uart init status, 0 - need init, 1 - no init.
#define LP_UART_INIT_CTRL_REG LP_SYSTEM_REG_LP_STORE9_REG
#define ROM_LOG_CTRL_REG LP_SYSTEM_REG_LP_STORE10_REG
typedef enum {
AWAKE = 0, //<CPU ON
LIGHT_SLEEP = BIT0, //CPU waiti, PLL ON. We don't need explicitly set this mode.

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -31,6 +31,11 @@
#define IDROM_SEG_SIZE (CONFIG_MMU_PAGE_SIZE << 10)
#endif
#define LP_ROM_DRAM_START 0x5010fa80 // Value taken from ROM elf, includes LP ROM stack
#define LP_RAM_END 0x50110000
#define LP_ROM_DRAM_SIZE (LP_RAM_END - LP_ROM_DRAM_START)
MEMORY
{
/**
@ -73,10 +78,10 @@ MEMORY
* lp ram memory (RWX). Persists over deep sleep. // TODO: IDF-5667
*/
#if CONFIG_ULP_COPROC_ENABLED
lp_ram_seg(RW) : org = 0x50108000 + CONFIG_ULP_COPROC_RESERVE_MEM,
len = 0x8000 - CONFIG_ULP_COPROC_RESERVE_MEM - RESERVE_RTC_MEM
lp_ram_seg(RW) : org = 0x50108000 + RESERVE_RTC_MEM + CONFIG_ULP_COPROC_RESERVE_MEM,
len = 0x8000 - CONFIG_ULP_COPROC_RESERVE_MEM - RESERVE_RTC_MEM - LP_ROM_DRAM_SIZE
#else
lp_ram_seg(RW) : org = 0x50108000 , len = 0x8000 - RESERVE_RTC_MEM
lp_ram_seg(RW) : org = 0x50108000 + RESERVE_RTC_MEM, len = 0x8000 - RESERVE_RTC_MEM
#endif // CONFIG_ULP_COPROC_ENABLED
/* We reduced the size of lp_ram_seg by RESERVE_RTC_MEM value.
@ -85,8 +90,9 @@ MEMORY
- (lower addr) rtc timer data (s_rtc_timer_retain_mem, see esp_clk.c files).
- (higher addr) bootloader rtc data (s_bootloader_retain_mem, when a Kconfig option is on).
The aim of this is to keep data that will not be moved around and have a fixed address.
This segment is placed at the beginning of LP RAM, as the end of LP RAM is occupied by LP ROM stack/data
*/
lp_reserved_seg(RW) : org = 0x50108000 + 0x8000 - RESERVE_RTC_MEM, len = RESERVE_RTC_MEM
lp_reserved_seg(RW) : org = 0x50108000, len = RESERVE_RTC_MEM
}
/* Heap ends at top of dram0_0_seg */

Wyświetl plik

@ -18,7 +18,12 @@ SECTIONS
*/
.rtc.text :
{
ALIGNED_SYMBOL(4, _rtc_fast_start)
/* Align the start of RTC code region as per PMP granularity
* this ensures we do not overwrite the permissions for the previous
* region (ULP mem/RTC reserved) regardless of their end alignment
*/
ALIGNED_SYMBOL(_esp_pmp_align_size, _rtc_fast_start)
ALIGNED_SYMBOL(_esp_pmp_align_size, _rtc_text_start)
arrays[rtc_text]
mapping[rtc_text]
@ -119,20 +124,21 @@ SECTIONS
{
ALIGNED_SYMBOL(4, _rtc_reserved_start)
KEEP(*(.bootloader_data_rtc_mem .bootloader_data_rtc_mem.*))
*(.rtc_timer_data_in_rtc_mem .rtc_timer_data_in_rtc_mem.*)
/**
* New data can only be added here to ensure existing data are not moved.
* Because data have adhered to the end of the segment and code is relied
* Because data have adhered to the beginning of the segment and code is relied
* on it.
* >> put new data here <<
*/
*(.rtc_timer_data_in_rtc_mem .rtc_timer_data_in_rtc_mem.*)
KEEP(*(.bootloader_data_rtc_mem .bootloader_data_rtc_mem.*))
_rtc_reserved_end = ABSOLUTE(.);
} > rtc_reserved_seg
_rtc_reserved_length = _rtc_reserved_end - _rtc_reserved_start;
_rtc_ulp_memory_start = _rtc_reserved_start + LENGTH(rtc_reserved_seg);
ASSERT((_rtc_reserved_length <= LENGTH(rtc_reserved_seg)),
"RTC reserved segment data does not fit.")

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -41,6 +41,8 @@
#define _esp_mmu_page_size CONFIG_MMU_PAGE_SIZE
#endif
#define ALIGN_UP(SIZE, AL) (((SIZE) + (AL - 1)) & ~(AL - 1))
#if CONFIG_SOC_RTC_MEM_SUPPORTED
#if CONFIG_BOOTLOADER_RESERVE_RTC_MEM
#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
@ -57,9 +59,15 @@
#if CONFIG_IDF_TARGET_ESP32
#define RESERVE_RTC_MEM (RTC_TIMER_RESERVE_RTC)
#elif CONFIG_ESP_ROM_HAS_LP_ROM && CONFIG_ULP_COPROC_ENABLED
/* RTC Reserved is placed before ULP memory, expand it to make sure the ULP start address
has the required alignment */
#define ULP_ALIGNMENT_REQ_BYTES 256
#define RESERVE_RTC_MEM ALIGN_UP(ESP_BOOTLOADER_RESERVE_RTC + RTC_TIMER_RESERVE_RTC, ULP_ALIGNMENT_REQ_BYTES)
#else
#define RESERVE_RTC_MEM (ESP_BOOTLOADER_RESERVE_RTC + RTC_TIMER_RESERVE_RTC)
#endif
#endif // SOC_RTC_MEM_SUPPORTED
#define QUOTED_STRING(STRING) #STRING

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