Compare commits

...

387 Commits

Author SHA1 Message Date
Michael (XIAO Xufeng) 1329b19fe4 versions: Update version to 4.4.1 2022-04-16 09:43:14 +08:00
Michael (XIAO Xufeng) 9b75e5664e Merge branch 'bugfix/iperf_performance_v4.4' into 'release/v4.4'
Bugfix/iperf performance (v4.4)

See merge request espressif/esp-idf!17600
2022-04-15 15:52:13 +08:00
Michael (XIAO Xufeng) 82f5cc3402 Merge branch 'bugfix/gdbgui_deps_4.4' into 'release/v4.4'
Tools: Fix incompatible package dependencies of gdbgui

See merge request espressif/esp-idf!17742
2022-04-15 15:07:05 +08:00
Jiang Jiang Jian fdb756b8f9 Merge branch 'bugfix/fix_phy_i2c_crash_v4.4' into 'release/v4.4'
esp_phy: Add IRAM_ATTR for phy i2c spinlock (backport v4.4)

See merge request espressif/esp-idf!17757
2022-04-14 18:26:35 +08:00
xiewenxiang ea1a9f9e3a esp_phy: Add IRAM_ATTR for phy i2c spinlock 2022-04-13 12:15:38 +08:00
Roland Dobai 734c6f8998 Tools: Fix incompatible package dependencies of gdbgui
Closes https://github.com/espressif/esp-idf/issues/8760
2022-04-12 08:59:30 +02:00
Jiang Jiang Jian d58b394dc5 Merge branch 'bugfix/fix_i2c_critical_and_iram_funcations_v4.4' into 'release/v4.4'
Update esp c3/s3 phy lib (dcbe608)

See merge request espressif/esp-idf!17714
2022-04-11 15:02:15 +08:00
xiewenxiang b37df7e3df Update esp c3/s3 phy lib (dcbe608) 2022-04-08 16:42:50 +08:00
Michael (XIAO Xufeng) b436132f9f Merge branch 'bugfix/phy_regi2c_critical_section_v4.4' into 'release/v4.4'
esp_phy: use spinlock to avoid regi2c access conflicts (v4.4)

See merge request espressif/esp-idf!17691
2022-04-07 19:23:51 +08:00
Ondrej Kosta 2dff50c3e2 Eth iperf default sdkconfig: Enable lwIP IRAM optimization 2022-04-06 10:44:31 +00:00
Ondrej Kosta 4d581456e4 Added bandwidth limitaion option to iperf test scripts 2022-04-06 10:44:31 +00:00
Ondrej Kosta 3f7cf8a540 iperf: added Tx bandwidth limit option 2022-04-06 10:44:31 +00:00
Ondrej Kosta ba62cbc04f Fixed Ethernet lwIP netif error indication 2022-04-06 10:44:31 +00:00
Michael (XIAO Xufeng) d378ca2b78 esp_phy: use spinlock to avoid regi2c access conflicts 2022-04-06 12:18:23 +08:00
Michael (XIAO Xufeng) 8522bb1178 regi2c: use safe version of spinlock, instead of ISR ver 2022-04-06 09:34:43 +08:00
Michael (XIAO Xufeng) f5ee7093b8 Merge branch 'test/disable_touch_sleep_testcase_v4.4' into 'release/v4.4'
touch: add protection for touch sleep case (v4.4)

See merge request espressif/esp-idf!17611
2022-03-30 15:24:15 +08:00
Michael (XIAO Xufeng) 472cbbe73b Merge branch 'bugfix/disable_touch_sleep_s3_v4.4' into 'release/v4.4'
touch_sensor: forbid from using touch sensor with sleep on ESP32-S3 (v4.4)

See merge request espressif/esp-idf!17579
2022-03-28 11:27:51 +08:00
Michael (XIAO Xufeng) b6c2c80e44 touch: add protection for touch sleep case 2022-03-27 02:44:47 +08:00
Michael (XIAO Xufeng) 3503ee41ca sleep: fixed the issue error log not printed 2022-03-25 14:50:26 +08:00
Michael (XIAO Xufeng) ea27a8543a touch_sensor: forbid from using touch sensor with sleep on ESP32-S3
This is not supported yet.
2022-03-25 14:50:26 +08:00
Roland Dobai c29343eb94 Merge branch 'feature/update_esptool_v4.4' into 'release/v4.4'
esptool: Update esptool submodule (v4.4)

See merge request espressif/esp-idf!17454
2022-03-11 16:00:22 +08:00
KonstantinKondrashov 353abc5702 esptool: Update esptool submodule 2022-03-11 06:39:30 +00:00
morris 45dcc4384c Merge branch 'feature/emac_start_stop_test_v4.4' into 'release/v4.4'
test_emac: extended Ethernet start/stop stress test (v4.4)

See merge request espressif/esp-idf!17306
2022-03-11 10:38:40 +08:00
Ondrej Kosta 11ae0ed007 increased parallel count of UT_T1_1 test 2022-03-10 15:59:07 +01:00
Wang Meng Yang 7a2068c864 Merge branch 'feature/update_hfp_hf_version_v4.4' into 'release/v4.4'
Update HFP_HF version to 1.7.2(v4.4)

See merge request espressif/esp-idf!17382
2022-03-10 20:20:16 +08:00
Ondrej Kosta 7768c389ad Created EMAC start/stop stress test under heavy traffic 2022-03-10 10:15:34 +01:00
Ondrej Kosta d53094bdc0 esp_eth: EMAC start/stop optimization 2022-03-10 10:15:34 +01:00
Krzysztof Budzynski c469316970 Merge branch 'docs/add_note_for_malloc_cap_dma_backport_v4.4' into 'release/v4.4'
docs: add note for MALLOC_CAP_DMA for ESP32-S2 according to customer feedback (backport v4.4)

See merge request espressif/esp-idf!17343
2022-03-10 17:10:10 +08:00
morris 0fca632ffd Merge branch 'bugfix/modbus_fix_start_after_destroy_issues_v44' into 'release/v4.4'
modbus: fix tcp slave destroy issues (backport v4.4)

See merge request espressif/esp-idf!17406
2022-03-09 09:48:36 +08:00
Marius Vikhammer c9ce438466 Merge branch 'bugfix/inline_intrmask_from_isr_v4.4' into 'release/v4.4'
freertos: always inline xPortSetInterruptMaskFromISR and vPortClearInterruptMaskFromISR (v4.4)

See merge request espressif/esp-idf!17325
2022-03-09 09:38:36 +08:00
morris 121ddb87e5 Merge branch 'bugfix/fix_adc_digital_not_reset_issue_v4.4' into 'release/v4.4'
adc: fix adc digital part not reset issue (v4.4)

See merge request espressif/esp-idf!17375
2022-03-08 23:16:33 +08:00
aleks d7fafdc916 freemodbus: fix port enable disable sequence for tcp master and slave 2022-03-08 10:07:19 +01:00
aleks ba9c0c29a9 modbus: fix tcp slave destroy issues
Closes https://github.com/espressif/esp-idf/issues/8211
2022-03-08 09:52:54 +01:00
Roland Dobai c45dee0a7a Merge branch 'bugfix/idf_size_assertions_v4.4' into 'release/v4.4'
tools: Fix assertion messages and fix some of them in idf_size.py (v4.4)

See merge request espressif/esp-idf!17348
2022-03-08 02:58:04 +08:00
morris 1b06c55ab1 Merge branch 'bugfix/fix_adc_calibration_light_sleep_issue_v4.4' into 'release/v4.4'
adc: fix calibration error when waking up from light sleep (v4.4)

See merge request espressif/esp-idf!16930
2022-03-07 19:01:31 +08:00
xiongweichao 898a7d071b Update HFP_HF version to 1.7.2 2022-03-07 18:16:05 +08:00
Jiang Jiang Jian dc7cb6de4b Merge branch 'bugfix/ignore_pmf_capable_flag_v4.4' into 'release/v4.4'
Always connect Station in PMF mode if possible (Backport v4.4)

See merge request espressif/esp-idf!17036
2022-03-07 16:24:44 +08:00
Armando e1515beb26 adc: fix adc digital not reset issue 2022-03-07 11:40:18 +08:00
Armando d53ea1166d rng: fix rng adc digital inpu not disabled issue 2022-03-07 11:39:27 +08:00
Armando 32afe6a498 sleep: restore analog calibration registers after waking up from light sleep
Closes https://github.com/espressif/esp-idf/issues/8287
Closes https://github.com/espressif/esp-idf/issues/7921
2022-03-07 11:28:48 +08:00
Jiang Jiang Jian 92a67e0fff Merge branch 'bugfix/add-resolution-suggestion-for-coredump_v4.4' into 'release/v4.4'
idf_monitor.py: Remove line finalization when coredump is in progress to avoid coredump failure (v4.4)

See merge request espressif/esp-idf!17364
2022-03-07 11:04:50 +08:00
Jiang Jiang Jian a97dd5e0e9 Merge branch 'bugfix/ble_mesh_console_correct_repl_config_prompt_forv4.4' into 'release/v4.4'
ble mesh:example:correct repl config prompt in ble mesh console(v4.4)

See merge request espressif/esp-idf!17183
2022-03-07 11:03:54 +08:00
Yuan Hong Hui b2e67d6ff1 ble mesh:example:correct repl config prompt in ble mesh console(v4.4) 2022-03-07 11:03:54 +08:00
Jiang Jiang Jian 3d2700146e Merge branch 'bugfix/uart_no_int_after_flush_v4.4' into 'release/v4.4'
UART: RX interrupts are now properly restored after a flush (backport v4.4)

See merge request espressif/esp-idf!17122
2022-03-07 11:03:33 +08:00
Jiang Jiang Jian d326c5283d Merge branch 'bugfix/ledc_consecutive_fade_v4.4' into 'release/v4.4'
ledc: Bugfixes for issues related to fade protection (backport v4.4)

See merge request espressif/esp-idf!16953
2022-03-07 11:00:46 +08:00
Jiang Jiang Jian 964db79c0e Merge branch 'docs/add_a_note_to_mck_io_num_v4.4' into 'release/v4.4'
docs: add a note to mck_io_num: for esp32, only gpio0/gpio1/gpio3 can be set (v4.4)

See merge request espressif/esp-idf!16694
2022-03-07 11:00:25 +08:00
Island 3c9657fa4e Merge branch 'feature/add_proxy_conn_and_disconn_event_v4.4' into 'release/v4.4'
ble_mesh: stack: Add proxy server connect and disconnect event (v4.4)

See merge request espressif/esp-idf!16993
2022-03-06 14:10:20 +08:00
wangjialiang 90083fcbb7 ble_mesh: stack: Bugfix the proxy client abnormal disconnection 2022-03-04 12:33:15 +00:00
wangjialiang 1016801eaf ble_mesh: stack: Add proxy server connect and disconnect event 2022-03-04 12:33:15 +00:00
Martin Gaňo eed93ac5bb Remove line finalization when coredump is active to avoid coredump failure
Closes https://github.com/espressif/esp-idf/issues/8099
2022-03-04 11:40:32 +01:00
Wang Fang 21cdaeade9 docs: add a note to mck_io_num: for esp32, only gpio0/gpio1/gpio3 can be set 2022-03-04 07:00:18 +00:00
Jiang Jiang Jian 380ee4b87a Merge branch 'bugfix/update_stack_init_check_v4.4' into 'release/v4.4'
Nimble: Remove stack initialization status from unwanted functions (v4.4)

See merge request espressif/esp-idf!17234
2022-03-04 14:11:23 +08:00
Jiang Jiang Jian 975b525e03 Merge branch 'bugfix/add_pll_track_feature_mr_4.4' into 'release/v4.4'
Add pll track feature

See merge request espressif/esp-idf!17285
2022-03-04 13:54:19 +08:00
morris f17a435ea7 Merge branch 'refactor/i2s_deprecate_confusing_names_v4.4' into 'release/v4.4'
i2s: Add detailed comments for confusing names (v4.4)

See merge request espressif/esp-idf!16748
2022-03-04 13:18:32 +08:00
Mahavir Jain 103cab3664 Merge branch 'bugfix/tcp_iperf_example_issue_for_4.4' into 'release/v4.4'
wifi:bugfix for iperf issue(backport v4.4)

See merge request espressif/esp-idf!17334
2022-03-04 11:15:11 +08:00
morris 75cfdc63c8 Merge branch 'ci/test_utils_ipc_stack_v4.4' into 'release/v4.4'
CI: increase IPC stack size for test_utils configs (v4.4)

See merge request espressif/esp-idf!17353
2022-03-04 10:44:19 +08:00
Marius Vikhammer 03cf81087b CI: increase IPC stack size for test_utils configs 2022-03-04 09:19:09 +08:00
Ivan Grokhotkov 89f57f3402 Merge branch 'bugfix/rom_time_t_size_deps_v4.4' into 'release/v4.4'
esp_rom: remove functions which depend on sizeof(struct stat) and all their callers (v4.4)

See merge request espressif/esp-idf!17040
2022-03-04 04:38:42 +08:00
Jiang Jiang Jian 169008616b Merge branch 'bugfix/a2dp_sniff_v4.4' into 'release/v4.4'
Fix crash when host exit sniff mode(v4.4)

See merge request espressif/esp-idf!17313
2022-03-03 23:37:37 +08:00
morris aa260a9376 Merge branch 'bugfix/i2s_mono_issue_on_c3_s3_v4.4' into 'release/v4.4'
🔧 i2s: fix bug of switching mono/stereo mode by 'i2s_set_clk' on c3/s3 (v4.4)

See merge request espressif/esp-idf!17331
2022-03-03 21:54:20 +08:00
Roland Dobai 524da1e4af Tools/idf_size.py: Support .noinit sections
Closes https://github.com/espressif/esp-idf/issues/8428
2022-03-03 13:55:46 +01:00
Roland Dobai 68a8a7de0d tools/idf_size.py: Identify objects without extension in MAP files 2022-03-03 13:55:46 +01:00
morris 0f11ac2bd3 Merge branch 'bugfix/i2s_dac_incorrect_clock_v4.4' into 'release/v4.4'
i2s: fix adc/dac clock calculation (v4.4)

See merge request espressif/esp-idf!17336
2022-03-03 20:37:43 +08:00
Mahavir Jain a472035d97 Merge branch 'feature/websocket_server_support_close_handle_v4.4' into 'release/v4.4'
esp_http_server: Websocket CLOSE frame can support callback function (backport v4.4)

See merge request espressif/esp-idf!17339
2022-03-03 18:40:34 +08:00
Mahavir Jain e6bbfb085f Merge branch 'bugfix/http_client_body_v4.4' into 'release/v4.4'
esp_http_client: Fix data corruption in http_on_body callback (v4.4)

See merge request espressif/esp-idf!17314
2022-03-03 18:29:26 +08:00
Shang Zhou d7f8526207 docs: add note for MALLOC_CAP_DMA for ESP32-S2 according to customer feedback 2022-03-03 16:54:18 +08:00
xueyunfei e00580109b examples/common_components: iperf: fix closing of client socket in TCP server mode
Details of the problem : After iperf ended, the socket was not closed, resulting in the WIFI buffer not being released.
2022-03-03 15:47:58 +08:00
yuanjm 3b91281c91 esp_http_server: Websocket CLOSE frame can support callback function
Closes https://github.com/espressif/esp-idf/issues/7493
2022-03-03 15:46:09 +08:00
laokaiyao 299d496c30 i2s: add detailed comments to some fileds (v4.4) 2022-03-03 05:55:35 +00:00
laokaiyao 15e8601cfc i2s: add mclk_div underflow check
Closes https://github.com/espressif/esp-idf/issues/8344
2022-03-03 12:23:47 +08:00
Stephan Hadinger 19f4eca4b9 Fix for mclk/bclk divisors #8326
Merges https://github.com/espressif/esp-idf/pull/8327
2022-03-03 12:23:47 +08:00
Shubham Kulkarni 7600869c35 esp_http_client: Cache received data in http_on_body callback.
This change fixes issue with data loss when multiple body chunks are
received after calling esp_http_client_fetch_headers.
2022-03-03 03:54:37 +00:00
laokaiyao 86d78c1592 i2s: fix bug of switching mono/stereo mode by 'i2s_set_clk' on c3/s3 2022-03-03 03:23:41 +00:00
Michael (XIAO Xufeng) eff03cbbd9 Merge branch 'feat/support_mxic_unlock_v4.4' into 'release/v4.4'
spi_flash: support unlock MXIC flash chips (v4.4)

See merge request espressif/esp-idf!17251
2022-03-03 11:13:09 +08:00
xiongweichao d8c7c41a43 Fix crash when host exit sniff mode 2022-03-03 02:59:31 +00:00
Marius Vikhammer 1690785432 spi flash: fix cache accessed while disabled issues at -O0
mask_get_id and gpio_hal_iomux_func_sel were called while cache
is disabled, but were not inlined as expected at -0O.
Force these functions to always be inlined.
2022-03-03 09:45:22 +08:00
Marius Vikhammer 3a7ec8acfa freertos: always inline xPortSetInterruptMaskFromISR and vPortClearInterruptMaskFromISR
These were called from IRAM context where the caller expect them to be inlined
and accessible when cache is disabled. This was not the case when compiled with -O0.

Closes https://github.com/espressif/esp-idf/issues/8301
2022-03-03 09:44:31 +08:00
Mahavir Jain 6ee5e622e8 Merge branch 'bugfix/http_client_ci_v4.4' into 'release/v4.4'
esp_http_client example: Use dl.espressif.com URL for performing request with Range header (v4.4)

See merge request espressif/esp-idf!17316
2022-03-03 00:55:23 +08:00
Jiang Jiang Jian f0e894e540 Merge branch 'bugfix/remove_c_series_chips_unsupported_efuse_field_backport_v4.4' into 'release/v4.4'
efuse: free esp32c3/esp32h2 unused efuse field (backport v4.4)

See merge request espressif/esp-idf!17292
2022-03-02 18:36:13 +08:00
Mahavir Jain 05bf1cd0f5 Merge branch 'fix/prod_mode_in_configure_ds_script_v4.4' into 'release/v4.4'
configure_ds.py: Fix the error for prod mode. They script now only verifies... (v4.4)

See merge request espressif/esp-idf!17209
2022-03-02 17:19:23 +08:00
Mahavir Jain 27e49aee72 Merge branch 'bugfix/check_chip_id_at_start_ota_v4.4' into 'release/v4.4'
esp_https_ota: fix for checking chip id at start of OTA (v4.4)

See merge request espressif/esp-idf!17220
2022-03-02 17:19:14 +08:00
morris 5f56bbd2d0 Merge branch 'bugfix/rtcio_increase_size_v4.4' into 'release/v4.4'
sleep: fixed ext1 cannot wakeup via RTCIO >= 18 issue (v4.4)

See merge request espressif/esp-idf!17201
2022-03-02 16:53:05 +08:00
Mahavir Jain ae2a6e40ab Merge branch 'bugfix/spiffs_example_test_v4.4' into 'release/v4.4'
examples/spiffs: increase test timeout (v4.4)

See merge request espressif/esp-idf!17265
2022-03-02 16:51:59 +08:00
morris 64f41ed6c4 Merge branch 'bugfix/bootloader_uart_custom_gpio_v4.4' into 'release/v4.4'
bootloader: fixed the issue custom_uart_gpio doesn't take effect (v4.4)

See merge request espressif/esp-idf!17307
2022-03-02 16:50:49 +08:00
morris 2e8df440c1 Merge branch 'feature/usb_host_cleanup_v4.4' into 'release/v4.4'
USB: Host stack cleanup and QOL update + wTotalLength Fix + omit MSC reset (v4.4.1)

See merge request espressif/esp-idf!16678
2022-03-02 16:49:38 +08:00
Roland Dobai 0ccee00059 Merge branch 'bugfix/coredump_data_section_v4.4' into 'release/v4.4'
espcoredump: fix a bug where tracked DRAM data where not dumped (v4.4)

See merge request espressif/esp-idf!17120
2022-03-02 16:48:00 +08:00
Roland Dobai 66e6cac168 Merge branch 'bugfix/tools_fix_gdb_2021r2_patch3_v4.4' into 'release/v4.4'
tools: update esp-2021r2-patch3 toolchain for fixing GDB (v4.4)

See merge request espressif/esp-idf!17245
2022-03-02 16:47:04 +08:00
Michael (XIAO Xufeng) 143c62d95d Merge branch 'bugfix/uart_custom_isr_test_disable_brk' into 'release/v4.4'
UART: Fix custom ISR unit test (v4.4)

See merge request espressif/esp-idf!17232
2022-03-02 16:45:07 +08:00
Shubham Kulkarni 81f8dce34c examples/esp_http_client: Use dl.espressif.com URL for performing request with Range header
esp_http_client_test.py: Add check for range request log
2022-03-02 13:20:28 +05:30
songruojing 2ef6b8845b uart: fixed reset logic on ESP32-S3 2022-03-02 02:42:46 +08:00
songruojing bdd7610e66 uart: fixed incorrect channel number on ESP32S2, S3 and C3 2022-03-02 02:42:06 +08:00
Michael (XIAO Xufeng) 8543d1b88a bootloader: fixed the issue custom_uart_gpio doesn't take effect 2022-03-02 02:40:45 +08:00
Yang Zhao 2bdea81b2a Update ESP32-C3 and ESP32-S3 bt lib and phy lib
Add the pll track feature to keep the ble connection stable when the environment
temprature increase form 0 to 74.
2022-03-01 14:56:47 +08:00
Nachiket Kukade 659306b243 esp_wifi: Always connect Station in PMF mode if possible
While using esp_wifi_set_config, flag pmf_capable defaults to 0.
Users may not bother to enable it, which prevents connection to a
WPA3 AP. Or the AP may reset into WPA3 mode failing the re-connection.
To ensure better security, deprecate the pmf_capable flag and set it to
true internally.
2022-02-28 17:55:42 +05:30
wuzhenghui e6e76195e8 remove in esptool 2022-02-28 17:40:02 +08:00
wuzhenghui 6c2f5a16bb remove esp32h2 unsupported efuse field 2022-02-28 17:33:12 +08:00
wuzhenghui c6aa1cf732 remove esp32c3 unsupported efuse field 2022-02-28 17:26:28 +08:00
Mahavir Jain 377267775c examples/spiffs: increase test timeout
This is to address frequent CI test failure where test most likely
timeouts during SPIFFS formatting operation.
2022-02-24 09:19:53 +05:30
Michael (XIAO Xufeng) e835599979 bootloader: support unlock MXIC flash chips 2022-02-23 16:23:34 +08:00
Anton Maklakov 48f8a7a26e test_apps/panic: GDB in esp-2021r2-patch3 toolchain doesn't contain the fix for interrupted backtraced
Revert "test_apps/panic: remove workaround for incorrect GDB backtrace"

This reverts commit 4548b6da63.
2022-02-23 10:52:05 +07:00
Anton Maklakov 1982883618 tools: update esp-2021r2-patch3 toolchain for fixing GDB
Closes https://github.com/espressif/esp-idf/issues/8065
    Closes https://github.com/espressif/esp-idf/issues/8342
    Closes https://github.com/espressif/openocd-esp32/issues/210
2022-02-23 09:20:43 +07:00
Rahul Tank ae546316d3 Nimble: Check stack initialization status before executing stack command
Previous commit added checks in some functions that can be called
    without stack initalization. Corrected such instances.
2022-02-22 10:26:43 +05:30
Omar Chebib 2fb3824dfa UART: Fix custom ISR unit test
On ESP32, UART_INTR_BRK_DET may be triggered after setting the new ISR handler.
Disable these interrrupts.
2022-02-22 10:54:06 +08:00
Omar Chebib 9a36ced294 espcoredump: add a test for coredump dumped sections 2022-02-22 02:38:00 +00:00
Omar Chebib b868fd2a95 espcoredump: fix a bug where tracked DRAM data where not dumped
Variables marked as COREDUMP_DRAM_ATTR will now be part of the core dump.

* Closes https://github.com/espressif/esp-idf/issues/8151
2022-02-22 02:38:00 +00:00
Omar Chebib 1e117f2f83 UART: RX interrupts are now properly restored after a flush
Added a unit test to make sure the expected behavior happens
2022-02-22 02:28:21 +00:00
Harshit Malpani bf7934aa84 esp_https_ota: fix for checking chip id at start of OTA 2022-02-21 13:55:53 +05:30
Aditya Patwardhan e37d149233 configure_ds.py: Fix the error for prod mode. They script now only verifies the purpose in the prod mode.
Closes https://github.com/espressif/esp-idf/issues/8285
2022-02-21 01:33:00 +05:30
Martin Valik d2a2a315ba Bugfix: omit MSC reset during initialization 2022-02-18 15:51:05 +08:00
Martin Valik e898e4b2f5 Bugfix: make wTotalLength uint16_t to avoid truncation 2022-02-18 15:51:05 +08:00
Darian Leung c46b74191e usb: Add USB Host Library documentation
This commit adds the USB Host Library documentation and fixes some nitpicks
in the Host Stack types.

Closes https://github.com/espressif/esp-idf/issues/6408
2022-02-18 15:51:05 +08:00
Darian Leung 6f6986277c usb: Add USB Host Library Example
The commit adds a basic example for the USB Host Library
2022-02-18 15:51:05 +08:00
Darian Leung ebd058c8c9 usb: Update USB Host Library
This commit updates the USB Host Library as follows:

- usb_helpers.h
    - Removed dependency on USB Host Library API
    - Added function to print string descriptors
- usbh
    - Fixed bug where an interface/endpoint could be claimed/allocated multiple times
    - Removed redundant device ref_count change
- Added unit test for USB Host Library API usage
2022-02-18 15:51:05 +08:00
Darian Leung 50bbdbc1de usb: Hub Driver and USBH recover port automatically after disconnection
This commit updates the Hub Driver and USBH as follows:
- Updated communication mechanism between Hub Driver and USBH
    - USBH notifies the Hub Driver via Hub request callback (usbh_hub_req_cb_t)
    - Hub Driver notifies the USBH via usbh_hub_pass_event()
- Hub Driver now defers all event handling to hub_process.
- Hub Driver and USBH will now automatically recover the port after a disconnected
    device has been closed.
- Fixed incorrect assert in usbh_dev_close()
2022-02-18 15:51:05 +08:00
Darian Leung ea6de613bf usb: Hub Driver Update and Refactor
Hub Driver is refactored as follows:

This commit update and refactors the Hub Driver as follows:

- Refactored enumeration state machine and stage functions
    - Enumeration stage is now incremented
    - Combined transfer stages of enumeration into common functions
- Comments updated
- Fixed usbh_hal_disable_debounce_lock() that would cause root_port_handle_events()
    to fail the HCD_PORT_CMD_RESET call because the previous port connection interrupt
    was not cleared.

The following features were added to the Hub Driver

- Enumeration config descriptor is now fetched in two separate stages
    - Header is fetched first to determine the wTotalLength of the descriptor
    - Fetching the full descriptor will request exactly wTotalLength bytes
    - This works around some non-compliant devices that will babble/return zero
        when requesting a length > wTotalLength
    - Closes https://github.com/espressif/esp-idf/issues/7799
- Enumeration now stores string descriptors
    - The Manufacturer, Product, and Serial Number string descriptors are
        now read and stored during enumeration
    - String descriptors are now part of usb_device_info_t
- Added unit test to test enumeration
2022-02-18 15:51:05 +08:00
Darian Leung 7f09fe1b23 usb: USB Host stack uses USB PHY driver
This commit updates the USB Host stack to use the USB PHY driver. The
USB PHY and the OTG Controller should now both be setup/deleted using
usb_new_phy() and usb_del_phy() respectively.

- The hcd_install() now expects the USB PHY and OTG Contorller to be
    already setup before it is called
- usb_host_install() now has an option to skip calling usb_del_phy() if
    the user wants to setup their own USB PHY (e.g., in the case of using
    and external PHY).
- CDC-ACM and MSC examples/test updated to use internal PHY

Closes https://github.com/espressif/esp-idf/issues/8061
2022-02-18 15:51:05 +08:00
Darian Leung b3b8ed79c8 usb: HCD multiple fixes
This commit fixes the following bugs in the HCD

- HCD control pipes fill incorrect transfer size

_buffer_fill_ctrl() would fill the transfer descriptors length with
wLength instead of transfer->num_bytes. Therefore, the remaining length
would be incorrect when a control transfer requests more bytes than are
available.

- Fix USB_TRANSFER_FLAG_ZERO_PACK behavior

The previous behavior of USB_TRANSFER_FLAG_ZERO_PACK was incorrect, and did not
support interrupt pipes. A zero length packet can now be added to Bulk/Interrupt
OUT transfers where the length is a multiple of the endpoint's MPS.

- Fixed HCD port suspend and resume test case

Halting a control pipe mid control transfer can lead some test devices to get stuck
2022-02-18 15:51:05 +08:00
Darian Leung 8888179439 usb: Tidy up usbh
- Remove enum_todo_flags from usbh
- USBH move config_desc to constant fields
2022-02-18 15:51:05 +08:00
Zim Kalinowski 000d3823bb Merge branch 'cumulative_backport_into_v4.4' into 'release/v4.4'
Cumulative backport MR (v4.4)

See merge request espressif/esp-idf!17194
2022-02-18 07:16:52 +00:00
Marius Vikhammer cdfd59cc0e docs: update copyright date for docs automatically 2022-02-18 12:59:12 +08:00
Zim Kalinowski a8c073c1cc fixed trailing whitespace 2022-02-18 12:58:53 +08:00
Zim Kalinowski dc4783945a freertos: Move Espressif's specific esp_reent_init into collective ifdef 2022-02-18 12:58:53 +08:00
Omar Chebib 7caacf20c1 Documentation: added ESP32S3 interrupt allocation doc 2022-02-18 12:36:05 +08:00
KonstantinKondrashov 90c63f7250 esp_system: ipc_isr does not use its own initialization task, it is done from ipc_task()
It helps to reduce the memory usage at startup.

Closes https://github.com/espressif/esp-idf/issues/8111
2022-02-18 12:36:05 +08:00
Michael (XIAO Xufeng) 21b80a969f soc: updated soc_caps about rtc_io and the format 2022-02-18 11:44:43 +08:00
Michael (XIAO Xufeng) fd20ac807c sleep: fixed ext1 cannot wakeup via RTCIO >= 18 issue
Closes https://github.com/espressif/esp-idf/issues/8231
2022-02-18 11:44:20 +08:00
Jakob Hasse c904b4807b bugfix (nvs): Fixed issues found by Coverity
*  Fixed potential memory leak
*  Fixed wrong strncpy usage
*  Fixed potential out of bounds access
2022-02-17 22:22:26 +08:00
Marius Vikhammer f3639dafc8 freertos: add pm_trace header include 2022-02-17 22:22:26 +08:00
Chip Weinberger 9cc4c2f34d SPIRAM: 'Abort on allocation failure' should not trigger when there is available SPI ram
(cherry picked from commit 8dcdb2f363fd3fa00bd77e4bd75e7c73d6c7d0fb)
2022-02-17 22:22:26 +08:00
Jiang Jiang Jian 5ff09f0a06 Merge branch 'bugfix/modbus_allow_address_gaps_in_master_data_dict_v44' into 'release/v4.4'
freemodbus: allow address gaps in master data dictionary (support of UID field in MBAP) (backport v4.4)

See merge request espressif/esp-idf!16896
2022-02-17 08:38:57 +00:00
Alex Lisitsyn d2399f6d8c freemodbus: allow address gaps in master data dictionary (support of UID field in MBAP) (backport v4.4) 2022-02-17 08:38:56 +00:00
Jiang Jiang Jian b2ef617a34 Merge branch 'bugfix/fix_ble_adv_underrun_error_v4.4' into 'release/v4.4'
components/bt: Fix ble adv_underrun issue(backport v4.4)

See merge request espressif/esp-idf!17164
2022-02-17 08:30:38 +00:00
Jiang Jiang Jian 38cca53445 Merge branch 'bugfix/assoc_comeback_fail_issue_v4.4' into 'release/v4.4'
Fix assoc comeback causing invalid state & FTM cleanup (Backport v4.4)

See merge request espressif/esp-idf!17170
2022-02-17 04:42:52 +00:00
Jiang Jiang Jian 98c5c7bac8 Merge branch 'bugfix/enterprise_certs_weak_md_v4.4' into 'release/v4.4'
esp_wifi: Fixed issue of weak md for certificates in wifi_enterprise example.(v4.4)

See merge request espressif/esp-idf!16979
2022-02-17 04:40:12 +00:00
Jiang Jiang Jian b39d0dbf2c Merge branch 'bugfix/usb_default_print_wifi_v4.4' into 'release/v4.4'
esp_phy: enable usb under default(without choosing USB_SERIAL_JTAG) (backport v4.4)

See merge request espressif/esp-idf!17075
2022-02-17 04:15:54 +00:00
Jiang Jiang Jian f9927119b8 Merge branch 'bugfix/efuse_timesettings_for_esp32s3_v4.4' into 'release/v4.4'
efuse: Fixes eFuse timesettings issue on esp32S3 (v4.4)

See merge request espressif/esp-idf!17177
2022-02-17 04:00:14 +00:00
Jiang Jiang Jian 174bd31bc0 Merge branch 'bugfix/usb_no_rom_log_v4.4' into 'release/v4.4'
USB_SERIAL_JTAG: Fix the issue that there is no rom log when restarting(backport v4.4)

See merge request espressif/esp-idf!17073
2022-02-17 03:59:36 +00:00
Marius Vikhammer 6664e6cf43 ds: update gen_digital_signature_tests.py to handle different max key sizes
Max key size is now decided by target parameter, and related parameters are
no longer hard coded.

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


(cherry picked from commit 4a3f50faa0)
2022-02-17 11:24:54 +08:00
morris 35d5a30d47 Merge branch 'feature/adc_calibration_version_2_on_c3_v4.4' into 'release/v4.4'
adc: upgrade adc calibration algorithm to version 2 on c3 (v4.4)

See merge request espressif/esp-idf!17049
2022-02-17 03:04:35 +00:00
morris 11440c8757 Merge branch 'bugfix/gpio_intr_on_core1_s3_v4.4' into 'release/v4.4'
gpio: Fix the bug that gpio interrupt cannot be triggered on app cpu on ESP32S3 (backport v4.4)

See merge request espressif/esp-idf!16595
2022-02-17 01:47:46 +00:00
David Čermák ae6f171370 Merge branch 'bugfix/mdns_null_deref_fuzzer_v4.4_' into 'release/v4.4'
mdns: Fix potential null deref reported by fuzzer test(v4.4)

See merge request espressif/esp-idf!17147
2022-02-17 01:21:00 +00:00
David Čermák bf7266312c Merge branch 'bugfix/esp_eth_start_tx_buff_v4.4_followup' into 'release/v4.4'
Fixed ESP32 EMAC driver `insufficient TX buffer size` (v4.4 followup)

See merge request espressif/esp-idf!16666
2022-02-16 18:33:12 +00:00
David Čermák 299b6538e4 Merge branch 'bugfix/protocols_test_on_eth_v4.4' into 'release/v4.4'
ci/mqtt: Move protocol tests to eth runners(v4.4)

See merge request espressif/esp-idf!17010
2022-02-16 18:31:54 +00:00
David Čermák 538401aa06 Merge branch 'contrib/github_pr_8337_v4.4' into 'release/v4.4'
Set success when closing socket (GitHub PR) (v4.4)

See merge request espressif/esp-idf!17097
2022-02-16 18:31:30 +00:00
KonstantinKondrashov d011404607 esptool: Fixes esp32h2 target name 2022-02-17 00:14:45 +08:00
Nachiket Kukade 908874c642 esp_wifi: Update wifi lib
1. Fix assoc comeback causing invalid state
2. Better cleanup in some FTM failure cases
2022-02-16 15:51:50 +05:30
KonstantinKondrashov 5c7b597594 efuse: Fixes eFuse timesettings issue on esp32S3 2022-02-16 15:15:27 +08:00
songruojing 60b0d30d9c ci: increase target-test.yml UT_T1_1 job to support newly added LEDC fade ut tests
(cherry picked from commit f5cbe89487)
2022-02-16 15:02:46 +08:00
songruojing 83edf2dbcf ledc: Fix FADE_NO_WAIT mode concurrency problem.
Add test cases for fade concurrency issue and fade timing check.

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

(cherry picked from commit be2ab09832)
2022-02-16 15:02:45 +08:00
songruojing 574f2c6a17 ledc: bugfix - Simplify the procedure to perform a one-time duty update
Avoid adding one extra fade cycle when performing a one-time duty update.
Add some notes to ledc_get_duty and ledc_update_duty APIs, so that users
are aware of when the new duty will be effective.

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

(cherry picked from commit e175086226)
2022-02-16 15:02:45 +08:00
Armando 175132a874 adc: upgrade adc calibration algorithm to version 2 on c3 2022-02-16 14:58:42 +08:00
Ivan Grokhotkov 492afe4d4a esp_adc_cal: move esp_adc_cal_get_voltage into common source file 2022-02-16 14:58:42 +08:00
Ivan Grokhotkov be542db463 esp_adc_cal: simplify CMakeLists.txt 2022-02-16 14:58:42 +08:00
songruojing 9991b1b021 ci: increase target-test.yml UT_T1_1 job to support newly added ut test 2022-02-16 14:52:39 +08:00
songruojing 41e452e7d8 gpio: Fix the bug that gpio interrupt cannot be triggered on app cpu on ESP32S3
Closes https://github.com/espressif/esp-idf/issues/7885

(cherry picked from commit 91f1159f9c)
2022-02-16 14:50:51 +08:00
songruojing b722e6f6ec gpio: Bugfix - Move esp_intr_free() out of the critical section in gpio_uninstall_isr_service()
Closes https://github.com/espressif/esp-idf/issues/5571

Fix the bug that if the API was called from one core to free the interrupt source on the other core, it would trigger interrupt watchdog.

(cherry picked from commit 0e8286c57b)
2022-02-16 14:50:51 +08:00
Zim Kalinowski 81861d03c0 Merge branch 'bugfix/fix_i2c_crash_v4.4' into 'release/v4.4'
I2C: Fix I2C Master operation with repeated start condition (backport v4.4)

See merge request espressif/esp-idf!17118
2022-02-16 06:30:44 +00:00
David Cermak c0e105cc41 mdns: Fix potential null deref reported by fuzzer test 2022-02-16 06:23:57 +00:00
Zim Kalinowski 33f7009bef Merge branch 'bugfix/i2c_spiram_bug_v4.4' into 'release/v4.4'
i2c: fix buffer check when SPIRAM used as a heap (backport v4.4)

See merge request espressif/esp-idf!17098
2022-02-16 05:16:32 +00:00
Jiang Jiang Jian d483bd9518 Merge branch 'feature/support_eap_fast_release_v4.4' into 'release/v4.4'
Add support for EAP-FAST authentication (backport v4.4)

See merge request espressif/esp-idf!16279
2022-02-16 03:28:15 +00:00
Jiang Jiang Jian 11ec6ed917 Merge branch 'bugfix/eap_client_crash_v4.4' into 'release/v4.4'
wpa_supplicant: Fix memory corruption (v4.4)

See merge request espressif/esp-idf!17128
2022-02-16 03:27:47 +00:00
Jiang Jiang Jian e3a5a85e2f Merge branch 'feature/gcov_esp32c3_v4.4' into 'release/v4.4'
debug_stubs and gcov: Refactor and add support for RISCV (v4.4)

See merge request espressif/esp-idf!17068
2022-02-16 03:26:49 +00:00
Zim Kalinowski 6ba07ccfaa Merge branch 'bugfix/typo_in_i2c_macro_v4.4' into 'release/v4.4'
I2C: Fix typo in I2C_TIMING_VAL_ERR_STR macro name (backport v4.4)

See merge request espressif/esp-idf!17116
2022-02-16 02:49:01 +00:00
Zim Kalinowski 118478cd51 Merge branch 'docs/add_an_example_list_for_esp32-wrover-kit_v4.4' into 'release/v4.4'
docs: add an example list for esp-wrover-kit (v4.4)

See merge request espressif/esp-idf!16691
2022-02-16 02:39:04 +00:00
Zim Kalinowski 192503abbb Merge branch 'example/nimble_readme_cleanup_v4.4' into 'release/v4.4'
docs/examples Changes on README files on Bluetooth Examples (v4.4)

See merge request espressif/esp-idf!16374
2022-02-16 02:30:04 +00:00
Zim Kalinowski ee908e4ef1 Merge branch 'feature/mdns_null_value_txt_v4.4' into 'release/v4.4'
mdns: Support for null-value TXT records (v4.4)

See merge request espressif/esp-idf!17172
2022-02-16 02:27:25 +00:00
xiewenxiang 35b2b3e24c components/bt: Fix ble adv_underrun issue
components/bt: Fix LLCP collision for channel map update
2022-02-16 00:39:00 +08:00
David Cermak a145a5ee48 mdns: Use memcpy() for copy to support non-text TXTs 2022-02-15 13:32:53 +01:00
David Cermak ec9dbd922d mdns: Support for null-value TXT records
Closes https://github.com/espressif/esp-idf/issues/8267
2022-02-15 13:32:53 +01:00
Cao Sen Miao 93be7d5192 usb_serial_jtag: remove the strict condition check in esp_phy 2022-02-15 18:56:49 +08:00
Cao Sen Miao bf523af21d usb_serial_jtag: can print when wifi enabled by default
Closes https://github.com/espressif/esp-idf/issues/8131
2022-02-15 18:56:48 +08:00
Cao Sen Miao a74e06560b USB_SERIAL_JTAG: Fix the issue that there is no rom log when restarting 2022-02-15 18:56:06 +08:00
Zim Kalinowski 83daa6dabb Merge branch 'bugfix/bump_docs_docker_tag_v4.4' into 'release/v4.4'
ci: bump esp-docs image tag to v5

See merge request espressif/esp-idf!17157
2022-02-15 10:15:14 +00:00
Marius Vikhammer ed8f29c406 ci: bump esp-docs image tag to v5 2022-02-15 11:55:01 +08:00
Michael (XIAO Xufeng) 8c61c5c565 Merge branch 'bugfix/lcd_rgb_memory_alignment_v4.4' into 'release/v4.4'
rgb lcd memory alignment(v4.4)

See merge request espressif/esp-idf!16883
2022-02-14 15:34:49 +00:00
morris 21b6c46d11 Merge branch 'bugfix/sdio_slave_dma_desc_int_v4.4' into 'release/v4.4'
sdio_slave: Fixed the issue that DMA descriptors allocated to non-DMA capable area (v4.4)

See merge request espressif/esp-idf!17135
2022-02-14 06:27:47 +00:00
Jiang Jiang Jian 13d30652cc Merge branch 'bugfix/wps_fixes_v4.4' into 'release/v4.4'
wpa_supplicant: Add WPS Fixes (Backport V4.4)

See merge request espressif/esp-idf!17064
2022-02-14 06:24:16 +00:00
Jiang Jiang Jian 71b81e4a01 Merge branch 'bugfix/support_esp32s2_eco1_v4.4' into 'release/v4.4'
esp_phy: Update ESP32S2 phy lib to support eco1 chip(V4.4)

See merge request espressif/esp-idf!16715
2022-02-14 05:55:29 +00:00
Michael (XIAO Xufeng) 21b4cd8325 sdio_slave: fixed the issue DMA desc not capable 2022-02-13 22:35:04 +08:00
Michael (XIAO Xufeng) c2c4b126f7 Merge branch 'feature/support_new_psram_v4.4' into 'release/v4.4'
psram: add ESP32-D0WD-R2-V3 support(backport v4.4)

See merge request espressif/esp-idf!16705
2022-02-13 14:13:38 +00:00
Michael (XIAO Xufeng) 246f72020f Merge branch 'bugfix/modbus_port_fix_lgpl_licensed_files_v4.4' into 'release/v4.4'
freemodbus: fix port contains lgpl licensed files (v4.4)

See merge request espressif/esp-idf!16550
2022-02-12 20:43:22 +00:00
Kapil Gupta 136c5b8204 wpa_supplicant: Fix invalid memory dereference 2022-02-12 10:32:33 +05:30
Dmitry Koptsov f60a914bae I2C: Fix I2C Master operation with repeated start condition
* Closes https://github.com/espressif/esp-idf/pull/8353
2022-02-11 15:37:24 +08:00
paul 8f3b47da39 I2C: Fix typo in I2C_TIMING_VAL_ERR_STR macro name
* Closes https://github.com/espressif/esp-idf/pull/8012
2022-02-11 15:29:52 +08:00
Mahavir Jain 47583770a1 Merge branch 'bugfix/fix_esp_http_client_example_v4.4' into 'release/v4.4'
esp_http_client: Fix memory leak in esp_http_client_example (backport v4.4)

See merge request espressif/esp-idf!17095
2022-02-11 04:56:29 +00:00
Roland Dobai 83ef7b6a95 Merge branch 'feature/limit_component_manager_version' into 'release/v4.4'
Tools: Limit idf-component-manager version

See merge request espressif/esp-idf!16405
2022-02-10 16:07:02 +00:00
Michael (XIAO Xufeng) 730ca0ea43 Merge branch 'bugfix/cpu_reset_perip_clk_disable_v4.4' into 'release/v4.4'
esp_system: change range comparsion for reset reason to specifc cpu reset reason comparison (backport v4.4)

See merge request espressif/esp-idf!15898
2022-02-10 10:32:09 +00:00
Hrudaynath Dhabe 0658a5b1da esp_wifi: Add an example for EAP-FAST. 2022-02-10 15:55:21 +05:30
Hrudaynath Dhabe e21832cabb esp_wifi: Add support for EAP-FAST authentication method 2022-02-10 15:54:15 +05:30
Michael (XIAO Xufeng) 8b86834a72 Merge branch 'bugfix/gpio_pin_num_fix_v4.4' into 'release/v4.4'
gpio: Fix some gpio pin num errors on esp32s2 and esp32c3 (backport v4.4)

See merge request espressif/esp-idf!16594
2022-02-10 10:21:52 +00:00
Michael (XIAO Xufeng) 954d52ff3a Merge branch 'flash/add_th_support_v4.4' into 'release/v4.4'
spi_flash: add support for th 1M flash(backport v4.4)

See merge request espressif/esp-idf!16714
2022-02-10 09:40:40 +00:00
Michael (XIAO Xufeng) fb1695ade7 Merge branch 'bugfix/fix_spi_cs_hold_time_issue_v4.4' into 'release/v4.4'
spi_master: fix spi cs_ena_posttrans issue (v4.4)

See merge request espressif/esp-idf!16686
2022-02-10 09:12:15 +00:00
morris 38b5c012f9 Merge branch 'bugfix/rmt_s2_doesnt_support_rx_wrap_v4.4' into 'release/v4.4'
rmt: do not support rx wrap on esp32s2 (v4.4)

See merge request espressif/esp-idf!17076
2022-02-10 09:11:32 +00:00
Omar Chebib 98647cf351 i2c: fix buffer check when SPIRAM used as a heap
* Closes https://github.com/espressif/esp-idf/issues/8173
2022-02-10 16:16:01 +08:00
Mahavir Jain 5355ba06f1 transport_ssl: use return value from close for non-TLS case 2022-02-10 13:03:32 +05:30
Dániel Buga 9e892fbf46 Set success when closing socket
Closes https://github.com/espressif/esp-idf/pull/8337
Closes IDFGH-6709
2022-02-10 13:02:58 +05:30
yuanjm 1b8c04bb57 esp_http_client: Fix memory leak in esp_http_client_example
Closes https://github.com/espressif/esp-idf/issues/8346
2022-02-10 14:35:13 +08:00
chenjianxing 50302e4157 esp_phy: Update ESP32S2 phy lib to support eco1 chip 2022-02-10 14:13:02 +08:00
Mahavir Jain 14b52e9d83 Merge branch 'bugfix/improve_ota_test_success_rate_v4.4' into 'release/v4.4'
OTA examples: Reduce example test failure rate (v4.4)

See merge request espressif/esp-idf!16613
2022-02-10 05:52:27 +00:00
Wang Meng Yang c7b9f94733 Merge branch 'bugfix/fix_bluedroid_compile_issue_v4.4' into 'release/v4.4'
components/bt: Fix bluedroid compile issue(backport release/v4.4)

See merge request espressif/esp-idf!16592
2022-02-09 11:28:57 +00:00
Wang Meng Yang 5cc185c442 Merge branch 'bugfix/controller_hci_uart_esp32c3_readme_v4.4' into 'release/v4.4'
Added support for ESP32-S3 chip in controller_hci_uart_esp32c3_and_esp32s3's README (v4.4)

See merge request espressif/esp-idf!16738
2022-02-09 11:18:40 +00:00
Shubham Kulkarni 4ecd0ef9fc advanced_https_ota: Move example tests on ethernet runners
Move BT tests to nightly run
2022-02-09 15:03:04 +05:30
Shubham Kulkarni 42e389263d native_ota_example: Move all example tests to ethernet based runners 2022-02-09 15:03:04 +05:30
Shubham Kulkarni f2c5c8e6d8 simple_ota_example: Move redundant and failing example_tests to nightly run 2022-02-09 15:03:04 +05:30
Shubham Kulkarni 690d7a5d6b target-test.yml: Add EXAMPLE_ETH_OTA runner to OTA on ethernet based runners 2022-02-09 15:03:04 +05:30
morris 956c6b889f rmt: do not support rx wrap on esp32s2
Closes https://github.com/espressif/esp-idf/issues/8354
2022-02-09 17:29:09 +08:00
Jiang Jiang Jian c8075df214 Merge branch 'bugfix/a2dp_source_congest_v4.4' into 'release/v4.4'
component_bt: Fixed a2dp source audio data packet congestion causing choppy audio in a2dp sink (v4.4)

See merge request espressif/esp-idf!16733
2022-02-09 08:16:01 +00:00
Jiang Jiang Jian 4158da586b Merge branch 'demo/opt_a2dp_demo_doc_v4.4' into 'release/v4.4'
demo/optimize a2dp demo documents (v4.4)

See merge request espressif/esp-idf!16587
2022-02-09 08:13:55 +00:00
Island afe82b4e1b Merge branch 'bugfix/filter_repeated_packages_v4.4' into 'release/v4.4'
filter repeated packages but not send response(v4.4)

See merge request espressif/esp-idf!16817
2022-02-09 06:18:43 +00:00
Yuan Hong Hui 006b4456e7 filter repeated packages but not send response(v4.4) 2022-02-09 06:18:42 +00:00
Island 4b7eea25ca Merge branch 'feature/pro_recv_hb_forv4.4' into 'release/v4.4'
provisioner receive heartbeat message (v4.4)

See merge request espressif/esp-idf!16636
2022-02-09 06:18:14 +00:00
Yuan Hong Hui 006c679f85 provisioner receive heartbeat message (v4.4) 2022-02-09 06:18:13 +00:00
Krzysztof Budzynski 690ff75346 Merge branch 'doc/esp32s3_sdmmc_v4.4' into 'release/v4.4'
docs: peripherals: update SD related docs for ESP32-S3 (v4.4)

See merge request espressif/esp-idf!17043
2022-02-09 03:28:57 +00:00
Krzysztof Budzynski c2a6f0fe29 Merge branch 'bugfix/perfmon_s3_v4.4' into 'release/v4.4'
perfmon: re-enable example for ESP32-S3, remove warning from the docs (v4.4)

See merge request espressif/esp-idf!17042
2022-02-09 03:28:01 +00:00
Alexey Gerenkov 54e416d3b8 docs: Updates apptrace menuconfig options in examples 2022-02-08 22:25:33 +03:00
Alexey Gerenkov e366d569d8 example/gcov: Adds support for esp32s2, esp32s3, esp32c3 and esp32h2 2022-02-08 22:25:33 +03:00
Alexey Gerenkov 89fe956ebc gcov: Fixes interference of gcov dump with normal IPC calls 2022-02-08 22:25:33 +03:00
Alexey Gerenkov 792f510d0d gcov: Do not use shrunk ROM's fake stdout and stderr FILE struct 2022-02-08 22:24:54 +03:00
Alexey Gerenkov 1bbefc3e5d debug_stubs: Refactor and add support for RISCV 2022-02-08 22:24:54 +03:00
Roland Dobai 1603b8181f Merge branch 'bugfix/win_rename_delay_v4.4' into 'release/v4.4'
Tools: Use delay between rename attempts on Windows in the installer (v4.4)

See merge request espressif/esp-idf!17056
2022-02-08 18:23:56 +00:00
Ivan Grokhotkov 330da63548 Merge branch 'bugfix/nvs_oom_check_wrong_pointer_v4.4' into 'release/v4.4'
nvs: fixed OOM check wrong pointer issue (backport 4.4)

See merge request espressif/esp-idf!16976
2022-02-08 14:54:48 +00:00
Ivan Grokhotkov 6c0c3029ab Merge branch 'bugfix/vfs_open_errno_v4.4' into 'release/v4.4'
vfs: don't overwrite errno by a hard coded ENOENT (Github PR) (v4.4)

See merge request espressif/esp-idf!17044
2022-02-08 14:37:29 +00:00
Kapil Gupta 757445422d wpa_supplicant: Add WPS Fixes
Add following bugfixes

1. Station not able to connect when WPS pin is pressed first on AP.
2. PBC overlap getting detected for selected registrar PIN APs.
3. Station not considering authorised MACs for PIN method.
4. For PIN methodm If no AP is found, station will loop through
   APs in its vicinity and try to do WPS with them one by one till
   WPS timeout occurs. This is for some APs which do not set
   selected registrar correctly.
2022-02-08 17:22:40 +05:30
aleks e26318bcac freemodbus: fix port contains lgpl licensed files
Initial version of freemodbus master port files have been added to ESP-IDF based on https://github.com/armink/FreeModbus_Slave-Master-RTT-STM32.
The overall repository license, at the time of adding these files, has been BSD 3-clause. However at that time, several port files carried LGPL license headers. As the author of these files confirmed in https://github.com/armink/FreeModbus_Slave-Master-RTT-STM32/issues/61#issuecomment-977828450, this wasn't intentional. ESP-IDF version of modbus master port has been rewritten to target FreeRTOS instead of RT-Thread, but the license headers remained from the original version. This commit corrects this, replacing the license of these files with BSD 3-clause.
2022-02-08 12:43:08 +01:00
David Cermak f4e54541f3 ws_client: Optimize example test payloads and timeouts
Important update: NO_DATA_TIMEOUT_SEC=5, as some ws-servers typically send pings in 30s or 10s intervals, so we might never fire shutdown test
2022-02-08 18:15:53 +08:00
David Cermak ff1846bebe ci/websockets: Run ws-client example test on ethernet runners 2022-02-08 18:15:53 +08:00
David Cermak 936bbdc75b ci/mdns: Run mdns test on ethernet runners 2022-02-08 18:15:49 +08:00
David Cermak 63dda9f1d9 ci: Increase parallel job count for Eth runners 2022-02-08 18:15:49 +08:00
David Cermak 2b62d7bfdc ci/mqtt: Move publish-connect test to ethernet runners 2022-02-08 18:15:48 +08:00
David Cermak d24241d5ad ci/mqtt: Move mqtt example tests to ethernet runners 2022-02-08 18:15:48 +08:00
Roland Dobai 18da1180ad Tools: Use delay between rename attempts on Windows in the installer 2022-02-08 11:06:14 +01:00
Jiang Jiang Jian 6934a0164a Merge branch 'bugfix/fix_common_clock_bug_v4.4' into 'release/v4.4'
esp_wifi: fix common clock bug (backport v4.4)

See merge request espressif/esp-idf!16971
2022-02-08 09:10:34 +00:00
Ivan Grokhotkov f98ec313f2 Merge branch 'revert-0a1e309e' into 'release/v4.4'
Revert "Merge branch 'bugfix/temp_disable_f8r8_test_v4.4' into 'release/v4.4'"

See merge request espressif/esp-idf!17037
2022-02-07 14:51:55 +00:00
Mahavir Jain 93855605f3 Merge branch 'bugfix/esp32c3_sysview_examples_build_error_v4.4' into 'release/v4.4'
riscv: fix portSTACK_GROWTH redefinition error (v4.4)

See merge request espressif/esp-idf!17038
2022-02-07 12:48:02 +00:00
Ivan Grokhotkov 23b0cdad8a vfs: add test for errno value after 'open' 2022-02-07 11:36:00 +01:00
hörbert 931dd74da6 vfs: don't overwrite errno by a hard coded ENOENT
Calling "open" in CHECK_AND_CALL sets a perfectly correct errno.
There is no need to overwrite that with a value of ENOENT, since doing
so hides lower level errors like EIO.

Closes https://github.com/espressif/esp-idf/pull/8036
2022-02-07 11:35:59 +01:00
Ivan Grokhotkov aaa2a344c6 docs: peripherals: update SD related docs for ESP32-S3 2022-02-07 11:31:17 +01:00
Ivan Grokhotkov faac0e7589 perfmon: re-enable example for ESP32-S3, remove warning from the docs
Includes minor fix for formatting of code blocks in the example readme
2022-02-07 11:28:57 +01:00
Ivan Grokhotkov 096c013675 esp_rom: remove functions which depend on sizeof(struct stat)
...and all their callers.

With the upcoming switch from sizeof(time_t)==4 to sizeof(time_t)==8,
sizeof(struct stat) is also increasing.

A few newlib functions present in ROM allocate 'struct stat' on the
stack and call _fstat_r on this structure. The implementation of
fstat is provided in ESP-IDF. This implementation will often do
memset(st, 0, sizeof(*st)), where st is 'struct stat*', before setting
some fields of this structure. If IDF is built with sizeof(st)
different from sizeof(st) which ROM was built with, this will lead
to an out-of-bounds write and a stack corruption.

This commit removes problematic ROM functions from the linker script.
Here are the functions which allocate 'struct stat':
* _isatty_r (in ROM)
* __swhatbuf_r, called by __smakebuf_r, called by __swsetup_r and
  __srefill_r (in ROM)
* _fseeko_r (not in ROM)
* glob2 (not in ROM)
* _gettemp (not in ROM)

As a result, these functions are used from libc.a, and use correct
size of 'stat' structure.

Closes https://github.com/espressif/esp-idf/issues/7980
2022-02-07 11:23:59 +01:00
Michael (XIAO Xufeng) 1e80a52de4 Merge branch 'bugfix/i2s_mclk_stopped_when_set_clock' into 'release/v4.4'
i2s: fix mclk stop issue when setting clock (v4.4)

See merge request espressif/esp-idf!16706
2022-02-07 09:47:19 +00:00
Erhan Kurubas 8fc5f8ae55 heap: use HEAP_TRACING_STACK_DEPTH default value for riscv 2022-02-07 09:47:57 +01:00
Erhan Kurubas 5c8bfa9b46 esp32c3: fix portSTACK_GROWTH redefinition error 2022-02-07 09:47:57 +01:00
xiewenxiang 2fe53759c9 components/bt: Fix bluedroid compile issue 2022-02-07 16:04:50 +08:00
Wang Meng Yang 0a0b652815 Merge branch 'bugfix/fix_bluedroid_ble50_adv_data_length_issue_v4.4' into 'release/v4.4'
components/bt: Fix bluedroid ble50 adv data length issue(backport release/v4.4)

See merge request espressif/esp-idf!16579
2022-02-07 08:01:55 +00:00
Lu Ai Jun aae55512b7 Update copyright headers 2022-02-07 07:41:03 +00:00
Lu Ai Jun 371ab10bcd Revert "Merge branch 'bugfix/temp_disable_f8r8_test_v4.4' into 'release/v4.4'"
This reverts merge request !17031
2022-02-07 15:39:25 +08:00
laokaiyao a9df58c776 i2s: fix mclk stopped when setting clock 2022-02-07 15:27:35 +08:00
Armando 1140036424 spi_master: fix spi cs_ena_posttrans issue 2022-02-07 12:19:51 +08:00
Wang Meng Yang 5e5af3606b Merge branch 'bugfix/nimble_spp_v4.4' into 'release/v4.4'
NimBLE :  SPP example fails to build on Windows (v4.4)

See merge request espressif/esp-idf!17013
2022-02-07 02:35:30 +00:00
Zim Kalinowski 7c986a64c7 Merge branch 'feature/adds_tips_to_run_ci_example_tests_v4.4' into 'release/v4.4'
examples: Adds a note on how to meet requirements to run the example_test.py (v4.4)

See merge request espressif/esp-idf!16944
2022-02-06 09:25:40 +00:00
Mahavir Jain 0a1e309ee4 Merge branch 'bugfix/temp_disable_f8r8_test_v4.4' into 'release/v4.4'
ci: temporarily disable MSPI_F8R8 test (v4.4)

See merge request espressif/esp-idf!17031
2022-02-05 05:34:09 +00:00
Ivan Grokhotkov e67ecd998c ci: temporarily disable MSPI_F8R8 test 2022-02-04 15:23:05 +01:00
Mahavir Jain d501a53f2f Merge branch 'feature/mbedtls-2.28.0_v4.4' into 'release/v4.4'
mbedtls: Upgrading to v2.28.0 (v4.4)

See merge request espressif/esp-idf!17004
2022-02-02 13:52:54 +00:00
Isha Pardikar db80244920 Merge branch 'bugfix/nimble_spp' into 'release/v4.4'
NimBLE : Fixed BLE SPP build fail on Windows

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

See merge request espressif/esp-idf!17013
2022-02-02 15:15:24 +05:30
Laukik Hase 51fc67f5fa ci: Fix issues for build stage
- Fixed logs expecting different format specifier
- Updated ignore list for check_public_header test
- Updated functions ported from mbedTLS
- Fix for make-system build errors
2022-02-02 15:03:48 +05:30
Laukik Hase 11366d643f mbedtls: Added option MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
- Removed code regarding MBEDTLS_DYNAMIC_FREE_PEER_CERT
  (config was kept for backward compatibility)
- Combined mbedTLS v2.28.x related options under a separate Kconfig menu
2022-02-02 10:56:48 +05:30
Laukik Hase c3d2f2361c protocomm: Updated function for constant time buffer comparison
- mbedtls_ssl_safer_memcmp() -> mbedtls_ct_memcmp()
2022-02-02 10:56:48 +05:30
Laukik Hase b10d0a533c wpa_supplicant: Saved message-type digest used in handshake for PRF operations 2022-02-02 10:56:48 +05:30
Laukik Hase 76b9beff3c mbedtls: Moved mbedtls_mpi_mul_int to port layer 2022-02-02 10:56:48 +05:30
Laukik Hase 76658d5066 mbedtls: Added config options for v2.28.0 upgrade 2022-02-02 10:56:48 +05:30
Laukik Hase 0fdc5f7490 mbedtls: Upgrade to v2.28.0 2022-02-02 10:56:13 +05:30
Mahavir Jain 28489ac412 Merge branch 'bugfix/provisioning_not_stopping_v4.4' into 'release/v4.4'
wifi_prov_mgr: Fix provisioning not stopping in release mode (v4.4)

See merge request espressif/esp-idf!17002
2022-02-01 05:22:38 +00:00
Laukik Hase b7c1c4913e wifi_prov_mgr: Fix provisioning not stopping in release mode
- For the wifi_prov_mgr example in release mode (with NDEBUG defined -
  assertions disabled), the task to stop provisioning is never started
  as it is voided by the assert function it is called in.

Closes https://github.com/espressif/esp-idf/issues/8309
2022-02-01 09:49:45 +05:30
Mahavir Jain 602b26ccd4 Merge branch 'feature/upgrade_expat_component_v4.4' into 'release/v4.4'
expat: upgrade to v2.4.3 release

See merge request espressif/esp-idf!16981
2022-01-31 07:14:04 +00:00
Harshit Malpani 3dbe641c6b expat: upgrade to v2.4.3 release
Detailed changelog: https://github.com/libexpat/libexpat/blob/R_2_4_3/expat/Changes
2022-01-31 11:13:26 +05:30
Mahavir Jain eb3797dc3f Merge branch 'provisioning/update_readme_v4.4' into 'release/v4.4'
provisioning: Remove legacy examples reference (v4.4)

See merge request espressif/esp-idf!16987
2022-01-29 10:46:56 +00:00
Anton Maklakov bfd3e9c54c Merge branch 'ci/split_assign_test_and_add_c3_integration_test_4.4' into 'release/v4.4'
Ci: split assign test and add c3 integration test 4.4

See merge request espressif/esp-idf!16925
2022-01-28 14:39:16 +00:00
Ivan Grokhotkov b9eda8431e Merge branch 'test/esp32s2_fatfs_speedtest_ci_fix_v4.4' into 'release/v4.4'
[Storage]: Re-enable FatFS write/read speed test (v4.4)

See merge request espressif/esp-idf!16080
2022-01-28 10:37:10 +00:00
Laukik Hase 954844a308 esp_prov.py: Replaced deprecated function for loading modules 2022-01-28 15:46:27 +05:30
Anton Maklakov e0968e506c Merge branch 'bugfix/unused_tag_string' into 'release/v4.4'
build: fix unused tag string (v4.4)

See merge request espressif/esp-idf!16838
2022-01-28 07:58:40 +00:00
aditi_lonkar 0113e2768d esp_wifi: Fixed issue of weak md for certificates in wifi_enterprise example. 2022-01-28 11:02:06 +05:30
morris 42abd894d4 build: fix unused tag string
Closes https://github.com/espressif/esp-idf/issues/8250
2022-01-28 11:59:45 +08:00
Michael (XIAO Xufeng) c8eb02bb39 bugfix (nvs): fixed wrong pointer check 2022-01-28 11:37:53 +08:00
Krzysztof Budzynski 257d95fc22 Merge branch 'docs/pinlayout_image_update_backport_v4.4' into 'release/v4.4'
docs: Update ESP32-DevKitC Pin Layout figure of higher resolution (backport v4.4)

See merge request espressif/esp-idf!16364
2022-01-28 03:22:51 +00:00
Mahavir Jain 036e3f2e46 Merge branch 'bugfix/address_already_used_exception_in_ota_tests_v4.4' into 'release/v4.4'
Fix 'address already in use' exception in OTA tests (v4.4)

See merge request espressif/esp-idf!16416
2022-01-27 12:32:45 +00:00
liuning 6e6c8bb682 esp_wifi: fix common clock bug (backport v4.4) 2022-01-27 20:19:41 +08:00
Roland Dobai 7acb7a9e00 Merge branch 'bugfix/rm_copyright_ignore_list' into 'release/v4.4'
CI: Remove unused copyright ignore list

See merge request espressif/esp-idf!16963
2022-01-27 12:15:56 +00:00
Roland Dobai 4649f3a46e CI: Remove unused copyright ignore list 2022-01-27 12:26:33 +01:00
Matus Fabo e64ae67888 fix: pin definitions for other boards
fix: re-enabled fatfs r/w test on sdspi
fix: copyright notice
add: pin definitions for esp32c3
fix: Changed fixed spi dma channel to a macro definition
2022-01-27 12:06:41 +01:00
Mahavir Jain d16aaae498 Merge branch 'feature/memprot_api_unified_c3_v4.4' into 'release/v4.4'
Memprot API unified - ESP32C3 (v4.4.1)

See merge request espressif/esp-idf!16489
2022-01-27 11:00:03 +00:00
Sergei Silnov 3d5b947355 Tools: Limit idf-component-manager version 2022-01-27 11:46:54 +01:00
songruojing b80a070395 esp_system: replace the range comparsion for reset reason in perip clk init with specific reset reason check, also add a test case in LEDC to check for the perip clk not being disabled after cpu reset
(cherry picked from commit f57456e9dd919e5eea1d3cd0caa64b5c97a4df73)
2022-01-27 09:51:00 +00:00
Shang Zhou 26a876e63f docs:update ESP32-DevKitC Pin Layout figure of higher resolution 2022-01-27 17:05:01 +08:00
Krzysztof Budzynski 8ec62d1d86 Merge branch 'docs/translation_backport_v4.4' into 'release/v4.4'
docs: update CN translation for MR15221 for v4.4

See merge request espressif/esp-idf!16756
2022-01-27 08:27:06 +00:00
Shang Zhou 3c76a058aa docs: update CN translation for MR15221 for v4.4 2022-01-27 08:27:04 +00:00
Krzysztof Budzynski c02f6b96af Merge branch 'docs/update_inconsistency_backport_v4.4' into 'release/v4.4'
docs: Update incorrect pins for S3 documentation, set a default value for future targets, and remove line breaks inside paragraphs (backport v4.4)

See merge request espressif/esp-idf!16367
2022-01-27 08:26:07 +00:00
Jiang Jiang Jian 1f45f160a8 Merge branch 'bugfix/fix_console_linenosie_backport_v4.4' into 'release/v4.4'
console: fix console stuck in auto test (backport v4.4)

See merge request espressif/esp-idf!16914
2022-01-27 07:18:46 +00:00
KonstantinKondrashov 9af4484ce3 examples: Adds a note on how to meet requirements to run the example_test.py
export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages"
python -m pip install -r $IDF_PATH/tools/ci/python_packages/ttfw_idf/requirements.txt

It helps to fix the ModuleNotFoundError issue with ttfw_idf and tiny_test_fw modules.

Closes https://github.com/espressif/esp-idf/issues/7815
2022-01-27 14:40:10 +08:00
Jiang Jiang Jian 8ab30f72b2 Merge branch 'bugfix/rd_rem_ext_feats_delayed_cs_v4.4' into 'release/v4.4'
bugfix/fix cs event for rd_rem_ext_feats delayed issue (v4.4)

See merge request espressif/esp-idf!16813
2022-01-27 05:45:35 +00:00
Jiang Jiang Jian 6114ac2994 Merge branch 'bugfix/fix_smartconfig_setopt_fail_v4.4' into 'release/v4.4'
smartconfig: Fix smartconfig set socket option fail (backport v4.4)

See merge request espressif/esp-idf!16772
2022-01-27 05:44:35 +00:00
Jiang Jiang Jian d982a9a5e1 Merge branch 'bugfix/config_parse_crash_after_flash_erase_v4.4' into 'release/v4.4'
component_bt: fixed config parse crash after flash_erase(v4.4)

See merge request espressif/esp-idf!16730
2022-01-27 05:44:17 +00:00
Jiang Jiang Jian 4f9afec016 Merge branch 'bugfix/ci_check_blobs_v4.4' into 'release/v4.4'
ci: improve checks for Wi-Fi/PHY libraries (v4.4)

See merge request espressif/esp-idf!16659
2022-01-27 05:42:56 +00:00
Jiang Jiang Jian 551cd2793b Merge branch 'doc/optimize_hfp_doc_4_4' into 'release/v4.4'
Doc/optimize hfp doc [backport v4.4]

See merge request espressif/esp-idf!16451
2022-01-27 05:42:17 +00:00
Jiang Jiang Jian bfd68507d8 Merge branch 'bugfix/PRs_on_esp_hid_v4.4' into 'release/v4.4'
bugfix/handle_3_esp_hid_PRs (v4.4)

See merge request espressif/esp-idf!16590
2022-01-27 05:41:52 +00:00
Jiang Jiang Jian 80a395e319 Merge branch 'Doc/optimize_spp_doc_v4.4' into 'release/v4.4'
Doc/Optimize SPP Document[backport 4.4]

See merge request espressif/esp-idf!16603
2022-01-27 05:41:33 +00:00
Jiang Jiang Jian 5788a393ea Merge branch 'doc/update_document_of_demo_bt_discovery_v4.4' into 'release/v4.4'
Doc/update document of demo bt discovery v4.4

See merge request espressif/esp-idf!16575
2022-01-27 05:40:52 +00:00
Mahavir Jain 7d9b93e2e0 Merge branch 'bugfix/MR16031_v4.4' into 'release/v4.4'
heap: adjust the order of RTC memory heap caps and regions(backport v4.4)

See merge request espressif/esp-idf!16704
2022-01-27 05:30:02 +00:00
Martin Vychodil 7d9652dccf System/Security: Memprot API unified (ESP32C3,ESP32S3)
Unified Memory protection API for all PMS-aware chips

Closes JIRA IDF-3849
2022-01-27 12:40:27 +08:00
Chen Yudong 386c2a2322 bugfix: checkout ref failed for origin branches 2022-01-27 11:55:58 +08:00
Chen Yudong fc1b518ef7 ci: exclude git files when uploading artifacts 2022-01-27 11:55:58 +08:00
Chen Yudong beda92a7a5 ci: update intergration test to support esp32c3 2022-01-27 11:55:53 +08:00
Chen Yudong 606f8fd59b ci: optimize downloading build_ssc artifacts 2022-01-26 22:33:14 +08:00
Chen Yudong 641bfa388a ci: move integration test related files outside of components 2022-01-26 22:33:14 +08:00
Chen Yudong 2ba22c4c6e ci: fix target_test label usage 2022-01-26 22:33:14 +08:00
Chen Yudong 6e11783992 ci: split assign tests 2022-01-26 22:33:09 +08:00
Mahavir Jain 55b1756d5f Merge branch 'contrib/github_pr_8139_backport_v4.4' into 'release/v4.4'
ledc.h - fix extern "C" to include ledc_cb_register() (backport v4.4)

See merge request espressif/esp-idf!16585
2022-01-26 13:40:22 +00:00
Mahavir Jain b5217ba9a2 Merge branch 'ci/enable_s3_examples_build_v4.4' into 'release/v4.4'
ci: re-enable s3 build for few examples (v4.4)

See merge request espressif/esp-idf!16894
2022-01-26 13:38:14 +00:00
Jiang Jiang Jian 56e854bb4e Merge branch 'bugfix/set_authmode_by_switching_number_to_string_v4.4' into 'release/v4.4'
CI: change ap authmode from number to string (backport v4.4)

See merge request espressif/esp-idf!16553
2022-01-26 11:53:30 +00:00
Roland Dobai 46fba83ac8 Merge branch 'bugfix/idf_tools_python_env_v4.4' into 'release/v4.4'
tools: improve virtualenv diagnostics, set python path explicitly (v4.4)

See merge request espressif/esp-idf!16807
2022-01-26 10:00:32 +00:00
Roland Dobai 65b3e0601f Merge branch 'bugfix/add_dummy_to_total_size_v4.4' into 'release/v4.4'
Tools: fix bug with total size calculation issue (v4.4)

See merge request espressif/esp-idf!16859
2022-01-26 09:59:48 +00:00
Roland Dobai a59e3ab59d Merge branch 'feature/esp32s3_apptrace_v4.4' into 'release/v4.4'
Feature/esp32s3 apptrace v4.4

See merge request espressif/esp-idf!16649
2022-01-26 09:58:35 +00:00
Ivan Grokhotkov ea62bcfaf0 Merge branch 'feature/ccache_in_ci_v4.4' into 'release/v4.4'
ci: enable ccache for build jobs (v4.4)

See merge request espressif/esp-idf!16806
2022-01-26 09:12:32 +00:00
Michael (XIAO Xufeng) a76f908074 Merge branch 'test/remove_spi_flash_perf_thr_v4.4' into 'release/v4.4'
spi_flash_test: remove threshold from unit test (v4.4)

See merge request espressif/esp-idf!16821
2022-01-26 08:20:26 +00:00
Harshit Malpani 446d3bfec8 Fix for advanced_ota_redirect_url example failure in CI 2022-01-26 10:42:13 +08:00
Harshit Malpani 839c34fd0a Fix 'address already in use' exception in OTA tests
We will stop the server instance at the end of each test case. This will solve the "address already in use" exception
2022-01-26 10:42:13 +08:00
Mahavir Jain f546d5e493 Merge branch 'fix/http2_request_example_v4.4' into 'release/v4.4'
http2_request_example: Change the target http2 server to http2.github.io (v4.4)

See merge request espressif/esp-idf!16670
2022-01-26 02:39:16 +00:00
Mahavir Jain f5ef3e2cf2 Merge branch 'wifi_prov_mgr/service_key_check_v4.4' into 'release/v4.4'
wifi_prov_mgr: Added check for passphrase length in softAP scheme (v4.4)

See merge request espressif/esp-idf!16569
2022-01-26 02:37:43 +00:00
Mahavir Jain 48eea7c479 Merge branch 'bugfix/fix_esp_https_ota_v4.4' into 'release/v4.4'
esp_https_ota: Fix esp_https_ota_begin may return error and exist memory leak (backport v4.4)

See merge request espressif/esp-idf!16777
2022-01-26 02:36:56 +00:00
Mahavir Jain 39386e05a5 Merge branch 'bugfix/invalid_url_cause_to_crash_v4.4' into 'release/v4.4'
http: Fix parsing invalid url cause to crash (v4.4)

See merge request espressif/esp-idf!16478
2022-01-26 02:34:29 +00:00
Mahavir Jain e19cc280d9 Merge branch 'docs/update_ws_server_example_readme_v4.4' into 'release/v4.4'
docs: Add user-friendly guide about how to use ws_server_example_test.py (backport v4.4)

See merge request espressif/esp-idf!16782
2022-01-26 02:31:22 +00:00
Zim Kalinowski fb1d00a9d1 Merge branch 'bugfix/efuse_timesettigs_in_burn_op_v4.4' into 'release/v4.4'
efuse: Fixes eFuse timesettings issue on esp32c3 (v4.4)

See merge request espressif/esp-idf!16921
2022-01-26 00:52:33 +00:00
Zim Kalinowski 979745417b Merge branch 'refactor/tinyusb_uses_usb_phy_v4.4' into 'release/v4.4'
tinyusb: Update tinyusb.c to use the usb_phy API to configure PHY (v4.4)

See merge request espressif/esp-idf!16855
2022-01-26 00:51:42 +00:00
Zim Kalinowski 40949e8d43 Merge branch 'bugfix/app_compatible_with_3_1_bootloader_v4.4' into 'release/v4.4'
esp_system: Fix RTC_WDT protection in esp_restart_noos (v4.4)

See merge request espressif/esp-idf!16740
2022-01-26 00:50:54 +00:00
Zim Kalinowski eb13f8a61d Merge branch 'bugfix/freertos_pd_ticks_to_ms_precision_v4.4' into 'release/v4.4'
Freertos: Fix loss of precision in pdTICKS_TO_MS (v4.4)

See merge request espressif/esp-idf!16673
2022-01-26 00:50:35 +00:00
Zim Kalinowski 3ea2a2ba9c Merge branch 'bugfix/bootloader_common_get_sha256_of_partition_when_image_invalid_v4.4' into 'release/v4.4'
bootloader: Fixes bootloader_common_get_sha256_of_partition. Adds hash check. (v4.4)

See merge request espressif/esp-idf!16923
2022-01-26 00:50:09 +00:00
KonstantinKondrashov 0b5d4edbc6 bootloader: Fixes bootloader_common_get_sha256_of_partition. Adds hash check.
Closes https://github.com/espressif/esp-idf/issues/8274
2022-01-25 19:58:29 +08:00
KonstantinKondrashov 1638b36804 efuse: Fixes eFuse timesettings issue on esp32c3 2022-01-25 19:14:31 +08:00
wuzhenghui c11b6f4885 fix console stuck in auto test 2022-01-25 17:04:48 +08:00
Ivan Grokhotkov 780b9b6d78 Merge branch 'update/version_4_4_0' into 'release/v4.4'
Update version to 4.4.0

See merge request espressif/esp-idf!16909
2022-01-25 08:42:49 +00:00
David Čermák c899c1b1da Merge branch 'bugfix/mdns_txt_alloc_issue_v4.4' into 'release/v4.4'
mdns: Fix alloc issue if TXT has empty value(Backport v4.4)

See merge request espressif/esp-idf!16889
2022-01-25 06:33:54 +00:00
jincheng 9f3b116e4f optmize a2dp demo document 2022-01-24 14:23:09 +08:00
Harshit Malpani e088379b26 ci: re-enable s3 build for few examples 2022-01-24 09:54:08 +05:30
Aditya Patwardhan b4fbd87f42 http2_request_example: Change the target http2 server to http2.github.io and
perform only a `GET` request.
2022-01-21 09:15:32 +05:30
morris f6ab703390 lcd: alloc framebuffer in alignment 2022-01-21 11:30:20 +08:00
morris 9c262ce065 lcd: split gpio check for de and hv mode 2022-01-21 11:30:20 +08:00
simon.chupin 960672b979 add test for checking memory segments with esptool.py 2022-01-19 17:32:19 +01:00
simon.chupin 40eede261e tools/idf_size: Fixed bug with wrong memory calculation 2022-01-19 17:32:18 +01:00
songruojing 6a6801e357 tinyusb: Update tinyusb.c to use the usb_phy API to configure PHY 2022-01-19 18:18:08 +08:00
Michael (XIAO Xufeng) 0382215ec7 spi_flash_test: remove threshold from unit test 2022-01-17 15:07:06 +08:00
jincheng a0e20e17f0 fix cs event for rd_rem_ext_feats delayed issue 2022-01-17 13:02:26 +08:00
Ivan Grokhotkov 2e3f4ff6dd tools: improve virtualenv diagnostics, set python path explicitly
- Check if pip is installed for sys.executable before attempting to
  create the virtual environment, bail out with an error if not.
- Don't pass --seeder argument to virtualenv if its version is
  too old. For example, on Ubuntu 18.04, virtualenv 15.1.0 doesn't
  support this argument.
- Pass --python argument to virtualenv to request specific interpreter
  to be used.

Closes https://github.com/espressif/esp-idf/issues/8045
2022-01-16 21:45:30 +01:00
Ivan Grokhotkov 698b406e56 ci: enable ccache for build jobs 2022-01-16 21:43:15 +01:00
Ivan Grokhotkov d17194caea ci: disable ccache when running CMake build system tests
Some tests check if certain files are rebuilt when source files are
'touch'ed. With ccache, 'touch'ing source files doesn't cause a
rebuild, hence the test fails. In case IDF_CCACHE_ENABLE was set in
the environment, unset it before starting the tests.
2022-01-16 21:43:15 +01:00
Yuan Jian Min 2a89b3c15a docs: Add user-friendly guide about how to use ws_server_example_test.py
Closes https://github.com/espressif/esp-idf/issues/8060
2022-01-12 20:36:59 +08:00
yuanjm dbb0eeecc7 esp_https_ota: Fix esp_https_ota_begin may return ESP_OK when http status code is not 200 and may exist memory leak
Closes https://github.com/espressif/esp-idf/issues/8195
2022-01-12 19:53:08 +08:00
yuanjm 9cf57a86a0 smartconfig: Fix smartconfig set socket option fail
Closes https://github.com/espressif/esp-idf/issues/8189
2022-01-12 14:48:02 +08:00
likunqiao 7aa2577d86 esp_phy: move lib_printf.c to esp_phy
* fix the issue when esp32h2 target using phy_printf and rtc_printf
2022-01-11 12:09:11 +08:00
KonstantinKondrashov 8f2045f0da esp_system: Fix RTC_WDT protection in esp_restart_noos
Fixed issue - v4.3 app not compatible with 3.1 bootloader
2022-01-10 21:57:29 +08:00
xiongweichao f4b329f9a5 Rename controller_hci_uart_esp32c3 to controller_hci_uart_esp32c3_and_esp32s3 2022-01-10 20:18:24 +08:00
xiongweichao b5d76c8c32 Added support for ESP32-S3 chip in controller_hci_uart_esp32c3's README 2022-01-10 20:18:17 +08:00
xiongweichao 121b33be29 add nvs initialize 2022-01-10 20:18:12 +08:00
xiongweichao 7485b4d4b2 btc_a2dp_control_set_datachnl_stat is only used by a2dp sink 2022-01-10 19:17:13 +08:00
xiongweichao 49f496e539 remove btc_a2dp_dispatch_datapath_evt and event 2022-01-10 19:16:25 +08:00
xiongweichao e4277d5202 Fixed the crash caused by calling esp_a2d_media_ctrl(ESP_A2D_MEDIA_CTRL_START) after stream started 2022-01-10 19:15:30 +08:00
xiongweichao d338750b86 Fixed a2dp source audio data packet congestion causing choppy audio in a2dp sink 2022-01-10 19:15:17 +08:00
xiongweichao 50e00e641b fixed config parse crash after flash_erase
Closes https://github.com/espressif/esp-idf/issues/6170
2022-01-10 17:41:57 +08:00
Cao Sen Miao 67b4ba33dd spi_flash: add support for th 1M flash 2022-01-10 12:39:09 +08:00
Cao Sen Miao e2ef65e117 psram: add ESP32-D0WD-R2-V3 support 2022-01-10 10:39:00 +08:00
jingli 23ec015d75 adjust the order of RTC memory heap caps and regions 2022-01-08 16:19:35 +08:00
Wang Fang 81936fd2b6 docs: add an example list for esp-wrover-kit 2022-01-07 16:47:54 +08:00
lisekt84 bead7c2eeb freertos: Fix loss of precision in pdTICKS_TO_MS
Closes https://github.com/espressif/esp-idf/pull/7856
Closes https://github.com/espressif/esp-idf/issues/7853

[darian@espressif.com: Updated commit message]
Signed-off-by: Darian Leung <darian@espressif.com>
2022-01-06 15:44:17 +08:00
Alexey Gerenkov 8c2990fcea trax: Adds ESP32-S3 support 2022-01-05 19:34:28 +01:00
Alexey Gerenkov 18cd2ea3e6 apptrace: Adds ESP32-S3 support 2022-01-05 19:26:33 +01:00
Ondrej Kosta fd9f97b5f4 emac_hal_start/stop function description added 2022-01-05 16:26:37 +01:00
Jack 63366f011a phy: update phy lib to remove ets_printf references 2022-01-05 17:29:55 +08:00
Ivan Grokhotkov 09552fdf68 ci: improve checks for Wi-Fi/PHYlibraries
- add missing Wi-Fi header MD5 checks for esp32c3, esp32s3
- check PHY libraries for references to ets_printf, in addition to
  checking Wi-Fi libraries. This used to happen until libphy.a was
  moved into a separate submodule.

Reported in https://github.com/espressif/esp-phy-lib/issues/3
2022-01-05 17:29:35 +08:00
Murray Fordyce 52224aebcf Fixed left right key confusion in comments.
"Left" and "Right" were swapped in some comments.
2022-01-05 10:46:46 +08:00
Chen Wu bd9ee38f3c http: Fix parsing invalid url cause to crash
Reason:
For example, if an url is lack of leading 'http:' by mistake, it causes to http_parser_parse_url() cannot parse http host item,
and then pass the null host pointer to _get_host_header(), crash happens.

Fix:
http added null pointer check now.

Closes https://jira.espressif.com:8443/browse/ESPAT-953
2021-12-31 14:40:21 +08:00
liqigan f29492dc9d fix typos and format 2021-12-31 11:18:17 +08:00
liqigan 3b1bdce816 optimize SPP documents 2021-12-30 16:11:56 +08:00
songruojing b25fb1111d gpio: Fix some gpio pin num errors on esp32s2 and esp32c3 2021-12-30 12:27:14 +08:00
Robin Krens e39b0dcd2e spacing styling correction 2021-12-30 10:47:49 +08:00
Robin Krens a61a935506 minor styling changes 2021-12-30 10:47:49 +08:00
Robin Krens b72a03fd07 esp_hid: fix output report char declaration
Current issue: output reports sent by Windows not received.
The report characteristic declaration should also support write without
response as specified by HIDS profile:
See https://www.bluetooth.com/specifications/GATT/ (page 14)
2021-12-30 10:47:49 +08:00
jincheng 629bd67001 fix on esp_hidh report map length checking function
Closes https://github.com/espressif/esp-idf/issues/7586
2021-12-30 10:47:49 +08:00
Emil Muratov 8423e7d785 ledc.h - fix extern "C" to include ledc_cb_register()
(cherry picked from commit d4de08182e)
2021-12-29 21:14:37 +08:00
xiewenxiang bf6b3ec0a8 component/bt: Support set HW CCA threshold value 2021-12-29 14:43:33 +08:00
xiewenxiang 5fc5016981 component/bt: fix periodic adv parameters detection issue 2021-12-29 14:43:22 +08:00
baohongde ace24fd3f8 components/bt: modify name of file 2021-12-29 14:31:54 +08:00
baohongde f4c6c48123 components/bt: Update the document of demo bt discovery 2021-12-29 14:31:38 +08:00
baohongde 55bd48b24e components/bt: Modify demo bt_discovery 2021-12-29 14:31:20 +08:00
Laukik Hase 474ff3e38f wifi_prov_mgr: Added check for passphrase length in softAP scheme
Closes https://github.com/espressif/esp-idf/issues/8063
2021-12-28 18:13:40 +05:30
huchaoru bd8e9d98ba CI: change ap authmode from number to string (backport v4.4) 2021-12-27 19:57:40 +08:00
weitianhua 8763c82e26 Fix Typos 2021-12-20 17:04:24 +08:00
weitianhua dec183dbb5 Optimize HFP Documents 2021-12-20 17:04:15 +08:00
pedro.minatel 7506a725be docs: Rebase and typos fixed for the bluetooth README files 2021-12-13 10:31:09 +00:00
Shang Zhou f64f2e4955 docs: Update inconsistency parts for S3 documentation, set a default value for future targets, and remove line breaks inside paragraphs 2021-12-13 11:23:18 +08:00
641 changed files with 26545 additions and 18137 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ variables:
# Docker images
BOT_DOCKER_IMAGE_TAG: ":latest"
ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env:v4.4-1-v4"
ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env:v4.4-1-v5"
ESP_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-env:v4.4-1"
AFL_FUZZER_TEST_IMAGE: "$CI_DOCKER_REGISTRY/afl-fuzzer-test:v4.4-1-1"
CLANG_STATIC_ANALYSIS_IMAGE: "${CI_DOCKER_REGISTRY}/clang-static-analysis:v4.4-1-2"
@@ -68,7 +68,7 @@ variables:
# target test repo parameters
TEST_ENV_CONFIG_REPO: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/ci-test-runner-configs.git"
CI_AUTO_TEST_SCRIPT_REPO_URL: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/auto_test_script.git"
CI_AUTO_TEST_SCRIPT_REPO_BRANCH: "ci/v3.1"
CI_AUTO_TEST_SCRIPT_REPO_BRANCH: "ci/v4.1"
.setup_tools_unless_target_test: &setup_tools_unless_target_test |
if [[ -n "$IDF_DONT_USE_MIRRORS" ]]; then
+117 -37
View File
@@ -1,54 +1,134 @@
assign_test:
extends: .rules:test:any_test
tags:
- assign_test
.assign_test_template:
image: $CI_DOCKER_REGISTRY/ubuntu-test-env$BOT_DOCKER_IMAGE_TAG
stage: assign_test
# gitlab ci do not support match job with RegEx or wildcard now in dependencies.
# we have a lot build example jobs. now we don't use dependencies, just download all artifacts of build stage.
dependencies: # Here is not a hard dependency relationship, could be skipped. so we do not use "needs" here.
- build_ssc_esp32
- build_esp_idf_tests_cmake_esp32
- build_esp_idf_tests_cmake_esp32s2
- build_esp_idf_tests_cmake_esp32s3
- build_esp_idf_tests_cmake_esp32c3
tags:
- assign_test
variables:
SUBMODULES_TO_FETCH: "components/esptool_py/esptool"
EXAMPLE_TEST_DIR: "${CI_PROJECT_DIR}/examples"
CUSTOM_TEST_DIR: "${CI_PROJECT_DIR}/tools/test_apps"
UNIT_TEST_DIR: "${CI_PROJECT_DIR}/components/idf_test/unit_test"
SUBMODULES_TO_FETCH: components/esptool_py/esptool
artifacts:
paths:
- ${TEST_DIR}/test_configs
- ${BUILD_DIR}/artifact_index.json
when: always
expire_in: 1 week
script:
- python tools/ci/python_packages/ttfw_idf/IDFAssignTest.py $TEST_TYPE $TEST_DIR -c $CI_TARGET_TEST_CONFIG_FILE -o $TEST_DIR/test_configs
assign_example_test:
extends:
- .assign_test_template
- .rules:build:example_test
needs:
- job: build_examples_cmake_esp32
artifacts: false
optional: true
- job: build_examples_cmake_esp32s2
artifacts: false
optional: true
- job: build_examples_cmake_esp32c3
artifacts: false
optional: true
- job: build_examples_cmake_esp32s3
artifacts: false
optional: true
variables:
TEST_TYPE: example_test
TEST_DIR: ${CI_PROJECT_DIR}/examples
BUILD_DIR: ${CI_PROJECT_DIR}/build_examples
assign_custom_test:
extends:
- .assign_test_template
- .rules:build:custom_test
needs:
- job: build_test_apps_esp32
artifacts: false
optional: true
- job: build_test_apps_esp32s2
artifacts: false
optional: true
- job: build_test_apps_esp32c3
artifacts: false
optional: true
- job: build_test_apps_esp32s3
artifacts: false
optional: true
variables:
TEST_TYPE: custom_test
TEST_DIR: ${CI_PROJECT_DIR}/tools/test_apps
BUILD_DIR: ${CI_PROJECT_DIR}/build_test_apps
assign_component_ut:
extends:
- .assign_test_template
- .rules:build:component_ut
needs:
- job: build_component_ut_esp32
artifacts: false
optional: true
- job: build_component_ut_esp32s2
artifacts: false
optional: true
- job: build_component_ut_esp32c3
artifacts: false
optional: true
- job: build_component_ut_esp32s3
artifacts: false
optional: true
variables:
TEST_TYPE: component_ut
TEST_DIR: ${CI_PROJECT_DIR}/component_ut
BUILD_DIR: ${CI_PROJECT_DIR}/build_component_ut
script:
# COMPONENT_UT_DIRS is set by `set_component_ut_vars` in `utils.sh`
COMPONENT_UT_OUTPUT_DIR: "${CI_PROJECT_DIR}/component_ut"
INTEGRATION_CONFIG_OUTPUT_PATH: "${CI_PROJECT_DIR}/components/idf_test/integration_test/CIConfigs"
- set_component_ut_vars
- python tools/ci/python_packages/ttfw_idf/IDFAssignTest.py $TEST_TYPE $COMPONENT_UT_DIRS -c $CI_TARGET_TEST_CONFIG_FILE -o $TEST_DIR/test_configs
assign_unit_test:
extends:
- .assign_test_template
- .rules:build:unit_test
needs:
- job: build_esp_idf_tests_cmake_esp32
optional: true
- job: build_esp_idf_tests_cmake_esp32s2
optional: true
- job: build_esp_idf_tests_cmake_esp32c3
optional: true
- job: build_esp_idf_tests_cmake_esp32s3
optional: true
variables:
TEST_TYPE: unit_test
TEST_DIR: ${CI_PROJECT_DIR}/components/idf_test/unit_test
BUILD_DIR: ${CI_PROJECT_DIR}/tools/unit-test-app/builds
script:
- python tools/ci/python_packages/ttfw_idf/IDFAssignTest.py $TEST_TYPE $TEST_DIR -c $CI_TARGET_TEST_CONFIG_FILE -o $TEST_DIR/test_configs
assign_integration_test:
extends:
- .assign_test_template
- .rules:test:integration_test
needs:
- build_ssc_esp32
- build_ssc_esp32c3
artifacts:
paths:
- $TEST_DIR/test_configs
variables:
TEST_DIR: ${CI_PROJECT_DIR}/tools/ci/integration_test
BUILD_DIR: ${CI_PROJECT_DIR}/SSC/ssc_bin
INTEGRATION_TEST_CASE_PATH: "${CI_PROJECT_DIR}/auto_test_script/TestCaseFiles"
ASSIGN_TEST_CASE_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIAssignTestCases.py"
PYTHONPATH: ${CI_PROJECT_DIR}/auto_test_script/packages
# auto_test_script only supports python 3.7.x
PYTHON_VER: 3.7.7
artifacts:
paths:
- components/idf_test/*/CIConfigs
- $EXAMPLE_TEST_DIR/test_configs
- $CUSTOM_TEST_DIR/test_configs
- $COMPONENT_UT_OUTPUT_DIR/test_configs
- build_examples/artifact_index.json
- build_test_apps/artifact_index.json
- build_component_ut/artifact_index.json
- tools/unit-test-app/builds/artifact_index.json
expire_in: 1 week
script:
- set_component_ut_vars
- python tools/ci/python_packages/ttfw_idf/IDFAssignTest.py example_test $EXAMPLE_TEST_DIR -c $CI_TARGET_TEST_CONFIG_FILE -o $EXAMPLE_TEST_DIR/test_configs
- python tools/ci/python_packages/ttfw_idf/IDFAssignTest.py custom_test $CUSTOM_TEST_DIR -c $CI_TARGET_TEST_CONFIG_FILE -o $CUSTOM_TEST_DIR/test_configs
- python tools/ci/python_packages/ttfw_idf/IDFAssignTest.py component_ut $COMPONENT_UT_DIRS -c $CI_TARGET_TEST_CONFIG_FILE -o $COMPONENT_UT_OUTPUT_DIR/test_configs
- python tools/ci/python_packages/ttfw_idf/IDFAssignTest.py unit_test $UNIT_TEST_DIR -c $CI_TARGET_TEST_CONFIG_FILE -o $UNIT_TEST_DIR/CIConfigs
# clone test script to assign tests
# can not retry if downing git lfs files failed, so using empty_branch first.
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
- retry_failed git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script --customized_only
# assign integration test cases
- python ${ASSIGN_TEST_CASE_SCRIPT} -t ${INTEGRATION_TEST_CASE_PATH} -c $CI_TARGET_TEST_CONFIG_FILE -b $IDF_PATH/SSC/ssc_bin -o $INTEGRATION_CONFIG_OUTPUT_PATH
- python ${ASSIGN_TEST_CASE_SCRIPT} -t ${INTEGRATION_TEST_CASE_PATH} -c $CI_TARGET_TEST_CONFIG_FILE -b ${BUILD_DIR} -o $TEST_DIR/test_configs
update_test_cases:
extends: .rules:ref:master-schedule
@@ -70,7 +150,7 @@ update_test_cases:
SUBMODULES_TO_FETCH: "components/esptool_py/esptool"
UNIT_TEST_DIR: "${CI_PROJECT_DIR}/components/idf_test/unit_test"
BOT_ACCOUNT_CONFIG_FILE: "${CI_PROJECT_DIR}/test-management/Config/Account.local.yml"
AUTO_TEST_SCRIPT_PATH: "${CI_PROJECT_DIR}/auto_test_script"
PYTHONPATH: ${CI_PROJECT_DIR}/auto_test_script/packages
PYTHON_VER: 3.7.7
script:
- export GIT_SHA=$(echo ${PIPELINE_COMMIT_SHA} | cut -c 1-8)
+5 -4
View File
@@ -5,6 +5,11 @@
- build
variables:
SIZE_INFO_LOCATION: "$CI_PROJECT_DIR/size_info.txt"
# Enable ccache for all build jobs. See configure_ci_environment.sh for more ccache related settings.
IDF_CCACHE_ENABLE: "1"
after_script:
# Show ccache statistics if enabled globally
- test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats || true
dependencies: []
.build_template_app_template:
@@ -34,10 +39,6 @@
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS}
# Only do the default cmake build for each target, remaining part are done in the build_template_app job
- tools/ci/build_template_app.sh ${BUILD_COMMAND_ARGS}
# Check if there are any stray printf/ets_printf references in WiFi libs
- cd components/esp_wifi/lib
- for dir in esp32 esp32s2; do test $(xtensa-esp32-elf-nm $dir/*.a | grep -w printf | wc -l) -eq 0; done;
- for dir in esp32 esp32s2; do test $(xtensa-esp32-elf-nm $dir/*.a | grep -w ets_printf | wc -l) -eq 0; done;
# build-related-pre-check-jobs ------------------------------------------------
# Build at least one project for each target at earliest stage to reduce build cost for obvious failing commits
+15 -13
View File
@@ -61,6 +61,9 @@
patterns:
- build_components
- build_system
included_in:
- "build:{0}"
- build:target_test
build:integration_test:
labels:
@@ -68,6 +71,8 @@ build:integration_test:
patterns:
- build_components
- build_system
included_in:
- build:target_test
####################
# Target Test Jobs #
@@ -79,14 +84,14 @@ build:integration_test:
labels: # For each rule, use labels <test_type> and <test_type>-<target>
- "{0}"
- "{0}_{1}"
- target_test
patterns: # For each rule, use patterns <test_type> and build-<test_type>
- "{0}"
- "build-{0}"
included_in: # Parent rules
- "build:{0}"
- "build:{0}-{1}"
- build:target_test
- test:target_test
- test:any_test
# -------------
# Special Cases
@@ -99,33 +104,30 @@ build:integration_test:
- "component_ut_{0}"
- unit_test
- "unit_test_{0}"
- target_test
patterns:
- component_ut
- "build-component_ut-{0}"
included_in:
- build:component_ut
- "build:component_ut-{0}"
- build:target_test
- test:target_test
- test:any_test
"test:integration_test":
labels:
- "integration_test"
- integration_test
- target_test
patterns:
- "integration_test"
- integration_test
included_in:
- "build:integration_test"
- build:integration_test
- build:target_test
- test:target_test
- test:any_test
"test:host_test":
labels:
- host_test
patterns:
- host_test
included_in:
- test:any_test
"test:submodule":
labels:
@@ -140,17 +142,17 @@ build:integration_test:
labels:
- iperf_stress_test
included_in:
- build:example_test
- build:example_test-esp32
- build:target_test
- test:any_test
"labels:weekend_test": # custom test
labels:
- weekend_test
included_in:
- build:custom_test
- build:custom_test-esp32
- build:target_test
- test:any_test
"labels:nvs_coverage": # host_test
labels:
+7 -2
View File
@@ -83,15 +83,20 @@ test_check_kconfigs:
script:
- python ${IDF_PATH}/tools/ci/test_check_kconfigs.py
check_wifi_lib_md5:
check_blobs:
extends: .pre_check_base_template
tags:
- build
variables:
SUBMODULES_TO_FETCH: "components/esp_wifi/lib"
SUBMODULES_TO_FETCH: "components/esp_wifi/lib;components/esp_phy/lib"
script:
# Check if Wi-Fi library header files match between IDF and the version used when compiling the libraries
- IDF_TARGET=esp32 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
- IDF_TARGET=esp32s2 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
- IDF_TARGET=esp32s3 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
- IDF_TARGET=esp32c3 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
# Check if Wi-Fi, PHY, BT blobs contain references to specific symbols
- bash $IDF_PATH/tools/ci/check_blobs.sh
check_fuzzer_compilation:
extends: .pre_check_base_template
+116 -83
View File
@@ -89,6 +89,7 @@
.patterns-integration_test: &patterns-integration_test
- "tools/ci/python_packages/tiny_test_fw/**/*"
- "tools/ci/integration_test/**/*"
.patterns-host_test: &patterns-host_test
- ".gitlab/ci/host-test.yml"
@@ -336,6 +337,9 @@
.if-label-submodule: &if-label-submodule
if: '$BOT_LABEL_SUBMODULE || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*submodule(?:,[^,\n\r]+)*$/i'
.if-label-target_test: &if-label-target_test
if: '$BOT_LABEL_TARGET_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*target_test(?:,[^,\n\r]+)*$/i'
.if-label-unit_test: &if-label-unit_test
if: '$BOT_LABEL_UNIT_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*unit_test(?:,[^,\n\r]+)*$/i'
@@ -366,12 +370,35 @@
- <<: *if-dev-push
changes: *patterns-build_system
.rules:build:component_ut:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
- <<: *if-label-component_ut_esp32c3
- <<: *if-label-component_ut_esp32s2
- <<: *if-label-component_ut_esp32s3
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-label-unit_test_esp32c3
- <<: *if-label-unit_test_esp32s2
- <<: *if-label-unit_test_esp32s3
- <<: *if-dev-push
changes: *patterns-build_components
- <<: *if-dev-push
changes: *patterns-build_system
- <<: *if-dev-push
changes: *patterns-component_ut
.rules:build:component_ut-esp32:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-dev-push
@@ -387,6 +414,7 @@
- <<: *if-label-build
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32c3
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32c3
- <<: *if-dev-push
@@ -402,6 +430,7 @@
- <<: *if-label-build
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32s2
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s2
- <<: *if-dev-push
@@ -417,6 +446,7 @@
- <<: *if-label-build
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32s3
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s3
- <<: *if-dev-push
@@ -426,12 +456,31 @@
- <<: *if-dev-push
changes: *patterns-component_ut
.rules:build:custom_test:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32
- <<: *if-label-custom_test_esp32c3
- <<: *if-label-custom_test_esp32s2
- <<: *if-label-custom_test_esp32s3
- <<: *if-label-target_test
- <<: *if-label-weekend_test
- <<: *if-dev-push
changes: *patterns-build_components
- <<: *if-dev-push
changes: *patterns-build_system
- <<: *if-dev-push
changes: *patterns-custom_test
.rules:build:custom_test-esp32:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32
- <<: *if-label-target_test
- <<: *if-label-weekend_test
- <<: *if-dev-push
changes: *patterns-build_components
@@ -446,6 +495,7 @@
- <<: *if-label-build
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32c3
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build_components
- <<: *if-dev-push
@@ -459,6 +509,7 @@
- <<: *if-label-build
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32s2
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build_components
- <<: *if-dev-push
@@ -472,6 +523,7 @@
- <<: *if-label-build
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32s3
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build_components
- <<: *if-dev-push
@@ -487,6 +539,26 @@
- <<: *if-dev-push
changes: *patterns-docker
.rules:build:example_test:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32
- <<: *if-label-example_test_esp32c3
- <<: *if-label-example_test_esp32s2
- <<: *if-label-example_test_esp32s3
- <<: *if-label-iperf_stress_test
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
changes: *patterns-build_components
- <<: *if-dev-push
changes: *patterns-build_system
- <<: *if-dev-push
changes: *patterns-example_test
.rules:build:example_test-esp32:
rules:
- <<: *if-protected
@@ -494,6 +566,7 @@
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32
- <<: *if-label-iperf_stress_test
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
@@ -509,6 +582,7 @@
- <<: *if-label-build
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32c3
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
@@ -524,6 +598,7 @@
- <<: *if-label-build
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32s2
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
@@ -539,6 +614,7 @@
- <<: *if-label-build
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32s3
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
@@ -553,6 +629,7 @@
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-integration_test
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build_components
- <<: *if-dev-push
@@ -590,6 +667,7 @@
- <<: *if-label-example_test_esp32s3
- <<: *if-label-integration_test
- <<: *if-label-iperf_stress_test
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-label-unit_test_esp32c3
@@ -613,10 +691,28 @@
- <<: *if-dev-push
changes: *patterns-unit_test
.rules:build:unit_test:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-label-unit_test_esp32c3
- <<: *if-label-unit_test_esp32s2
- <<: *if-label-unit_test_esp32s3
- <<: *if-dev-push
changes: *patterns-build_components
- <<: *if-dev-push
changes: *patterns-build_system
- <<: *if-dev-push
changes: *patterns-unit_test
.rules:build:unit_test-esp32:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-dev-push
@@ -630,6 +726,7 @@
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32c3
- <<: *if-dev-push
@@ -643,6 +740,7 @@
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s2
- <<: *if-dev-push
@@ -656,6 +754,7 @@
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s3
- <<: *if-dev-push
@@ -692,50 +791,6 @@
rules:
- <<: *if-label-weekend_test
.rules:test:any_test:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
- <<: *if-label-component_ut_esp32c3
- <<: *if-label-component_ut_esp32s2
- <<: *if-label-component_ut_esp32s3
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32
- <<: *if-label-custom_test_esp32c3
- <<: *if-label-custom_test_esp32s2
- <<: *if-label-custom_test_esp32s3
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32
- <<: *if-label-example_test_esp32c3
- <<: *if-label-example_test_esp32s2
- <<: *if-label-example_test_esp32s3
- <<: *if-label-host_test
- <<: *if-label-integration_test
- <<: *if-label-iperf_stress_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-label-unit_test_esp32c3
- <<: *if-label-unit_test_esp32s2
- <<: *if-label-unit_test_esp32s3
- <<: *if-label-weekend_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
changes: *patterns-component_ut
- <<: *if-dev-push
changes: *patterns-custom_test
- <<: *if-dev-push
changes: *patterns-example_test
- <<: *if-dev-push
changes: *patterns-host_test
- <<: *if-dev-push
changes: *patterns-integration_test
- <<: *if-dev-push
changes: *patterns-unit_test
.rules:test:component_ut-esp32:
rules:
- <<: *if-protected
@@ -743,6 +798,7 @@
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-dev-push
@@ -755,6 +811,7 @@
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32c3
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32c3
- <<: *if-dev-push
@@ -767,6 +824,7 @@
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32s2
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s2
- <<: *if-dev-push
@@ -779,6 +837,7 @@
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32s3
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s3
- <<: *if-dev-push
@@ -791,6 +850,7 @@
when: never
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-custom_test
@@ -801,6 +861,7 @@
when: never
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32c3
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-custom_test
@@ -811,6 +872,7 @@
when: never
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32s2
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-custom_test
@@ -821,6 +883,7 @@
when: never
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32s3
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-custom_test
@@ -831,6 +894,7 @@
when: never
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
@@ -843,6 +907,7 @@
when: never
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32c3
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
@@ -855,6 +920,7 @@
when: never
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32s2
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
@@ -867,6 +933,7 @@
when: never
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32s3
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
@@ -887,6 +954,7 @@
- <<: *if-label-build-only
when: never
- <<: *if-label-integration_test
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-integration_test
@@ -899,50 +967,12 @@
- <<: *if-dev-push
changes: *patterns-submodule
.rules:test:target_test:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
- <<: *if-label-component_ut_esp32c3
- <<: *if-label-component_ut_esp32s2
- <<: *if-label-component_ut_esp32s3
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32
- <<: *if-label-custom_test_esp32c3
- <<: *if-label-custom_test_esp32s2
- <<: *if-label-custom_test_esp32s3
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32
- <<: *if-label-example_test_esp32c3
- <<: *if-label-example_test_esp32s2
- <<: *if-label-example_test_esp32s3
- <<: *if-label-integration_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-label-unit_test_esp32c3
- <<: *if-label-unit_test_esp32s2
- <<: *if-label-unit_test_esp32s3
- <<: *if-dev-push
changes: *patterns-build-example_test
- <<: *if-dev-push
changes: *patterns-component_ut
- <<: *if-dev-push
changes: *patterns-custom_test
- <<: *if-dev-push
changes: *patterns-example_test
- <<: *if-dev-push
changes: *patterns-integration_test
- <<: *if-dev-push
changes: *patterns-unit_test
.rules:test:unit_test-esp32:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-dev-push
@@ -953,6 +983,7 @@
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32c3
- <<: *if-dev-push
@@ -963,6 +994,7 @@
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s2
- <<: *if-dev-push
@@ -973,6 +1005,7 @@
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s3
- <<: *if-dev-push
+56 -36
View File
@@ -7,13 +7,13 @@
.target_test_job_template:
stage: target_test
needs:
- assign_test
artifacts:
when: always
paths:
- "**/*.log"
- $LOG_PATH
exclude:
- .git/**/*
expire_in: 1 week
reports:
junit: $LOG_PATH/*/XUNIT_RESULT.xml
@@ -38,6 +38,8 @@
.example_test_template:
extends: .target_test_job_template
needs:
- assign_example_test
variables:
TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/examples/test_configs"
@@ -115,10 +117,9 @@ example_test_001D:
example_test_OTA:
extends: .example_test_esp32_template
parallel: 2
tags:
- ESP32
- Example_WIFI_OTA
- EXAMPLE_ETH_OTA
example_test_protocols:
extends: .example_test_esp32_template
@@ -127,6 +128,13 @@ example_test_protocols:
- ESP32
- Example_WIFI_Protocols
# This job is only triggered by env var `NIGHTLY_RUN`, please do NOT remove
example_test_esp32_WIFI_OTA:
extends: .example_test_esp32_template
tags:
- ESP32
- Example_WIFI_OTA
example_test_002:
extends: .example_test_esp32_template
image: $CI_DOCKER_REGISTRY/ubuntu-test-env$BOT_DOCKER_IMAGE_TAG
@@ -295,6 +303,8 @@ example_test_ESP32C3_SDSPI:
.test_app_template:
extends: .target_test_job_template
needs:
- assign_custom_test
variables:
TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/test_apps"
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/tools/test_apps/test_configs"
@@ -333,6 +343,12 @@ test_app_test_002:
- ESP32
- Example_WIFI
test_app_test_eth:
extends: .test_app_esp32_template
tags:
- ESP32
- Example_EthKitV1
test_app_test_003:
extends: .test_app_esp32_template
tags:
@@ -381,6 +397,8 @@ test_app_test_flash_psram_f8r8:
.component_ut_template:
extends: .target_test_job_template
needs: # the assign already needs all the build jobs
- assign_component_ut
variables:
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/component_ut/test_configs"
script:
@@ -443,9 +461,11 @@ component_ut_test_esp32c3:
.unit_test_template:
extends: .target_test_job_template
needs: # the assign already needs all the build jobs
- assign_unit_test
variables:
TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/components/idf_test/unit_test/CIConfigs"
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/components/idf_test/unit_test/test_configs"
.unit_test_esp32_template:
extends:
@@ -513,7 +533,7 @@ UT_006:
UT_007:
extends: .unit_test_esp32_template
parallel: 4
parallel: 7
tags:
- ESP32_IDF
- UT_T1_1
@@ -664,7 +684,7 @@ UT_046:
UT_047:
extends: .unit_test_esp32s2_template
parallel: 6
parallel: 7
tags:
- ESP32S2_IDF
- UT_T1_1
@@ -683,7 +703,7 @@ UT_S2_SDSPI:
UT_C3:
extends: .unit_test_esp32c3_template
parallel: 34
parallel: 35
tags:
- ESP32C3_IDF
- UT_T1_1
@@ -727,7 +747,7 @@ UT_C3_SDSPI:
UT_S3:
extends: .unit_test_esp32s3_template
parallel: 31
parallel: 32
tags:
- ESP32S3_IDF
- UT_T1_1
@@ -761,18 +781,18 @@ component_ut_test_lan8720:
extends:
- .target_test_job_template
- .rules:test:integration_test
needs:
- assign_test
- build_ssc_esp32
needs: # the assign already needs all the build jobs
- assign_integration_test
variables:
LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
LOG_PATH: "${CI_PROJECT_DIR}/TEST_LOGS"
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/auto_test_script/TestCaseFiles"
MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/components/idf_test/integration_test/CIConfigs"
KNOWN_ISSUE_FILE: "${CI_PROJECT_DIR}/components/idf_test/integration_test/KnownIssues"
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/tools/ci/integration_test/test_configs"
KNOWN_ISSUE_FILE: "${CI_PROJECT_DIR}/tools/ci/integration_test/KnownIssues"
CI_RUNNER_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIRunner.py"
PYTHONPATH: ${CI_PROJECT_DIR}/auto_test_script/packages
PREPARE_TEST_BIN_SCRIPT: "${CI_PROJECT_DIR}/tools/ci/integration_test/prepare_test_bins.py"
PYTHONPATH: "${CI_PROJECT_DIR}/auto_test_script/packages:${PYTHONPATH}"
INITIAL_CONDITION_RETRY_COUNT: "1"
# auto_test_script only supports python 3.7.x
PYTHON_VER: 3.7.7
script:
@@ -789,8 +809,15 @@ component_ut_test_lan8720:
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script --customized_only
- cat ${KNOWN_ISSUE_FILE} >> ${TEST_CASE_FILE_PATH}/KnownIssues
# run test
- python ${PREPARE_TEST_BIN_SCRIPT} $CONFIG_FILE
- python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOB_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
.integration_test_esp32c3_template:
extends:
- .integration_test_template
variables:
LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32C3_IDF"
nvs_compatible_test:
extends: .integration_test_template
artifacts:
@@ -818,11 +845,12 @@ nvs_compatible_test:
- cd auto_test_script
- ./tools/prepare_nvs_bin.sh
# run test
- python ${PREPARE_TEST_BIN_SCRIPT} $CONFIG_FILE
- python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOB_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
IT_001:
extends: .integration_test_template
parallel: 3
parallel: 2
tags:
- ESP32_IDF
- SSC_T1_4
@@ -835,34 +863,26 @@ IT_002:
IT_003:
extends: .integration_test_template
parallel: 14
parallel: 9
tags:
- ESP32_IDF
- SSC_T2_5
IT_004:
extends: .integration_test_template
tags:
- ESP32_IDF
- SSC_T1_APC
IT_005:
extends: .integration_test_template
parallel: 2
tags:
- ESP32_IDF
- SSC_T1_5
IT_006:
extends: .integration_test_template
parallel: 12
parallel: 5
tags:
- ESP32_IDF
- SSC_T1_6
IT_007:
extends: .integration_test_template
parallel: 3
tags:
- ESP32_IDF
- SSC_T1_7
@@ -873,12 +893,6 @@ IT_008:
- ESP32_IDF
- SSC_T1_8
IT_009:
extends: .integration_test_template
tags:
- ESP32_IDF
- SSC_T1_3
IT_011:
extends: .integration_test_template
tags:
@@ -931,7 +945,6 @@ IT_018:
IT_019:
extends: .integration_test_template
parallel: 2
tags:
- ESP32_IDF
- SSC_T2_2
@@ -942,8 +955,15 @@ IT_020:
- ESP32_IDF
- SSC_T2_3
IT_021:
IT_022:
extends: .integration_test_template
tags:
- ESP32_IDF
- SSC_T2_4
- SSC_T3_2
IT_C3_001:
extends: .integration_test_esp32c3_template
parallel: 6
tags:
- ESP32C3_IDF
- SSC_T2_5
+3 -1
View File
@@ -18,11 +18,13 @@ menu "Application Level Tracing"
config APPTRACE_DEST_TRAX
bool
depends on IDF_TARGET_ARCH_XTENSA && !ESP32_TRAX && !ESP32S2_TRAX
depends on IDF_TARGET_ARCH_XTENSA && !ESP32_TRAX && !ESP32S2_TRAX && !ESP32S3_TRAX
select ESP32_MEMMAP_TRACEMEM
select ESP32S2_MEMMAP_TRACEMEM
select ESP32S3_MEMMAP_TRACEMEM
select ESP32_MEMMAP_TRACEMEM_TWOBANKS
select ESP32S2_MEMMAP_TRACEMEM_TWOBANKS
select ESP32S3_MEMMAP_TRACEMEM_TWOBANKS
default n
help
Enables/disable TRAX tracing HW.
@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <sys/param.h>
#include <string.h>
#include "sdkconfig.h"
@@ -93,7 +99,8 @@ static esp_err_t esp_apptrace_membufs_swap(esp_apptrace_membufs_proto_data_t *pr
if (proto->hw->host_data_pending() && hdr->block_sz > 0) {
// TODO: add support for multiple blocks from host, currently there is no need for that
uint8_t *p = proto->blocks[new_block_num].start + proto->blocks[new_block_num].sz;
ESP_APPTRACE_LOGD("Recvd %d bytes from host [%x %x %x %x %x %x %x %x .. %x %x %x %x %x %x %x %x]", hdr->block_sz,
ESP_APPTRACE_LOGD("Recvd %d bytes from host (@ 0x%x) [%x %x %x %x %x %x %x %x .. %x %x %x %x %x %x %x %x]",
hdr->block_sz, proto->blocks[new_block_num].start,
*(proto->blocks[new_block_num].start+0), *(proto->blocks[new_block_num].start+1),
*(proto->blocks[new_block_num].start+2), *(proto->blocks[new_block_num].start+3),
*(proto->blocks[new_block_num].start+4), *(proto->blocks[new_block_num].start+5),
-7
View File
@@ -52,18 +52,11 @@ void gcov_dump_task(void *pvParameter)
}
ESP_EARLY_LOGV(TAG, "Config apptrace down buf");
esp_apptrace_down_buffer_config(down_buf, ESP_GCOV_DOWN_BUF_SIZE);
/* we are directing the std outputs to the fake ones in order to reduce stack usage */
FILE *old_stderr = stderr;
FILE *old_stdout = stdout;
stderr = (FILE *) &__sf_fake_stderr;
stdout = (FILE *) &__sf_fake_stdout;
ESP_EARLY_LOGV(TAG, "Dump data...");
__gcov_dump();
// reset dump status to allow incremental data accumulation
__gcov_reset();
free(down_buf);
stderr = old_stderr;
stdout = old_stdout;
ESP_EARLY_LOGV(TAG, "Finish file transfer session");
dump_result = esp_apptrace_fstop(ESP_APPTRACE_DEST_TRAX);
if (dump_result != ESP_OK) {
+7 -16
View File
@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "esp_log.h"
#include "esp_app_trace_membufs_proto.h"
#include "esp_app_trace_port.h"
@@ -94,25 +100,10 @@ esp_apptrace_hw_t *esp_apptrace_jtag_hw_get(void **data)
e.g. OpenOCD flasher stub use own implementation of it. */
__attribute__((weak)) int esp_apptrace_advertise_ctrl_block(void *ctrl_block_addr)
{
register int sys_nr = RISCV_APPTRACE_SYSNR;
register int host_ret = 0;
if (!esp_cpu_in_ocd_debug_mode()) {
return 0;
}
__asm__ volatile ( \
".option push\n" \
".option norvc\n" \
"mv a0, %[sys_nr]\n" \
"mv a1, %[arg1]\n" \
"slli zero,zero,0x1f\n" \
"ebreak\n" \
"srai zero,zero,0x7\n" \
"mv %[host_ret], a0\n" \
".option pop\n" \
:[host_ret]"=r"(host_ret)
:[sys_nr]"r"(sys_nr),[arg1]"r"(ctrl_block_addr):"a0","a1");
return host_ret;
return cpu_hal_syscall(RISCV_APPTRACE_SYSNR, (int)ctrl_block_addr, 0, 0, 0, NULL);
}
/* Returns up buffers config.
+22 -26
View File
@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
//
// How It Works
// ************
@@ -143,9 +149,9 @@
#include "sdkconfig.h"
#include "soc/soc.h"
#include "soc/dport_access.h"
#if CONFIG_IDF_TARGET_ESP32
#include "soc/dport_reg.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "soc/tracemem_config.h"
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#include "soc/sensitive_reg.h"
#endif
#include "eri.h"
@@ -154,18 +160,6 @@
#include "esp_app_trace_membufs_proto.h"
#include "esp_app_trace_port.h"
// TODO: move these (and same definitions in trax.c to dport_reg.h)
#if CONFIG_IDF_TARGET_ESP32
#define TRACEMEM_MUX_PROBLK0_APPBLK1 0
#define TRACEMEM_MUX_BLK0_ONLY 1
#define TRACEMEM_MUX_BLK1_ONLY 2
#define TRACEMEM_MUX_PROBLK1_APPBLK0 3
#elif CONFIG_IDF_TARGET_ESP32S2
#define TRACEMEM_MUX_BLK0_NUM 19
#define TRACEMEM_MUX_BLK1_NUM 20
#define TRACEMEM_BLK_NUM2ADDR(_n_) (0x3FFB8000UL + 0x4000UL*((_n_)-4))
#endif
// TRAX is disabled, so we use its registers for our own purposes
// | 31..XXXXXX..24 | 23 .(host_connect). 23 | 22 .(host_data). 22| 21..(block_id)..15 | 14..(block_len)..0 |
#define ESP_APPTRACE_TRAX_CTRL_REG ERI_TRAX_DELAYCNT
@@ -182,18 +176,6 @@
#define ESP_APPTRACE_TRAX_INITED(_hw_) ((_hw_)->inited & (1 << cpu_hal_get_core_id()))
#if CONFIG_IDF_TARGET_ESP32
static uint8_t * const s_trax_blocks[] = {
(uint8_t *) 0x3FFFC000,
(uint8_t *) 0x3FFF8000
};
#elif CONFIG_IDF_TARGET_ESP32S2
static uint8_t * const s_trax_blocks[] = {
(uint8_t *)TRACEMEM_BLK_NUM2ADDR(TRACEMEM_MUX_BLK0_NUM),
(uint8_t *)TRACEMEM_BLK_NUM2ADDR(TRACEMEM_MUX_BLK1_NUM)
};
#endif
#define ESP_APPTRACE_TRAX_BLOCK_SIZE (0x4000UL)
/** TRAX HW transport data */
@@ -223,6 +205,12 @@ static bool esp_apptrace_trax_host_data_pending(void);
const static char *TAG = "esp_apptrace";
static uint8_t * const s_trax_blocks[] = {
(uint8_t *)TRACEMEM_BLK0_ADDR,
(uint8_t *)TRACEMEM_BLK1_ADDR
};
esp_apptrace_hw_t *esp_apptrace_uart_hw_get(int num, void **data)
{
return NULL;
@@ -300,6 +288,14 @@ static inline void esp_apptrace_trax_select_memory_block(int block_num)
DPORT_WRITE_PERI_REG(DPORT_TRACEMEM_MUX_MODE_REG, block_num ? TRACEMEM_MUX_BLK0_ONLY : TRACEMEM_MUX_BLK1_ONLY);
#elif CONFIG_IDF_TARGET_ESP32S2
WRITE_PERI_REG(DPORT_PMS_OCCUPY_3_REG, block_num ? BIT(TRACEMEM_MUX_BLK0_NUM-4) : BIT(TRACEMEM_MUX_BLK1_NUM-4));
#elif CONFIG_IDF_TARGET_ESP32S3
// select memory block to be exposed to the TRAX module (accessed by host)
uint32_t block_bits = block_num ? TRACEMEM_CORE0_MUX_BLK_BITS(TRACEMEM_MUX_BLK0_NUM)
: TRACEMEM_CORE0_MUX_BLK_BITS(TRACEMEM_MUX_BLK1_NUM);
block_bits |= block_num ? TRACEMEM_CORE1_MUX_BLK_BITS(TRACEMEM_MUX_BLK0_NUM)
: TRACEMEM_CORE1_MUX_BLK_BITS(TRACEMEM_MUX_BLK1_NUM);
ESP_EARLY_LOGV(TAG, "Select block %d @ %p (bits 0x%x)", block_num, s_trax_blocks[block_num], block_bits);
DPORT_WRITE_PERI_REG(SENSITIVE_INTERNAL_SRAM_USAGE_2_REG, block_bits);
#endif
}
@@ -73,6 +73,8 @@ Revision: $Rev: 3734 $
#include "esp32/clk.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/clk.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/clk.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/clk.h"
#endif
@@ -142,6 +144,8 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
#define SYSVIEW_TIMESTAMP_FREQ (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000)
#elif CONFIG_IDF_TARGET_ESP32S2
#define SYSVIEW_TIMESTAMP_FREQ (CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000)
#elif CONFIG_IDF_TARGET_ESP32S3
#define SYSVIEW_TIMESTAMP_FREQ (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000)
#endif
#endif // TS_USE_CCOUNT
@@ -76,9 +76,6 @@ Notes:
*
**********************************************************************
*/
#ifndef portSTACK_GROWTH
#define portSTACK_GROWTH ( -1 )
#endif
#define SYSVIEW_FREERTOS_MAX_NOF_TASKS CONFIG_APPTRACE_SV_MAX_TASKS
+23 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -824,3 +824,25 @@ static void test_flow6(void)
// 2 Stage: run factory -> check it -> copy factory to OTA0 -> reboot --//--
// 3 Stage: run OTA0 -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0 using esp_ota_write_with_offset", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow6, test_flow6);
TEST_CASE("Test bootloader_common_get_sha256_of_partition returns ESP_ERR_IMAGE_INVALID when image is ivalid", "[partitions]")
{
const esp_partition_t *cur_app = esp_ota_get_running_partition();
ESP_LOGI(TAG, "copy current app to next part");
const esp_partition_t *other_app = get_next_update_partition();
copy_current_app_to_next_part(cur_app, other_app);
erase_ota_data();
uint8_t sha_256_cur_app[32];
uint8_t sha_256_other_app[32];
TEST_ESP_OK(bootloader_common_get_sha256_of_partition(cur_app->address, cur_app->size, cur_app->type, sha_256_cur_app));
TEST_ESP_OK(bootloader_common_get_sha256_of_partition(other_app->address, other_app->size, other_app->type, sha_256_other_app));
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha_256_cur_app, sha_256_other_app, sizeof(sha_256_cur_app), "must be the same");
uint32_t data = 0;
bootloader_flash_write(other_app->address + 0x50, &data, sizeof(data), false);
TEST_ESP_ERR(ESP_ERR_IMAGE_INVALID, bootloader_common_get_sha256_of_partition(other_app->address, other_app->size, other_app->type, sha_256_other_app));
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha_256_cur_app, sha_256_other_app, sizeof(sha_256_cur_app), "must be the same");
}
@@ -168,6 +168,12 @@ esp_err_t bootloader_common_get_sha256_of_partition (uint32_t address, uint32_t
}
if (data.image.hash_appended) {
memcpy(out_sha_256, data.image_digest, ESP_PARTITION_HASH_LEN);
uint8_t calc_sha256[ESP_PARTITION_HASH_LEN];
// The hash is verified before returning, if app content is invalid then the function returns ESP_ERR_IMAGE_INVALID.
esp_err_t error = bootloader_sha256_flash_contents(address, data.image_len - ESP_PARTITION_HASH_LEN, calc_sha256);
if (error || memcmp(data.image_digest, calc_sha256, ESP_PARTITION_HASH_LEN) != 0) {
return ESP_ERR_IMAGE_INVALID;
}
return ESP_OK;
}
// If image doesn't have a appended hash then hash calculates for entire image.
@@ -73,10 +73,12 @@ void bootloader_console_init(void)
// Route GPIO signals to/from pins
const uint32_t tx_idx = UART_PERIPH_SIGNAL(uart_num, SOC_UART_TX_PIN_IDX);
const uint32_t rx_idx = UART_PERIPH_SIGNAL(uart_num, SOC_UART_RX_PIN_IDX);
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[uart_rx_gpio], PIN_FUNC_GPIO);
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[uart_rx_gpio]);
esp_rom_gpio_pad_pullup_only(uart_rx_gpio);
esp_rom_gpio_connect_out_signal(uart_tx_gpio, tx_idx, 0, 0);
esp_rom_gpio_connect_in_signal(uart_rx_gpio, rx_idx, 0);
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[uart_tx_gpio], PIN_FUNC_GPIO);
// Enable the peripheral
periph_ll_enable_clk_clear_rst(PERIPH_UART0_MODULE + uart_num);
}
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -12,8 +12,7 @@
uint8_t bootloader_common_get_chip_revision(void)
{
// should return the same value as esp_efuse_get_chip_ver()
/* No other revisions for ESP32-S2 */
return 0;
return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_WAFER_VERSION);
}
uint32_t bootloader_common_get_chip_ver_pkg(void)
@@ -43,15 +43,15 @@
#define BYTESHIFT(VAR, IDX) (((VAR) >> ((IDX) * 8)) & 0xFF)
#define ISSI_ID 0x9D
#define MXIC_ID 0xC2
#define GD_Q_ID_HIGH 0xC8
#define GD_Q_ID_MID 0x40
#define GD_Q_ID_LOW 0x16
#define ESP_BOOTLOADER_SPIFLASH_BP_MASK_ISSI (BIT7 | BIT5 | BIT4 | BIT3 | BIT2)
#define ESP_BOOTLOADER_SPIFLASH_QE_16B BIT9 // QE position when you write 16 bits at one time.
#define ESP_BOOTLOADER_SPIFLASH_QE_8B BIT1 // QE position when you write 8 bits(for SR2) at one time.
#define ESP_BOOTLOADER_SPIFLASH_WRITE_8B (8)
#define ESP_BOOTLOADER_SPIFLASH_WRITE_16B (16)
#define ESP_BOOTLOADER_SPIFLASH_QE_GD_SR2 BIT1 // QE position when you write 8 bits(for SR2) at one time.
#define ESP_BOOTLOADER_SPIFLASH_QE_SR1_2BYTE BIT9 // QE position when you write 16 bits at one time.
#ifndef BOOTLOADER_BUILD
/* Normal app version maps to esp_spi_flash.h operations...
@@ -495,72 +495,77 @@ FORCE_INLINE_ATTR bool is_gd_q_chip(const esp_rom_spiflash_chip_t* chip)
return BYTESHIFT(chip->device_id, 2) == GD_Q_ID_HIGH && BYTESHIFT(chip->device_id, 1) == GD_Q_ID_MID && BYTESHIFT(chip->device_id, 0) >= GD_Q_ID_LOW;
}
FORCE_INLINE_ATTR bool is_mxic_chip(const esp_rom_spiflash_chip_t* chip)
{
return BYTESHIFT(chip->device_id, 2) == MXIC_ID;
}
esp_err_t IRAM_ATTR __attribute__((weak)) bootloader_flash_unlock(void)
{
// At the beginning status == new_status == status_sr2 == new_status_sr2 == 0.
// If the register doesn't need to be updated, keep them the same (0), so that no command will be actually sent.
uint16_t status = 0; // status for SR1 or SR1+SR2 if writing SR with 01H + 2Bytes.
uint16_t new_status = 0;
uint8_t status_sr2 = 0; // status_sr2 for SR2.
uint8_t new_status_sr2 = 0;
uint8_t write_sr_bit = 0;
uint8_t sr1_bit_num = 0;
esp_err_t err = ESP_OK;
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
if (is_issi_chip(&g_rom_flashchip)) {
write_sr_bit = ESP_BOOTLOADER_SPIFLASH_WRITE_8B;
// ISSI chips have different QE position
if (is_issi_chip(&g_rom_flashchip) || is_mxic_chip(&g_rom_flashchip)) {
// Currently ISSI & MXIC share the same command and register layout, which is different from the default model.
// If any code here needs to be modified, check both chips.
status = bootloader_execute_flash_command(CMD_RDSR, 0, 0, 8);
/* Clear all bits in the mask.
(This is different from ROM esp_rom_spiflash_unlock, which keeps all bits as-is.)
*/
sr1_bit_num = 8;
new_status = status & (~ESP_BOOTLOADER_SPIFLASH_BP_MASK_ISSI);
// Skip if nothing needs to be cleared. Otherwise will waste time waiting for the flash to clear nothing.
} else if (is_gd_q_chip(&g_rom_flashchip)) {
/* The GD chips behaviour is to clear all bits in SR1 and clear bits in SR2 except QE bit.
Use 01H to write SR1 and 31H to write SR2.
*/
write_sr_bit = ESP_BOOTLOADER_SPIFLASH_WRITE_8B;
status = bootloader_execute_flash_command(CMD_RDSR, 0, 0, 8);
sr1_bit_num = 8;
new_status = 0;
status_sr2 = bootloader_execute_flash_command(CMD_RDSR2, 0, 0, 8);
new_status_sr2 = status_sr2 & ESP_BOOTLOADER_SPIFLASH_QE_8B;
new_status_sr2 = status_sr2 & ESP_BOOTLOADER_SPIFLASH_QE_GD_SR2;
} else {
/* For common behaviour, like XMC chips, Use 01H+2Bytes to write both SR1 and SR2*/
write_sr_bit = ESP_BOOTLOADER_SPIFLASH_WRITE_16B;
status = bootloader_execute_flash_command(CMD_RDSR, 0, 0, 8) | (bootloader_execute_flash_command(CMD_RDSR2, 0, 0, 8) << 8);
/* Clear all bits except QE, if it is set.
(This is different from ROM esp_rom_spiflash_unlock, which keeps all bits as-is.)
*/
new_status = status & ESP_BOOTLOADER_SPIFLASH_QE_16B;
sr1_bit_num = 16;
new_status = status & ESP_BOOTLOADER_SPIFLASH_QE_SR1_2BYTE;
}
// When SR is written, set to true to indicate that WRDI need to be sent to ensure the protection is ON before return.
bool status_written = false;
// Skip if nothing needs to be changed. Meaningless writing to SR increases the risk during write and wastes time.
if (status != new_status) {
/* if the status in SR not equal to the ideal status, the status need to be updated */
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
bootloader_execute_flash_command(CMD_WREN, 0, 0, 0);
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
bootloader_execute_flash_command(CMD_WRSR, new_status, write_sr_bit, 0);
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
bootloader_execute_flash_command(CMD_WRSR, new_status, sr1_bit_num, 0);
status_written = true;
}
if (status_sr2 != new_status_sr2) {
/* If the status in SR2 not equal to the ideal status, the status need to be updated.
It doesn't need to be updated if status in SR2 is 0.
Note: if we need to update both SR1 and SR2, the `CMD_WREN` needs to be sent again.
*/
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
bootloader_execute_flash_command(CMD_WREN, 0, 0, 0);
bootloader_execute_flash_command(CMD_WRSR2, new_status_sr2, 8, 0);
status_written = true;
}
if (status_written) {
//Call esp_rom_spiflash_wait_idle to make sure previous WRSR is completed.
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
bootloader_execute_flash_command(CMD_WRSR2, new_status_sr2, write_sr_bit, 0);
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
bootloader_execute_flash_command(CMD_WRDI, 0, 0, 0);
}
bootloader_execute_flash_command(CMD_WRDI, 0, 0, 0);
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
return err;
}
@@ -74,6 +74,7 @@ void bootloader_random_enable(void)
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC_DTEST_RTC_ADDR, 0);
}
//TODO: IDF-4714
void bootloader_random_disable(void)
{
/* Restore internal I2C bus state */
@@ -82,13 +83,19 @@ void bootloader_random_disable(void)
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC_ENT_RTC_ADDR, 0);
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC_DTEST_RTC_ADDR, 0);
/* Restore SARADC to default mode */
CLEAR_PERI_REG_MASK(SENS_SAR_MEAS1_MUX_REG, SENS_SAR1_DIG_FORCE);
SET_PERI_REG_MASK(SYSTEM_PERIP_CLK_EN0_REG, SYSTEM_APB_SARADC_CLK_EN);
REG_SET_FIELD(SENS_SAR_POWER_XPD_SAR_REG, SENS_FORCE_XPD_SAR, 0);
CLEAR_PERI_REG_MASK(APB_SARADC_CTRL2_REG, APB_SARADC_TIMER_EN);
//Stop SAR ADC clock
CLEAR_PERI_REG_MASK(SENS_SAR_PERI_CLK_GATE_CONF_REG, SENS_SARADC_CLK_EN);
//Power off SAR ADC
REG_SET_FIELD(SENS_SAR_POWER_XPD_SAR_REG, SENS_FORCE_XPD_SAR, 0);
//return to ADC RTC controller
CLEAR_PERI_REG_MASK(SENS_SAR_MEAS1_MUX_REG, SENS_SAR1_DIG_FORCE);
//Invalidate ADC digital trigger timer
CLEAR_PERI_REG_MASK(APB_SARADC_CTRL2_REG, APB_SARADC_TIMER_EN);
//Disable ADC digital part
CLEAR_PERI_REG_MASK(SYSTEM_PERIP_CLK_EN0_REG, SYSTEM_APB_SARADC_CLK_EN);
//Hold reset bit for ADC digital part
SET_PERI_REG_MASK(SYSTEM_PERIP_RST_EN0_REG, SYSTEM_APB_SARADC_RST);
/* Note: the 8M CLK entropy source continues running even after this function is called,
but as mentioned above it's better to enable Wi-Fi or BT or call bootloader_random_enable()
@@ -82,6 +82,7 @@ const static qio_info_t chip_data[] = {
{ "WinBond", 0xEF, 0x4000, 0xFF00, read_status_16b_rdsr_rdsr2, write_status_16b_wrsr, 9 },
{ "GD", 0xC8, 0x6000, 0xFF00, read_status_16b_rdsr_rdsr2, write_status_16b_wrsr, 9 },
{ "XM25QU64A", 0x20, 0x3817, 0xFFFF, read_status_8b_xmc25qu64a, write_status_8b_xmc25qu64a, 6 },
{ "TH", 0xcd, 0x6000, 0xFF00, read_status_16b_rdsr_rdsr2, write_status_16b_wrsr, 9 },
/* Final entry is default entry, if no other IDs have matched.
+3 -1
View File
@@ -550,10 +550,12 @@ static void config_parse(nvs_handle_t fp, config_t *config)
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
char *keyname = osi_calloc(keyname_bufsz);
int buf_size = get_config_size_from_flash(fp);
char *buf = osi_calloc(buf_size);
char *buf = NULL;
if(buf_size == 0) { //First use nvs
goto error;
}
buf = osi_calloc(buf_size);
if (!line || !section || !buf || !keyname) {
err_code |= 0x01;
goto error;
@@ -66,6 +66,13 @@ config BT_CTRL_HW_CCA
help
It enables HW CCA feature in controller
config BT_CTRL_HW_CCA_VAL
int "CCA threshold value"
range 20 60
default 20
help
It is the threshold value of HW CCA, if the value is 30, it means CCA threshold is -30 dBm.
config BT_CTRL_HW_CCA_EFF
int
default 1 if BT_CTRL_HW_CCA
@@ -81,6 +81,13 @@ config BT_CTRL_HW_CCA
help
It enables HW CCA feature in controller
config BT_CTRL_HW_CCA_VAL
int "CCA threshold value"
range 20 60
default 20
help
It is the threshold value of HW CCA, if the value is 30, it means CCA threshold is -30 dBm.
config BT_CTRL_HW_CCA_EFF
int
default 1 if BT_CTRL_HW_CCA
@@ -877,6 +877,8 @@ typedef enum {
ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT, /*!< Proxy Client set filter type completion event */
ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT, /*!< Proxy Client add filter address completion event */
ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT, /*!< Proxy Client remove filter address completion event */
ESP_BLE_MESH_PROXY_SERVER_CONNECTED_EVT, /*!< Proxy Server establishes connection successfully event */
ESP_BLE_MESH_PROXY_SERVER_DISCONNECTED_EVT, /*!< Proxy Server terminates connection successfully event */
ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT, /*!< Local model subscribes group address completion event */
ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT, /*!< Local model unsubscribes group address completion event */
ESP_BLE_MESH_DEINIT_MESH_COMP_EVT, /*!< De-initialize BLE Mesh stack completion event */
@@ -1459,6 +1461,19 @@ typedef union {
uint8_t conn_handle; /*!< Proxy connection handle */
uint16_t net_idx; /*!< Corresponding NetKey Index */
} proxy_client_remove_filter_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT */
/**
* @brief ESP_BLE_MESH_PROXY_SERVER_CONNECTED_EVT
*/
struct ble_mesh_proxy_server_connected_param {
uint8_t conn_handle; /*!< Proxy connection handle */
} proxy_server_connected; /*!< Event parameter of ESP_BLE_MESH_PROXY_SERVER_CONNECTED_EVT */
/**
* @brief ESP_BLE_MESH_PROXY_SERVER_DISCONNECTED_EVT
*/
struct ble_mesh_proxy_server_disconnected_param {
uint8_t conn_handle; /*!< Proxy connection handle */
uint8_t reason; /*!< Proxy disconnect reason */
} proxy_server_disconnected; /*!< Event parameter of ESP_BLE_MESH_PROXY_SERVER_DISCONNECTED_EVT */
/**
* @brief ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT
*/
@@ -1002,6 +1002,41 @@ static void btc_ble_mesh_proxy_client_filter_status_recv_cb(uint8_t conn_handle,
}
#endif /* CONFIG_BLE_MESH_GATT_PROXY_CLIENT */
#if CONFIG_BLE_MESH_GATT_PROXY_SERVER
static void btc_ble_mesh_proxy_server_connect_cb(uint8_t conn_handle)
{
esp_ble_mesh_prov_cb_param_t mesh_param = {0};
if (conn_handle >= BLE_MESH_MAX_CONN) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
BT_DBG("%s", __func__);
mesh_param.proxy_server_connected.conn_handle = conn_handle;
btc_ble_mesh_prov_callback(&mesh_param, ESP_BLE_MESH_PROXY_SERVER_CONNECTED_EVT);
}
static void btc_ble_mesh_proxy_server_disconnect_cb(uint8_t conn_handle, uint8_t reason)
{
esp_ble_mesh_prov_cb_param_t mesh_param = {0};
if (conn_handle >= BLE_MESH_MAX_CONN) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
BT_DBG("%s", __func__);
mesh_param.proxy_server_disconnected.conn_handle = conn_handle;
mesh_param.proxy_server_disconnected.reason = reason;
btc_ble_mesh_prov_callback(&mesh_param, ESP_BLE_MESH_PROXY_SERVER_DISCONNECTED_EVT);
}
#endif /* CONFIG_BLE_MESH_GATT_PROXY_SERVER */
int btc_ble_mesh_client_model_init(esp_ble_mesh_model_t *model)
{
if (!bt_mesh_is_initialized()) {
@@ -1769,6 +1804,10 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
bt_mesh_proxy_client_set_disconn_cb(btc_ble_mesh_proxy_client_disconnect_cb);
bt_mesh_proxy_client_set_filter_status_cb(btc_ble_mesh_proxy_client_filter_status_recv_cb);
#endif /* CONFIG_BLE_MESH_GATT_PROXY_CLIENT */
#if CONFIG_BLE_MESH_GATT_PROXY_SERVER
bt_mesh_proxy_server_set_conn_cb(btc_ble_mesh_proxy_server_connect_cb);
bt_mesh_proxy_server_set_disconn_cb(btc_ble_mesh_proxy_server_disconnect_cb);
#endif /* CONFIG_BLE_MESH_GATT_PROXY_SERVER */
int err_code = bt_mesh_init((struct bt_mesh_prov *)arg->mesh_init.prov,
(struct bt_mesh_comp *)arg->mesh_init.comp);
/* Give the semaphore when BLE Mesh initialization is finished. */
@@ -539,7 +539,8 @@ static int disc_cb(struct ble_gap_event *event, void *arg)
}
}
} else if (bt_mesh_gattc_info[i].service_uuid == BLE_MESH_UUID_MESH_PROXY_VAL) {
if (bt_mesh_gattc_conn_cb != NULL && bt_mesh_gattc_conn_cb->proxy_notify != NULL) {
if (bt_mesh_gattc_conn_cb != NULL && bt_mesh_gattc_conn_cb->proxy_notify != NULL &&
bt_mesh_gattc_info[i].wr_desc_done) {
len = bt_mesh_gattc_conn_cb->proxy_notify(&bt_mesh_gattc_info[i].conn,
notif_data, notif_len);
if (len < 0) {
@@ -159,6 +159,23 @@ static void proxy_sar_timeout(struct k_work *work)
}
#if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER)
/**
* The following callbacks are used to notify proper information
* to the application layer.
*/
static proxy_server_connect_cb_t proxy_server_connect_cb;
static proxy_server_disconnect_cb_t proxy_server_disconnect_cb;
void bt_mesh_proxy_server_set_conn_cb(proxy_server_connect_cb_t cb)
{
proxy_server_connect_cb = cb;
}
void bt_mesh_proxy_server_set_disconn_cb(proxy_server_disconnect_cb_t cb)
{
proxy_server_disconnect_cb = cb;
}
/* Next subnet in queue to be advertised */
static int next_idx;
@@ -605,6 +622,10 @@ static void proxy_connected(struct bt_mesh_conn *conn, uint8_t err)
client->filter_type = NONE;
#if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER)
(void)memset(client->filter, 0, sizeof(client->filter));
if (proxy_server_connect_cb) {
proxy_server_connect_cb(conn->handle);
}
#endif
net_buf_simple_reset(&client->buf);
}
@@ -621,6 +642,11 @@ static void proxy_disconnected(struct bt_mesh_conn *conn, uint8_t reason)
struct bt_mesh_proxy_client *client = &clients[i];
if (client->conn == conn) {
#if CONFIG_BLE_MESH_GATT_PROXY_SERVER
if (proxy_server_disconnect_cb) {
proxy_server_disconnect_cb(conn->handle, reason);
}
#endif
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) &&
client->filter_type == PROV) {
bt_mesh_pb_gatt_close(conn);
@@ -38,6 +38,9 @@ extern "C" {
#define DEVICE_NAME_SIZE (BLE_MESH_GAP_ADV_MAX_LEN - 2)
#endif
typedef void (*proxy_server_connect_cb_t)(uint8_t conn_handle);
typedef void (*proxy_server_disconnect_cb_t)(uint8_t conn_handle, uint8_t reason);
int bt_mesh_set_device_name(const char *name);
int bt_mesh_proxy_server_send(struct bt_mesh_conn *conn, uint8_t type,
@@ -46,6 +49,9 @@ int bt_mesh_proxy_server_send(struct bt_mesh_conn *conn, uint8_t type,
int bt_mesh_proxy_server_prov_enable(void);
int bt_mesh_proxy_server_prov_disable(bool disconnect);
void bt_mesh_proxy_server_set_conn_cb(proxy_server_connect_cb_t cb);
void bt_mesh_proxy_server_set_disconn_cb(proxy_server_disconnect_cb_t cb);
int bt_mesh_proxy_server_gatt_enable(void);
int bt_mesh_proxy_server_gatt_disable(void);
@@ -236,7 +236,7 @@ typedef enum {
#define ESP_BT_GAP_MIN_INQ_LEN (0x01) /*!< Minimum inquiry duration, unit is 1.28s */
#define ESP_BT_GAP_MAX_INQ_LEN (0x30) /*!< Maximum inquiry duration, unit is 1.28s */
/// A2DP state callback parameters
/// GAP state callback parameters
typedef union {
/**
* @brief ESP_BT_GAP_DISC_RES_EVT
@@ -60,6 +60,9 @@ typedef enum {
#define ESP_HF_CLIENT_PEER_FEAT_ECC 0x80 /* Enhanced Call Control */
#define ESP_HF_CLIENT_PEER_FEAT_EXTERR 0x100 /* Extended error codes */
#define ESP_HF_CLIENT_PEER_FEAT_CODEC 0x200 /* Codec Negotiation */
/* HFP 1.7+ */
#define ESP_HF_CLIENT_PEER_FEAT_HF_IND 0x400 /* HF Indicators */
#define ESP_HF_CLIENT_PEER_FEAT_ESCO_S4 0x800 /* eSCO S4 Setting Supported */
/* CHLD feature masks of AG */
#define ESP_HF_CLIENT_CHLD_FEAT_REL 0x01 /* 0 Release waiting call or held calls */
@@ -232,7 +232,7 @@ const tBTA_HF_CLIENT_ST_TBL bta_hf_client_st_tbl[] = {
bta_hf_client_st_closing
};
const char *bta_hf_client_version = "1.6";
const int bta_hf_client_version = HFP_HF_VERSION_1_7;
/* HF Client control block */
#if BTA_DYNAMIC_MEMORY == FALSE
@@ -387,7 +387,7 @@ static void bta_hf_client_api_enable(tBTA_HF_CLIENT_DATA *p_data)
bta_hf_client_cb.p_cback = p_data->api_enable.p_cback;
/* check if mSBC support enabled */
if (strcmp(bta_hf_client_version, "1.6") == 0) {
if (bta_hf_client_version >= HFP_HF_VERSION_1_6) {
bta_hf_client_cb.msbc_enabled = TRUE;
} else{
bta_hf_client_cb.msbc_enabled = FALSE;
@@ -18,6 +18,7 @@
******************************************************************************/
#include "bta_hf_client_int.h"
#include "bta/bta_hf_client_api.h"
#include "common/bt_trace.h"
#include <string.h>
#include "common/bt_defs.h"
@@ -34,6 +35,11 @@
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 | \
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5)
#define BTA_HF_CLIENT_SCO_PARAM_IDX_CVSD 0 /* SCO setting for CVSD */
#define BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S3 1 /* eSCO setting for CVSD S3 */
#define BTA_HF_CLIENT_ESCO_PARAM_IDX_MSBC_T2 2 /* eSCO setting for mSBC T2 */
#define BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S4 3 /* eSCO setting for CVSD S4 */
static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
/* SCO CVSD */
{
@@ -72,6 +78,19 @@ static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
.retrans_effort = BTM_ESCO_RETRANS_QUALITY,
},
/* HFP 1.7+ */
/* ESCO CVSD S4 */
{
.rx_bw = BTM_64KBITS_RATE,
.tx_bw = BTM_64KBITS_RATE,
.max_latency = 12,
.voice_contfmt = BTM_VOICE_SETTING_CVSD,
/* Allow controller to use all types available except 5-slot EDR */
.packet_types = (BTM_SCO_LINK_ALL_PKT_MASK |
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
.retrans_effort = BTM_ESCO_RETRANS_QUALITY,
}
};
@@ -178,18 +197,27 @@ static void bta_hf_client_sco_conn_rsp(tBTM_ESCO_CONN_REQ_EVT_DATA *p_data)
{
tBTM_ESCO_PARAMS resp;
UINT8 hci_status = HCI_SUCCESS;
UINT8 index = BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S3;
#if (BTM_SCO_HCI_INCLUDED == TRUE )
tBTA_HFP_CODEC_INFO codec_info = {BTA_HFP_SCO_CODEC_PCM};
UINT32 pcm_sample_rate;
#endif
APPL_TRACE_DEBUG("%s", __FUNCTION__);
APPL_TRACE_DEBUG("%s: negotiated codec = %d", __FUNCTION__, bta_hf_client_cb.scb.negotiated_codec);
if (bta_hf_client_cb.scb.sco_state == BTA_HF_CLIENT_SCO_LISTEN_ST) {
if (p_data->link_type == BTM_LINK_TYPE_SCO) {
resp = bta_hf_client_esco_params[0];
index = BTA_HF_CLIENT_SCO_PARAM_IDX_CVSD;
} else {
resp = bta_hf_client_esco_params[bta_hf_client_cb.scb.negotiated_codec];
if ((bta_hf_client_cb.scb.negotiated_codec == BTM_SCO_CODEC_CVSD) &&
(bta_hf_client_cb.scb.features && BTA_HF_CLIENT_FEAT_ESCO_S4) &&
(bta_hf_client_cb.scb.peer_features && BTA_HF_CLIENT_PEER_ESCO_S4)) {
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S4;
} else if (bta_hf_client_cb.scb.negotiated_codec == BTM_SCO_CODEC_MSBC) {
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_MSBC_T2;
}
}
resp = bta_hf_client_esco_params[index];
/* tell sys to stop av if any */
bta_sys_sco_use(BTA_ID_HS, 1, bta_hf_client_cb.scb.peer_addr);
@@ -350,6 +378,7 @@ static void bta_hf_client_sco_create(BOOLEAN is_orig)
tBTM_STATUS status;
UINT8 *p_bd_addr = NULL;
tBTM_ESCO_PARAMS params;
UINT8 index = BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S3;
#if (BTM_SCO_HCI_INCLUDED == TRUE )
tBTM_SCO_ROUTE_TYPE sco_route;
tBTA_HFP_CODEC_INFO codec_info = {BTA_HFP_SCO_CODEC_PCM};
@@ -364,7 +393,15 @@ static void bta_hf_client_sco_create(BOOLEAN is_orig)
return;
}
params = bta_hf_client_esco_params[1];
if (bta_hf_client_cb.scb.negotiated_codec == BTM_SCO_CODEC_CVSD) {
if ((bta_hf_client_cb.scb.features && BTA_HF_CLIENT_FEAT_ESCO_S4) &&
(bta_hf_client_cb.scb.peer_features && BTA_HF_CLIENT_PEER_ESCO_S4)) {
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_CVSD_S4;
}
} else if (bta_hf_client_cb.scb.negotiated_codec == BTM_SCO_CODEC_MSBC) {
index = BTA_HF_CLIENT_ESCO_PARAM_IDX_MSBC_T2;
}
params = bta_hf_client_esco_params[index];
/* if initiating set current scb and peer bd addr */
if (is_orig) {
@@ -114,7 +114,7 @@ BOOLEAN bta_hf_client_add_record(char *p_service_name, UINT8 scn,
/* add profile descriptor list */
profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
version = HFP_VERSION_1_6;
version = HFP_VERSION_1_7;
result &= SDP_AddProfileDescriptorList(sdp_handle, profile_uuid, version);
@@ -29,6 +29,7 @@
#define HFP_VERSION_1_1 0x0101
#define HFP_VERSION_1_5 0x0105
#define HFP_VERSION_1_6 0x0106
#define HFP_VERSION_1_7 0x0107
/* RFCOMM MTU SIZE */
#define BTA_HF_CLIENT_MTU 256
@@ -33,6 +33,10 @@
** Constants and data types
*****************************************************************************/
/* Hands-Free unit(HF) version */
#define HFP_HF_VERSION_1_6 0x0106 /* v1.6 */
#define HFP_HF_VERSION_1_7 0x0107 /* v1.7 */
/* HFP peer (AG) features*/
#define BTA_HF_CLIENT_PEER_FEAT_3WAY 0x00000001 /* Three-way calling */
#define BTA_HF_CLIENT_PEER_FEAT_ECNR 0x00000002 /* Echo cancellation and/or noise reduction */
@@ -44,6 +48,9 @@
#define BTA_HF_CLIENT_PEER_ECC 0x00000080 /* Enhanced Call Control */
#define BTA_HF_CLIENT_PEER_EXTERR 0x00000100 /* Extended error codes */
#define BTA_HF_CLIENT_PEER_CODEC 0x00000200 /* Codec Negotiation */
/* HFP 1.7+ */
#define BTA_HF_CLIENT_PEER_HF_IND 0x00000400 /* HF Indicators */
#define BTA_HF_CLIENT_PEER_ESCO_S4 0x00000800 /* eSCO S4 Setting Supported */
typedef UINT16 tBTA_HF_CLIENT_PEER_FEAT;
@@ -56,6 +63,8 @@ typedef UINT16 tBTA_HF_CLIENT_PEER_FEAT;
#define BTA_HF_CLIENT_FEAT_ECS 0x00000020 /* Enhanced Call Status */
#define BTA_HF_CLIENT_FEAT_ECC 0x00000040 /* Enhanced Call Control */
#define BTA_HF_CLIENT_FEAT_CODEC 0x00000080 /* Codec Negotiation */
#define BTA_HF_CLIENT_FEAT_HF_IND 0x00000100 /* HF indicators */
#define BTA_HF_CLIENT_FEAT_ESCO_S4 0x00000200 /* eSCO S4 Setting Supported */
/* HFP HF extended call handling - masks not related to any spec */
#define BTA_HF_CLIENT_CHLD_REL 0x00000001 /* 0 Release waiting call or held calls */
@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*****************************************************************************
*
@@ -33,7 +25,7 @@
#if BTC_AV_INCLUDED
typedef struct {
BOOLEAN data_channel_open;
BOOLEAN data_channel_open; /* used only by A2DP sink */
UINT8 a2dp_cmd_pending; /* we can have max one command pending */
} tBTC_AA_CTRL_CB;
@@ -83,7 +75,9 @@ static void btc_a2dp_datapath_open(void)
btc_a2dp_source_encoder_update();
}
#endif
#if (BTC_AV_SINK_INCLUDED == TRUE)
btc_aa_ctrl_cb.data_channel_open = TRUE;
#endif
}
BOOLEAN btc_a2dp_control_get_datachnl_stat(void)
@@ -96,22 +90,6 @@ void btc_a2dp_control_set_datachnl_stat(BOOLEAN open)
btc_aa_ctrl_cb.data_channel_open = open;
}
static void btc_a2dp_dispatch_datapath_evt(uint32_t dp_evt)
{
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_A2DP;
msg.act = BTC_AV_DATAPATH_CTRL_EVT;
btc_av_args_t arg;
memset(&arg, 0, sizeof(btc_av_args_t));
arg.dp_evt = dp_evt;
/* Switch to BTC context */
APPL_TRACE_DEBUG("%s sig %u act %u, dp_evt %u\n", __func__, msg.sig, msg.act, arg.dp_evt);
btc_transfer_context(&msg, &arg, sizeof(btc_av_args_t), NULL);
}
void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
{
APPL_TRACE_DEBUG("BTC MEDIA (A2DP-DATA) EVENT %u", ctrl);
@@ -146,17 +124,14 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
break;
case ESP_A2D_MEDIA_CTRL_START:
if (btc_av_stream_ready() == TRUE ) {
/* post start event and wait for audio path to open */
/* post start event */
btc_dispatch_sm_event(BTC_AV_START_STREAM_REQ_EVT, NULL, 0);
btc_a2dp_dispatch_datapath_evt(BTC_AV_DATAPATH_OPEN_EVT);
#if (BTC_AV_SINK_INCLUDED == TRUE)
if (btc_av_get_peer_sep() == AVDT_TSEP_SRC && btc_av_get_service_id() == BTA_A2DP_SINK_SERVICE_ID) {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
}
#endif
} else if (btc_av_stream_started_ready()) {
btc_a2dp_dispatch_datapath_evt(BTC_AV_DATAPATH_OPEN_EVT);
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
} else {
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/******************************************************************************
**
@@ -1579,7 +1571,6 @@ static void btc_a2dp_source_thread_init(UNUSED_ATTR void *context)
static void btc_a2dp_source_thread_cleanup(UNUSED_ATTR void *context)
{
btc_a2dp_control_set_datachnl_stat(FALSE);
/* Clear media task flag */
btc_a2dp_source_state = BTC_A2DP_SOURCE_STATE_OFF;
@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*****************************************************************************
*
@@ -681,6 +673,9 @@ static BOOLEAN btc_av_state_opened_handler(btc_sm_event_t event, void *p_data)
/* pending start flag will be cleared when exit current state */
}
#endif /* BTC_AV_SRC_INCLUDED */
/* wait for audio path to open */
btc_a2dp_control_datapath_ctrl(BTC_AV_DATAPATH_OPEN_EVT);
btc_sm_change_state(btc_av_cb.sm_handle, BTC_AV_STATE_STARTED);
} break;
@@ -1509,10 +1504,6 @@ void btc_a2dp_call_handler(btc_msg_t *msg)
btc_a2dp_control_media_ctrl(arg->ctrl);
break;
}
case BTC_AV_DATAPATH_CTRL_EVT: {
btc_a2dp_control_datapath_ctrl(arg->dp_evt);
break;
}
case BTC_AV_CONNECT_REQ_EVT:
btc_sm_dispatch(btc_av_cb.sm_handle, msg->act, (char *)msg->arg);
break;
@@ -51,13 +51,13 @@
#endif
#ifndef BTC_HF_CLIENT_FEATURES
#define BTC_HF_CLIENT_FEATURES ( BTA_HF_CLIENT_FEAT_ECNR | \
BTA_HF_CLIENT_FEAT_3WAY | \
BTA_HF_CLIENT_FEAT_CLI | \
BTA_HF_CLIENT_FEAT_VREC | \
BTA_HF_CLIENT_FEAT_VOL | \
BTA_HF_CLIENT_FEAT_ECS | \
BTA_HF_CLIENT_FEAT_ECC | \
#define BTC_HF_CLIENT_FEATURES ( BTA_HF_CLIENT_FEAT_ECNR | \
BTA_HF_CLIENT_FEAT_3WAY | \
BTA_HF_CLIENT_FEAT_CLI | \
BTA_HF_CLIENT_FEAT_VREC | \
BTA_HF_CLIENT_FEAT_VOL | \
BTA_HF_CLIENT_FEAT_ECS | \
BTA_HF_CLIENT_FEAT_ECC | \
BTA_HF_CLIENT_FEAT_CODEC)
#endif
@@ -66,7 +66,7 @@
/************************************************************************************
** Static variables
************************************************************************************/
const char *btc_hf_client_version = "1.6";
const int btc_hf_client_version = HFP_HF_VERSION_1_7;
#if HFP_DYNAMIC_MEMORY == FALSE
static hf_client_local_param_t hf_client_local_param;
@@ -200,7 +200,7 @@ static bt_status_t connect_int( bt_bdaddr_t *bd_addr, uint16_t uuid )
bt_status_t btc_hf_client_connect( bt_bdaddr_t *bd_addr )
{
BTC_TRACE_EVENT("HFP Client version is %s", btc_hf_client_version);
BTC_TRACE_EVENT("HFP Client version is 0x%04x", btc_hf_client_version);
CHECK_HF_CLIENT_INIT();
return btc_queue_connect(UUID_SERVCLASS_HF_HANDSFREE, bd_addr, connect_int);
}
@@ -690,33 +690,36 @@ bt_status_t btc_hf_client_execute_service(BOOLEAN b_enable)
{
BTC_TRACE_EVENT("%s enable:%d", __FUNCTION__, b_enable);
if (b_enable)
{
/* Enable and register with BTA-HFClient */
BTA_HfClientEnable(bte_hf_client_evt);
if (strcmp(btc_hf_client_version, "1.6") == 0)
{
BTC_TRACE_EVENT("Support Codec Nego. %d ", BTC_HF_CLIENT_FEATURES);
BTA_HfClientRegister(BTC_HF_CLIENT_SECURITY, BTC_HF_CLIENT_FEATURES,
BTC_HF_CLIENT_SERVICE_NAME);
}
else
{
BTC_TRACE_EVENT("No Codec Nego Supported");
hf_client_local_param.btc_hf_client_features = BTC_HF_CLIENT_FEATURES;
hf_client_local_param.btc_hf_client_features = hf_client_local_param.btc_hf_client_features & (~BTA_HF_CLIENT_FEAT_CODEC);
BTC_TRACE_EVENT("hf_client_local_param.btc_hf_client_features is %d", hf_client_local_param.btc_hf_client_features);
BTA_HfClientRegister(BTC_HF_CLIENT_SECURITY, hf_client_local_param.btc_hf_client_features,
BTC_HF_CLIENT_SERVICE_NAME);
}
if (b_enable)
{
/* Enable and register with BTA-HFClient */
BTA_HfClientEnable(bte_hf_client_evt);
hf_client_local_param.btc_hf_client_features = BTC_HF_CLIENT_FEATURES;
if (btc_hf_client_version >= HFP_HF_VERSION_1_7)
{
hf_client_local_param.btc_hf_client_features |= BTA_HF_CLIENT_FEAT_ESCO_S4;
BTC_TRACE_EVENT("eSCO S4 Setting Supported");
}
else
{
BTA_HfClientDeregister(hf_client_local_param.btc_hf_client_cb.handle);
BTA_HfClientDisable();
}
return BT_STATUS_SUCCESS;
}
else if (btc_hf_client_version >= HFP_HF_VERSION_1_6)
{
BTC_TRACE_EVENT("No eSCO S4 Setting Supported");
}
else
{
BTC_TRACE_EVENT("No Codec Nego Supported");
hf_client_local_param.btc_hf_client_features = hf_client_local_param.btc_hf_client_features & (~BTA_HF_CLIENT_FEAT_CODEC);
}
BTC_TRACE_EVENT("hf_client_local_param.btc_hf_client_features is %d", hf_client_local_param.btc_hf_client_features);
BTA_HfClientRegister(BTC_HF_CLIENT_SECURITY, hf_client_local_param.btc_hf_client_features,
BTC_HF_CLIENT_SERVICE_NAME);
}
else
{
BTA_HfClientDeregister(hf_client_local_param.btc_hf_client_cb.handle);
BTA_HfClientDisable();
}
return BT_STATUS_SUCCESS;
}
static void process_ind_evt(tBTA_HF_CLIENT_IND *ind)
@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*******************************************************************************
@@ -79,7 +71,6 @@ typedef enum {
BTC_AV_SRC_API_REG_DATA_CB_EVT,
#endif /* BTC_AV_SRC_INCLUDED */
BTC_AV_API_MEDIA_CTRL_EVT,
BTC_AV_DATAPATH_CTRL_EVT,
} btc_av_act_t;
/* btc_av_args_t */
@@ -104,8 +95,6 @@ typedef union {
#endif /* BTC_AV_SRC_INCLUDED */
// BTC_AV_API_MEDIA_CTRL_EVT
esp_a2d_media_ctrl_t ctrl;
// BTC_AV_DATAPATH_CTRL_EVT
uint32_t dp_evt;
} btc_av_args_t;
/*******************************************************************************
@@ -209,7 +209,8 @@ static void parse_ble_read_adv_max_len_response(
{
uint8_t *stream = read_command_complete_header(response, HCI_BLE_RD_MAX_ADV_DATA_LEN, 1 /* bytes after */);
STREAM_TO_UINT8(*adv_max_len_ptr, stream);
// Size: 2 Octets ; Value: 0x001F 0x0672 ; Maximum supported advertising data length
STREAM_TO_UINT16(*adv_max_len_ptr, stream);
osi_free(response);
}
@@ -693,23 +693,16 @@ tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
uint16_t rem_len;
uint16_t rem_len = len;
UINT8 operation = 0;
UINT16 data_offset = 0;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((status = btm_ble_ext_adv_set_data_validate(instance, len, data)) != BTM_SUCCESS) {
BTM_TRACE_ERROR("%s, invalid extend adv data.", __func__);
goto end;
}
if (len > controller_get_interface()->ble_get_ext_adv_data_max_len()) {
BTM_TRACE_ERROR("%s, The adv data len(%d) is longer then the controller adv max len(%d)",
__func__, len, controller_get_interface()->ble_get_ext_adv_data_max_len());
status = BTM_ILLEGAL_VALUE;
}
rem_len = len;
do {
UINT8 send_data_len = (rem_len > BTM_BLE_PERIODIC_ADV_DATA_LEN_MAX) ? BTM_BLE_PERIODIC_ADV_DATA_LEN_MAX : rem_len;
@@ -733,8 +726,8 @@ tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data
data_offset += send_data_len;
} while(rem_len);
end:
cb_params.status = status;
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT, &cb_params);
return status;
@@ -1112,6 +1105,12 @@ static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len,
BTM_TRACE_ERROR("%s, for the legacy adv, the adv data length can't exceed 31. line %d", __func__, __LINE__);
return BTM_ILLEGAL_VALUE;
}
} else {
if (len > controller_get_interface()->ble_get_ext_adv_data_max_len()) {
BTM_TRACE_ERROR("%s, The adv data len(%d) is longer then the controller adv max len(%d)",
__func__, len, controller_get_interface()->ble_get_ext_adv_data_max_len());
return BTM_ILLEGAL_VALUE;
}
}
return BTM_SUCCESS;
@@ -1539,13 +1539,12 @@ void smp_idle_terminate(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_fast_conn_param(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
#if (BT_MULTI_CONNECTION_ENBALE == FALSE)
if(p_cb->role == BTM_ROLE_MASTER) {
#if (BT_MULTI_CONNECTION_ENBALE == FALSE)
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
}
#endif
} else {
#if (SMP_SLAVE_CON_PARAMS_UPD_ENABLE == TRUE)
else {
tBTM_SEC_DEV_REC *p_rec = btm_find_dev (p_cb->pairing_bda);
if(p_rec && p_rec->ble.skip_update_conn_param) {
//do nothing
@@ -1558,8 +1557,8 @@ void smp_fast_conn_param(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
#if (BT_MULTI_CONNECTION_ENBALE == FALSE)
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
#endif
}
#endif
}
}
/*******************************************************************************
@@ -18,7 +18,7 @@ extern "C" {
#endif
#define ESP_BT_CTRL_CONFIG_MAGIC_VAL 0x5A5AA5A5
#define ESP_BT_CTRL_CONFIG_VERSION 0x02104270
#define ESP_BT_CTRL_CONFIG_VERSION 0x02112280
#define ESP_BT_HCI_TL_MAGIC_VALUE 0xfadebead
#define ESP_BT_HCI_TL_VERSION 0x00010000
@@ -178,6 +178,7 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
.hw_target_code = BLE_HW_TARGET_CODE_ESP32C3_CHIP_ECO0, \
.slave_ce_len_min = SLAVE_CE_LEN_MIN_DEFAULT, \
.hw_recorrect_en = AGC_RECORRECT_EN, \
.cca_thresh = CONFIG_BT_CTRL_HW_CCA_VAL, \
};
#else
@@ -244,6 +245,7 @@ typedef struct {
uint32_t hw_target_code; /*!< hardware target */
uint8_t slave_ce_len_min;
uint8_t hw_recorrect_en;
uint8_t cca_thresh; /*!< cca threshold*/
} esp_bt_controller_config_t;
/**
@@ -18,7 +18,7 @@ extern "C" {
#endif
#define ESP_BT_CTRL_CONFIG_MAGIC_VAL 0x5A5AA5A5
#define ESP_BT_CTRL_CONFIG_VERSION 0x02104270
#define ESP_BT_CTRL_CONFIG_VERSION 0x02112280
#define ESP_BT_HCI_TL_MAGIC_VALUE 0xfadebead
#define ESP_BT_HCI_TL_VERSION 0x00010000
@@ -177,6 +177,7 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
.hw_target_code = BLE_HW_TARGET_CODE_ESP32S3_CHIP_ECO0, \
.slave_ce_len_min = SLAVE_CE_LEN_MIN_DEFAULT, \
.hw_recorrect_en = AGC_RECORRECT_EN, \
.cca_thresh = CONFIG_BT_CTRL_HW_CCA_VAL, \
};
#else
@@ -243,6 +244,7 @@ typedef struct {
uint32_t hw_target_code; /*!< hardware target */
uint8_t slave_ce_len_min; /*!< slave minimum ce length*/
uint8_t hw_recorrect_en;
uint8_t cca_thresh; /*!< cca threshold*/
} esp_bt_controller_config_t;
/**
+1 -1
View File
@@ -865,7 +865,7 @@ static int linenoiseEdit(char *buf, size_t buflen, const char *prompt)
nread = read(in_fd, &c, 1);
if (nread <= 0) return l.len;
if ( (getMillis() - t1) < LINENOISE_PASTE_KEY_DELAY ) {
if ( (getMillis() - t1) < LINENOISE_PASTE_KEY_DELAY && c != ENTER) {
/* Pasting data, insert characters without formatting.
* This can only be performed when the cursor is at the end of the
* line. */
+3 -1
View File
@@ -284,8 +284,10 @@ esp_err_t adc_digi_initialize(const adc_digi_init_config_t *init_config)
};
adc_hal_context_config(&s_adc_digi_ctx->hal, &config);
//enable SARADC module clock
//enable ADC digital part
periph_module_enable(PERIPH_SARADC_MODULE);
//reset ADC digital part
periph_module_reset(PERIPH_SARADC_MODULE);
#if SOC_ADC_CALIBRATION_V1_SUPPORTED
adc_hal_calibration_init(ADC_NUM_1);
+4
View File
@@ -248,6 +248,10 @@ esp_err_t touch_pad_config(touch_pad_t touch_num)
esp_err_t touch_pad_init(void)
{
//TODO: IDF-4813
extern bool esp_no_sleep;
esp_no_sleep = true;
if (rtc_touch_mux == NULL) {
rtc_touch_mux = xSemaphoreCreateMutex();
}
+15 -4
View File
@@ -491,15 +491,21 @@ esp_err_t gpio_isr_handler_remove(gpio_num_t gpio_num)
void gpio_uninstall_isr_service(void)
{
gpio_isr_func_t *gpio_isr_func_free = NULL;
gpio_isr_handle_t gpio_isr_handle_free = NULL;
portENTER_CRITICAL(&gpio_context.gpio_spinlock);
if (gpio_context.gpio_isr_func == NULL) {
portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
return;
}
portENTER_CRITICAL(&gpio_context.gpio_spinlock);
esp_intr_free(gpio_context.gpio_isr_handle);
free(gpio_context.gpio_isr_func);
gpio_isr_func_free = gpio_context.gpio_isr_func;
gpio_context.gpio_isr_func = NULL;
gpio_isr_handle_free = gpio_context.gpio_isr_handle;
gpio_context.gpio_isr_handle = NULL;
gpio_context.isr_core_id = GPIO_ISR_CORE_ID_UNINIT;
portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
esp_intr_free(gpio_isr_handle_free);
free(gpio_isr_func_free);
return;
}
@@ -532,7 +538,12 @@ esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int intr_alloc_flags,
#else /* CONFIG_FREERTOS_UNICORE */
ret = esp_ipc_call_blocking(gpio_context.isr_core_id, gpio_isr_register_on_core_static, (void *)&p);
#endif /* !CONFIG_FREERTOS_UNICORE */
if(ret != ESP_OK || p.ret != ESP_OK) {
if (ret != ESP_OK) {
ESP_LOGE(GPIO_TAG, "esp_ipc_call_blocking failed (0x%x)", ret);
return ESP_ERR_NOT_FOUND;
}
if (p.ret != ESP_OK) {
ESP_LOGE(GPIO_TAG, "esp_intr_alloc failed (0x%x)", p.ret);
return ESP_ERR_NOT_FOUND;
}
return ESP_OK;
+28 -25
View File
@@ -39,7 +39,7 @@ static const char *I2C_TAG = "i2c";
#define I2C_DRIVER_ERR_STR "i2c driver install error"
#define I2C_DRIVER_MALLOC_ERR_STR "i2c driver malloc error"
#define I2C_NUM_ERROR_STR "i2c number error"
#define I2C_TIMEING_VAL_ERR_STR "i2c timing value error"
#define I2C_TIMING_VAL_ERR_STR "i2c timing value error"
#define I2C_ADDR_ERROR_STR "i2c null address error"
#define I2C_DRIVER_NOT_INSTALL_ERR_STR "i2c driver not installed"
#define I2C_SLAVE_BUFFER_LEN_ERR_STR "i2c buffer size too small for slave mode"
@@ -705,8 +705,8 @@ esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t *i2c_conf)
esp_err_t i2c_set_period(i2c_port_t i2c_num, int high_period, int low_period)
{
ESP_RETURN_ON_FALSE(i2c_num < I2C_NUM_MAX, ESP_ERR_INVALID_ARG, I2C_TAG, I2C_NUM_ERROR_STR);
ESP_RETURN_ON_FALSE((high_period <= I2C_SCL_HIGH_PERIOD_V) && (high_period > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMEING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((low_period <= I2C_SCL_LOW_PERIOD_V) && (low_period > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMEING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((high_period <= I2C_SCL_HIGH_PERIOD_V) && (high_period > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((low_period <= I2C_SCL_LOW_PERIOD_V) && (low_period > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMING_VAL_ERR_STR);
I2C_ENTER_CRITICAL(&(i2c_context[i2c_num].spinlock));
i2c_hal_set_scl_timing(&(i2c_context[i2c_num].hal), high_period, low_period);
@@ -748,8 +748,8 @@ esp_err_t i2c_filter_disable(i2c_port_t i2c_num)
esp_err_t i2c_set_start_timing(i2c_port_t i2c_num, int setup_time, int hold_time)
{
ESP_RETURN_ON_FALSE(i2c_num < I2C_NUM_MAX, ESP_ERR_INVALID_ARG, I2C_TAG, I2C_NUM_ERROR_STR);
ESP_RETURN_ON_FALSE((hold_time <= I2C_SCL_START_HOLD_TIME_V) && (hold_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMEING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((setup_time <= I2C_SCL_RSTART_SETUP_TIME_V) && (setup_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMEING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((hold_time <= I2C_SCL_START_HOLD_TIME_V) && (hold_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((setup_time <= I2C_SCL_RSTART_SETUP_TIME_V) && (setup_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMING_VAL_ERR_STR);
I2C_ENTER_CRITICAL(&(i2c_context[i2c_num].spinlock));
i2c_hal_set_start_timing(&(i2c_context[i2c_num].hal), setup_time, hold_time);
@@ -770,8 +770,8 @@ esp_err_t i2c_get_start_timing(i2c_port_t i2c_num, int *setup_time, int *hold_ti
esp_err_t i2c_set_stop_timing(i2c_port_t i2c_num, int setup_time, int hold_time)
{
ESP_RETURN_ON_FALSE(i2c_num < I2C_NUM_MAX, ESP_ERR_INVALID_ARG, I2C_TAG, I2C_NUM_ERROR_STR);
ESP_RETURN_ON_FALSE((setup_time <= I2C_SCL_STOP_SETUP_TIME_V) && (setup_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMEING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((hold_time <= I2C_SCL_STOP_HOLD_TIME_V) && (hold_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMEING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((setup_time <= I2C_SCL_STOP_SETUP_TIME_V) && (setup_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((hold_time <= I2C_SCL_STOP_HOLD_TIME_V) && (hold_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMING_VAL_ERR_STR);
I2C_ENTER_CRITICAL(&(i2c_context[i2c_num].spinlock));
i2c_hal_set_stop_timing(&(i2c_context[i2c_num].hal), setup_time, hold_time);
@@ -792,8 +792,8 @@ esp_err_t i2c_get_stop_timing(i2c_port_t i2c_num, int *setup_time, int *hold_tim
esp_err_t i2c_set_data_timing(i2c_port_t i2c_num, int sample_time, int hold_time)
{
ESP_RETURN_ON_FALSE(i2c_num < I2C_NUM_MAX, ESP_ERR_INVALID_ARG, I2C_TAG, I2C_NUM_ERROR_STR);
ESP_RETURN_ON_FALSE((sample_time <= I2C_SDA_SAMPLE_TIME_V) && (sample_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMEING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((hold_time <= I2C_SDA_HOLD_TIME_V) && (hold_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMEING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((sample_time <= I2C_SDA_SAMPLE_TIME_V) && (sample_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((hold_time <= I2C_SDA_HOLD_TIME_V) && (hold_time > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMING_VAL_ERR_STR);
I2C_ENTER_CRITICAL(&(i2c_context[i2c_num].spinlock));
i2c_hal_set_sda_timing(&(i2c_context[i2c_num].hal), sample_time, hold_time);
@@ -814,7 +814,7 @@ esp_err_t i2c_get_data_timing(i2c_port_t i2c_num, int *sample_time, int *hold_ti
esp_err_t i2c_set_timeout(i2c_port_t i2c_num, int timeout)
{
ESP_RETURN_ON_FALSE(i2c_num < I2C_NUM_MAX, ESP_ERR_INVALID_ARG, I2C_TAG, I2C_NUM_ERROR_STR);
ESP_RETURN_ON_FALSE((timeout <= I2C_LL_MAX_TIMEOUT) && (timeout > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMEING_VAL_ERR_STR);
ESP_RETURN_ON_FALSE((timeout <= I2C_LL_MAX_TIMEOUT) && (timeout > 0), ESP_ERR_INVALID_ARG, I2C_TAG, I2C_TIMING_VAL_ERR_STR);
I2C_ENTER_CRITICAL(&(i2c_context[i2c_num].spinlock));
i2c_hal_set_tout(&(i2c_context[i2c_num].hal), timeout);
@@ -1342,7 +1342,9 @@ static void IRAM_ATTR i2c_master_cmd_begin_static(i2c_port_t i2c_num)
p_i2c->cmd_idx = 0;
if (i2c_cmd_is_single_byte(cmd) || cmd->total_bytes == cmd->bytes_used) {
p_i2c->cmd_link.head = p_i2c->cmd_link.head->next;
p_i2c->cmd_link.head->cmd.bytes_used = 0;
if(p_i2c->cmd_link.head) {
p_i2c->cmd_link.head->cmd.bytes_used = 0;
}
}
p_i2c->status = I2C_STATUS_WRITE;
break;
@@ -1375,16 +1377,18 @@ static void IRAM_ATTR i2c_master_cmd_begin_static(i2c_port_t i2c_num)
//Check whether read or write buffer in cmd_link is internal.
static bool is_cmd_link_buffer_internal(const i2c_cmd_link_t *link)
{
const i2c_cmd_link_t *cmd_link = link;
while (cmd_link != NULL) {
if (cmd_link->cmd.hw_cmd.op_code == I2C_LL_CMD_WRITE || cmd_link->cmd.hw_cmd.op_code == I2C_LL_CMD_READ) {
if (cmd_link->cmd.data != NULL && !esp_ptr_internal(cmd_link->cmd.data)) {
return false;
}
}
cmd_link = cmd_link->next;
bool is_internal = true;
for (const i2c_cmd_link_t *cmd_link = link;
cmd_link != NULL && is_internal;
cmd_link = cmd_link->next)
{
/* A command node has a valid pointer if it is a read command or a write command with more than one byte. */
const bool data_pointer = (cmd_link->cmd.hw_cmd.op_code == I2C_LL_CMD_WRITE && !i2c_cmd_is_single_byte(&cmd_link->cmd))
|| cmd_link->cmd.hw_cmd.op_code == I2C_LL_CMD_READ;
/* Check if the (non-NULL) pointer points to internal memory. */
is_internal &= !data_pointer || cmd_link->cmd.data == NULL || esp_ptr_internal(cmd_link->cmd.data);
}
return true;
return is_internal;
}
#endif
@@ -1398,11 +1402,10 @@ esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle,
#if CONFIG_SPIRAM_USE_MALLOC
//If the i2c read or write buffer is not in internal RAM, we will return ESP_FAIL
//to avoid the ISR handler function crashing when the cache is disabled.
if ((p_i2c_obj[i2c_num]->intr_alloc_flags & ESP_INTR_FLAG_IRAM)) {
if (!is_cmd_link_buffer_internal(((const i2c_cmd_desc_t *)cmd_handle)->head) ) {
ESP_LOGE(I2C_TAG, I2C_PSRAM_BUFFER_WARN_STR);
return ESP_ERR_INVALID_ARG;
}
if ( (p_i2c_obj[i2c_num]->intr_alloc_flags & ESP_INTR_FLAG_IRAM) &&
!is_cmd_link_buffer_internal(((const i2c_cmd_desc_t *)cmd_handle)->head) ) {
ESP_LOGE(I2C_TAG, I2C_PSRAM_BUFFER_WARN_STR);
return ESP_ERR_INVALID_ARG;
}
#endif
// Sometimes when the FSM get stuck, the ACK_ERR interrupt will occur endlessly until we reset the FSM and clear bus.
+47 -15
View File
@@ -1000,9 +1000,9 @@ static esp_err_t i2s_calculate_adc_dac_clock(int i2s_num, i2s_hal_clock_cfg_t *c
ESP_RETURN_ON_FALSE(p_i2s[i2s_num]->hal_cfg.mode & (I2S_MODE_DAC_BUILT_IN | I2S_MODE_ADC_BUILT_IN), ESP_ERR_INVALID_ARG, TAG, "current mode is not built-in ADC/DAC");
/* Set I2S bit clock */
clk_cfg->bclk = p_i2s[i2s_num]->hal_cfg.sample_rate * I2S_LL_AD_BCK_FACTOR * 2;
clk_cfg->bclk = p_i2s[i2s_num]->hal_cfg.sample_rate * I2S_LL_AD_BCK_FACTOR;
/* Set I2S bit clock default division */
clk_cfg->bclk_div = I2S_LL_AD_BCK_FACTOR;
clk_cfg->bclk_div = p_i2s[i2s_num]->hal_cfg.chan_bits;
/* If fixed_mclk and use_apll are set, use fixed_mclk as mclk frequency, otherwise calculate by mclk = sample_rate * multiple */
clk_cfg->mclk = (p_i2s[i2s_num]->use_apll && p_i2s[i2s_num]->fixed_mclk) ?
p_i2s[i2s_num]->fixed_mclk : clk_cfg->bclk * clk_cfg->bclk_div;
@@ -1213,7 +1213,7 @@ static esp_err_t i2s_calculate_clock(i2s_port_t i2s_num, i2s_hal_clock_cfg_t *cl
static uint32_t i2s_get_max_channel_num(i2s_channel_t chan_mask)
{
uint32_t max_chan = 0;
uint32_t channel = chan_mask & 0xFFFF;
uint32_t channel = chan_mask >> 16;
for (int i = 0; channel && i < 16; i++, channel >>= 1) {
if (channel & 0x01) {
max_chan = i + 1;
@@ -1246,7 +1246,7 @@ static uint32_t i2s_get_active_channel_num(const i2s_hal_config_t *hal_cfg)
#if SOC_I2S_SUPPORTS_TDM
case I2S_CHANNEL_FMT_MULTIPLE: {
uint32_t num = 0;
uint32_t chan_mask = hal_cfg->chan_mask & 0xFFFF;
uint32_t chan_mask = hal_cfg->chan_mask >> 16;
for (int i = 0; chan_mask && i < 16; i++, chan_mask >>= 1) {
if (chan_mask & 0x01) {
num++;
@@ -1566,18 +1566,36 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, uint32_t bits_cfg, i2s_
ESP_RETURN_ON_FALSE(p_i2s[i2s_num], ESP_ERR_INVALID_ARG, TAG, "I2S%d has not installed yet", i2s_num);
i2s_hal_config_t *cfg = &p_i2s[i2s_num]->hal_cfg;
/* Stop I2S */
i2s_stop(i2s_num);
/* If not the first time, update configuration */
if (p_i2s[i2s_num]->last_buf_size) {
cfg->sample_rate = rate;
cfg->sample_bits = bits_cfg & 0xFFFF;
cfg->chan_bits = (bits_cfg >> 16) > cfg->sample_bits ? (bits_cfg >> 16) : cfg->sample_bits;
#if SOC_I2S_SUPPORTS_TDM
cfg->chan_mask = ch;
cfg->chan_fmt = ch == I2S_CHANNEL_MONO ? I2S_CHANNEL_FMT_ONLY_RIGHT : cfg->chan_fmt;
cfg->active_chan = i2s_get_active_channel_num(cfg);
uint32_t max_channel = i2s_get_max_channel_num(cfg->chan_mask);
/* If total channel is smaller than max actived channel number then set it to the max active channel number */
cfg->total_chan = p_i2s[i2s_num]->hal_cfg.total_chan < max_channel ? max_channel : p_i2s[i2s_num]->hal_cfg.total_chan;
if (ch & I2S_CHANNEL_MONO) {
cfg->chan_fmt = I2S_CHANNEL_FMT_ONLY_RIGHT;
cfg->chan_mask = I2S_TDM_ACTIVE_CH0; // Only activate one channel in mono
if (ch >> 16) {
cfg->total_chan = i2s_get_max_channel_num(ch);
} else {
cfg->total_chan = 2;
}
} else {
if (ch >> 16) {
cfg->chan_fmt = I2S_CHANNEL_FMT_MULTIPLE;
cfg->chan_mask = ch & 0xFFFF0000;
cfg->total_chan = i2s_get_max_channel_num(cfg->chan_mask);
} else {
/* If no TDM channels activated, use 2 channels as defualt */
cfg->chan_fmt = I2S_CHANNEL_FMT_RIGHT_LEFT;
cfg->chan_mask = I2S_TDM_ACTIVE_CH0 | I2S_TDM_ACTIVE_CH1;
cfg->total_chan = 2;
}
}
#else
/* Default */
cfg->chan_fmt = ch == I2S_CHANNEL_MONO ? I2S_CHANNEL_FMT_ONLY_RIGHT : cfg->chan_fmt;
@@ -1601,9 +1619,6 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, uint32_t bits_cfg, i2s_
ESP_RETURN_ON_FALSE((data_bits % 8 == 0), ESP_ERR_INVALID_ARG, TAG, "Invalid bits per sample");
ESP_RETURN_ON_FALSE((data_bits <= I2S_BITS_PER_SAMPLE_32BIT), ESP_ERR_INVALID_ARG, TAG, "Invalid bits per sample");
/* Stop I2S */
i2s_stop(i2s_num);
i2s_hal_clock_cfg_t clk_cfg;
/* To get sclk, mclk, mclk_div bclk and bclk_div */
i2s_calculate_clock(i2s_num, &clk_cfg);
@@ -1779,8 +1794,8 @@ static esp_err_t i2s_driver_init(i2s_port_t i2s_num, const i2s_config_t *i2s_con
p_i2s[i2s_num]->hal_cfg.total_chan = 2;
break;
case I2S_CHANNEL_FMT_MULTIPLE:
ESP_RETURN_ON_FALSE(i2s_config->chan_mask, ESP_ERR_INVALID_ARG, TAG, "i2s all channel are disabled");
p_i2s[i2s_num]->hal_cfg.chan_mask = i2s_config->chan_mask;
ESP_RETURN_ON_FALSE((i2s_config->chan_mask >> 16), ESP_ERR_INVALID_ARG, TAG, "i2s all channel are disabled");
p_i2s[i2s_num]->hal_cfg.chan_mask = i2s_config->chan_mask & 0xFFFF0000;
/* Get the max actived channel number */
uint32_t max_channel = i2s_get_max_channel_num(p_i2s[i2s_num]->hal_cfg.chan_mask);
/* If total channel is smaller than max actived channel number then set it to the max active channel number */
@@ -1895,6 +1910,14 @@ esp_err_t i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config,
#endif
/* Enable module clock */
i2s_hal_enable_module_clock(&p_i2s[i2s_num]->hal);
#if SOC_I2S_SUPPORTS_TDM
if (i2s_config->mode & I2S_MODE_TX) {
i2s_ll_tx_enable_clock(p_i2s[i2s_num]->hal.dev);
}
if (i2s_config->mode & I2S_MODE_RX) {
i2s_ll_rx_enable_clock(p_i2s[i2s_num]->hal.dev);
}
#endif
/* Step 5: Initialize I2S configuration and set the configurations to register */
i2s_hal_config_param(&(pre_alloc_i2s_obj->hal), &pre_alloc_i2s_obj->hal_cfg);
@@ -1911,6 +1934,7 @@ esp_err_t i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config,
/* Step 7: Set I2S clocks and start. No need to give parameters since configurations has been set in 'i2s_driver_init' */
ESP_GOTO_ON_ERROR(i2s_set_clk(i2s_num, 0, 0, 0), err, TAG, "I2S set clock failed");
return ESP_OK;
err:
@@ -1972,6 +1996,14 @@ esp_err_t i2s_driver_uninstall(i2s_port_t i2s_num)
esp_pm_lock_delete(p_i2s[i2s_num]->pm_lock);
p_i2s[i2s_num]->pm_lock = NULL;
}
#endif
#if SOC_I2S_SUPPORTS_TDM
if (p_i2s[i2s_num]->hal_cfg.mode & I2S_MODE_TX) {
i2s_ll_tx_disable_clock(p_i2s[i2s_num]->hal.dev);
}
if (p_i2s[i2s_num]->hal_cfg.mode & I2S_MODE_RX) {
i2s_ll_rx_disable_clock(p_i2s[i2s_num]->hal.dev);
}
#endif
/* Disable module clock */
i2s_hal_disable_module_clock(&p_i2s[i2s_num]->hal);
+17 -3
View File
@@ -78,7 +78,7 @@ typedef struct {
*
*/
typedef struct {
int mck_io_num; /*!< MCK in out pin*/
int mck_io_num; /*!< MCK in out pin. Note that ESP32 supports setting MCK on GPIO0/GPIO1/GPIO3 only*/
int bck_io_num; /*!< BCK in out pin*/
int ws_io_num; /*!< WS in out pin*/
int data_out_num; /*!< DATA out pin*/
@@ -97,8 +97,22 @@ typedef struct {
i2s_channel_fmt_t channel_format; /*!< I2S channel format.*/
i2s_comm_format_t communication_format; /*!< I2S communication format */
int intr_alloc_flags; /*!< Flags used to allocate the interrupt. One or multiple (ORred) ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info */
int dma_buf_count; /*!< I2S DMA Buffer Count */
int dma_buf_len; /*!< I2S DMA Buffer Length */
int dma_buf_count; /**< The total number of DMA buffers to receive/transmit data.
* A descriptor includes some information such as buffer address,
* the address of the next descriptor, and the buffer length.
* Since one descriptor points to one buffer, therefore, 'dma_desc_num' can be interpreted as the total number of DMA buffers used to store data from DMA interrupt.
* Notice that these buffers are internal to'i2s_read' and descriptors are created automatically inside of the I2S driver.
* Users only need to set the buffer number while the length is derived from the parameter described below.
*/
int dma_buf_len; /**< Number of frames in a DMA buffer.
* A frame means the data of all channels in a WS cycle.
* The real_dma_buf_size = dma_buf_len * chan_num * bits_per_chan / 8.
* For example, if two channels in stereo mode (i.e., 'channel_format' is set to 'I2S_CHANNEL_FMT_RIGHT_LEFT') are active,
* and each channel transfers 32 bits (i.e., 'bits_per_sample' is set to 'I2S_BITS_PER_CHAN_32BIT'),
* then the total number of bytes of a frame is 'channel_format' * 'bits_per_sample' = 2 * 32 / 8 = 8 bytes.
* We assume that the current 'dma_buf_len' is 100, then the real length of the DMA buffer is 8 * 100 = 800 bytes.
* Note that the length of an internal real DMA buffer shouldn't be greater than 4092.
*/
bool use_apll; /*!< I2S using APLL as main I2S clock, enable it to get accurate clock */
bool tx_desc_auto_clear; /*!< I2S auto clear tx descriptor if there is underflow condition (helps in avoiding noise in case of data unavailability) */
int fixed_mclk; /*!< I2S using fixed MCLK output. If use_apll = true and fixed_mclk > 0, then the clock output for i2s is fixed and equal to the fixed_mclk value. If fixed_mclk set, mclk_multiple won't take effect */
+9 -4
View File
@@ -85,6 +85,7 @@ esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf);
* @brief LEDC update channel parameters
* @note Call this function to activate the LEDC updated parameters.
* After ledc_set_duty, we need to call this function to update the settings.
* And the new LEDC parameters don't take effect until the next PWM cycle.
* @note ledc_set_duty, ledc_set_duty_with_hpoint and ledc_update_duty are not thread-safe, do not call these functions to
* control one LEDC channel in different tasks at the same time.
* A thread-safe version of API is ledc_set_duty_and_update
@@ -203,6 +204,9 @@ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t
/**
* @brief LEDC get duty
* This function returns the duty at the present PWM cycle.
* You shouldn't expect the function to return the new duty in the same cycle of calling ledc_update_duty,
* because duty update doesn't take effect until the next cycle.
*
* @param speed_mode Select the LEDC channel group with specified speed mode. Note that not all targets support high speed mode.
* @param channel LEDC channel (0 - LEDC_CHANNEL_MAX-1), select from ledc_channel_t
@@ -385,7 +389,8 @@ void ledc_fade_func_uninstall(void);
* Other duty operations will have to wait until the fade operation has finished.
* @param speed_mode Select the LEDC channel group with specified speed mode. Note that not all targets support high speed mode.
* @param channel LEDC channel number
* @param fade_mode Whether to block until fading done.
* @param fade_mode Whether to block until fading done. See ledc_types.h ledc_fade_mode_t for more info.
* Note that this function will not return until fading to the target duty if LEDC_FADE_WAIT_DONE mode is selected.
*
* @return
* - ESP_OK Success
@@ -443,9 +448,6 @@ esp_err_t ledc_set_fade_time_and_start(ledc_mode_t speed_mode, ledc_channel_t ch
* - ESP_FAIL Fade function init error
*/
esp_err_t ledc_set_fade_step_and_start(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t target_duty, uint32_t scale, uint32_t cycle_num, ledc_fade_mode_t fade_mode);
#ifdef __cplusplus
}
#endif
/**
* @brief LEDC callback registration function
@@ -461,3 +463,6 @@ esp_err_t ledc_set_fade_step_and_start(ledc_mode_t speed_mode, ledc_channel_t ch
* - ESP_FAIL Fade function init error
*/
esp_err_t ledc_cb_register(ledc_mode_t speed_mode, ledc_channel_t channel, ledc_cbs_t *cbs, void *user_arg);
#ifdef __cplusplus
}
#endif
+21 -26
View File
@@ -63,9 +63,9 @@ static portMUX_TYPE ledc_spinlock = portMUX_INITIALIZER_UNLOCKED;
#define LEDC_FADE_TOO_SLOW_STR "LEDC FADE TOO SLOW"
#define LEDC_FADE_TOO_FAST_STR "LEDC FADE TOO FAST"
static const char *LEDC_NOT_INIT = "LEDC is not initialized";
static const char *LEDC_FADE_SERVICE_ERR_STR = "LEDC fade service not installed";
static const char *LEDC_FADE_INIT_ERROR_STR = "LEDC fade channel init error, not enough memory or service not installed";
static __attribute__((unused)) const char *LEDC_NOT_INIT = "LEDC is not initialized";
static __attribute__((unused)) const char *LEDC_FADE_SERVICE_ERR_STR = "LEDC fade service not installed";
static __attribute__((unused)) const char *LEDC_FADE_INIT_ERROR_STR = "LEDC fade channel init error, not enough memory or service not installed";
//This value will be calibrated when in use.
static uint32_t s_ledc_slow_clk_8M = 0;
@@ -184,7 +184,7 @@ esp_err_t ledc_timer_set(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_
static IRAM_ATTR esp_err_t ledc_duty_config(ledc_mode_t speed_mode, ledc_channel_t channel, int hpoint_val, int duty_val,
ledc_duty_direction_t duty_direction, uint32_t duty_num, uint32_t duty_cycle, uint32_t duty_scale)
{
portENTER_CRITICAL(&ledc_spinlock);
portENTER_CRITICAL_SAFE(&ledc_spinlock);
if (hpoint_val >= 0) {
ledc_hal_set_hpoint(&(p_ledc_obj[speed_mode]->ledc_hal), channel, hpoint_val);
}
@@ -196,7 +196,7 @@ static IRAM_ATTR esp_err_t ledc_duty_config(ledc_mode_t speed_mode, ledc_channel
ledc_hal_set_duty_cycle(&(p_ledc_obj[speed_mode]->ledc_hal), channel, duty_cycle);
ledc_hal_set_duty_scale(&(p_ledc_obj[speed_mode]->ledc_hal), channel, duty_scale);
ledc_ls_channel_update(speed_mode, channel);
portEXIT_CRITICAL(&ledc_spinlock);
portEXIT_CRITICAL_SAFE(&ledc_spinlock);
return ESP_OK;
}
@@ -466,8 +466,8 @@ esp_err_t ledc_set_duty_with_hpoint(ledc_mode_t speed_mode, ledc_channel_t chann
hpoint, //uint32_t hpoint_val,
duty, //uint32_t duty_val,
1, //uint32_t increase,
1, //uint32_t duty_num,
1, //uint32_t duty_cycle,
0, //uint32_t duty_num,
0, //uint32_t duty_cycle,
0 //uint32_t duty_scale
);
_ledc_fade_hw_release(speed_mode, channel);
@@ -486,8 +486,8 @@ esp_err_t ledc_set_duty(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t
LEDC_VAL_NO_CHANGE,
duty, //uint32_t duty_val,
1, //uint32_t increase,
1, //uint32_t duty_num,
1, //uint32_t duty_cycle,
0, //uint32_t duty_num,
0, //uint32_t duty_cycle,
0 //uint32_t duty_scale
);
_ledc_fade_hw_release(speed_mode, channel);
@@ -568,9 +568,9 @@ void IRAM_ATTR ledc_fade_isr(void* arg)
ledc_calc_fade_end_channel(&intr_status, &channel);
// clear interrupt
portENTER_CRITICAL(&ledc_spinlock);
portENTER_CRITICAL_ISR(&ledc_spinlock);
ledc_hal_clear_fade_end_intr_status(&(p_ledc_obj[speed_mode]->ledc_hal), channel);
portEXIT_CRITICAL(&ledc_spinlock);
portEXIT_CRITICAL_ISR(&ledc_spinlock);
if (s_ledc_fade_rec[speed_mode][channel] == NULL) {
//fade object not initialized yet.
@@ -620,9 +620,9 @@ void IRAM_ATTR ledc_fade_isr(void* arg)
1,
0);
}
portENTER_CRITICAL(&ledc_spinlock);
portENTER_CRITICAL_ISR(&ledc_spinlock);
ledc_hal_set_duty_start(&(p_ledc_obj[speed_mode]->ledc_hal), channel, true);
portEXIT_CRITICAL(&ledc_spinlock);
portEXIT_CRITICAL_ISR(&ledc_spinlock);
}
}
if (HPTaskAwoken == pdTRUE || cb_yield) {
@@ -765,7 +765,10 @@ static void _ledc_fade_start(ledc_mode_t speed_mode, ledc_channel_t channel, led
ledc_enable_intr_type(speed_mode, channel, LEDC_INTR_FADE_END);
ledc_update_duty(speed_mode, channel);
if (fade_mode == LEDC_FADE_WAIT_DONE) {
xSemaphoreTake(s_ledc_fade_rec[speed_mode][channel]->ledc_fade_sem, portMAX_DELAY);
// Waiting for fade done
_ledc_fade_hw_acquire(speed_mode, channel);
// Release hardware to support next time fade configure
_ledc_fade_hw_release(speed_mode, channel);
}
}
@@ -807,7 +810,6 @@ esp_err_t ledc_fade_start(ledc_mode_t speed_mode, ledc_channel_t channel, ledc_f
LEDC_CHECK(p_ledc_obj[speed_mode] != NULL, LEDC_NOT_INIT, ESP_ERR_INVALID_STATE);
_ledc_fade_hw_acquire(speed_mode, channel);
_ledc_fade_start(speed_mode, channel, fade_mode);
_ledc_fade_hw_release(speed_mode, channel);
return ESP_OK;
}
@@ -855,14 +857,13 @@ esp_err_t ledc_set_duty_and_update(ledc_mode_t speed_mode, ledc_channel_t channe
LEDC_ARG_CHECK(speed_mode < LEDC_SPEED_MODE_MAX, "speed_mode");
LEDC_ARG_CHECK(channel < LEDC_CHANNEL_MAX, "channel");
LEDC_ARG_CHECK(duty <= ledc_get_max_duty(speed_mode, channel), "target_duty");
LEDC_ARG_CHECK(hpoint <= LEDC_HPOINT_VAL_MAX, "hpoint");
LEDC_CHECK(p_ledc_obj[speed_mode] != NULL, LEDC_NOT_INIT, ESP_ERR_INVALID_STATE);
LEDC_CHECK(ledc_fade_channel_init_check(speed_mode, channel) == ESP_OK , LEDC_FADE_INIT_ERROR_STR, ESP_FAIL);
_ledc_op_lock_acquire(speed_mode, channel);
LEDC_CHECK(ledc_fade_channel_init_check(speed_mode, channel) == ESP_OK, LEDC_FADE_INIT_ERROR_STR, ESP_FAIL);
_ledc_fade_hw_acquire(speed_mode, channel);
_ledc_set_fade_with_step(speed_mode, channel, duty, 0, 1);
_ledc_fade_start(speed_mode, channel, LEDC_FADE_WAIT_DONE);
ledc_duty_config(speed_mode, channel, hpoint, duty, 1, 0, 0, 0);
ledc_update_duty(speed_mode, channel);
_ledc_fade_hw_release(speed_mode, channel);
_ledc_op_lock_release(speed_mode, channel);
return ESP_OK;
}
@@ -878,9 +879,6 @@ esp_err_t ledc_set_fade_time_and_start(ledc_mode_t speed_mode, ledc_channel_t ch
_ledc_fade_hw_acquire(speed_mode, channel);
_ledc_set_fade_with_time(speed_mode, channel, target_duty, max_fade_time_ms);
_ledc_fade_start(speed_mode, channel, fade_mode);
if (fade_mode == LEDC_FADE_WAIT_DONE) {
_ledc_fade_hw_release(speed_mode, channel);
}
_ledc_op_lock_release(speed_mode, channel);
return ESP_OK;
}
@@ -899,9 +897,6 @@ esp_err_t ledc_set_fade_step_and_start(ledc_mode_t speed_mode, ledc_channel_t ch
_ledc_fade_hw_acquire(speed_mode, channel);
_ledc_set_fade_with_step(speed_mode, channel, target_duty, scale, cycle_num);
_ledc_fade_start(speed_mode, channel, fade_mode);
if (fade_mode == LEDC_FADE_WAIT_DONE) {
_ledc_fade_hw_release(speed_mode, channel);
}
_ledc_op_lock_release(speed_mode, channel);
return ESP_OK;
}
+4
View File
@@ -65,11 +65,15 @@ IRAM_ATTR void wifi_bt_common_module_disable(void)
void wifi_module_enable(void)
{
portENTER_CRITICAL_SAFE(&periph_spinlock);
periph_ll_wifi_module_enable_clk_clear_rst();
portEXIT_CRITICAL_SAFE(&periph_spinlock);
}
void wifi_module_disable(void)
{
portENTER_CRITICAL_SAFE(&periph_spinlock);
periph_ll_wifi_module_disable_clk_set_rst();
portEXIT_CRITICAL_SAFE(&periph_spinlock);
}
#endif // CONFIG_ESP32_WIFI_ENABLED
+2 -2
View File
@@ -236,7 +236,7 @@ static esp_err_t init_context(const sdio_slave_config_t *config)
sdio_ringbuf_t *buf = &(context.hal->send_desc_queue);
//one item is not used.
buf->size = SDIO_SLAVE_SEND_DESC_SIZE * (config->send_queue_size + 1);
buf->data = (uint8_t *)heap_caps_malloc(buf->size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
buf->data = (uint8_t *)heap_caps_malloc(buf->size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT | MALLOC_CAP_DMA);
if (buf->data == NULL) {
goto no_mem;
}
@@ -738,7 +738,7 @@ sdio_slave_buf_handle_t sdio_slave_recv_register_buf(uint8_t *start)
{
SDIO_SLAVE_CHECK(esp_ptr_dma_capable(start) && (uint32_t)start % 4 == 0,
"buffer to register should be DMA capable and 32-bit aligned", NULL);
recv_desc_t *desc = (recv_desc_t *)heap_caps_malloc(sizeof(recv_desc_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
recv_desc_t *desc = (recv_desc_t *)heap_caps_malloc(sizeof(recv_desc_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT | MALLOC_CAP_DMA);
if (desc == NULL) {
SDIO_SLAVE_LOGE("cannot allocate lldesc for new buffer");
return NULL;
+1 -1
View File
@@ -164,7 +164,7 @@ typedef struct spi_bus_lock_t spi_bus_lock_t;
#define REQUEST_BIT(mask) ((mask) << REQ_SHIFT)
#define PENDING_BIT(mask) ((mask) << PENDING_SHIFT)
#define DEV_MASK(id) (LOCK_BIT(1<<id) | PENDING_BIT(1<<id) | REQUEST_BIT(1<<id))
#define ID_DEV_MASK(mask) (ffs(mask) - 1)
#define ID_DEV_MASK(mask) (__builtin_ffs(mask) - 1)
#define REQ_MASK BIT1_MASK(REQ_SHIFT+MAX_DEV_NUM, REQ_SHIFT)
#define PEND_MASK BIT1_MASK(PENDING_SHIFT+MAX_DEV_NUM, PENDING_SHIFT)
+41 -4
View File
@@ -20,6 +20,7 @@
#include "sdkconfig.h"
#include "esp_rom_uart.h"
#include "esp_rom_sys.h"
#include "test_utils.h"
#define WAKE_UP_IGNORE 1 // gpio_wakeup function development is not completed yet, set it deprecated.
@@ -57,7 +58,7 @@
#define TEST_GPIO_EXT_OUT_IO 2 // default output GPIO
#define TEST_GPIO_EXT_IN_IO 3 // default input GPIO
#define TEST_GPIO_OUTPUT_PIN 1
#define TEST_GPIO_OUTPUT_MAX GPIO_NUM_21
#define TEST_GPIO_OUTPUT_MAX GPIO_NUM_MAX
#define TEST_GPIO_USB_DM_IO 18 // USB D- GPIO
#define TEST_GPIO_USB_DP_IO 19 // USB D+ GPIO
#define TEST_GPIO_INPUT_LEVEL_HIGH_PIN 10
@@ -100,7 +101,7 @@ static gpio_config_t init_io(gpio_num_t num)
__attribute__((unused)) static void gpio_isr_edge_handler(void *arg)
{
uint32_t gpio_num = (uint32_t) arg;
esp_rom_printf("GPIO[%d] intr, val: %d\n", gpio_num, gpio_get_level(gpio_num));
esp_rom_printf("GPIO[%d] intr on core %d, val: %d\n", gpio_num, cpu_hal_get_core_id(), gpio_get_level(gpio_num));
edge_intr_times++;
}
@@ -408,6 +409,42 @@ TEST_CASE("GPIO enable and disable interrupt test", "[gpio][test_env=UT_T1_GPIO]
}
#endif //DISABLED_FOR_TARGETS(ESP32S2, ESP32S3, ESP32C3)
#if !CONFIG_FREERTOS_UNICORE
static void install_isr_service_task(void *arg)
{
uint32_t gpio_num = (uint32_t) arg;
//rising edge intr
TEST_ESP_OK(gpio_set_intr_type(gpio_num, GPIO_INTR_POSEDGE));
TEST_ESP_OK(gpio_install_isr_service(0));
gpio_isr_handler_add(gpio_num, gpio_isr_edge_handler, (void *) gpio_num);
vTaskSuspend(NULL);
}
TEST_CASE("GPIO interrupt on other CPUs test", "[gpio]")
{
TaskHandle_t gpio_task_handle;
gpio_config_t input_output_io = init_io(TEST_GPIO_EXT_OUT_IO);
input_output_io.mode = GPIO_MODE_INPUT_OUTPUT;
input_output_io.pull_up_en = 1;
TEST_ESP_OK(gpio_config(&input_output_io));
for (int cpu_num = 1; cpu_num < portNUM_PROCESSORS; ++cpu_num) {
// We assume unit-test task is running on core 0, so we install gpio interrupt on other cores
edge_intr_times = 0;
TEST_ESP_OK(gpio_set_level(TEST_GPIO_EXT_OUT_IO, 0));
xTaskCreatePinnedToCore(install_isr_service_task, "install_isr_service_task", 2048, (void *) TEST_GPIO_EXT_OUT_IO, 1, &gpio_task_handle, cpu_num);
vTaskDelay(200 / portTICK_RATE_MS);
TEST_ESP_OK(gpio_set_level(TEST_GPIO_EXT_OUT_IO, 1));
vTaskDelay(100 / portTICK_RATE_MS);
TEST_ASSERT_EQUAL_INT(edge_intr_times, 1);
gpio_isr_handler_remove(TEST_GPIO_EXT_OUT_IO);
gpio_uninstall_isr_service();
test_utils_task_delete(gpio_task_handle);
}
}
#endif //!CONFIG_FREERTOS_UNICORE
// ESP32 Connect GPIO18 with GPIO19, ESP32-S2 Connect GPIO17 with GPIO21,
// ESP32-S3 Connect GPIO17 with GPIO21, ESP32C3 Connect GPIO2 with GPIO3
// use multimeter to test the voltage, so it is ignored in CI
@@ -756,11 +793,11 @@ static void gpio_isr_handler(void *arg)
*/
TEST_CASE("GPIO ISR service test", "[gpio][ignore]")
{
static gpio_isr_param_t io9_param = {
gpio_isr_param_t io9_param = {
.gpio_num = TEST_IO_9,
.isr_cnt = 0,
};
static gpio_isr_param_t io10_param = {
gpio_isr_param_t io10_param = {
.gpio_num = TEST_IO_10,
.isr_cnt = 0,
};
+131 -41
View File
@@ -34,6 +34,8 @@
#define HIGHEST_LIMIT 10000
#define LOWEST_LIMIT -10000
#define TEST_PWM_FREQ 2000
#if SOC_LEDC_SUPPORT_HS_MODE
#define TEST_SPEED_MODE LEDC_HIGH_SPEED_MODE
#define SPEED_MODE_LIST {LEDC_HIGH_SPEED_MODE, LEDC_LOW_SPEED_MODE}
@@ -63,17 +65,31 @@ static ledc_timer_config_t create_default_timer_config(void)
ledc_time_config.speed_mode = TEST_SPEED_MODE;
ledc_time_config.duty_resolution = LEDC_TIMER_13_BIT;
ledc_time_config.timer_num = LEDC_TIMER_0;
ledc_time_config.freq_hz = 2000;
ledc_time_config.freq_hz = TEST_PWM_FREQ;
ledc_time_config.clk_cfg = LEDC_USE_APB_CLK;
return ledc_time_config;
}
static void fade_setup(void)
{
ledc_channel_config_t ledc_ch_config = initialize_channel_config();
ledc_ch_config.duty = 0;
ledc_timer_config_t ledc_time_config = create_default_timer_config();
TEST_ESP_OK(ledc_channel_config(&ledc_ch_config));
TEST_ESP_OK(ledc_timer_config(&ledc_time_config));
vTaskDelay(5 / portTICK_PERIOD_MS);
//initialize fade service
TEST_ESP_OK(ledc_fade_func_install(0));
}
static void timer_duty_set_get(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t duty)
{
TEST_ESP_OK(ledc_set_duty(speed_mode, channel, duty));
TEST_ESP_OK(ledc_update_duty(speed_mode, channel));
vTaskDelay(1000 / portTICK_RATE_MS);
TEST_ASSERT_EQUAL_INT32(ledc_get_duty(speed_mode, channel), duty);
vTaskDelay(100 / portTICK_RATE_MS);
TEST_ASSERT_EQUAL_INT32(duty, ledc_get_duty(speed_mode, channel));
}
// use logic analyzer to view
@@ -302,9 +318,9 @@ TEST_CASE("LEDC memory leak test", "[ledc]")
TEST_ESP_OK(ledc_stop(ledc_time_config.speed_mode, LEDC_CHANNEL_0, 0));
}
// the duty need to be detected by waveform given by the logic analyzer
// can't get it directly, so set it "ignore"
TEST_CASE("LEDC set and get dut(with logic analyzer)", "[ledc][ignore]")
// duty should be manually checked from the waveform using a logic analyzer
// this test is enabled only for testting the settings
TEST_CASE("LEDC set and get duty", "[ledc]")
{
ledc_timer_t timer_list[4] = {LEDC_TIMER_0, LEDC_TIMER_1, LEDC_TIMER_2, LEDC_TIMER_3};
ledc_mode_t speed_mode_list[LEDC_SPEED_MODE_MAX] = SPEED_MODE_LIST;
@@ -315,61 +331,111 @@ TEST_CASE("LEDC set and get dut(with logic analyzer)", "[ledc][ignore]")
}
}
TEST_CASE("LEDC fade with time(logic analyzer)", "[ledc][ignore]")
TEST_CASE("LEDC fade with time", "[ledc]")
{
const ledc_mode_t test_speed_mode = TEST_SPEED_MODE;
ledc_channel_config_t ledc_ch_config = initialize_channel_config();
ledc_ch_config.duty = 0;
ledc_timer_config_t ledc_time_config = create_default_timer_config();
fade_setup();
TEST_ESP_OK(ledc_channel_config(&ledc_ch_config));
TEST_ESP_OK(ledc_timer_config(&ledc_time_config));
//initialize fade service
TEST_ESP_OK(ledc_fade_func_install(0));
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 4000, 1000));
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 4000, 200));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE));
// TODO: allows for 5% deviation here due to driver code (IDF-2099)
vTaskDelay(1050 / portTICK_RATE_MS);
TEST_ASSERT_EQUAL_INT32(ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0), 4000);
TEST_ASSERT_EQUAL_INT32(4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 0, 1000));
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 0, 200));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_NO_WAIT));
vTaskDelay(1050 / portTICK_RATE_MS);
TEST_ASSERT_EQUAL_INT32(ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0), 0);
// duty should not be too far from initial value
TEST_ASSERT_INT32_WITHIN(20, 4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
vTaskDelay(210 / portTICK_PERIOD_MS);
TEST_ASSERT_EQUAL_INT32(0, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
//deinitial fade service
//deinitialize fade service
ledc_fade_func_uninstall();
}
TEST_CASE("LEDC fade with step(logic analyzer)", "[ledc][ignore]")
TEST_CASE("LEDC fade with step", "[ledc]")
{
const ledc_mode_t test_speed_mode = TEST_SPEED_MODE;
ledc_channel_config_t ledc_ch_config = initialize_channel_config();
ledc_ch_config.duty = 0;
ledc_timer_config_t ledc_time_config = create_default_timer_config();
fade_setup();
TEST_ESP_OK(ledc_channel_config(&ledc_ch_config));
TEST_ESP_OK(ledc_timer_config(&ledc_time_config));
//initialize fade service.
TEST_ESP_OK(ledc_fade_func_install(0));
TEST_ESP_OK(ledc_set_fade_with_step(test_speed_mode, LEDC_CHANNEL_0, 4000, 2, 1));
TEST_ESP_OK(ledc_set_fade_with_step(test_speed_mode, LEDC_CHANNEL_0, 4000, 4, 1));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE));
vTaskDelay(1050 / portTICK_RATE_MS);
TEST_ASSERT_EQUAL_INT32(ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0), 4000);
TEST_ASSERT_EQUAL_INT32(4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
TEST_ESP_OK(ledc_set_fade_with_step(test_speed_mode, LEDC_CHANNEL_0, 0, 4, 2));
TEST_ESP_OK(ledc_set_fade_with_step(test_speed_mode, LEDC_CHANNEL_0, 0, 4, 1));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_NO_WAIT));
vTaskDelay(1050 / portTICK_RATE_MS);
TEST_ASSERT_EQUAL_INT32(ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0), 0);
// duty should not be too far from initial value
TEST_ASSERT_INT32_WITHIN(20, 4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
vTaskDelay(525 / portTICK_PERIOD_MS);
TEST_ASSERT_EQUAL_INT32(0, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
//scaler=0 check
TEST_ASSERT(ledc_set_fade_with_step(test_speed_mode, LEDC_CHANNEL_0, 4000, 0, 1) == ESP_ERR_INVALID_ARG);
//deinitial fade service
//deinitialize fade service
ledc_fade_func_uninstall();
}
TEST_CASE("LEDC fast switching duty with fade_wait_done", "[ledc]")
{
const ledc_mode_t test_speed_mode = TEST_SPEED_MODE;
fade_setup();
// fade function will block until fading to the target duty
int64_t fade_start, fade_stop;
fade_start = esp_timer_get_time();
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 4000, 200));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE));
TEST_ASSERT_EQUAL_INT32(4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 1000, 150));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE));
TEST_ASSERT_EQUAL_INT32(1000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
fade_stop = esp_timer_get_time();
int time_ms = (fade_stop - fade_start) / 1000;
TEST_ASSERT_TRUE(fabs(time_ms - 350) < 20);
// next duty update will not take place until last fade reaches its target duty
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 4000, 200));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE));
TEST_ASSERT_EQUAL_INT32(4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
TEST_ESP_OK(ledc_set_duty(test_speed_mode, LEDC_CHANNEL_0, 500));
TEST_ESP_OK(ledc_update_duty(test_speed_mode, LEDC_CHANNEL_0));
vTaskDelay(5 / portTICK_PERIOD_MS);
TEST_ASSERT_EQUAL_INT32(500, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
//deinitialize fade service
ledc_fade_func_uninstall();
}
TEST_CASE("LEDC fast switching duty with fade_no_wait", "[ledc]")
{
const ledc_mode_t test_speed_mode = TEST_SPEED_MODE;
fade_setup();
// fade function returns immediately, but next fade still needs to wait for last fade ends
int64_t fade_start, first_fade_complete;
fade_start = esp_timer_get_time();
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 4000, 200));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_NO_WAIT));
TEST_ASSERT_LESS_THAN(4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 1000, 150));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_NO_WAIT));
first_fade_complete = esp_timer_get_time();
// duty should not be too far from first fade target duty
TEST_ASSERT_INT32_WITHIN(20, 4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
int time_ms = (first_fade_complete - fade_start) / 1000;
TEST_ASSERT_TRUE(fabs(time_ms - 200) < 20);
vTaskDelay(158 / portTICK_PERIOD_MS);
TEST_ASSERT_EQUAL_INT32(1000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
// next duty update will not take place until last fade reaches its target duty
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 4000, 200));
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_NO_WAIT));
TEST_ASSERT_LESS_THAN(4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
TEST_ESP_OK(ledc_set_duty(test_speed_mode, LEDC_CHANNEL_0, 500));
TEST_ESP_OK(ledc_update_duty(test_speed_mode, LEDC_CHANNEL_0));
vTaskDelay(5 / portTICK_PERIOD_MS);
TEST_ASSERT_EQUAL_INT32(500, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
//deinitialize fade service
ledc_fade_func_uninstall();
}
@@ -492,6 +558,30 @@ TEST_CASE("LEDC timer pause and resume", "[ledc][test_env=UT_T1_LEDC]")
TEST_ASSERT_UINT32_WITHIN(5, count, 5000);
}
static void ledc_cpu_reset_test_first_stage(void)
{
ledc_channel_config_t ledc_ch_config = initialize_channel_config();
TEST_ESP_OK(ledc_channel_config(&ledc_ch_config));
ledc_timer_config_t ledc_time_config = create_default_timer_config();
TEST_ESP_OK(ledc_timer_config(&ledc_time_config));
vTaskDelay(50 / portTICK_RATE_MS);
esp_restart();
}
static void ledc_cpu_reset_test_second_stage(void)
{
TEST_ASSERT_EQUAL(ESP_RST_SW, esp_reset_reason());
int16_t count;
count = wave_count(1000);
TEST_ASSERT_UINT32_WITHIN(5, count, TEST_PWM_FREQ);
}
TEST_CASE_MULTIPLE_STAGES("LEDC software reset test",
"[ledc][test_env=UT_T1_LEDC]",
ledc_cpu_reset_test_first_stage,
ledc_cpu_reset_test_second_stage);
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3)
#endif // SOC_PCNT_SUPPORTED
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -22,7 +22,7 @@
#define RMT_TX_CHANNEL_ENCODING_END (SOC_RMT_TX_CANDIDATES_PER_GROUP-1)
// CI ONLY: Don't connect any other signals to this GPIO
#define RMT_DATA_IO (4) // bind signal RMT_SIG_OUT0_IDX and RMT_SIG_IN0_IDX on the same GPIO
#define RMT_DATA_IO (0) // bind signal RMT_SIG_OUT0_IDX and RMT_SIG_IN0_IDX on the same GPIO
#define RMT_TESTBENCH_FLAGS_ALWAYS_ON (1<<0)
#define RMT_TESTBENCH_FLAGS_CARRIER_ON (1<<1)
+78 -1
View File
@@ -408,6 +408,10 @@ static void uart_test_custom_isr_core0(void* param) {
TEST_ESP_OK(uart_param_config(uart_echo, &uart_config));
TEST_ESP_OK(uart_set_pin(uart_echo, uart_tx, uart_rx, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
/* Prevent the custom ISR handler from being called if UART_INTR_BRK_DET interrupt occurs.
* It shall only be called for TX interrupts. */
uart_disable_intr_mask(uart_echo, UART_INTR_BRK_DET);
/* Unregister the default ISR setup by the function call above */
TEST_ESP_OK(uart_isr_free(uart_echo));
TEST_ESP_OK(uart_isr_register(uart_echo, uart_custom_isr, NULL, intr_alloc_flags, &handle));
@@ -450,10 +454,83 @@ TEST_CASE("uart can register and free custom ISRs", "[uart]")
5,
&task_handle,
0);
TEST_ASSERT(ret)
TEST_ASSERT(ret);
TEST_ASSERT(xTaskNotifyWait(0, 0, NULL, 1000 / portTICK_PERIOD_MS));
(void) task_handle;
#else
uart_test_custom_isr_core0(NULL);
#endif //!CONFIG_FREERTOS_UNICORE
}
TEST_CASE("uart int state restored after flush", "[uart]")
{
/**
* The first goal of this test is to make sure that when our RX FIFO is full,
* we can continue receiving back data after flushing
* For more details, check IDF-4374
*/
uart_config_t uart_config = {
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.source_clk = UART_SCLK_APB,
};
const uart_port_t uart_echo = UART_NUM_1;
const int uart_tx_signal = U1TXD_OUT_IDX;
const int uart_tx = 4;
const int uart_rx = 5;
const int buf_size = 256;
const int intr_alloc_flags = 0;
TEST_ESP_OK(uart_driver_install(uart_echo, buf_size * 2, 0, 0, NULL, intr_alloc_flags));
TEST_ESP_OK(uart_param_config(uart_echo, &uart_config));
TEST_ESP_OK(uart_set_pin(uart_echo, uart_tx, uart_rx, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
/* Make sure UART2's RX signal is connected to TX pin
* This creates a loop that lets us receive anything we send on the UART */
esp_rom_gpio_connect_out_signal(uart_rx, uart_tx_signal, false, false);
uint8_t *data = (uint8_t *) malloc(buf_size);
TEST_ASSERT_NOT_NULL(data);
uart_write_bytes(uart_echo, (const char *) data, buf_size);
/* As we set up a loopback, we can read them back on RX */
int len = uart_read_bytes(uart_echo, data, buf_size, 1000 / portTICK_RATE_MS);
TEST_ASSERT_EQUAL(len, buf_size);
/* Fill the RX buffer, this should disable the RX interrupts */
int written = uart_write_bytes(uart_echo, (const char *) data, buf_size);
TEST_ASSERT_NOT_EQUAL(-1, written);
written = uart_write_bytes(uart_echo, (const char *) data, buf_size);
TEST_ASSERT_NOT_EQUAL(-1, written);
written = uart_write_bytes(uart_echo, (const char *) data, buf_size);
TEST_ASSERT_NOT_EQUAL(-1, written);
/* Flush the input buffer, RX interrupts should be re-enabled */
uart_flush_input(uart_echo);
written = uart_write_bytes(uart_echo, (const char *) data, buf_size);
TEST_ASSERT_NOT_EQUAL(-1, written);
len = uart_read_bytes(uart_echo, data, buf_size, 1000 / portTICK_RATE_MS);
/* len equals buf_size bytes if interrupts were indeed re-enabled */
TEST_ASSERT_EQUAL(len, buf_size);
/**
* Second test, make sure that if we explicitly disable the RX interrupts,
* they are NOT re-enabled after flushing
* To do so, start by cleaning the RX FIFO, disable the RX interrupts,
* flush again, send data to the UART and check that we haven't received
* any of the bytes */
uart_flush_input(uart_echo);
uart_disable_rx_intr(uart_echo);
uart_flush_input(uart_echo);
written = uart_write_bytes(uart_echo, (const char *) data, buf_size);
TEST_ASSERT_NOT_EQUAL(-1, written);
len = uart_read_bytes(uart_echo, data, buf_size, 250 / portTICK_RATE_MS);
TEST_ASSERT_EQUAL(len, 0);
TEST_ESP_OK(uart_driver_delete(uart_echo));
free(data);
}
@@ -1977,6 +1977,10 @@ static void test_deep_sleep_init(void)
TEST_CASE("Touch Sensor sleep pad wakeup deep sleep test", "[touch][ignore]")
{
//TODO: IDF-4813
#if TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3)
abort();
#endif //TEMPORARY_DISABLED_FOR_TARGETS(..)
test_deep_sleep_init();
/* Change the work duty of touch sensor to reduce current. */
+40 -14
View File
@@ -114,6 +114,7 @@ typedef struct {
uint8_t *rx_head_ptr; /*!< pointer to the head of RX item*/
uint8_t rx_data_buf[SOC_UART_FIFO_LEN]; /*!< Data buffer to stash FIFO data*/
uint8_t rx_stash_len; /*!< stashed data length.(When using flow control, after reading out FIFO data, if we fail to push to buffer, we can just stash them.) */
uint32_t rx_int_usr_mask; /*!< RX interrupt status. Valid at any time, regardless of RX buffer status. */
uart_pat_rb_t rx_pattern_pos;
int tx_buf_size; /*!< TX ring buffer size */
bool tx_waiting_fifo; /*!< this flag indicates that some task is waiting for FIFO empty interrupt, used to send all data without any data buffer*/
@@ -357,16 +358,45 @@ esp_err_t uart_enable_intr_mask(uart_port_t uart_num, uint32_t enable_mask)
{
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
/* Keep track of the interrupt toggling. In fact, without such variable,
* once the RX buffer is full and the RX interrupts disabled, it is
* impossible what was the previous state (enabled/disabled) of these
* interrupt masks. Thus, this will be very particularly handy when
* emptying a filled RX buffer. */
p_uart_obj[uart_num]->rx_int_usr_mask |= enable_mask;
uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), enable_mask);
uart_hal_ena_intr_mask(&(uart_context[uart_num].hal), enable_mask);
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
return ESP_OK;
}
/**
* @brief Function re-enabling the given interrupts (mask) if and only if
* they have not been disabled by the user.
*
* @param uart_num UART number to perform the operation on
* @param enable_mask Interrupts (flags) to be re-enabled
*
* @return ESP_OK in success, ESP_FAIL if uart_num is incorrect
*/
static esp_err_t uart_reenable_intr_mask(uart_port_t uart_num, uint32_t enable_mask)
{
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
/* Mask will only contain the interrupt flags that needs to be re-enabled
* AND which have NOT been explicitly disabled by the user. */
uint32_t mask = p_uart_obj[uart_num]->rx_int_usr_mask & enable_mask;
uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), mask);
uart_hal_ena_intr_mask(&(uart_context[uart_num].hal), mask);
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
return ESP_OK;
}
esp_err_t uart_disable_intr_mask(uart_port_t uart_num, uint32_t disable_mask)
{
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
p_uart_obj[uart_num]->rx_int_usr_mask &= ~disable_mask;
uart_hal_disable_intr_mask(&(uart_context[uart_num].hal), disable_mask);
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
return ESP_OK;
@@ -1235,7 +1265,9 @@ static bool uart_check_buf_full(uart_port_t uart_num)
p_uart_obj[uart_num]->rx_buffered_len += p_uart_obj[uart_num]->rx_stash_len;
p_uart_obj[uart_num]->rx_buffer_full_flg = false;
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
uart_enable_rx_intr(p_uart_obj[uart_num]->uart_num);
/* Only re-activate UART_INTR_RXFIFO_TOUT or UART_INTR_RXFIFO_FULL
* interrupts if they were NOT explicitly disabled by the user. */
uart_reenable_intr_mask(p_uart_obj[uart_num]->uart_num, UART_INTR_RXFIFO_TOUT | UART_INTR_RXFIFO_FULL);
return true;
}
}
@@ -1313,16 +1345,6 @@ esp_err_t uart_get_buffered_data_len(uart_port_t uart_num, size_t *size)
esp_err_t uart_flush(uart_port_t uart_num) __attribute__((alias("uart_flush_input")));
static esp_err_t uart_disable_intr_mask_and_return_prev(uart_port_t uart_num, uint32_t disable_mask, uint32_t *prev_mask)
{
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
*prev_mask = uart_hal_get_intr_ena_status(&uart_context[uart_num].hal) & disable_mask;
uart_hal_disable_intr_mask(&(uart_context[uart_num].hal), disable_mask);
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
return ESP_OK;
}
esp_err_t uart_flush_input(uart_port_t uart_num)
{
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
@@ -1330,11 +1352,12 @@ esp_err_t uart_flush_input(uart_port_t uart_num)
uart_obj_t *p_uart = p_uart_obj[uart_num];
uint8_t *data;
size_t size;
uint32_t prev_mask;
//rx sem protect the ring buffer read related functions
xSemaphoreTake(p_uart->rx_mux, (portTickType)portMAX_DELAY);
uart_disable_intr_mask_and_return_prev(uart_num, UART_INTR_RXFIFO_FULL | UART_INTR_RXFIFO_TOUT, &prev_mask);
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
uart_hal_disable_intr_mask(&(uart_context[uart_num].hal), UART_INTR_RXFIFO_FULL | UART_INTR_RXFIFO_TOUT);
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
while (true) {
if (p_uart->rx_head_ptr) {
vRingbufferReturnItem(p_uart->rx_ring_buf, p_uart->rx_head_ptr);
@@ -1382,7 +1405,9 @@ esp_err_t uart_flush_input(uart_port_t uart_num)
p_uart->rx_cur_remain = 0;
p_uart->rx_head_ptr = NULL;
uart_hal_rxfifo_rst(&(uart_context[uart_num].hal));
uart_enable_intr_mask(uart_num, prev_mask);
/* Only re-enable UART_INTR_RXFIFO_TOUT or UART_INTR_RXFIFO_FULL if they
* were explicitly enabled by the user. */
uart_reenable_intr_mask(uart_num, UART_INTR_RXFIFO_TOUT | UART_INTR_RXFIFO_FULL);
xSemaphoreGive(p_uart->rx_mux);
return ESP_OK;
}
@@ -1561,6 +1586,7 @@ esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_b
p_uart_obj[uart_num]->tx_waiting_fifo = false;
p_uart_obj[uart_num]->rx_ptr = NULL;
p_uart_obj[uart_num]->rx_cur_remain = 0;
p_uart_obj[uart_num]->rx_int_usr_mask = UART_INTR_RXFIFO_FULL | UART_INTR_RXFIFO_TOUT;
p_uart_obj[uart_num]->rx_head_ptr = NULL;
p_uart_obj[uart_num]->tx_buf_size = tx_buffer_size;
p_uart_obj[uart_num]->uart_select_notif_callback = NULL;
+2 -56
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -9,7 +9,7 @@
#include <assert.h>
#include "esp_efuse_table.h"
// md5_digest_table ef33779021404fbaddc878eefebaddc1
// md5_digest_table 720eb12a076091cb1a236c15d9fa3308
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
// If you want to change some fields, you need to change esp_efuse_table.csv file
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
@@ -175,10 +175,6 @@ static const esp_efuse_desc_t DIS_FORCE_DOWNLOAD[] = {
{EFUSE_BLK0, 44, 1}, // Disable force chip go to download mode function,
};
static const esp_efuse_desc_t DIS_USB[] = {
{EFUSE_BLK0, 45, 1}, // Disable USB function,
};
static const esp_efuse_desc_t DIS_CAN[] = {
{EFUSE_BLK0, 46, 1}, // Disable CAN function,
};
@@ -295,10 +291,6 @@ static const esp_efuse_desc_t UART_PRINT_CHANNEL[] = {
{EFUSE_BLK0, 130, 1}, // 0: UART0. 1: UART1,
};
static const esp_efuse_desc_t FLASH_ECC_MODE[] = {
{EFUSE_BLK0, 131, 1}, // Set this bit to set flsah ecc mode. 0:flash ecc 16to18 byte mode. 1:flash ecc 16to17 byte mode,
};
static const esp_efuse_desc_t DIS_USB_DOWNLOAD_MODE[] = {
{EFUSE_BLK0, 132, 1}, // Disable download through USB,
};
@@ -311,22 +303,6 @@ static const esp_efuse_desc_t UART_PRINT_CONTROL[] = {
{EFUSE_BLK0, 134, 2}, // b00:force print. b01:control by GPIO8 - low level print. b10:control by GPIO8 - high level print. b11:force disable print.,
};
static const esp_efuse_desc_t PIN_POWER_SELECTION[] = {
{EFUSE_BLK0, 136, 1}, // GPIO33-GPIO37 power supply selection in ROM code. 0:VDD3P3_CPU. 1:VDD_SPI.,
};
static const esp_efuse_desc_t FLASH_TYPE[] = {
{EFUSE_BLK0, 137, 1}, // Connected Flash interface type. 0: 4 data line. 1: 8 data line,
};
static const esp_efuse_desc_t FLASH_PAGE_SIZE[] = {
{EFUSE_BLK0, 138, 2}, // Flash page size,
};
static const esp_efuse_desc_t FLASH_ECC_EN[] = {
{EFUSE_BLK0, 140, 1}, // Enable ECC for flash boot,
};
static const esp_efuse_desc_t FORCE_SEND_RESUME[] = {
{EFUSE_BLK0, 141, 1}, // Force ROM code to send a resume command during SPI boot,
};
@@ -712,11 +688,6 @@ const esp_efuse_desc_t* ESP_EFUSE_DIS_FORCE_DOWNLOAD[] = {
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_DIS_USB[] = {
&DIS_USB[0], // Disable USB function
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_DIS_CAN[] = {
&DIS_CAN[0], // Disable CAN function
NULL
@@ -862,11 +833,6 @@ const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CHANNEL[] = {
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FLASH_ECC_MODE[] = {
&FLASH_ECC_MODE[0], // Set this bit to set flsah ecc mode. 0:flash ecc 16to18 byte mode. 1:flash ecc 16to17 byte mode
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_DOWNLOAD_MODE[] = {
&DIS_USB_DOWNLOAD_MODE[0], // Disable download through USB
NULL
@@ -882,26 +848,6 @@ const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CONTROL[] = {
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_PIN_POWER_SELECTION[] = {
&PIN_POWER_SELECTION[0], // GPIO33-GPIO37 power supply selection in ROM code. 0:VDD3P3_CPU. 1:VDD_SPI.
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FLASH_TYPE[] = {
&FLASH_TYPE[0], // Connected Flash interface type. 0: 4 data line. 1: 8 data line
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FLASH_PAGE_SIZE[] = {
&FLASH_PAGE_SIZE[0], // Flash page size
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FLASH_ECC_EN[] = {
&FLASH_ECC_EN[0], // Enable ECC for flash boot
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FORCE_SEND_RESUME[] = {
&FORCE_SEND_RESUME[0], // Force ROM code to send a resume command during SPI boot
NULL
@@ -55,7 +55,6 @@
DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 42, 1, Disable Icache in download mode
DIS_USB_DEVICE, EFUSE_BLK0, 43, 1, Disable USB_DEVICE
DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 44, 1, Disable force chip go to download mode function
DIS_USB, EFUSE_BLK0, 45, 1, Disable USB function
DIS_CAN, EFUSE_BLK0, 46, 1, Disable CAN function
JTAG_SEL_ENABLE, EFUSE_BLK0, 47, 1, Set this bit to enable selection between usb_to_jtag and pad_to_jtag through strapping gpio10 when both reg_dis_usb_jtag and reg_dis_pad_jtag are equal to 0.
SOFT_DIS_JTAG, EFUSE_BLK0, 48, 3, Set these bits to disable JTAG in the soft way (odd number 1 means disable). JTAG can be enabled in HMAC module.
@@ -91,14 +90,9 @@
DIS_DOWNLOAD_MODE, EFUSE_BLK0, 128, 1, Disble download mode include boot_mode[3:0] is 0 1 2 3 6 7
DIS_LEGACY_SPI_BOOT, EFUSE_BLK0, 129, 1, Disable_Legcy_SPI_boot mode include boot_mode[3:0] is 4
UART_PRINT_CHANNEL, EFUSE_BLK0, 130, 1, 0: UART0. 1: UART1
FLASH_ECC_MODE, EFUSE_BLK0, 131, 1, Set this bit to set flsah ecc mode. 0:flash ecc 16to18 byte mode. 1:flash ecc 16to17 byte mode
DIS_USB_DOWNLOAD_MODE, EFUSE_BLK0, 132, 1, Disable download through USB
ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 133, 1, Enable security download mode
UART_PRINT_CONTROL, EFUSE_BLK0, 134, 2, b00:force print. b01:control by GPIO8 - low level print. b10:control by GPIO8 - high level print. b11:force disable print.
PIN_POWER_SELECTION, EFUSE_BLK0, 136, 1, GPIO33-GPIO37 power supply selection in ROM code. 0:VDD3P3_CPU. 1:VDD_SPI.
FLASH_TYPE, EFUSE_BLK0, 137, 1, Connected Flash interface type. 0: 4 data line. 1: 8 data line
FLASH_PAGE_SIZE, EFUSE_BLK0, 138, 2, Flash page size
FLASH_ECC_EN, EFUSE_BLK0, 140, 1, Enable ECC for flash boot
FORCE_SEND_RESUME, EFUSE_BLK0, 141, 1, Force ROM code to send a resume command during SPI boot
SECURE_VERSION, EFUSE_BLK0, 142, 16, Secure version for anti-rollback
Can't render this file because it contains an unexpected character in line 7 and column 87.
+30 -12
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -51,26 +51,44 @@ const esp_efuse_range_addr_t range_write_addr_blocks[] = {
{(uint32_t) &write_mass_blocks[EFUSE_BLK10][0], (uint32_t) &write_mass_blocks[EFUSE_BLK10][7]},
};
#ifndef CONFIG_EFUSE_VIRTUAL
// Update Efuse timing configuration
static esp_err_t esp_efuse_set_timing(void)
{
// efuse clock is fixed in ESP32-C3, so the ets_efuse_set_timing() function
// takes an argument for compatibility with older ROM functions but it's ignored.
int res = ets_efuse_set_timing(0);
assert(res == 0);
(void)res;
REG_SET_FIELD(EFUSE_WR_TIM_CONF2_REG, EFUSE_PWR_OFF_NUM, 0x60);
REG_SET_FIELD(EFUSE_WR_TIM_CONF2_REG, EFUSE_PWR_OFF_NUM, 0x190);
return ESP_OK;
}
static void efuse_read(void)
{
esp_efuse_set_timing();
REG_WRITE(EFUSE_CONF_REG, EFUSE_READ_OP_CODE);
REG_WRITE(EFUSE_CMD_REG, EFUSE_READ_CMD);
while (REG_GET_BIT(EFUSE_CMD_REG, EFUSE_READ_CMD) != 0) { }
/*Due to a hardware error, we have to read READ_CMD again to make sure the efuse clock is normal*/
while (REG_GET_BIT(EFUSE_CMD_REG, EFUSE_READ_CMD) != 0) { }
}
#ifndef CONFIG_EFUSE_VIRTUAL
static void efuse_program(esp_efuse_block_t block)
{
esp_efuse_set_timing();
REG_WRITE(EFUSE_CONF_REG, EFUSE_WRITE_OP_CODE);
REG_WRITE(EFUSE_CMD_REG, ((block << EFUSE_BLK_NUM_S) & EFUSE_BLK_NUM_M) | EFUSE_PGM_CMD);
while (REG_GET_BIT(EFUSE_CMD_REG, EFUSE_PGM_CMD) != 0) { };
ets_efuse_clear_program_registers();
efuse_read();
}
#endif // ifndef CONFIG_EFUSE_VIRTUAL
// Efuse read operation: copies data from physical efuses to efuse read registers.
void esp_efuse_utility_clear_program_registers(void)
{
ets_efuse_read();
efuse_read();
ets_efuse_clear_program_registers();
}
@@ -104,7 +122,7 @@ void esp_efuse_utility_burn_chip(void)
}
int data_len = (range_write_addr_blocks[num_block].end - range_write_addr_blocks[num_block].start) + sizeof(uint32_t);
memcpy((void *)EFUSE_PGM_DATA0_REG, (void *)range_write_addr_blocks[num_block].start, data_len);
ets_efuse_program(num_block);
efuse_program(num_block);
break;
}
}
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -9,7 +9,7 @@ extern "C" {
#endif
// md5_digest_table ef33779021404fbaddc878eefebaddc1
// md5_digest_table 720eb12a076091cb1a236c15d9fa3308
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
// If you want to change some fields, you need to change esp_efuse_table.csv file
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
@@ -56,7 +56,6 @@ extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_JTAG[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_ICACHE[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_DEVICE[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_FORCE_DOWNLOAD[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_CAN[];
extern const esp_efuse_desc_t* ESP_EFUSE_JTAG_SEL_ENABLE[];
extern const esp_efuse_desc_t* ESP_EFUSE_SOFT_DIS_JTAG[];
@@ -86,14 +85,9 @@ extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_TPUW[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_MODE[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_LEGACY_SPI_BOOT[];
extern const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CHANNEL[];
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_ECC_MODE[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_DOWNLOAD_MODE[];
extern const esp_efuse_desc_t* ESP_EFUSE_ENABLE_SECURITY_DOWNLOAD[];
extern const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CONTROL[];
extern const esp_efuse_desc_t* ESP_EFUSE_PIN_POWER_SELECTION[];
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_TYPE[];
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_PAGE_SIZE[];
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_ECC_EN[];
extern const esp_efuse_desc_t* ESP_EFUSE_FORCE_SEND_RESUME[];
extern const esp_efuse_desc_t* ESP_EFUSE_SECURE_VERSION[];
extern const esp_efuse_desc_t* ESP_EFUSE_MAC_FACTORY[];
+2 -56
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -9,7 +9,7 @@
#include <assert.h>
#include "esp_efuse_table.h"
// md5_digest_table 6aaac59bd3f6d31bea4aef43b1f0d78a
// md5_digest_table d3317916050c9ac3f0b2056ee72173af
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
// If you want to change some fields, you need to change esp_efuse_table.csv file
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
@@ -175,10 +175,6 @@ static const esp_efuse_desc_t DIS_FORCE_DOWNLOAD[] = {
{EFUSE_BLK0, 44, 1}, // Disable force chip go to download mode function,
};
static const esp_efuse_desc_t DIS_USB[] = {
{EFUSE_BLK0, 45, 1}, // Disable USB function,
};
static const esp_efuse_desc_t DIS_CAN[] = {
{EFUSE_BLK0, 46, 1}, // Disable CAN function,
};
@@ -295,10 +291,6 @@ static const esp_efuse_desc_t UART_PRINT_CHANNEL[] = {
{EFUSE_BLK0, 130, 1}, // 0: UART0. 1: UART1,
};
static const esp_efuse_desc_t FLASH_ECC_MODE[] = {
{EFUSE_BLK0, 131, 1}, // Set this bit to set flsah ecc mode. 0:flash ecc 16to18 byte mode. 1:flash ecc 16to17 byte mode,
};
static const esp_efuse_desc_t DIS_USB_DOWNLOAD_MODE[] = {
{EFUSE_BLK0, 132, 1}, // Disable download through USB,
};
@@ -311,22 +303,6 @@ static const esp_efuse_desc_t UART_PRINT_CONTROL[] = {
{EFUSE_BLK0, 134, 2}, // b00:force print. b01:control by GPIO8 - low level print. b10:control by GPIO8 - high level print. b11:force disable print.,
};
static const esp_efuse_desc_t PIN_POWER_SELECTION[] = {
{EFUSE_BLK0, 136, 1}, // GPIO33-GPIO37 power supply selection in ROM code. 0:VDD3P3_CPU. 1:VDD_SPI.,
};
static const esp_efuse_desc_t FLASH_TYPE[] = {
{EFUSE_BLK0, 137, 1}, // Connected Flash interface type. 0: 4 data line. 1: 8 data line,
};
static const esp_efuse_desc_t FLASH_PAGE_SIZE[] = {
{EFUSE_BLK0, 138, 2}, // Flash page size,
};
static const esp_efuse_desc_t FLASH_ECC_EN[] = {
{EFUSE_BLK0, 140, 1}, // Enable ECC for flash boot,
};
static const esp_efuse_desc_t FORCE_SEND_RESUME[] = {
{EFUSE_BLK0, 141, 1}, // Force ROM code to send a resume command during SPI boot,
};
@@ -697,11 +673,6 @@ const esp_efuse_desc_t* ESP_EFUSE_DIS_FORCE_DOWNLOAD[] = {
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_DIS_USB[] = {
&DIS_USB[0], // Disable USB function
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_DIS_CAN[] = {
&DIS_CAN[0], // Disable CAN function
NULL
@@ -847,11 +818,6 @@ const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CHANNEL[] = {
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FLASH_ECC_MODE[] = {
&FLASH_ECC_MODE[0], // Set this bit to set flsah ecc mode. 0:flash ecc 16to18 byte mode. 1:flash ecc 16to17 byte mode
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_DOWNLOAD_MODE[] = {
&DIS_USB_DOWNLOAD_MODE[0], // Disable download through USB
NULL
@@ -867,26 +833,6 @@ const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CONTROL[] = {
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_PIN_POWER_SELECTION[] = {
&PIN_POWER_SELECTION[0], // GPIO33-GPIO37 power supply selection in ROM code. 0:VDD3P3_CPU. 1:VDD_SPI.
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FLASH_TYPE[] = {
&FLASH_TYPE[0], // Connected Flash interface type. 0: 4 data line. 1: 8 data line
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FLASH_PAGE_SIZE[] = {
&FLASH_PAGE_SIZE[0], // Flash page size
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FLASH_ECC_EN[] = {
&FLASH_ECC_EN[0], // Enable ECC for flash boot
NULL
};
const esp_efuse_desc_t* ESP_EFUSE_FORCE_SEND_RESUME[] = {
&FORCE_SEND_RESUME[0], // Force ROM code to send a resume command during SPI boot
NULL
@@ -56,7 +56,6 @@
DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 42, 1, Disable Icache in download mode
DIS_USB_DEVICE, EFUSE_BLK0, 43, 1, Disable USB_DEVICE
DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 44, 1, Disable force chip go to download mode function
DIS_USB, EFUSE_BLK0, 45, 1, Disable USB function
DIS_CAN, EFUSE_BLK0, 46, 1, Disable CAN function
JTAG_SEL_ENABLE, EFUSE_BLK0, 47, 1, Set this bit to enable selection between usb_to_jtag and pad_to_jtag through strapping gpio10 when both reg_dis_usb_jtag and reg_dis_pad_jtag are equal to 0.
SOFT_DIS_JTAG, EFUSE_BLK0, 48, 3, Set these bits to disable JTAG in the soft way (odd number 1 means disable). JTAG can be enabled in HMAC module.
@@ -92,14 +91,9 @@
DIS_DOWNLOAD_MODE, EFUSE_BLK0, 128, 1, Disble download mode include boot_mode[3:0] is 0 1 2 3 6 7
DIS_LEGACY_SPI_BOOT, EFUSE_BLK0, 129, 1, Disable_Legcy_SPI_boot mode include boot_mode[3:0] is 4
UART_PRINT_CHANNEL, EFUSE_BLK0, 130, 1, 0: UART0. 1: UART1
FLASH_ECC_MODE, EFUSE_BLK0, 131, 1, Set this bit to set flsah ecc mode. 0:flash ecc 16to18 byte mode. 1:flash ecc 16to17 byte mode
DIS_USB_DOWNLOAD_MODE, EFUSE_BLK0, 132, 1, Disable download through USB
ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 133, 1, Enable security download mode
UART_PRINT_CONTROL, EFUSE_BLK0, 134, 2, b00:force print. b01:control by GPIO8 - low level print. b10:control by GPIO8 - high level print. b11:force disable print.
PIN_POWER_SELECTION, EFUSE_BLK0, 136, 1, GPIO33-GPIO37 power supply selection in ROM code. 0:VDD3P3_CPU. 1:VDD_SPI.
FLASH_TYPE, EFUSE_BLK0, 137, 1, Connected Flash interface type. 0: 4 data line. 1: 8 data line
FLASH_PAGE_SIZE, EFUSE_BLK0, 138, 2, Flash page size
FLASH_ECC_EN, EFUSE_BLK0, 140, 1, Enable ECC for flash boot
FORCE_SEND_RESUME, EFUSE_BLK0, 141, 1, Force ROM code to send a resume command during SPI boot
SECURE_VERSION, EFUSE_BLK0, 142, 16, Secure version for anti-rollback
BOOT_DISABLE_FAST_WAKE, EFUSE_BLK0, 158, 1, Fast verify on wake option in ROM for Secure Boot
Can't render this file because it contains an unexpected character in line 7 and column 87.
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -9,7 +9,7 @@ extern "C" {
#endif
// md5_digest_table 6aaac59bd3f6d31bea4aef43b1f0d78a
// md5_digest_table d3317916050c9ac3f0b2056ee72173af
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
// If you want to change some fields, you need to change esp_efuse_table.csv file
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
@@ -56,7 +56,6 @@ extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_JTAG[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_ICACHE[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_DEVICE[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_FORCE_DOWNLOAD[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_CAN[];
extern const esp_efuse_desc_t* ESP_EFUSE_JTAG_SEL_ENABLE[];
extern const esp_efuse_desc_t* ESP_EFUSE_SOFT_DIS_JTAG[];
@@ -86,14 +85,9 @@ extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_TPUW[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_MODE[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_LEGACY_SPI_BOOT[];
extern const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CHANNEL[];
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_ECC_MODE[];
extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_DOWNLOAD_MODE[];
extern const esp_efuse_desc_t* ESP_EFUSE_ENABLE_SECURITY_DOWNLOAD[];
extern const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CONTROL[];
extern const esp_efuse_desc_t* ESP_EFUSE_PIN_POWER_SELECTION[];
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_TYPE[];
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_PAGE_SIZE[];
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_ECC_EN[];
extern const esp_efuse_desc_t* ESP_EFUSE_FORCE_SEND_RESUME[];
extern const esp_efuse_desc_t* ESP_EFUSE_SECURE_VERSION[];
extern const esp_efuse_desc_t* ESP_EFUSE_BOOT_DISABLE_FAST_WAKE[];
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -25,7 +25,7 @@ uint8_t esp_efuse_get_chip_ver(void)
{
// should return the same value as bootloader_common_get_chip_revision()
uint32_t chip_ver = 0;
// TODO: ESP32S2 does not have this field
esp_efuse_read_field_blob(ESP_EFUSE_WAFER_VERSION, &chip_ver, ESP_EFUSE_WAFER_VERSION[0]->bit_count);
return chip_ver;
}
+31 -6
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -51,19 +51,44 @@ const esp_efuse_range_addr_t range_write_addr_blocks[] = {
{(uint32_t) &write_mass_blocks[EFUSE_BLK10][0], (uint32_t) &write_mass_blocks[EFUSE_BLK10][7]},
};
#ifndef CONFIG_EFUSE_VIRTUAL
// Update Efuse timing configuration
static esp_err_t esp_efuse_set_timing(void)
{
uint32_t clock_hz = esp_clk_apb_freq();
return ets_efuse_set_timing(clock_hz) ? ESP_FAIL : ESP_OK;
REG_SET_FIELD(EFUSE_WR_TIM_CONF2_REG, EFUSE_PWR_OFF_NUM, 0x190);
return ESP_OK;
}
static void efuse_read(void)
{
esp_efuse_set_timing();
REG_WRITE(EFUSE_CONF_REG, EFUSE_READ_OP_CODE);
REG_WRITE(EFUSE_CMD_REG, EFUSE_READ_CMD);
while (REG_GET_BIT(EFUSE_CMD_REG, EFUSE_READ_CMD) != 0) { }
/*Due to a hardware error, we have to read READ_CMD again to make sure the efuse clock is normal*/
while (REG_GET_BIT(EFUSE_CMD_REG, EFUSE_READ_CMD) != 0) { }
}
#ifndef CONFIG_EFUSE_VIRTUAL
static void efuse_program(esp_efuse_block_t block)
{
esp_efuse_set_timing();
REG_WRITE(EFUSE_CONF_REG, EFUSE_WRITE_OP_CODE);
REG_WRITE(EFUSE_CMD_REG, ((block << EFUSE_BLK_NUM_S) & EFUSE_BLK_NUM_M) | EFUSE_PGM_CMD);
while (REG_GET_BIT(EFUSE_CMD_REG, EFUSE_PGM_CMD) != 0) { };
ets_efuse_clear_program_registers();
efuse_read();
}
#endif // ifndef CONFIG_EFUSE_VIRTUAL
// Efuse read operation: copies data from physical efuses to efuse read registers.
void esp_efuse_utility_clear_program_registers(void)
{
ets_efuse_read();
efuse_read();
ets_efuse_clear_program_registers();
}
@@ -97,7 +122,7 @@ void esp_efuse_utility_burn_chip(void)
}
int data_len = (range_write_addr_blocks[num_block].end - range_write_addr_blocks[num_block].start) + sizeof(uint32_t);
memcpy((void *)EFUSE_PGM_DATA0_REG, (void *)range_write_addr_blocks[num_block].start, data_len);
ets_efuse_program(num_block);
efuse_program(num_block);
break;
}
}
-8
View File
@@ -56,14 +56,6 @@ menu "ESP32C3-Specific"
The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and
instead of panicking, have the debugger stop on the offending instruction.
config ESP32C3_DEBUG_STUBS_ENABLE
bool "OpenOCD debug stubs"
default COMPILER_OPTIMIZATION_LEVEL_DEBUG
depends on !ESP32C3_TRAX
help
Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging,
e.g. GCOV data dump.
config ESP32C3_BROWNOUT_DET
bool "Hardware brownout detect & reset"
depends on !IDF_ENV_FPGA
-8
View File
@@ -53,14 +53,6 @@ menu "ESP32H2-Specific"
The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and
instead of panicking, have the debugger stop on the offending instruction.
config ESP32H2_DEBUG_STUBS_ENABLE
bool "OpenOCD debug stubs"
default COMPILER_OPTIMIZATION_LEVEL_DEBUG
depends on !ESP32H2_TRAX
help
Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging,
e.g. GCOV data dump.
config ESP32H2_BROWNOUT_DET
bool "Hardware brownout detect & reset"
default y
-8
View File
@@ -256,14 +256,6 @@ menu "ESP32S2-specific"
The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and
instead of panicking, have the debugger stop on the offending instruction.
config ESP32S2_DEBUG_STUBS_ENABLE
bool "OpenOCD debug stubs"
default COMPILER_OPTIMIZATION_LEVEL_DEBUG
depends on !ESP32S2_TRAX
help
Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging,
e.g. GCOV data dump.
config ESP32S2_BROWNOUT_DET
bool "Hardware brownout detect & reset"
depends on !IDF_ENV_FPGA
-8
View File
@@ -328,14 +328,6 @@ menu "ESP32S3-Specific"
The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and
instead of panicking, have the debugger stop on the offending instruction.
config ESP32S3_DEBUG_STUBS_ENABLE
bool "OpenOCD debug stubs"
default COMPILER_OPTIMIZATION_LEVEL_DEBUG
depends on !ESP32S3_TRAX
help
Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging,
e.g. GCOV data dump.
config ESP32S3_BROWNOUT_DET
bool "Hardware brownout detect & reset"
depends on !IDF_ENV_FPGA
+9 -19
View File
@@ -1,22 +1,12 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "esp32")
idf_component_register(SRCS "esp_adc_cal_esp32.c"
INCLUDE_DIRS "include"
REQUIRES driver efuse)
elseif(${target} STREQUAL "esp32s2")
idf_component_register(SRCS "esp_adc_cal_esp32s2.c"
INCLUDE_DIRS "include"
REQUIRES driver efuse)
elseif(${target} STREQUAL "esp32c3")
idf_component_register(SRCS "esp_adc_cal_esp32c3.c"
INCLUDE_DIRS "include"
REQUIRES driver efuse)
elseif(${target} STREQUAL "esp32s3")
idf_component_register(SRCS "esp_adc_cal_esp32s3.c"
INCLUDE_DIRS "include"
REQUIRES driver efuse)
set(srcs "esp_adc_cal_common.c")
set(src_target "${target}/esp_adc_cal.c")
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${src_target}")
list(APPEND srcs ${src_target})
endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS include
REQUIRES driver
PRIV_REQUIRES efuse)
+1 -1
View File
@@ -2,5 +2,5 @@
# Component Makefile
#
COMPONENT_SRCDIRS := . $(IDF_TARGET)
COMPONENT_ADD_INCLUDEDIRS := include
COMPONENT_OBJEXCLUDE += esp_adc_cal_esp32s2.o esp_adc_cal_esp32c3.o esp_adc_cal_esp32h2.o esp_adc_cal_esp32s3.o
@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include "esp_types.h"
@@ -83,8 +75,6 @@
#define LUT_HIGH_THRESH (LUT_LOW_THRESH + LUT_ADC_STEP_SIZE)
#define ADC_12_BIT_RES 4096
const static char LOG_TAG[] = "ADC_CALI";
/* ------------------------ Characterization Constants ---------------------- */
static const uint32_t adc1_tp_atten_scale[4] = {65504, 86975, 120389, 224310};
static const uint32_t adc2_tp_atten_scale[4] = {65467, 86861, 120416, 224708};
@@ -363,26 +353,3 @@ uint32_t esp_adc_cal_raw_to_voltage(uint32_t adc_reading, const esp_adc_cal_char
return calculate_voltage_linear(adc_reading, chars->coeff_a, chars->coeff_b);
}
}
esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel,
const esp_adc_cal_characteristics_t *chars,
uint32_t *voltage)
{
//Check parameters
ESP_RETURN_ON_FALSE(chars != NULL, ESP_ERR_INVALID_ARG, LOG_TAG, "No characteristic input");
ESP_RETURN_ON_FALSE(voltage != NULL, ESP_ERR_INVALID_ARG, LOG_TAG, "No output buffer");
esp_err_t ret = ESP_OK;
int adc_reading;
if (chars->adc_num == ADC_UNIT_1) {
//Check channel is valid on ADC1
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(0), ESP_ERR_INVALID_ARG, LOG_TAG, "Invalid channel");
adc_reading = adc1_get_raw(channel);
} else {
//Check channel is valid on ADC2
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(1), ESP_ERR_INVALID_ARG, LOG_TAG, "Invalid channel");
ret = adc2_get_raw(channel, chars->bit_width, &adc_reading);
}
*voltage = esp_adc_cal_raw_to_voltage((uint32_t)adc_reading, chars);
return ret;
}
@@ -1,16 +1,8 @@
// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include <stdbool.h>
@@ -23,16 +15,47 @@
#include "hal/adc_ll.h"
#include "esp_efuse_rtc_calib.h"
#include "esp_adc_cal.h"
#include "../esp_adc_cal_internal.h"
const static char LOG_TAG[] = "adc_calib";
const static char LOG_TAG[] = "ADC_CALI";
/* ------------------------ Characterization Constants ---------------------- */
// coeff_a and coeff_b are actually floats
// they are scaled to put them into uint32_t so that the headers do not have to be changed
// coeff_a is actually a float number
// it is scaled to put them into uint32_t so that the headers do not have to be changed
static const int coeff_a_scaling = 65536;
static const int coeff_b_scaling = 1024;
/**
* @note Error Calculation
* Coefficients for calculating the reading voltage error.
* Four sets of coefficients for atten0 ~ atten3 respectively.
*
* For each item, first element is the Coefficient, second element is the Multiple. (Coefficient / Multiple) is the real coefficient.
*
* @note {0,0} stands for unused item
* @note In case of the overflow, these coeffcients are recorded as Absolute Value
* @note For atten0 ~ 2, error = (K0 * X^0) + (K1 * X^1) + (K2 * X^2); For atten3, error = (K0 * X^0) + (K1 * X^1) + (K2 * X^2) + (K3 * X^3) + (K4 * X^4);
* @note Above formula is rewritten from the original documentation, please note that the coefficients are re-ordered.
* @note ADC1 and ADC2 use same coeffients
*/
const static uint64_t adc_error_coef_atten[4][5][2] = {
{{225966470500043, 1e15}, {7265418501948, 1e16}, {109410402681, 1e16}, {0, 0}, {0, 0}}, //atten0
{{4229623392600516, 1e16}, {731527490903, 1e16}, {88166562521, 1e16}, {0, 0}, {0, 0}}, //atten1
{{1017859239236435, 1e15}, {97159265299153, 1e16}, {149794028038, 1e16}, {0, 0}, {0, 0}}, //atten2
{{14912262772850453, 1e16}, {228549975564099, 1e16}, {356391935717, 1e16}, {179964582, 1e16}, {42046, 1e16}} //atten3
};
/**
* Term sign
* @note ADC1 and ADC2 use same coeffients
*/
const static int32_t adc_error_sign[4][5] = {
{-1, -1, 1, 0, 0}, //atten0
{ 1, -1, 1, 0, 0}, //atten1
{-1, -1, 1, 0, 0}, //atten2
{-1, -1, 1, -1, 1} //atten3
};
/* -------------------- Characterization Helper Data Types ------------------ */
typedef struct {
uint32_t voltage;
@@ -46,9 +69,9 @@ typedef struct {
union {
adc_calib_data_ver1 ver1;
} efuse_data;
} adc_calib_parsed_info;
} adc_calib_parsed_info_t;
static esp_err_t prepare_calib_data_for(int version_num, adc_unit_t adc_num, adc_atten_t atten, adc_calib_parsed_info *parsed_data_storage)
static esp_err_t prepare_calib_data_for(int version_num, adc_unit_t adc_num, adc_atten_t atten, adc_calib_parsed_info_t *parsed_data_storage)
{
assert(version_num == 1);
esp_err_t ret;
@@ -72,7 +95,7 @@ static esp_err_t prepare_calib_data_for(int version_num, adc_unit_t adc_num, adc
* Estimate the (assumed) linear relationship btwn the measured raw value and the voltage
* with the previously done measurement when the chip was manufactured.
*/
static void calculate_characterization_coefficients(const adc_calib_parsed_info *parsed_data, esp_adc_cal_characteristics_t *chars)
static void calculate_characterization_coefficients(const adc_calib_parsed_info_t *parsed_data, esp_adc_cal_characteristics_t *chars)
{
ESP_LOGD(LOG_TAG, "Calib V1, Cal Voltage = %d, Digi out = %d\n", parsed_data->efuse_data.ver1.voltage, parsed_data->efuse_data.ver1.digi);
@@ -101,7 +124,7 @@ esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
esp_adc_cal_characteristics_t *chars)
{
esp_err_t ret;
adc_calib_parsed_info efuse_parsed_data = {0};
adc_calib_parsed_info_t efuse_parsed_data = {0};
// Check parameters
ESP_RETURN_ON_FALSE(adc_num == ADC_UNIT_1 || adc_num == ADC_UNIT_2, ESP_ADC_CAL_VAL_NOT_SUPPORTED, LOG_TAG, "Invalid unit num");
ESP_RETURN_ON_FALSE(chars != NULL, ESP_ADC_CAL_VAL_NOT_SUPPORTED, LOG_TAG, "Ivalid characteristic");
@@ -134,28 +157,16 @@ esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
uint32_t esp_adc_cal_raw_to_voltage(uint32_t adc_reading, const esp_adc_cal_characteristics_t *chars)
{
assert(chars != NULL);
return adc_reading * chars->coeff_a / coeff_a_scaling + chars->coeff_b / coeff_b_scaling;
}
esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel,
const esp_adc_cal_characteristics_t *chars,
uint32_t *voltage)
{
// Check parameters
ESP_RETURN_ON_FALSE(chars != NULL, ESP_ERR_INVALID_ARG, LOG_TAG, "No characteristic input");
ESP_RETURN_ON_FALSE(voltage != NULL, ESP_ERR_INVALID_ARG, LOG_TAG, "No output buffer");
int32_t error = 0;
uint64_t v_cali_1 = adc_reading * chars->coeff_a / coeff_a_scaling;
esp_adc_error_calc_param_t param = {
.v_cali_input = v_cali_1,
.term_num = (chars->atten == 3) ? 5 : 3,
.coeff = &adc_error_coef_atten,
.sign = &adc_error_sign,
};
error = esp_adc_cal_get_reading_error(&param, chars->atten);
esp_err_t ret = ESP_OK;
int adc_reading;
if (chars->adc_num == ADC_UNIT_1) {
//Check if channel is valid on ADC1
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(0), ESP_ERR_INVALID_ARG, LOG_TAG, "Invalid channel");
adc_reading = adc1_get_raw(channel);
} else {
//Check if channel is valid on ADC2
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(1), ESP_ERR_INVALID_ARG, LOG_TAG, "Invalid channel");
ret = adc2_get_raw(channel, chars->bit_width, &adc_reading);
}
*voltage = esp_adc_cal_raw_to_voltage((uint32_t)adc_reading, chars);
return ret;
return (int32_t)v_cali_1 - error;
}
@@ -1,16 +1,8 @@
// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include "esp_types.h"
@@ -206,26 +198,3 @@ uint32_t esp_adc_cal_raw_to_voltage(uint32_t adc_reading, const esp_adc_cal_char
assert(chars != NULL);
return adc_reading * chars->coeff_a / coeff_a_scaling + chars->coeff_b / coeff_b_scaling;
}
esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel,
const esp_adc_cal_characteristics_t *chars,
uint32_t *voltage)
{
// Check parameters
ESP_RETURN_ON_FALSE(chars != NULL, ESP_ERR_INVALID_ARG, LOG_TAG, "No characteristic input");
ESP_RETURN_ON_FALSE(voltage != NULL, ESP_ERR_INVALID_ARG, LOG_TAG, "No output buffer");
esp_err_t ret = ESP_OK;
int adc_reading;
if (chars->adc_num == ADC_UNIT_1) {
//Check if channel is valid on ADC1
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(0), ESP_ERR_INVALID_ARG, LOG_TAG, "Invalid channel");
adc_reading = adc1_get_raw(channel);
} else {
//Check if channel is valid on ADC2
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(1), ESP_ERR_INVALID_ARG, LOG_TAG, "Invalid channel");
ret = adc2_get_raw(channel, chars->bit_width, &adc_reading);
}
*voltage = esp_adc_cal_raw_to_voltage((uint32_t)adc_reading, chars);
return ret;
}
@@ -15,6 +15,7 @@
#include "hal/adc_types.h"
#include "esp_efuse_rtc_calib.h"
#include "esp_adc_cal.h"
#include "../esp_adc_cal_internal.h"
const static char LOG_TAG[] = "ADC_CALI";
@@ -33,33 +34,35 @@ static const int coeff_a_scaling = 1000000;
*
* @note {0,0} stands for unused item
* @note In case of the overflow, these coeffcients are recorded as Absolute Value
* @note For atten0 ~ 2, error = a1 * X^2 + a2 * X + a3; For atten3, error = a1 * X^4 + a2 * X^3 + a3 * X^2 + a4 * X + a5;
* @note For atten0 ~ 2, error = (K0 * X^0) + (K1 * X^1) + (K2 * X^2); For atten3, error = (K0 * X^0) + (K1 * X^1) + (K2 * X^2) + (K3 * X^3) + (K4 * X^4);
* @note Above formula is rewritten from the original documentation, please note that the coefficients are re-ordered.
*/
const static uint64_t adc_error_coef_atten[4][10][2] = {
{{9798249589, 1e15}, {50871540569528, 1e16}, {3, 1}, {0, 0}, {0, 0}, //ADC1 atten0
{36615265189, 1e16}, {1353548869615, 1e16}, {3, 1}, {0, 0}, {0, 0}}, //ADC2 atten0
{{101379430548, 1e16}, {49393185868806, 1e16}, {3, 1}, {0, 0}, {0, 0}, //ADC1 atten1
{118964995959, 1e16}, {66319894226185, 1e16}, {2, 1}, {0, 0}, {0, 0}}, //ADC2 atten1
{{208385525314, 1e16}, {147640181047414, 1e16}, {2, 1}, {0, 0}, {0, 0}, //ADC1 atten2
{259011467956, 1e16}, {200996773954387, 1e16}, {1, 1}, {0, 0}, {0, 0}}, //ADC2 atten2
{{13515, 1e15}, {70769718, 1e15}, {1297891447611, 1e16}, {644334888647536, 1e16}, {1,1}, //ADC1 atten3
{15038, 1e15}, {79672528, 1e15}, {1478791187119, 1e16}, {755717904943462, 1e16}, {1,1}} //ADC2 atten3
const static uint64_t adc1_error_coef_atten[4][5][2] = {
{{27856531419538344, 1e16}, {50871540569528, 1e16}, {9798249589, 1e15}, {0, 0}, {0, 0}}, //ADC1 atten0
{{29831022915028695, 1e16}, {49393185868806, 1e16}, {101379430548, 1e16}, {0, 0}, {0, 0}}, //ADC1 atten1
{{23285545746296417, 1e16}, {147640181047414, 1e16}, {208385525314, 1e16}, {0, 0}, {0, 0}}, //ADC1 atten2
{{644403418269478, 1e15}, {644334888647536, 1e16}, {1297891447611, 1e16}, {70769718, 1e15}, {13515, 1e15}} //ADC1 atten3
};
const static int32_t adc_error_sign[4][10] = {
{1, -1, -1, 0, 0, //ADC1 atten0
1, 1, -1, 0, 0}, //ADC2 atten0
{1, -1, -1, 0, 0, //ADC1 atten1
1, -1, -1, 0, 0}, //ADC2 atten1
{1, -1, -1, 0, 0, //ADC1 atten2
1, -1, -1, 0, 0}, //ADC2 atten2
{1, -1, 1, -1, -1, //ADC1 atten3
1, -1, 1, -1, 1} //ADC2 atten3
const static uint64_t adc2_error_coef_atten[4][5][2] = {
{{25668651654328927, 1e16}, {1353548869615, 1e16}, {36615265189, 1e16}, {0, 0}, {0, 0}}, //ADC2 atten0
{{23690184690298404, 1e16}, {66319894226185, 1e16}, {118964995959, 1e16}, {0, 0}, {0, 0}}, //ADC2 atten1
{{9452499397020617, 1e16}, {200996773954387, 1e16}, {259011467956, 1e16}, {0, 0}, {0, 0}}, //ADC2 atten2
{{12247719764336924,1e16}, {755717904943462, 1e16}, {1478791187119, 1e16}, {79672528, 1e15}, {15038, 1e15}} //ADC2 atten3
};
/**
* Term sign
*/
const static int32_t adc1_error_sign[4][5] = {
{-1, -1, 1, 0, 0}, //ADC1 atten0
{-1, -1, 1, 0, 0}, //ADC1 atten1
{-1, -1, 1, 0, 0}, //ADC1 atten2
{-1, -1, 1, -1, 1} //ADC1 atten3
};
const static int32_t adc2_error_sign[4][5] = {
{-1, 1, 1, 0, 0}, //ADC2 atten0
{-1, -1, 1, 0, 0}, //ADC2 atten1
{-1, -1, 1, 0, 0}, //ADC2 atten2
{ 1, -1, 1, -1, 1} //ADC2 atten3
};
/* -------------------- Characterization Helper Data Types ------------------ */
@@ -151,47 +154,6 @@ esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
return ESP_ADC_CAL_VAL_EFUSE_TP_FIT;
}
static int32_t get_reading_error(uint64_t v_cali_1, uint8_t adc_num, uint8_t atten)
{
if (v_cali_1 == 0) {
return 0;
}
uint8_t term_max = (atten == 3) ? 5 : 3;
int32_t error = 0;
uint64_t coeff = 0;
uint64_t term[5] = {0};
/**
* For atten0 ~ 2:
* error = a1 * X^2 + a2 * X + a3;
*
* For atten3:
* error = a1 * X^4 + a2 * X^3 + a3 * X^2 + a4 * X + a5;
*/
//Calculate all the power beforehand
term[term_max-1] = 1;
term[term_max-2] = v_cali_1;
for (int term_id = term_max - 3; term_id >= 0; term_id--) {
term[term_id] = term[term_id + 1] * v_cali_1;
}
//Calculate each term
uint8_t coef_id_start = (adc_num == ADC_UNIT_1) ? 0 : 5;
for (int i = 0; i < term_max; i++) {
coeff = adc_error_coef_atten[atten][coef_id_start + i][0];
term[i] = term[i] * coeff;
ESP_LOGV(LOG_TAG, "big coef is %llu, big term%d is %llu, coef_id is %d", coeff, i, term[i], coef_id_start + i);
term[i] = term[i] / adc_error_coef_atten[atten][coef_id_start + i][1];
error += (int32_t)term[i] * adc_error_sign[atten][i];
ESP_LOGV(LOG_TAG, "term%d is %llu, error is %d", i, term[i], error);
}
return error;
}
uint32_t esp_adc_cal_raw_to_voltage(uint32_t adc_reading, const esp_adc_cal_characteristics_t *chars)
{
assert(chars != NULL);
@@ -209,29 +171,16 @@ uint32_t esp_adc_cal_raw_to_voltage(uint32_t adc_reading, const esp_adc_cal_char
v_cali_1 = v_cali_1 / coeff_a_scaling;
ESP_LOGV(LOG_TAG, "v_cali_1 is %llu", v_cali_1);
error = get_reading_error(v_cali_1, chars->adc_num, chars->atten);
//Curve Fitting error correction
esp_adc_error_calc_param_t param = {
.v_cali_input = v_cali_1,
.term_num = (chars->atten == 3) ? 5 : 3,
.coeff = (chars->adc_num == ADC_UNIT_1) ? &adc1_error_coef_atten : &adc2_error_coef_atten,
.sign = (chars->adc_num == ADC_UNIT_1) ? &adc1_error_sign : &adc2_error_sign,
};
error = esp_adc_cal_get_reading_error(&param, chars->atten);
voltage = (int32_t)v_cali_1 - error;
return voltage;
}
esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel,
const esp_adc_cal_characteristics_t *chars,
uint32_t *voltage)
{
// Check parameters
ESP_RETURN_ON_FALSE(chars != NULL, ESP_ERR_INVALID_ARG, LOG_TAG, "No characteristic input");
ESP_RETURN_ON_FALSE(voltage != NULL, ESP_ERR_INVALID_ARG, LOG_TAG, "No output buffer");
esp_err_t ret = ESP_OK;
int adc_reading;
if (chars->adc_num == ADC_UNIT_1) {
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(0), ESP_ERR_INVALID_ARG, LOG_TAG, "Invalid channel");
adc_reading = adc1_get_raw(channel);
} else {
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(1), ESP_ERR_INVALID_ARG, LOG_TAG, "Invalid channel");
ret = adc2_get_raw(channel, chars->bit_width, &adc_reading);
}
*voltage = esp_adc_cal_raw_to_voltage((uint32_t)adc_reading, chars);
return ret;
}
@@ -0,0 +1,85 @@
/*
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include <string.h>
#include "esp_types.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp_check.h"
#include "driver/adc.h"
#include "hal/adc_types.h"
#include "esp_adc_cal.h"
#include "esp_adc_cal_internal.h"
const static char *TAG = "ADC_CALI";
esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel,
const esp_adc_cal_characteristics_t *chars,
uint32_t *voltage)
{
// Check parameters
ESP_RETURN_ON_FALSE(chars != NULL, ESP_ERR_INVALID_ARG, TAG, "No characteristic input");
ESP_RETURN_ON_FALSE(voltage != NULL, ESP_ERR_INVALID_ARG, TAG, "No output buffer");
esp_err_t ret = ESP_OK;
int adc_reading;
if (chars->adc_num == ADC_UNIT_1) {
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(0), ESP_ERR_INVALID_ARG, TAG, "Invalid channel");
adc_reading = adc1_get_raw(channel);
} else {
ESP_RETURN_ON_FALSE(channel < SOC_ADC_CHANNEL_NUM(1), ESP_ERR_INVALID_ARG, TAG, "Invalid channel");
ret = adc2_get_raw(channel, chars->bit_width, &adc_reading);
}
*voltage = esp_adc_cal_raw_to_voltage((uint32_t)adc_reading, chars);
return ret;
}
#if ESP_ADC_CAL_CURVE_FITTING_SUPPORTED
/*------------------------------------------------------------------------------
* Private API
*----------------------------------------------------------------------------*/
int32_t esp_adc_cal_get_reading_error(const esp_adc_error_calc_param_t *param, uint8_t atten)
{
if (param->v_cali_input == 0) {
return 0;
}
uint64_t v_cali_1 = param->v_cali_input;
uint8_t term_num = param->term_num;
int32_t error = 0;
uint64_t coeff = 0;
uint64_t variable[term_num];
uint64_t term[term_num];
memset(variable, 0, term_num * sizeof(uint64_t));
memset(term, 0, term_num * sizeof(uint64_t));
/**
* For atten0 ~ 2:
* error = (K0 * X^0) + (K1 * X^1) + (K2 * X^2);
*
* For atten3:
* error = (K0 * X^0) + (K1 * X^1) + (K2 * X^2) + (K3 * X^3) + (K4 * X^4);
*/
variable[0] = 1;
coeff = (*param->coeff)[atten][0][0];
term[0] = variable[0] * coeff / (*param->coeff)[atten][0][1];
error = (int32_t)term[0] * (*param->sign)[atten][0];
for (int i = 1; i < term_num; i++) {
variable[i] = variable[i-1] * v_cali_1;
coeff = (*param->coeff)[atten][i][0];
term[i] = variable[i] * coeff;
ESP_LOGV(TAG, "big coef is %llu, big term%d is %llu, coef_id is %d", coeff, i, term[i], i);
term[i] = term[i] / (*param->coeff)[atten][i][1];
error += (int32_t)term[i] * (*param->sign)[atten][i];
ESP_LOGV(TAG, "term%d is %llu, error is %d", i, term[i], error);
}
return error;
}
#endif //#if ESP_ADC_CAL_CURVE_FITTING_SUPPORTED
@@ -0,0 +1,50 @@
/*
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
#endif
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
#define ESP_ADC_CAL_CURVE_FITTING_SUPPORTED 1
#define COEFF_GROUP_NUM 4
#define TERM_MAX 5
#endif
#if ESP_ADC_CAL_CURVE_FITTING_SUPPORTED
/**
* Calculation parameters used for curve fitting calibration algorithm error
*
* @note For atten0 ~ 2, error = (K0 * X^0) + (K1 * X^1) + (K2 * X^2); For atten3, error = (K0 * X^0) + (K1 * X^1) + (K2 * X^2) + (K3 * X^3) + (K4 * X^4);
* Where X is the `v_cali_input`.
*/
typedef struct {
uint64_t v_cali_input; //Input to calculate the error
uint8_t term_num; //Term number of the algorithm formula
const uint64_t (*coeff)[COEFF_GROUP_NUM][TERM_MAX][2]; //Coeff of each term. See `adc_error_coef_atten` for details (and the magic number 2)
const int32_t (*sign)[COEFF_GROUP_NUM][TERM_MAX]; //Sign of each term
} esp_adc_error_calc_param_t;
/**
* Calculate the curve fitting error
*
* @param param see `esp_adc_error_calc_param_t`
* @param atten ADC attenuation
*/
int32_t esp_adc_cal_get_reading_error(const esp_adc_error_calc_param_t *param, uint8_t atten);
#endif //#if ESP_ADC_CAL_CURVE_FITTING_SUPPORTED
#ifdef __cplusplus
}
#endif
+5 -13
View File
@@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_ADC_CAL_H__
#define __ESP_ADC_CAL_H__
+2 -1
View File
@@ -33,7 +33,8 @@ set(optional_reqs ulp
esp_netif
soc
esp-tls
esp_https_ota)
esp_https_ota
esp_hw_support)
idf_build_get_property(build_components BUILD_COMPONENTS)
foreach(req ${optional_reqs})
+18 -17
View File
@@ -1,17 +1,9 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_ATTR_H__
#define __ESP_ATTR_H__
@@ -33,17 +25,24 @@ extern "C" {
// Forces data into DRAM instead of flash
#define DRAM_ATTR _SECTION_ATTR_IMPL(".dram1", __COUNTER__)
#ifdef CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY
// IRAM can only be accessed as an 8-bit memory on ESP32, when CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY is set
#define IRAM_8BIT_ACCESSIBLE (CONFIG_IDF_TARGET_ESP32 && CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY)
// Make sure that IRAM is accessible as an 8-bit memory on ESP32.
// If that's not the case, coredump cannot dump data from IRAM.
#if IRAM_8BIT_ACCESSIBLE
// Forces data into IRAM instead of DRAM
#define IRAM_DATA_ATTR __attribute__((section(".iram.data")))
// Forces data into IRAM instead of DRAM and map it to coredump
#define COREDUMP_IRAM_DATA_ATTR _SECTION_ATTR_IMPL(".iram.data.coredump", __COUNTER__)
#define COREDUMP_IRAM_DATA_ATTR _SECTION_ATTR_IMPL(".iram2.coredump", __COUNTER__)
// Forces bss into IRAM instead of DRAM
#define IRAM_BSS_ATTR __attribute__((section(".iram.bss")))
#else
#define COREDUMP_IRAM_DATA_ATTR
// IRAM is not accessible as an 8-bit memory, put IRAM coredump variables in DRAM
#define COREDUMP_IRAM_DATA_ATTR COREDUMP_DRAM_ATTR
#define IRAM_DATA_ATTR
#define IRAM_BSS_ATTR
@@ -103,7 +102,9 @@ extern "C" {
#define RTC_NOINIT_ATTR _SECTION_ATTR_IMPL(".rtc_noinit", __COUNTER__)
// Forces code into DRAM instead of flash and map it to coredump
#define COREDUMP_DRAM_ATTR _SECTION_ATTR_IMPL(".dram1.coredump", __COUNTER__)
// Use dram2 instead of dram1 to make sure this section will not be included
// by dram1 section in the linker script
#define COREDUMP_DRAM_ATTR _SECTION_ATTR_IMPL(".dram2.coredump", __COUNTER__)
// Forces data into RTC memory and map it to coredump
#define COREDUMP_RTC_DATA_ATTR _SECTION_ATTR_IMPL(".rtc.coredump", __COUNTER__)
@@ -25,6 +25,7 @@ extern "C" {
*/
#if defined(CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT)
#define ESP_RETURN_ON_ERROR(x, log_tag, format, ...) do { \
(void)log_tag; \
esp_err_t err_rc_ = (x); \
if (unlikely(err_rc_ != ESP_OK)) { \
return err_rc_; \
@@ -35,6 +36,7 @@ extern "C" {
* A version of ESP_RETURN_ON_ERROR() macro that can be called from ISR.
*/
#define ESP_RETURN_ON_ERROR_ISR(x, log_tag, format, ...) do { \
(void)log_tag; \
esp_err_t err_rc_ = (x); \
if (unlikely(err_rc_ != ESP_OK)) { \
return err_rc_; \
@@ -46,6 +48,7 @@ extern "C" {
* sets the local variable 'ret' to the code, and then exits by jumping to 'goto_tag'.
*/
#define ESP_GOTO_ON_ERROR(x, goto_tag, log_tag, format, ...) do { \
(void)log_tag; \
esp_err_t err_rc_ = (x); \
if (unlikely(err_rc_ != ESP_OK)) { \
ret = err_rc_; \
@@ -57,6 +60,7 @@ extern "C" {
* A version of ESP_GOTO_ON_ERROR() macro that can be called from ISR.
*/
#define ESP_GOTO_ON_ERROR_ISR(x, goto_tag, log_tag, format, ...) do { \
(void)log_tag; \
esp_err_t err_rc_ = (x); \
if (unlikely(err_rc_ != ESP_OK)) { \
ret = err_rc_; \
@@ -69,6 +73,7 @@ extern "C" {
* and returns with the supplied 'err_code'.
*/
#define ESP_RETURN_ON_FALSE(a, err_code, log_tag, format, ...) do { \
(void)log_tag; \
if (unlikely(!(a))) { \
return err_code; \
} \
@@ -78,6 +83,7 @@ extern "C" {
* A version of ESP_RETURN_ON_FALSE() macro that can be called from ISR.
*/
#define ESP_RETURN_ON_FALSE_ISR(a, err_code, log_tag, format, ...) do { \
(void)log_tag; \
if (unlikely(!(a))) { \
return err_code; \
} \
@@ -88,6 +94,7 @@ extern "C" {
* sets the local variable 'ret' to the supplied 'err_code', and then exits by jumping to 'goto_tag'.
*/
#define ESP_GOTO_ON_FALSE(a, err_code, goto_tag, log_tag, format, ...) do { \
(void)log_tag; \
if (unlikely(!(a))) { \
ret = err_code; \
goto goto_tag; \
@@ -98,6 +105,7 @@ extern "C" {
* A version of ESP_GOTO_ON_FALSE() macro that can be called from ISR.
*/
#define ESP_GOTO_ON_FALSE_ISR(a, err_code, goto_tag, log_tag, format, ...) do { \
(void)log_tag; \
if (unlikely(!(a))) { \
ret = err_code; \
goto goto_tag; \
+6 -12
View File
@@ -1,16 +1,9 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <stdint.h>
@@ -46,6 +39,7 @@ typedef int esp_err_t;
#define ESP_ERR_MESH_BASE 0x4000 /*!< Starting number of MESH error codes */
#define ESP_ERR_FLASH_BASE 0x6000 /*!< Starting number of flash error codes */
#define ESP_ERR_HW_CRYPTO_BASE 0xc000 /*!< Starting number of HW cryptography module error codes */
#define ESP_ERR_MEMPROT_BASE 0xd000 /*!< Starting number of Memory Protection API error codes */
/**
* @brief Returns string for esp_err_t error codes
@@ -23,7 +23,7 @@ extern "C" {
/** Minor version number (x.X.x) */
#define ESP_IDF_VERSION_MINOR 4
/** Patch version number (x.x.X) */
#define ESP_IDF_VERSION_PATCH 0
#define ESP_IDF_VERSION_PATCH 1
/**
* Macro to convert IDF version number into an integer
@@ -23,6 +23,9 @@
#if __has_include("esp_image_format.h")
#include "esp_image_format.h"
#endif
#if __has_include("esp_memprot_err.h")
#include "esp_memprot_err.h"
#endif
#if __has_include("esp_mesh.h")
#include "esp_mesh.h"
#endif
@@ -758,6 +761,33 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# endif
# ifdef ESP_ERR_HW_CRYPTO_DS_INVALID_PADDING
ERR_TBL_IT(ESP_ERR_HW_CRYPTO_DS_INVALID_PADDING), /* 49157 0xc005 */
# endif
// components/esp_common/include/esp_err.h
# ifdef ESP_ERR_MEMPROT_BASE
ERR_TBL_IT(ESP_ERR_MEMPROT_BASE), /* 53248 0xd000 Starting number of Memory Protection API
error codes */
# endif
// components/esp_hw_support/include/esp_memprot_err.h
# ifdef ESP_ERR_MEMPROT_MEMORY_TYPE_INVALID
ERR_TBL_IT(ESP_ERR_MEMPROT_MEMORY_TYPE_INVALID), /* 53249 0xd001 */
# endif
# ifdef ESP_ERR_MEMPROT_SPLIT_ADDR_INVALID
ERR_TBL_IT(ESP_ERR_MEMPROT_SPLIT_ADDR_INVALID), /* 53250 0xd002 */
# endif
# ifdef ESP_ERR_MEMPROT_SPLIT_ADDR_OUT_OF_RANGE
ERR_TBL_IT(ESP_ERR_MEMPROT_SPLIT_ADDR_OUT_OF_RANGE), /* 53251 0xd003 */
# endif
# ifdef ESP_ERR_MEMPROT_SPLIT_ADDR_UNALIGNED
ERR_TBL_IT(ESP_ERR_MEMPROT_SPLIT_ADDR_UNALIGNED), /* 53252 0xd004 */
# endif
# ifdef ESP_ERR_MEMPROT_UNIMGMT_BLOCK_INVALID
ERR_TBL_IT(ESP_ERR_MEMPROT_UNIMGMT_BLOCK_INVALID), /* 53253 0xd005 */
# endif
# ifdef ESP_ERR_MEMPROT_WORLD_INVALID
ERR_TBL_IT(ESP_ERR_MEMPROT_WORLD_INVALID), /* 53254 0xd006 */
# endif
# ifdef ESP_ERR_MEMPROT_AREA_INVALID
ERR_TBL_IT(ESP_ERR_MEMPROT_AREA_INVALID), /* 53255 0xd007 */
# endif
};
#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
+5 -15
View File
@@ -1,16 +1,8 @@
// Copyright 2019-2021 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <sys/cdefs.h>
#include <stdatomic.h>
@@ -270,13 +262,11 @@ esp_err_t esp_eth_start(esp_eth_handle_t hdl)
esp_eth_driver_t *eth_driver = (esp_eth_driver_t *)hdl;
ESP_GOTO_ON_FALSE(eth_driver, ESP_ERR_INVALID_ARG, err, TAG, "ethernet driver handle can't be null");
esp_eth_phy_t *phy = eth_driver->phy;
esp_eth_mac_t *mac = eth_driver->mac;
// check if driver has stopped
esp_eth_fsm_t expected_fsm = ESP_ETH_FSM_STOP;
ESP_GOTO_ON_FALSE(atomic_compare_exchange_strong(&eth_driver->fsm, &expected_fsm, ESP_ETH_FSM_START),
ESP_ERR_INVALID_STATE, err, TAG, "driver started already");
ESP_GOTO_ON_ERROR(phy->negotiate(phy), err, TAG, "phy negotiation failed");
ESP_GOTO_ON_ERROR(mac->start(mac), err, TAG, "start mac failed");
ESP_GOTO_ON_ERROR(esp_event_post(ETH_EVENT, ETHERNET_EVENT_START, &eth_driver, sizeof(esp_eth_driver_t *), 0),
err, TAG, "send ETHERNET_EVENT_START event failed");
ESP_GOTO_ON_ERROR(phy->get_link(phy), err, TAG, "phy get link status failed");
+14 -20
View File
@@ -1,16 +1,8 @@
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include <stdlib.h>
#include <sys/cdefs.h>
@@ -41,7 +33,7 @@
static const char *TAG = "esp.emac";
#define PHY_OPERATION_TIMEOUT_US (1000)
#define MAC_STOP_TIMEOUT_MS (100)
#define MAC_STOP_TIMEOUT_US (250)
#define FLOW_CONTROL_LOW_WATER_MARK (CONFIG_ETH_DMA_RX_BUFFER_NUM / 3)
#define FLOW_CONTROL_HIGH_WATER_MARK (FLOW_CONTROL_LOW_WATER_MARK * 2)
@@ -72,6 +64,8 @@ typedef struct {
static esp_err_t esp_emac_alloc_driver_obj(const eth_mac_config_t *config, emac_esp32_t **emac_out_hdl, void **out_descriptors);
static void esp_emac_free_driver_obj(emac_esp32_t *emac, void *descriptors);
static esp_err_t emac_esp32_start(esp_eth_mac_t *mac);
static esp_err_t emac_esp32_stop(esp_eth_mac_t *mac);
static esp_err_t emac_esp32_set_mediator(esp_eth_mac_t *mac, esp_eth_mediator_t *eth)
{
@@ -158,11 +152,11 @@ static esp_err_t emac_esp32_set_link(esp_eth_mac_t *mac, eth_link_t link)
switch (link) {
case ETH_LINK_UP:
ESP_GOTO_ON_ERROR(esp_intr_enable(emac->intr_hdl), err, TAG, "enable interrupt failed");
emac_hal_start(&emac->hal);
emac_esp32_start(mac);
break;
case ETH_LINK_DOWN:
ESP_GOTO_ON_ERROR(esp_intr_disable(emac->intr_hdl), err, TAG, "disable interrupt failed");
emac_hal_stop(&emac->hal);
emac_esp32_stop(mac);
break;
default:
ESP_GOTO_ON_FALSE(false, ESP_ERR_INVALID_ARG, err, TAG, "unknown link status");
@@ -232,7 +226,7 @@ static esp_err_t emac_esp32_transmit(esp_eth_mac_t *mac, uint8_t *buf, uint32_t
esp_err_t ret = ESP_OK;
emac_esp32_t *emac = __containerof(mac, emac_esp32_t, parent);
uint32_t sent_len = emac_hal_transmit_frame(&emac->hal, buf, length);
ESP_GOTO_ON_FALSE(sent_len == length, ESP_ERR_INVALID_SIZE, err, TAG, "insufficient TX buffer size");
ESP_GOTO_ON_FALSE(sent_len == length, ESP_ERR_NO_MEM, err, TAG, "insufficient TX buffer size");
return ESP_OK;
err:
return ret;
@@ -404,9 +398,9 @@ static esp_err_t emac_esp32_stop(esp_eth_mac_t *mac)
if ((ret = emac_hal_stop(&emac->hal)) == ESP_OK) {
break;
}
to += 20;
vTaskDelay(pdMS_TO_TICKS(20));
} while (to < MAC_STOP_TIMEOUT_MS);
to += 25;
esp_rom_delay_us(25);
} while (to < MAC_STOP_TIMEOUT_US);
return ret;
}
+10 -2
View File
@@ -1,7 +1,15 @@
# EMAC Test
| Supported Targets | ESP32 |
| ----------------- | ----- |
This test app is used to test MAC layer behavior with different PHY chips:
- ip101
- lan8720
- IP101
- LAN8720
## Prerequisites
Install third part Python packages:
```bash
pip install scapy
```
@@ -1,9 +1,12 @@
import os
import re
import socket
from collections.abc import Callable
from threading import Thread
import tiny_test_fw
import ttfw_idf
from scapy.all import Ether, raw
from ttfw_idf import TestFormat
try:
@@ -39,26 +42,52 @@ def configure_eth_if(func): # type: (typing.Any) -> typing.Any
def check_eth_recv_packet(so): # type: (socket.socket) -> None
so.settimeout(10)
try:
pkt = so.recv(1024)
for i in range(128, 1024):
if pkt[i] != i & 0xff:
eth_frame = Ether(so.recv(1024))
for i in range(0, 1010):
if eth_frame.load[i] != i & 0xff:
raise Exception('Packet content mismatch')
except Exception as e:
raise e
@configure_eth_if
def send_eth_packet(so, mac): # type: (socket.socket, bytes) -> None
def send_eth_packet(so, mac): # type: (socket.socket, str) -> None
so.settimeout(10)
pkt = bytearray()
pkt += mac # dest
pkt += so.getsockname()[4] # src
pkt += bytes.fromhex('2222') # proto
pkt += bytes(1010) # padding to 1024
for i in range(128, 1024):
pkt[i] = i & 0xff
payload = bytearray(1010)
for i, _ in enumerate(payload):
payload[i] = i & 0xff
eth_frame = Ether(dst=mac, src=so.getsockname()[4], type=0x2222) / raw(payload)
try:
so.send(pkt)
so.send(raw(eth_frame))
except Exception as e:
raise e
@configure_eth_if
def recv_resp_poke(so, i): # type: (socket.socket, int) -> None
so.settimeout(10)
try:
eth_frame = Ether(so.recv(60))
if eth_frame.type == 0x2222 and eth_frame.load[0] == 0xfa:
if eth_frame.load[1] != i:
raise Exception('Missed Poke Packet')
eth_frame.dst = eth_frame.src
eth_frame.src = so.getsockname()[4]
eth_frame.load = bytes.fromhex('fb') # POKE_RESP code
so.send(raw(eth_frame))
except Exception as e:
raise e
@configure_eth_if
def traffic_gen(so, mac, enabled): # type: (socket.socket, str, Callable) -> None
payload = bytes.fromhex('ff') # DUMMY_TRAFFIC code
payload += bytes(1485)
eth_frame = Ether(dst=mac, src=so.getsockname()[4], type=0x2222) / raw(payload)
try:
while enabled() == 1:
so.send(raw(eth_frame))
except Exception as e:
raise e
@@ -78,14 +107,43 @@ def test_component_ut_esp_eth(env, appname): # type: (tiny_test_fw.Env, str) ->
stdout = dut.expect("Enter next test, or 'enter' to see menu", full_stdout=True)
ttfw_idf.ComponentUTResult.parse_result(stdout, test_format=TestFormat.UNITY_BASIC)
dut.write('"recv_pkt"')
expect_result = dut.expect(re.compile(r'([\s\S]*)DUT MAC: ([0-9a-zA-Z:]*)'), timeout=10)
expect_result = dut.expect(re.compile(
r'([\s\S]*)'
r'DUT MAC: ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})'),
timeout=10
)
stdout = expect_result[0]
send_eth_packet(bytes.fromhex('ffffffffffff')) # broadcast frame
send_eth_packet(bytes.fromhex('010000000000')) # multicast frame
send_eth_packet(bytes.fromhex(expect_result[1].replace(':', ''))) # unicast frame
send_eth_packet('ff:ff:ff:ff:ff:ff') # broadcast frame
send_eth_packet('01:00:00:00:00:00') # multicast frame
send_eth_packet(expect_result[1]) # unicast frame
stdout += dut.expect("Enter next test, or 'enter' to see menu", full_stdout=True)
ttfw_idf.ComponentUTResult.parse_result(stdout, test_format=TestFormat.UNITY_BASIC)
dut.write('"start_stop_stress_test"')
expect_result = dut.expect(re.compile(
r'([\s\S]*)'
r'DUT MAC: ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})'),
timeout=10
)
# Start/stop under heavy Tx traffic
for tx_i in range(10):
recv_resp_poke(tx_i)
# Start/stop under heavy Rx traffic
traffic_en = 1
thread = Thread(target=traffic_gen, args=(expect_result[1], lambda:traffic_en, ))
thread.start()
try:
for rx_i in range(10):
recv_resp_poke(rx_i)
finally:
traffic_en = 0
thread.join()
stdout = dut.expect("Enter next test, or 'enter' to see menu", full_stdout=True)
ttfw_idf.ComponentUTResult.parse_result(stdout, test_format=TestFormat.UNITY_BASIC)
@ttfw_idf.idf_component_unit_test(env_tag='COMPONENT_UT_IP101', target=['esp32'])
def test_component_ut_esp_eth_ip101(env, _): # type: (tiny_test_fw.Env, typing.Any) -> None
@@ -17,6 +17,10 @@
#define ETH_MULTICAST_RECV_BIT BIT(1)
#define ETH_UNICAST_RECV_BIT BIT(2)
#define POKE_REQ 0xFA
#define POKE_RESP 0xFB
#define DUMMY_TRAFFIC 0xFF
typedef struct {
uint8_t dest[6];
uint8_t src[6];
@@ -170,12 +174,14 @@ TEST_CASE("ethernet_broadcast_transmit", "[esp_eth]")
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_start(eth_handle)); // start Ethernet driver state machine
TEST_ASSERT(xSemaphoreTake(mutex, pdMS_TO_TICKS(3000)));
// even if PHY (IP101) indicates autonegotiation done and link up, it sometimes may miss few packets after atonego reset, hence wait a bit
vTaskDelay(pdMS_TO_TICKS(100));
emac_frame_t *pkt = malloc(1024);
pkt->proto = 0x2222;
memset(pkt->dest, 0xff, 6); // broadcast addr
for (int i = 128; i < 1024; ++i){
((uint8_t*)pkt)[i] = i & 0xff;
for (int i = 0; i < (1024 - ETH_HEADER_LEN); ++i){
pkt->data[i] = i & 0xff;
}
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_transmit(eth_handle, pkt, 1024));
@@ -198,8 +204,8 @@ esp_err_t l2_packet_txrx_test_cb(esp_eth_handle_t hdl, uint8_t *buffer, uint32_t
// check header
if (pkt->proto == 0x2222 && length == 1024) {
// check content
for (int i = 128; i < 1024; ++i) {
if (buffer[i] != (i & 0xff)) {
for (int i = 0; i < (length - ETH_HEADER_LEN); ++i) {
if (pkt->data[i] != (i & 0xff)) {
return ESP_OK;
}
}
@@ -259,6 +265,171 @@ TEST_CASE("recv_pkt", "[esp_eth]")
vEventGroupDelete(eth_event_group);
}
typedef struct
{
SemaphoreHandle_t mutex;
int rx_pkt_cnt;
} recv_info_t;
TEST_CASE("start_stop_stress_test", "[esp_eth]")
{
void eth_event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
EventGroupHandle_t eth_event_group = (EventGroupHandle_t)arg;
switch (event_id) {
case ETHERNET_EVENT_CONNECTED:
xEventGroupSetBits(eth_event_group, ETH_CONNECT_BIT);
break;
case ETHERNET_EVENT_DISCONNECTED:
break;
case ETHERNET_EVENT_START:
xEventGroupSetBits(eth_event_group, ETH_START_BIT);
break;
case ETHERNET_EVENT_STOP:
xEventGroupSetBits(eth_event_group, ETH_STOP_BIT);
break;
default:
break;
}
}
esp_err_t eth_recv_cb(esp_eth_handle_t hdl, uint8_t *buffer, uint32_t length, void *priv)
{
emac_frame_t *pkt = (emac_frame_t *)buffer;
recv_info_t *recv_info = (recv_info_t *)priv;
if (pkt->proto == 0x2222) {
switch (pkt->data[0])
{
case POKE_RESP:
xSemaphoreGive(recv_info->mutex);
break;
case DUMMY_TRAFFIC:
(recv_info->rx_pkt_cnt)++;
break;
default:
break;
}
}
free(buffer);
return ESP_OK;
}
recv_info_t recv_info;
recv_info.mutex = xSemaphoreCreateBinary();
TEST_ASSERT_NOT_NULL(recv_info.mutex);
recv_info.rx_pkt_cnt = 0;
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); // apply default MAC configuration
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config); // create MAC instance
TEST_ASSERT_NOT_NULL(mac);
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration
#if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101)
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config); // create PHY instance
#elif defined(CONFIG_TARGET_ETH_PHY_DEVICE_LAN8720)
esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
#endif
TEST_ASSERT_NOT_NULL(phy);
esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy); // apply default driver configuration
esp_eth_handle_t eth_handle = NULL; // after driver installed, we will get the handle of the driver
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_driver_install(&config, &eth_handle)); // install driver
TEST_ASSERT_NOT_NULL(eth_handle);
TEST_ASSERT_EQUAL(ESP_OK, mac->get_addr(mac, local_mac_addr));
// test app will parse the DUT MAC from this line of log output
printf("DUT MAC: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", local_mac_addr[0], local_mac_addr[1], local_mac_addr[2],
local_mac_addr[3], local_mac_addr[4], local_mac_addr[5]);
TEST_ESP_OK(esp_eth_update_input_path(eth_handle, eth_recv_cb, &recv_info));
EventBits_t bits = 0;
EventGroupHandle_t eth_event_group = xEventGroupCreate();
TEST_ASSERT(eth_event_group != NULL);
TEST_ESP_OK(esp_event_loop_create_default());
TEST_ESP_OK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, &eth_event_handler, eth_event_group));
// create a control frame to control test flow between the UT and the Python test script
emac_frame_t *ctrl_pkt = calloc(1, 60);
ctrl_pkt->proto = 0x2222;
memset(ctrl_pkt->dest, 0xff, 6); // broadcast addr
memcpy(ctrl_pkt->src, local_mac_addr, 6);
// create dummy data packet used for traffic generation
emac_frame_t *pkt = calloc(1, 1500);
pkt->proto = 0x2222;
// we don't care about dest MAC address much, however it is better to not be broadcast or multifcast to not flood
// other network nodes
memset(pkt->dest, 0xBA, 6);
memcpy(pkt->src, local_mac_addr, 6);
printf("EMAC start/stop stress test under heavy Tx traffic\n");
for (int tx_i = 0; tx_i < 10; tx_i++) {
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_start(eth_handle)); // start Ethernet driver state machine
bits = xEventGroupWaitBits(eth_event_group, ETH_CONNECT_BIT, true, true, pdMS_TO_TICKS(3000));
TEST_ASSERT((bits & ETH_CONNECT_BIT) == ETH_CONNECT_BIT);
// even if PHY (IP101) indicates autonegotiation done and link up, it sometimes may miss few packets after atonego reset, hence wait a bit
vTaskDelay(pdMS_TO_TICKS(100));
// at first, check that Tx/Rx path works as expected by poking the test script
// this also serves as main PASS/FAIL criteria
ctrl_pkt->data[0] = POKE_REQ;
ctrl_pkt->data[1] = tx_i;
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_transmit(eth_handle, ctrl_pkt, 60));
TEST_ASSERT(xSemaphoreTake(recv_info.mutex, pdMS_TO_TICKS(3000)));
printf("Tx Test iteration %d\n", tx_i);
// generate heavy Tx traffic
printf("Note: transmit errors are expected...\n");
for (int j = 0; j < 150; j++) {
// return value is not checked on purpose since it is expected that it may fail time to time because
// we may try to queue more packets than hardware is able to handle
pkt->data[0] = j & 0xFF;
esp_eth_transmit(eth_handle, pkt, 1500);
}
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_stop(eth_handle));
bits = xEventGroupWaitBits(eth_event_group, ETH_STOP_BIT, true, true, pdMS_TO_TICKS(3000));
TEST_ASSERT((bits & ETH_STOP_BIT) == ETH_STOP_BIT);
printf("Ethernet stopped\n");
}
printf("EMAC start/stop stress test under heavy Rx traffic\n");
for (int rx_i = 0; rx_i < 10; rx_i++) {
recv_info.rx_pkt_cnt = 0;
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_start(eth_handle)); // start Ethernet driver state machine
bits = xEventGroupWaitBits(eth_event_group, ETH_CONNECT_BIT, true, true, pdMS_TO_TICKS(3000));
TEST_ASSERT((bits & ETH_CONNECT_BIT) == ETH_CONNECT_BIT);
// even if PHY (IP101) indicates autonegotiation done and link up, it sometimes may miss few packets after atonego reset, hence wait a bit
vTaskDelay(pdMS_TO_TICKS(100));
ctrl_pkt->data[0] = POKE_REQ;
ctrl_pkt->data[1] = rx_i;
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_transmit(eth_handle, ctrl_pkt, 60));
TEST_ASSERT(xSemaphoreTake(recv_info.mutex, pdMS_TO_TICKS(3000)));
printf("Rx Test iteration %d\n", rx_i);
vTaskDelay(pdMS_TO_TICKS(500));
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_stop(eth_handle));
bits = xEventGroupWaitBits(eth_event_group, ETH_STOP_BIT, true, true, pdMS_TO_TICKS(3000));
TEST_ASSERT((bits & ETH_STOP_BIT) == ETH_STOP_BIT);
printf("Recv packets: %d\n", recv_info.rx_pkt_cnt);
TEST_ASSERT_GREATER_THAN_INT32(0, recv_info.rx_pkt_cnt);
printf("Ethernet stopped\n");
}
free(ctrl_pkt);
free(pkt);
TEST_ESP_OK(esp_event_handler_unregister(ETH_EVENT, ESP_EVENT_ANY_ID, eth_event_handler));
TEST_ASSERT_EQUAL(ESP_OK, esp_event_loop_delete_default());
TEST_ASSERT_EQUAL(ESP_OK, esp_eth_driver_uninstall(eth_handle));
phy->del(phy);
mac->del(mac);
vEventGroupDelete(eth_event_group);
vSemaphoreDelete(recv_info.mutex);
}
void app_main(void)
{
unity_run_menu();

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